iridescence
Loading...
Searching...
No Matches
gridmap.hpp
Go to the documentation of this file.
1#ifndef GLK_GRIDMAP_HPP
2#define GLK_GRIDMAP_HPP
3
4#include <memory>
5#include <glk/drawable.hpp>
6
7namespace glk {
8
9class Texture;
10
19class GridMap : public Drawable {
20public:
35 enum class ColorMode { RAW = 0, TURBO, PROB, PROB_TURBO, RGBA };
36
44 GridMap(double resolution, int width, int height, const unsigned char* values, int alpha = 255, ColorMode mode = ColorMode::PROB);
45
54 GridMap(double resolution, int width, int height, float scale, const float* values, float alpha = 1.0f, ColorMode mode = ColorMode::PROB);
55 virtual ~GridMap();
56
57 virtual void draw(glk::GLSLShader& shader) const override;
58
59 void update_color(int width, int height, const unsigned char* values, int alpha = 255, ColorMode mode = ColorMode::PROB);
60 void update_color(const unsigned char* values, int alpha = 255, ColorMode mode = ColorMode::PROB);
61 void update_color(int width, int height, float scale, const float* values, float alpha = 1.0f, ColorMode mode = ColorMode::PROB);
62 void update_color(float scale, const float* values, float alpha = 1.0f, ColorMode mode = ColorMode::PROB);
63
64private:
65 GridMap(const GridMap&);
66 GridMap& operator=(const GridMap&);
67
68 void init_vao(double resolution, int width, int height);
69
70private:
71 GLuint vao;
72 GLuint vbo;
73 GLuint tbo;
74 std::unique_ptr<Texture> texture;
75};
76
77} // namespace glk
78
79#endif
Definition drawable.hpp:12
GLSLShader is a wrapper for OpenGL shader programs.
Definition glsl_shader.hpp:49
void update_color(int width, int height, 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)
virtual void draw(glk::GLSLShader &shader) const override
ColorMode
ColorMode defines how the color values are interpreted.
Definition gridmap.hpp:35
@ TURBO
Definition gridmap.hpp:35
@ PROB_TURBO
Definition gridmap.hpp:35
@ RAW
Definition gridmap.hpp:35
@ PROB
Definition gridmap.hpp:35
@ RGBA
Definition gridmap.hpp:35
GridMap(double resolution, int width, int height, const unsigned char *values, int alpha=255, ColorMode mode=ColorMode::PROB)
Constructor.
virtual ~GridMap()
void update_color(float scale, const float *values, float alpha=1.0f, ColorMode mode=ColorMode::PROB)
void update_color(const unsigned char *values, int alpha=255, ColorMode mode=ColorMode::PROB)
GridMap(double resolution, int width, int height, float scale, const float *values, float alpha=1.0f, ColorMode mode=ColorMode::PROB)
Constructor.
Texture class to wrap OpenGL texture object.
Definition texture.hpp:11
Definition async_buffer_copy.hpp:6