3#include "surface_renderer.h"
4#include "render_data_base.h"
11template <
typename ColorType = rgb>
25 CGV_RDB_TRANSFER_ARRAY(normal,
normals);
26 CGV_RDB_TRANSFER_ARRAY(texcoord,
texcoords);
44 void add_normal(
const cgv::vec3& normal) {
48 void add_texcoord(
const cgv::vec2& texcoord) {
52 void add_triangle(
const vec3& position0,
const vec3& position1,
const vec3& position2) {
53 super::add_position(position0);
54 super::add_position(position1);
55 super::add_position(position2);
58 void add_triangle_color(
const ColorType& color) {
59 super::add_color(color);
60 super::add_color(color);
61 super::add_color(color);
64 void add_triangle_colors(
const ColorType& color0,
const ColorType& color1,
const ColorType& color2) {
65 super::add_color(color0);
66 super::add_color(color1);
67 super::add_color(color2);
70 void add_triangle_normal(
const vec3& normal) {
76 void add_triangle_normals(
const vec3& normal0,
const vec3& normal1,
const vec3& normal2) {
82 void add_triangle_texcoord(
const vec2& texcoord) {
83 add_texcoord(texcoord);
84 add_texcoord(texcoord);
85 add_texcoord(texcoord);
88 void add_triangle_texcoords(
const vec2& texcoord0,
const vec2& texcoord1,
const vec2& texcoord2) {
89 add_texcoord(texcoord0);
90 add_texcoord(texcoord1);
91 add_texcoord(texcoord2);
98 super::add_position(position);
102 void add(
const vec3& position,
const ColorType& color,
const cgv::vec3& normal) {
103 super::add(position, color);
107 void add(
const vec3& position,
const ColorType& color,
const cgv::vec2& texcoord) {
108 super::add(position, color);
109 add_texcoord(texcoord);
112 void fill_normals(
const cgv::vec3& normal) {
116 void fill_texcoords(
const cgv::vec2& texcoord) {
base class for all drawables, which is independent of the used rendering API.
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.
Render data for triangular surface geometry with support for the surface_renderer.
std::vector< cgv::vec2 > texcoords
array of texture coordinates
std::vector< cgv::vec3 > normals
array of normals
bool transfer(context &ctx, surface_renderer &r) override
See render_data_base::transfer.
base classes for renderers that support surface rendering
surface_renderer & ref_surface_renderer(context &ctx, int ref_count_change)
reference to a singleton surface renderer that can be shared among drawables
this header is dependency free
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