Class ViridisInterpolation
Defined in File ViridisInterpolation.h
Inheritance Relationships
Base Type
public flamegpu::visualiser::ColorFunction
(Class ColorFunction)
Class Documentation
-
class ViridisInterpolation : public flamegpu::visualiser::ColorFunction
Agent color function for mapping a floating point value to the Viridis palette Viridis is a color blind friendly palette Originally from BIDS/MatPlotLib: https://github.com/BIDS/colormap
Public Functions
-
explicit ViridisInterpolation(const std::string &variable_name, const float &min_bound = 0.0f, const float &max_bound = 1.0f)
Constructs a HSV Viridis palette function generator
Note
max_bound may be lower than min_bound if the palette should be reversed
- Parameters:
variable_name – Name of the agent variable which maps to the color, the variable type must be float
min_bound – The agent variable value that should map to the lowest color (Dark blue)
max_bound – The agent variable value that should map to the highest color (Light yellow)
-
ViridisInterpolation &setBounds(const float &min_bound, const float &max_bound)
Set the bounds to clamp an agent variable to before using for HSV interpolation
Note
Defaults to (0.0, 1.0)
Note
This is somewhat redundant, but exists for interface parity with HSVInterpolation
- Parameters:
min_bound – The agent variable value that should map to the minimum hue, must be smaller than max_bound
max_bound – The agent variable value that should map to the maximum hue, must be larger than min_bound
- Throws:
exception::InvalidArgument – if min_bound > max_bound
- Returns:
Returns itself, so that you can chain the method (otherwise constructor would have too many optional args)
-
virtual std::string getSrc(unsigned int array_len) const override
Returns GLSL for a function that returns a color based on the configured HSV interpolation
- Parameters:
array_len – Length of the variable array
-
virtual std::string getSamplerName() const override
Always returns “color_arg”
-
virtual std::string getAgentVariableName() const override
Returns variable_name
-
virtual std::type_index getAgentVariableRequiredType() const override
Returns std::type_index(typeid(float))
-
explicit ViridisInterpolation(const std::string &variable_name, const float &min_bound = 0.0f, const float &max_bound = 1.0f)