3#include "rectangle_renderer.h"
4#include "render_data_base.h"
11template <
typename ColorType = rgb>
27 CGV_RDB_TRANSFER_ARRAY(extent,
extents);
29 CGV_RDB_TRANSFER_ARRAY(rotation,
rotations);
30 CGV_RDB_TRANSFER_ARRAY(texcoord,
texcoords);
90 void add_secondary_color(
const ColorType& color) {
94 void add_border_color(
const ColorType& color) {
98 void add_extent(
const vec2& extent) {
102 void add_translation(
const vec3& translation) {
106 void add_rotation(
const quat& rotation) {
110 void add_texcoord(
const vec4& texcoord) {
117 void add(
const vec3& position,
const vec2& extent) {
118 super::add_position(position);
122 void add(
const vec3& position,
const vec4& texcoord) {
123 super::add_position(position);
124 add_texcoord(texcoord);
127 void add(
const vec3& position,
const ColorType& color,
const vec2& extent) {
128 super::add(position, color);
132 void add(
const vec3& position,
const vec2& extent,
const quat& rotation) {
133 super::add_position(position);
135 add_rotation(rotation);
138 void add(
const vec3& translation,
const quat& rotation) {
139 add_translation(translation);
140 add_rotation(rotation);
143 void fill_secondary_colors(
const ColorType& color) {
147 void fill_border_colors(
const ColorType& color) {
151 void fill_extents(
const vec2& extent) {
155 void fill_translations(
const vec3& translation) {
159 void fill_rotations(
const quat& rotation) {
163 void fill_texcoords(
const vec4& texcoord) {
A simple and naiive implementation of an optional value.
base class for all drawables, which is independent of the used rendering API.
Render data for rectangle geometry with support for the rectangle_renderer.
cgv::data::optional< ColorType > const_border_color
optional constant border color used for all elements
bool transfer(context &ctx, rectangle_renderer &r) override
See render_data_base::transfer.
std::vector< ColorType > border_colors
array of border colors
cgv::data::optional< vec4 > const_texcoord
optional constant texcoord used for all elements
cgv::data::optional< vec2 > const_extent
optional constant extent used for all elements
std::vector< vec4 > texcoords
array of texcoords
cgv::data::optional< ColorType > const_secondary_color
optional constant secondary color used for all elements
cgv::data::optional< quat > const_rotation
optional constant rotation used for all elements
std::vector< vec2 > extents
array of extents
std::vector< quat > rotations
array of rotations
std::vector< ColorType > secondary_colors
array of secondary colors
void set_const_attributes(context &ctx, rectangle_renderer &r) override
See render_data_base::set_const_attributes.
std::vector< vec3 > translations
array of translations
cgv::data::optional< vec3 > const_translation
optional constant translation used for all elements
renderer that supports plane rendering
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(const context &ctx, const T &rotation)
set single rotation for all rectangles from a quaternion of type T, which has 4 components
void set_translation(const context &ctx, const T &translation)
template method to set translation for all rectangles from a vector type T, which should have 3 compo...
void set_border_color(const context &ctx, const T &color)
templated method to set the border color attribute from a single color of type T
void set_extent(const context &ctx, const cgv::math::fvec< T, 2U > &extent)
specify a single extent for all boxes
A base class for storing render data and style usable with the default renderers provided in the cgv:...
virtual bool transfer(context &ctx, RendererType &r)
Transfers the data stored in members to the attribute array.
void clear()
Clear the stored data and set state out of date.
void fill(std::vector< T > &vector, const T &value)
Template for filling a member array to the size of the render data.
virtual void set_const_attributes(context &ctx, RendererType &r)
Set constant vertex attributes if present.
void set_texcoord(const context &ctx, const T &texcoord)
templated method to set the texcoord attribute without array
rectangle_renderer & ref_rectangle_renderer(context &ctx, int ref_count_change)
reference to a singleton plane renderer that can be shared among drawables
cgv::math::fvec< float, 4 > vec4
declare type of 4d single precision floating point vectors (used for homogeneous coordinates)
cgv::math::quaternion< float > quat
declare type of quaternion
cgv::math::fvec< float, 2 > vec2
declare type of 2d single precision floating point vectors
cgv::math::fvec< float, 3 > vec3
declare type of 3d single precision floating point vectors