#ifndef COLORMAP_H #define COLORMAP_H #include <memory> #include <vector> #include <armadillo> #include <glad/gl.h> #include <nod.hpp> #include "colorscale.h" class Colormap { public: static const int SAMPLES = 128; enum Orientation { Horizontal, Vertical }; Colormap(); ~Colormap(); GLuint texture() const { return m_texture; } size_t width() const { return m_width; } size_t height() const { return m_height; } void update(); void setOrientation(Orientation orientation); Orientation orientation() const { return m_orientation; } nod::signal<void(std::shared_ptr<const ColorScale>)> colorScaleChanged; nod::signal<void(Orientation)> orientationChanged; void setColorScale(std::shared_ptr<const ColorScale> scale); private: void updateTexture(); size_t m_width, m_height; GLuint m_texture; bool m_shouldUpdateTexture; Orientation m_orientation; std::vector<float> m_cmap; }; #endif // COLORMAP_H