Class ColorFunction

Inheritance Relationships

Derived Types

Class Documentation

class ColorFunction

Interface for generating shader code for a function that generates a color during model execution

Subclassed by flamegpu::visualiser::DiscreteColor< T >, flamegpu::visualiser::HSVInterpolation, flamegpu::visualiser::StaticColor, flamegpu::visualiser::ViridisInterpolation

Public Functions

virtual std::string getSrc(unsigned int variable_array_len) const = 0

Returns GLSL source code for a function with the prototype vec4 calculateColor() It may optionally also include a definition for a uniform samplerBuffer If a uniform samplerBuffer is included, it’s identifier should be returned by getSamplerName()

Parameters:

variable_array_len – Length of the variable array

inline virtual std::string getSamplerName() const

If the shader source contains a samplerBuffer definition (e.g. of a single float/int) This should be the identifier so that the buffer can be bound to it Otherwise empty string

inline virtual std::string getAgentVariableName() const

If the shader source contains a samplerBuffer definition This should be the name of the agent variable so that the buffer can be bound to it Otherwise empty string

inline virtual unsigned int getAgentArrayVariableElement() const

If the shader source contains a samplerBuffer definition This should be the name of the index of the element within the agent variable (0 if it’s not an array variable)

inline virtual std::type_index getAgentVariableRequiredType() const

If the shader source contains a samplerBuffer definition This should be the type of the agent variable so that the buffer can be bound to it Otherwise void typeid is returned.

inline void setAgentArrayVariableElement(const unsigned int _element)

Specify the array variable’s element to use

Note

Calling this is not required if the agent variable is not an array variable

Parameters:

_element – Index of the element within the array variable

Protected Attributes

unsigned int element = 0

The element of the array variable to use (else 0 if not array variable)