GridMap is a drawable that represents a 2D grid map with color values. It assumes that pixel values are stored in row-major order (values[y * width + x]), starting from the (-x, -y) corner (i.e., the first row lies at -y). The grid map lies on the XY plane, and the center is at the origin (0, 0, 0), thus it extends from (-resolution * width / 2, -resolution * height / 2) to (resolution * width / 2, resolution * height / 2). Use guik::TextureColor as shader setting.
More...
#include <gridmap.hpp>
|
| | GridMap (double resolution, int width, int height, const unsigned char *values, int alpha=255, ColorMode mode=ColorMode::PROB) |
| | Constructor.
|
| | GridMap (double resolution, int width, int height, float scale, const float *values, float alpha=1.0f, ColorMode mode=ColorMode::PROB) |
| | Constructor.
|
| virtual | ~GridMap () |
| virtual void | draw (glk::GLSLShader &shader) const override |
| void | update_color (int width, int height, const unsigned char *values, int alpha=255, ColorMode mode=ColorMode::PROB) |
| void | update_color (const unsigned char *values, int alpha=255, ColorMode mode=ColorMode::PROB) |
| void | update_color (int width, int height, float scale, const float *values, float alpha=1.0f, ColorMode mode=ColorMode::PROB) |
| void | update_color (float scale, const float *values, float alpha=1.0f, ColorMode mode=ColorMode::PROB) |
| virtual | ~Drawable () |
GridMap is a drawable that represents a 2D grid map with color values. It assumes that pixel values are stored in row-major order (values[y * width + x]), starting from the (-x, -y) corner (i.e., the first row lies at -y). The grid map lies on the XY plane, and the center is at the origin (0, 0, 0), thus it extends from (-resolution * width / 2, -resolution * height / 2) to (resolution * width / 2, resolution * height / 2). Use guik::TextureColor as shader setting.
◆ ColorMode
ColorMode defines how the color values are interpreted.
Assuming N=width*height For uint8 values: RAW: expects |values|=N, and rgb[i] = values[i] TURBO: expects |values|=N, and rgb[i] = colormap(TURBO, values[i]) PROB: expects |values|=N, and rgb[i] = 100 - values[i] PROB_TURBO: expects |values|=N, and rgb[i] = colormap(TURBO, (100 - values[i]) * 255.0 / 100.0) RGBA: expects |values|=4*N, and rgba[i] = values[i*4:i*4+4] For float values: RAW: expects |values|=N, and rgb[i] = scale * values[i] TURBO: expects |values|=N, and rgb[i] = colormapf(TURBO, scale * values[i]) PROB: expects |values|=N, and rgb[i] = 1.0 - scale * values[i] PROB_TURBO: expects |values|=N, and rgb[i] = colormapf(TURBO, 1.0 - scale * values[i]) RGBA: expects |values|=4*N, and rgba[i] = values[i*4:i*4+4] (scale is not applied)
| Enumerator |
|---|
| RAW | |
| TURBO | |
| PROB | |
| PROB_TURBO | |
| RGBA | |
◆ GridMap() [1/2]
| glk::GridMap::GridMap |
( |
double | resolution, |
|
|
int | width, |
|
|
int | height, |
|
|
const unsigned char * | values, |
|
|
int | alpha = 255, |
|
|
ColorMode | mode = ColorMode::PROB ) |
Constructor.
- Parameters
-
| resolution | Resolution of each grid cell in world units. |
| width | Width [cells] |
| height | Height [cells] |
| values | Pointer to the color values. |
| alpha | Alpha value for the entire map. Ignored if ColorMode is RGBA. |
| mode | Color mode for interpreting the values. |
◆ GridMap() [2/2]
| glk::GridMap::GridMap |
( |
double | resolution, |
|
|
int | width, |
|
|
int | height, |
|
|
float | scale, |
|
|
const float * | values, |
|
|
float | alpha = 1.0f, |
|
|
ColorMode | mode = ColorMode::PROB ) |
Constructor.
- Parameters
-
| resolution | Resolution of each grid cell in world units. |
| width | Width [cells] |
| height | Height [cells] |
| scale | Scale factor for the color values. Ignored if ColorMode is RGBA. |
| values | Pointer to the color values. |
| alpha | Alpha value for the entire map. Ignored if ColorMode is RGBA. |
| mode | Color mode for interpreting the values. |
◆ ~GridMap()
| virtual glk::GridMap::~GridMap |
( |
| ) |
|
|
virtual |
◆ draw()
◆ update_color() [1/4]
◆ update_color() [2/4]
| void glk::GridMap::update_color |
( |
float | scale, |
|
|
const float * | values, |
|
|
float | alpha = 1.0f, |
|
|
ColorMode | mode = ColorMode::PROB ) |
◆ update_color() [3/4]
| void glk::GridMap::update_color |
( |
int | width, |
|
|
int | height, |
|
|
const unsigned char * | values, |
|
|
int | alpha = 255, |
|
|
ColorMode | mode = ColorMode::PROB ) |
◆ update_color() [4/4]
| void glk::GridMap::update_color |
( |
int | width, |
|
|
int | height, |
|
|
float | scale, |
|
|
const float * | values, |
|
|
float | alpha = 1.0f, |
|
|
ColorMode | mode = ColorMode::PROB ) |
The documentation for this class was generated from the following file:
- /home/runner/work/iridescence/iridescence/include/glk/gridmap.hpp