3 #include "group_renderer.h"
5 #include "gl/lib_begin.h"
9 class CGV_API slab_renderer;
15 extern CGV_API slab_renderer&
ref_slab_renderer(context& ctx,
int ref_count_change = 0);
35 int tf_source_channel;
80 void set_position_is_center(
bool _position_is_center);
87 void set_extent(
const context& ctx,
const T& extent) { has_extents =
true; ref_prog().set_attribute(ctx, ref_prog().get_attribute_location(ctx,
"extent"), extent); }
90 void set_extent_array(
const context& ctx,
const std::vector<T>& extents) { has_extents =
true; set_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"extent"), extents); }
93 void set_extent_array(
const context& ctx,
const T* extents,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_extents =
true; set_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"extent"), extents, nr_elements, stride_in_bytes); }
97 set_composed_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"position"),
98 &box.front(), box.size(), box[0].get_min_pnt());
99 ref_composed_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"extent"),
100 ref_prog().get_attribute_location(ctx,
"position"), &box.front(), box.size(), box[0].get_max_pnt());
101 has_positions =
true;
103 set_position_is_center(
false);
106 template <
typename T>
108 set_composed_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"position"),
109 box, count, box[0].get_min_pnt());
110 ref_composed_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"extent"),
111 ref_prog().get_attribute_location(ctx,
"position"), box, count, box[0].get_max_pnt());
112 has_positions =
true;
114 set_position_is_center(
false);
117 template <
typename T>
118 void set_translation_array(
const context& ctx,
const std::vector<T>& translations) { has_translations =
true; set_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"translation"), translations); }
120 template <
typename T>
121 void set_translation_array(
const context& ctx,
const T* translations,
size_t nr_elements,
unsigned stride) { has_translations =
true; set_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"translation"), translations, nr_elements, stride); }
123 template <
typename T>
124 void set_rotation_array(
const context& ctx,
const std::vector<T>& rotations) { has_rotations =
true; set_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"rotation"), rotations); }
126 template <
typename T>
127 void set_rotation_array(
const context& ctx,
const T* rotations,
size_t nr_elements,
unsigned stride) { has_rotations =
true; set_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"rotation"), rotations, nr_elements, stride); }
129 template <
typename T>
131 has_texture_indices =
true;
132 int loc = ref_prog().get_attribute_location(ctx,
"texture_index");
133 set_attribute_array(ctx, loc, texture_indices);
136 template <
typename T>
137 void set_texture_index_array(
const context& ctx,
const T* texture_indices,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_texture_indices =
true; set_attribute_array(ctx, ref_prog().get_attribute_location(ctx,
"texture_index"), texture_indices, nr_elements, stride_in_bytes); }
139 bool validate_attributes(
const context& ctx)
const;
143 void draw(
context& ctx,
size_t start,
size_t count,
144 bool use_strips =
false,
bool use_adjacency =
false, uint32_t strip_restart_index = -1);
147 struct CGV_API slab_render_style_reflect :
public slab_render_style
155 #include <cgv/config/lib_end.h>
void set_translation_array(const context &ctx, const std::vector< T > &translations)
template method to set the translations from a vector of vectors of type T, which should have 3 compo...
Definition: slab_renderer.h:118
base class for all render styles
Definition: renderer.h:16
float scale
compensates for the overall slab scale
Definition: slab_renderer.h:49
bool position_is_center
whether position is slab center, if not it is lower left bottom corner
Definition: slab_renderer.h:67
float opacity
multiplied to the input opacity value during rendering to change the overall opacity of the slabs
Definition: slab_renderer.h:43
Definition: slab_renderer.h:25
void set_texture_index_array(const context &ctx, const T *texture_indices, size_t nr_elements, unsigned stride_in_bytes=0)
extent array specifies slab extends in case of position_is_center=true, otherwise the maximum point o...
Definition: slab_renderer.h:137
float falloff_mix
overall influence of the falloff
Definition: slab_renderer.h:45
Definition: group_renderer.h:15
void set_rotation_array(const context &ctx, const std::vector< T > &rotations)
template method to set the rotation from a vector of quaternions of type T, which should have 4 compo...
Definition: slab_renderer.h:124
bool has_thicknesses
store whether thickness array has been specified
Definition: slab_renderer.h:69
bool use_transfer_function
whether to use a transfer function or interpret the luminance as alpha, initialized to false
Definition: slab_renderer.h:33
void set_extent(const context &ctx, const T &extent)
specify a single extent for all slabs
Definition: slab_renderer.h:87
void set_rotation_array(const context &ctx, const T *rotations, size_t nr_elements, unsigned stride)
template method to set the rotation from a vector of quaternions of type T, which should have 4 compo...
Definition: slab_renderer.h:127
int tex_idx_offset
used to offset the texture index of each slab when specified
Definition: slab_renderer.h:37
attribute array manager used to upload arrays to gpu
Definition: renderer.h:21
float falloff_strength
strength of the opacity falloff in the slabs normal direction
Definition: slab_renderer.h:47
Definition: reflection_handler.h:63
void set_translation_array(const context &ctx, const T *translations, size_t nr_elements, unsigned stride)
template method to set the translations from a vector of vectors of type T, which should have 3 compo...
Definition: slab_renderer.h:121
void set_box_array(const context &ctx, const cgv::media::axis_aligned_box< T, 3 > *box, size_t count)
specify box array directly. This sets position_is_center to false as well as position and extent arra...
Definition: slab_renderer.h:107
bool has_texture_indices
whether array with per slab texture index has been specified
Definition: slab_renderer.h:65
void set_extent_array(const context &ctx, const std::vector< T > &extents)
extent array specifies slab extends in case of position_is_center=true, otherwise the maximum point o...
Definition: slab_renderer.h:90
float step_size
constant step size for volume ray integration over all slabs
Definition: slab_renderer.h:41
this reflection traits implementation is used for external self_reflect implementations of instances ...
Definition: reflect_extern.h:28
int tex_idx_stride
multiplied to the texture index of each slab
Definition: slab_renderer.h:39
renderer that supports point splatting
Definition: slab_renderer.h:56
bool has_extents
store whether extent array has been specified
Definition: slab_renderer.h:59
void set_extent_array(const context &ctx, const T *extents, size_t nr_elements, unsigned stride_in_bytes=0)
extent array specifies slab extends in case of position_is_center=true, otherwise the maximum point o...
Definition: slab_renderer.h:93
float thickness_scale
multiplied to the thickness, initialized to 1
Definition: slab_renderer.h:27
int tex_unit
unit used to access the slab texture values, initialized to 0, must point to a 2d texture array
Definition: slab_renderer.h:29
bool has_translations
whether array with per slab translations has been specified
Definition: slab_renderer.h:61
int tf_tex_unit
unit used to access the volume transfer function texture, initialized to 1, must be a 1d texture
Definition: slab_renderer.h:31
the cgv namespace
Definition: vr_calib.cxx:9
void set_texture_index_array(const context &ctx, const std::vector< T > &texture_indices)
extent array specifies slab extends in case of position_is_center=true, otherwise the maximum point o...
Definition: slab_renderer.h:130
Definition: context.h:525
slab_renderer & ref_slab_renderer(context &ctx, int ref_count_change)
reference to a singleton slab renderer that is shared among drawables
Definition: slab_renderer.cxx:7
bool has_rotations
whether array with per slab rotations has been specified
Definition: slab_renderer.h:63
void set_box_array(const context &ctx, const std::vector< cgv::media::axis_aligned_box< T, 3 > > &box)
specify box array directly. This sets position_is_center to false as well as position and extent arra...
Definition: slab_renderer.h:96
abstract renderer class that provides functionality for grouping primitives
Definition: group_renderer.h:26