4#include <cgv/reflect/reflect_extern.h>
5#include <cgv/render/shader_program.h>
6#include <cgv_reflect_types/render/context.h>
8#include "gl/lib_begin.h"
28 bool has_group_indices =
false;
29 bool has_group_colors =
false;
30 bool has_group_translations =
false;
31 bool has_group_rotations =
false;
53 void set_group_index_array(
const context& ctx,
const vertex_buffer& vbo,
size_t offset_in_bytes,
size_t nr_elements,
unsigned stride_in_bytes = 0) {
set_group_index_array(ctx,
type_descriptor(element_descriptor_traits<T>::get_type_descriptor(T()),
true), vbo, offset_in_bytes, nr_elements, stride_in_bytes); }
55 void remove_group_index_array(
const context& ctx);
61 void set_group_colors(
const context& ctx,
const T* colors,
size_t nr_elements) { has_group_colors =
true;
ref_prog().set_uniform_array(ctx,
"group_colors", colors, nr_elements); }
64 void set_group_translations(
const context& ctx,
const std::vector<T>& group_translations) { has_group_translations =
true;
ref_prog().set_uniform_array(ctx,
"group_translations", group_translations); }
67 void set_group_translations(
const context& ctx,
const T* group_translations,
size_t nr_elements) { has_group_translations =
true;
ref_prog().set_uniform_array(ctx,
"group_translations", group_translations, nr_elements); }
70 void set_group_rotations(
const context& ctx,
const std::vector<T>& group_rotations) { has_group_rotations =
true;
ref_prog().set_uniform_array(ctx,
"group_rotations", group_rotations); }
73 void set_group_rotations(
const context& ctx,
const T* group_rotations,
size_t nr_elements) { has_group_rotations =
true;
ref_prog().set_uniform_array(ctx,
"group_rotations", group_rotations, nr_elements); }
94#include <cgv/config/lib_end.h>
the self reflection handler is passed to the virtual self_reflect() method of cgv::base::base.
attribute array manager used to upload arrays to gpu
base class for all drawables, which is independent of the used rendering API.
abstract renderer class that provides functionality for grouping primitives
bool disable(context &ctx) override
disable renderer
void set_group_rotations(const context &ctx, const T *group_rotations, size_t nr_elements)
template method to set the group rotation from a vector of quaternions of type T, which should have 4...
void set_group_index_array(const context &ctx, const std::vector< unsigned > &group_indices)
method to set the group index attribute
void set_group_translations(const context &ctx, const T *group_translations, size_t nr_elements)
template method to set the group translations from a vector of vectors of type T, which should have 3...
void set_group_rotations(const context &ctx, const std::vector< T > &group_rotations)
template method to set the group rotation from a vector of quaternions of type T, which should have 4...
void update_shader_program_options(shader_compile_options &options) const override
overload to update the shader program compile options based on the current render style; only called ...
void set_group_colors(const context &ctx, const std::vector< T > &colors)
template method to set the group colors from a vector of colors of type T
bool enable(context &ctx) override
overload to activate group style
bool validate_attributes(const context &ctx) const override
check additionally the group attributes
void set_group_index_array(const context &ctx, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
template method to set the group index color attribute from a vertex buffer object,...
void enable_attribute_array_manager(const context &ctx, attribute_array_manager &aam) override
call this before setting attribute arrays to manage attribute array in given manager
void set_group_colors(const context &ctx, const T *colors, size_t nr_elements)
template method to set the group colors from a vector of colors of type T
void disable_attribute_array_manager(const context &ctx, attribute_array_manager &aam) override
call this after last render/draw call to ensure that no other users of renderer change attribute arra...
void set_group_translations(const context &ctx, const std::vector< T > &group_translations)
template method to set the group translations from a vector of vectors of type T, which should have 3...
shader_program & ref_prog()
derived renderer classes have access to shader program
renderer()
construct and init attribute tracking flags
Stores preprocessor options used for conditionally compiling shader programs.
a vertex buffer is an unstructured memory block on the GPU.
namespace for api independent GPU programming
this header is dependency free
this reflection traits implementation is used for external self_reflect implementations of instances ...
render style used for group information
bool use_group_transformation
whether to use group translation and rotation indexed through group index, defaults to false
bool use_group_color
whether to use group colors indexed through group index, defaults to false
int max_nr_groups
maximum number of groups supported by shader
base class for all render styles
compact type description of data that can be sent to the context; convertible to int