cgv
Loading...
Searching...
No Matches
cgv::render::surface_render_data< ColorType > Class Template Reference

Render data for triangular surface geometry with support for the surface_renderer. More...

#include <surface_render_data.h>

Inheritance diagram for cgv::render::surface_render_data< ColorType >:
cgv::render::render_data_base< RendererType, RenderStyleType, ColorType >

Public Member Functions

void clear ()
 
void add_normal (const cgv::vec3 &normal)
 
void add_texcoord (const cgv::vec2 &texcoord)
 
void add_triangle (const vec3 &position0, const vec3 &position1, const vec3 &position2)
 
void add_triangle_color (const ColorType &color)
 
void add_triangle_colors (const ColorType &color0, const ColorType &color1, const ColorType &color2)
 
void add_triangle_normal (const vec3 &normal)
 
void add_triangle_normals (const vec3 &normal0, const vec3 &normal1, const vec3 &normal2)
 
void add_triangle_texcoord (const vec2 &texcoord)
 
void add_triangle_texcoords (const vec2 &texcoord0, const vec2 &texcoord1, const vec2 &texcoord2)
 
void add (const vec3 &position, const cgv::vec3 &normal)
 
void add (const vec3 &position, const ColorType &color, const cgv::vec3 &normal)
 
void add (const vec3 &position, const ColorType &color, const cgv::vec2 &texcoord)
 
void fill_normals (const cgv::vec3 &normal)
 
void fill_texcoords (const cgv::vec2 &texcoord)
 
void add (const vec3 &position, const ColorType &color)
 
- Public Member Functions inherited from cgv::render::render_data_base< RendererType, RenderStyleType, ColorType >
size_t size ()
 Return the number of stored positions.
 
bool empty () const
 Return whether this render data is empty.
 
void clear ()
 Clear the stored data and set state out of date.
 
void set_out_of_date ()
 Notify the render data about state changes.
 
size_t render_count ()
 Return the number of vertices that will be rendered.
 
const attribute_array_managerref_attribute_array_manager () const
 Constant access to the private attribute_array_manager.
 
bool init (context &ctx)
 Initialize the attribute array manager and increase the reference count of the used renderer singleton.
 
void destruct (context &ctx)
 Destruct the attribute array manager and decrease the reference count of the used renderer singleton.
 
void early_transfer (context &ctx, RendererType &r)
 Perform a transfer of the stored data to the attribute_array right now.
 
bool enable (context &ctx, RendererType &r, const RenderStyleType &s)
 Enable the render data for rendering.
 
bool disable (context &ctx, RendererType &r)
 Disable the renderer and attribute_array.
 
void draw (context &ctx, renderer &r, unsigned offset=0, int count=-1)
 Draw the stored geometry using the given renderer.
 
void render (context &ctx, unsigned offset=0, int count=-1)
 Render the stored geometry.
 
void render (context &ctx, const RenderStyleType &s, unsigned offset=0, int count=-1)
 Render the stored geometry using the given style.
 
void render (context &ctx, RendererType &r, unsigned offset=0, int count=-1)
 Render the stored geometry using the given renderer.
 
void render (context &ctx, RendererType &r, const RenderStyleType &s, unsigned offset=0, int count=-1)
 Render the stored geometry using the given renderer and style.
 
void add_index (const uint32_t index)
 
void add_position (const vec3 &position)
 
void add_color (const ColorType &color)
 
void add (const vec3 &position, const ColorType &color)
 
void fill_colors (const ColorType &color)
 

Public Attributes

std::vector< cgv::vec3normals
 array of normals
 
std::vector< cgv::vec2texcoords
 array of texture coordinates
 
- Public Attributes inherited from cgv::render::render_data_base< RendererType, RenderStyleType, ColorType >
RenderStyleType style
 the default render style
 
std::vector< uint32_t > indices
 array of indices used for optional indexed rendering
 
std::vector< vec3positions
 array of positions
 
std::vector< ColorType > colors
 array of colors
 
cgv::data::optional< ColorType > const_color
 optional constant color used for all elements
 

Protected Member Functions

bool transfer (context &ctx, surface_renderer &r) override
 See render_data_base::transfer.
 
- Protected Member Functions inherited from cgv::render::render_data_base< RendererType, RenderStyleType, ColorType >
virtual bool transfer (context &ctx, RendererType &r)
 Transfers the data stored in members to the attribute array.
 
virtual void set_const_attributes (context &ctx, RendererType &r)
 Set constant vertex attributes if present.
 
template<typename T >
void fill (std::vector< T > &vector, const T &value)
 Template for filling a member array to the size of the render data.
 

Detailed Description

template<typename ColorType = rgb>
class cgv::render::surface_render_data< ColorType >

Render data for triangular surface geometry with support for the surface_renderer.

See render_data_base.

Template Parameters
ColorTypeThe type used to represent colors. Must be cgv::render::rgb or cgv::render::rgba.

Definition at line 12 of file surface_render_data.h.

Member Function Documentation

◆ add() [1/4]

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add ( const vec3 position,
const cgv::vec3 normal 
)
inline

Definition at line 97 of file surface_render_data.h.

◆ add() [2/4]

template<typename ColorType = rgb>
void cgv::render::render_data_base< RendererType, RenderStyleType, ColorType >::add ( const vec3 position,
const ColorType &  color 
)
inline

Definition at line 362 of file render_data_base.h.

◆ add() [3/4]

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add ( const vec3 position,
const ColorType &  color,
const cgv::vec2 texcoord 
)
inline

Definition at line 107 of file surface_render_data.h.

◆ add() [4/4]

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add ( const vec3 position,
const ColorType &  color,
const cgv::vec3 normal 
)
inline

Definition at line 102 of file surface_render_data.h.

◆ add_normal()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_normal ( const cgv::vec3 normal)
inline

Definition at line 44 of file surface_render_data.h.

◆ add_texcoord()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_texcoord ( const cgv::vec2 texcoord)
inline

Definition at line 48 of file surface_render_data.h.

◆ add_triangle()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_triangle ( const vec3 position0,
const vec3 position1,
const vec3 position2 
)
inline

Definition at line 52 of file surface_render_data.h.

◆ add_triangle_color()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_triangle_color ( const ColorType &  color)
inline

Definition at line 58 of file surface_render_data.h.

◆ add_triangle_colors()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_triangle_colors ( const ColorType &  color0,
const ColorType &  color1,
const ColorType &  color2 
)
inline

Definition at line 64 of file surface_render_data.h.

◆ add_triangle_normal()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_triangle_normal ( const vec3 normal)
inline

Definition at line 70 of file surface_render_data.h.

◆ add_triangle_normals()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_triangle_normals ( const vec3 normal0,
const vec3 normal1,
const vec3 normal2 
)
inline

Definition at line 76 of file surface_render_data.h.

◆ add_triangle_texcoord()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_triangle_texcoord ( const vec2 texcoord)
inline

Definition at line 82 of file surface_render_data.h.

◆ add_triangle_texcoords()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::add_triangle_texcoords ( const vec2 texcoord0,
const vec2 texcoord1,
const vec2 texcoord2 
)
inline

Definition at line 88 of file surface_render_data.h.

◆ clear()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::clear ( )
inline

Definition at line 38 of file surface_render_data.h.

◆ fill_normals()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::fill_normals ( const cgv::vec3 normal)
inline

Definition at line 112 of file surface_render_data.h.

◆ fill_texcoords()

template<typename ColorType = rgb>
void cgv::render::surface_render_data< ColorType >::fill_texcoords ( const cgv::vec2 texcoord)
inline

Definition at line 116 of file surface_render_data.h.

◆ transfer()

Member Data Documentation

◆ normals

template<typename ColorType = rgb>
std::vector<cgv::vec3> cgv::render::surface_render_data< ColorType >::normals

array of normals

Definition at line 34 of file surface_render_data.h.

Referenced by cgv::render::surface_render_data< ColorType >::transfer().

◆ texcoords

template<typename ColorType = rgb>
std::vector<cgv::vec2> cgv::render::surface_render_data< ColorType >::texcoords

array of texture coordinates

Definition at line 36 of file surface_render_data.h.

Referenced by cgv::render::surface_render_data< ColorType >::transfer().


The documentation for this class was generated from the following file: