Game Physics Template 1.0
A template for game physics in C++ WEBGPU
Loading...
Searching...
No Matches
Colormap Class Reference

Public Member Functions

 Colormap (std::string name)
 Create a colormap.
 
float textureOffset ()
 Calculate the y-offset of the colormap in the colormap texture.
 
glm::vec3 operator() (float value)
 Apply the colormap.
 

Static Public Member Functions

static void init ()
 Load the colormaps from resources/colormaps.png and resources/colormaps.txt.
 

Static Public Attributes

static ResourceManager::Image colormaps
 All colormaps in on texture, line by line.
 

Constructor & Destructor Documentation

◆ Colormap()

Colormap::Colormap ( std::string  name)

Create a colormap.

Parameters
nameThe name of the colormap. All colormaps from matplotlib are available, for more info look into resources/colormaps.txt

Common colormaps are: hot, gray, viridis, plasma, inferno, magma, cividis...

Member Function Documentation

◆ init()

void Colormap::init ( )
static

Load the colormaps from resources/colormaps.png and resources/colormaps.txt.

Only has to be called once, this happens automatically when the first colormap is created. 

◆ operator()()

glm::vec3 Colormap::operator() ( float  value)

Apply the colormap.

Parameters
valueThe value to apply the colormap to. values will be clamped to [0, 1]
Returns
The color of the value in the colormap

◆ textureOffset()

float Colormap::textureOffset ( )

Calculate the y-offset of the colormap in the colormap texture.

Returns
The y-offset of the colormap in the colormap texture. Range: [0, 1]

The documentation for this class was generated from the following files: