|
cgv
|
Manages graphics resources to enable using device_color_scale in shader programs. More...
#include <color_scale_adapter.h>
Public Member Functions | |
| bool | init (const context &ctx) |
| Initialize the color_scale_adapter. | |
| bool | destruct (const context &ctx) |
| Destruct the color_scale_adapter. | |
| bool | enable (const context &ctx, int texture_unit) |
| Enable the managed render resources to prepare for rendering. | |
| bool | disable (const context &ctx) |
| Disable the managed render resources after rendering. | |
| void | set_uniforms_in_program (context &ctx, shader_program &prog, int texture_unit) |
| Set texture unit and uniform buffer location in the given shader_program and prepare uniform buffer. | |
| void | set_color_scale (std::shared_ptr< const device_color_scale > color_scale) |
| Set a reference to a single device_color_scale to be managed by this color_scale_adapter. | |
| void | set_color_scales (const std::vector< std::shared_ptr< const device_color_scale > > &color_scales) |
| Set a reference to multiple device_color_scales to be managed by this color_scale_adapter. | |
| size_t | get_supported_color_scale_count () const |
| Get the number of maximally supported device_color_scales. | |
| texture & | get_texture (const context &ctx) |
| Get the texture containing the device_color_scales' color data. | |
Manages graphics resources to enable using device_color_scale in shader programs.
color_scale_adapter can store a reference to one or more device_color_scales and handles automatic texture and uniform buffer creation to enable using color_scales in shader programs that use the interface from color_scale.glsl. The texture is only updated if new device_color_scales are set or the referenced device_color_scales are modified as detected through color_scale::get_modified_time().
Definition at line 22 of file color_scale_adapter.h.
| bool cgv::render::color_scale_adapter::destruct | ( | const context & | ctx | ) |
Destruct the color_scale_adapter.
Destructs the used buffers. No method may be called after this, except init().
| ctx | The CGV rendering context. |
Definition at line 10 of file color_scale_adapter.cxx.
References cgv::render::texture::destruct().
Referenced by cgv::plot::plot_base::clear().
| bool cgv::render::color_scale_adapter::disable | ( | const context & | ctx | ) |
Disable the managed render resources after rendering.
| ctx | The CGV rendering context. |
Definition at line 27 of file color_scale_adapter.cxx.
References cgv::render::texture::disable().
Referenced by cgv::plot::plot3d::draw().
| bool cgv::render::color_scale_adapter::enable | ( | const context & | ctx, |
| int | texture_unit | ||
| ) |
Enable the managed render resources to prepare for rendering.
| ctx | The CGV rendering context. |
| texture_unit | The texture unit used for the color scale texture. Must match the value used in set_uniforms_in_program(). |
Definition at line 15 of file color_scale_adapter.cxx.
References cgv::render::texture::enable().
Referenced by cgv::plot::plot3d::draw().
|
inline |
Get the number of maximally supported device_color_scales.
Definition at line 72 of file color_scale_adapter.h.
Get the texture containing the device_color_scales' color data.
| ctx | The CGV rendering context. |
Definition at line 67 of file color_scale_adapter.cxx.
| bool cgv::render::color_scale_adapter::init | ( | const context & | ctx | ) |
Initialize the color_scale_adapter.
Initializes the used buffers. Needs to be called first before any other method.
| ctx | The CGV rendering context. |
Definition at line 6 of file color_scale_adapter.cxx.
Referenced by cgv::plot::plot_base::init().
| void cgv::render::color_scale_adapter::set_color_scale | ( | std::shared_ptr< const device_color_scale > | color_scale | ) |
Set a reference to a single device_color_scale to be managed by this color_scale_adapter.
| color_scale | The adapted device_color_scale. |
Definition at line 48 of file color_scale_adapter.cxx.
| void cgv::render::color_scale_adapter::set_color_scales | ( | const std::vector< std::shared_ptr< const device_color_scale > > & | color_scales | ) |
Set a reference to multiple device_color_scales to be managed by this color_scale_adapter.
Will only store references to the first get_supported_color_scale_count() passed device_color_scales.
| color_scales | The adapted device_color_scales. |
Definition at line 57 of file color_scale_adapter.cxx.
Referenced by cgv::plot::plot_base::set_mapping_uniforms().
| void cgv::render::color_scale_adapter::set_uniforms_in_program | ( | context & | ctx, |
| shader_program & | prog, | ||
| int | texture_unit | ||
| ) |
Set texture unit and uniform buffer location in the given shader_program and prepare uniform buffer.
| ctx | The CGV rendering context. |
| prog | The shader_program used for rendering. Must be linked against color_scale.glsl. |
| texture_unit | The texture unit used for the color scale texture. Must match the value used in enable(). |
Definition at line 32 of file color_scale_adapter.cxx.
References cgv::render::shader_program::disable(), cgv::render::shader_program::enable(), cgv::render::shader_program::is_enabled(), and cgv::render::shader_program::set_uniform().
Referenced by cgv::plot::plot_base::set_mapping_uniforms().