cgv
Loading...
Searching...
No Matches
color_scale_adapter.h
1#pragma once
2
3#include <vector>
4
5#include <cgv/data/time_stamp.h>
6
7#include "device_color_scale.h"
8#include "shader_program.h"
9#include "uniform_buffer.h"
10
11#include "lib_begin.h"
12
13namespace cgv {
14namespace render {
15
22class CGV_API color_scale_adapter {
23public:
29 bool init(const context& ctx);
30
36 bool destruct(const context& ctx);
37
43 bool enable(const context& ctx, int texture_unit);
44
49 bool disable(const context& ctx);
50
56 void set_uniforms_in_program(context& ctx, shader_program& prog, int texture_unit);
57
61 void set_color_scale(std::shared_ptr<const device_color_scale> color_scale);
62
67 void set_color_scales(const std::vector<std::shared_ptr<const device_color_scale>>& color_scales);
68
73 return k_max_color_scale_count_;
74 }
75
83 texture& get_texture(const context& ctx);
84
85private:
87 static const size_t k_max_color_scale_count_ = 4;
89 static const size_t k_texture_width_ = 256;
90
94 cgv::data::time_point get_latest_color_scale_modification_time() const;
95
102 bool create_texture(const context& ctx);
103
105 cgv::data::time_stamp build_time_;
107 std::vector<std::shared_ptr<const device_color_scale>> color_scales_;
109 texture texture_ = { "uint8[R,G,B,A]" };
111 std::vector<device_color_scale_arguments> uniforms_;
113 uniform_buffer<device_color_scale_arguments> uniform_buffer_;
114};
115
116} // namespace render
117} // namespace cgv
118
119#include <cgv/config/lib_end.h>
Keep a time stamp to store modified time of objects.
Definition time_stamp.h:11
Manages graphics resources to enable using device_color_scale in shader programs.
size_t get_supported_color_scale_count() const
Get the number of maximally supported device_color_scales.
base class for all drawables, which is independent of the used rendering API.
Definition context.h:668
a shader program combines several shader code fragments to a complete definition of the shading pipel...
the texture class encapsulates all functionality independent of the rendering api.
Definition texture.h:15
this header is dependency free
Definition print.h:11