3#include "surface_renderer.h"
5#include "gl/lib_begin.h"
59 void set_position_is_center(
bool _position_is_center);
61 bool enable(
context& ctx)
override;
70 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,
"extent", extents, nr_elements, stride_in_bytes); }
72 void remove_extent_array(
const context& ctx);
74 template <
typename T =
float>
75 void set_radius(
const context& ctx,
const T& radius) { has_radii =
true; ref_prog().set_attribute(ctx, ref_prog().get_attribute_location(ctx,
"radius"), radius); }
77 template <
typename T =
float>
78 void set_radius_array(
const context& ctx,
const std::vector<T>& radii) { has_radii =
true; set_attribute_array(ctx,
"radius", radii); }
80 template <
typename T =
float>
81 void set_radius_array(
const context& ctx,
const T* radii,
size_t nr_elements,
unsigned stride_in_bytes = 0) { has_radii =
true; set_attribute_array(ctx,
"radius", radii, nr_elements, stride_in_bytes); }
83 void remove_radius_array(
const context& ctx);
97 void set_secondary_color_array(
const context& ctx,
const vertex_buffer& vbo,
size_t offset_in_bytes,
size_t nr_elements,
unsigned stride_in_bytes = 0) {
set_secondary_color_array(ctx,
type_descriptor(element_descriptor_traits<T>::get_type_descriptor(T()),
true), vbo, offset_in_bytes, nr_elements, stride_in_bytes); }
99 void remove_secondary_color_array(
const context& ctx);
101 template <
typename T>
108 template <
typename T>
117 template <
typename T>
126 template <
typename T>
129 template <
typename T>
130 void set_translation_array(
const context& ctx,
const T* translations,
size_t nr_elements,
unsigned stride_in_bytes = 0) {
has_translations =
true; set_attribute_array(ctx,
"translation", translations, nr_elements, stride_in_bytes); }
132 void remove_translation_array(
const context& ctx);
134 template <
typename T>
137 template <
typename T>
138 void set_rotation_array(
const context& ctx,
const T* rotations,
size_t nr_elements,
unsigned stride_in_bytes = 0) {
has_rotations =
true; set_attribute_array(ctx,
"rotation", rotations, nr_elements, stride_in_bytes); }
140 void remove_rotation_array(
const context& ctx);
142 bool disable(
context& ctx)
override;
144 void draw(
context& ctx,
size_t start,
size_t count,
145 bool use_strips =
false,
bool use_adjacency =
false, uint32_t strip_restart_index = -1)
override;
155#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
renderer that supports point splatting
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...
void set_extent_array(const context &ctx, const std::vector< T > &extents)
extent array specifies box extends in case of position_is_center=true, otherwise the maximum point of...
bool has_translations
whether array with per box translations has been specified
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...
void set_secondary_color_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 secondary color attribute from a vertex buffer object, the element type mu...
void set_box(const context &ctx, const cgv::media::axis_aligned_box< T, 3 > &box)
specify a single box. This sets position_is_center to false as well as position and extent attributes
void set_secondary_color_array(const context &ctx, const T *colors, size_t nr_elements, unsigned stride_in_bytes=0)
template method to set the secondary color attribute from a vector of colors of type T
void set_secondary_color_array(const context &ctx, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0)
method to set the secondary color attribute from a vertex buffer object, the element type must be giv...
void set_secondary_color(const context &ctx, const T &color)
templated method to set the secondary color attribute from a single color of type T
void set_rotation_array(const context &ctx, const T *rotations, size_t nr_elements, unsigned stride_in_bytes=0)
template method to set the rotation from a vector of quaternions of type T, which should have 4 compo...
void set_extent(const context &ctx, const T &extent)
specify a single extent for all boxes
bool has_rotations
whether array with per box rotations has been specified
void set_translation_array(const context &ctx, const T *translations, size_t nr_elements, unsigned stride_in_bytes=0)
template method to set the translations from a vector of vectors of type T, which should have 3 compo...
void set_secondary_color_array(const context &ctx, const std::vector< T > &colors)
template method to set the secondary color attribute from a vector of colors of type T
render_style * create_render_style() const override
create and return the default render style
std::string get_default_prog_name() const override
return the default shader program name
void set_extent_array(const context &ctx, const T *extents, size_t nr_elements, unsigned stride_in_bytes=0)
extent array specifies box extends in case of position_is_center=true, otherwise the maximum point of...
bool has_radii
store whether extent array has been specified
void set_box_array(const context &ctx, const std::vector< cgv::media::axis_aligned_box< T, 3 > > &boxes)
specify box array directly. This sets position_is_center to false as well as position and extent arra...
void set_box_array(const context &ctx, const cgv::media::axis_aligned_box< T, 3 > *boxes, size_t count)
specify box array directly. This sets position_is_center to false as well as position and extent arra...
bool has_secondary_colors
whether secondary color or color array was set
bool position_is_center
whether position is box center, if not it is lower left bottom corner
void set_position_is_center(bool _position_is_center)
set the flag, whether the position is interpreted as the box center, true by default
bool has_extents
store whether extent array has been specified
base class for all drawables, which is independent of the used rendering API.
bool ref_composed_attribute_array(const context &ctx, const std::string &name, const std::string &name_ref, const C *array_ptr, size_t nr_elements, const T &elem)
in case that several attributes are stored interleaved, call set_composed_attribute_array() for the f...
bool set_composed_attribute_array(const context &ctx, const std::string &name, const C *array_ptr, size_t nr_elements, const T &elem)
in case that several attributes are stored interleaved, call this function for the first and ref_comp...
shader_program & ref_prog()
derived renderer classes have access to shader program
bool has_positions
track whether position attribute is defined
void set_position(const context &ctx, const T &position)
templated method to set the position attribute from a single position of type T
Stores preprocessor options used for conditionally compiling shader programs.
base classes for renderers that support surface rendering
a vertex buffer is an unstructured memory block on the GPU.
namespace for api independent GPU programming
box_renderer & ref_box_renderer(context &ctx, int ref_count_change)
reference to a singleton box renderer that is shared among drawables
this header is dependency free
cgv::math::fvec< float, 3 > vec3
declare type of 3d single precision floating point vectors
this reflection traits implementation is used for external self_reflect implementations of instances ...
boxes use surface render styles
vec3 default_extent
extent used in case extent array is not specified; defaults to (1,1,1)
vec3 relative_anchor
box anchor position relative to center that corresponds to the position attribute; defaults to (0,...
bool rounding
whether to use rounding of edges and corners (enabling re-compiles shader program)
float default_radius
radius used in case radius array is not specified
base class for all render styles
compact type description of data that can be sent to the context; convertible to int