cgv
cgv::render::mesh_render_info Class Reference

#include <mesh_render_info.h>

Inheritance diagram for cgv::render::mesh_render_info:
cgv::render::render_info

Public Types

typedef cgv::math::fvec< idx_type, 3 > vec3i
 index triple type
 
typedef cgv::type::uint32_type idx_type
 define index type
 
typedef cgv::media::color< float, cgv::media::RGB > rgb
 declare rgb color type
 
typedef cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > rgba
 declare rgba color type
 
typedef cgv::media::color< cgv::type::uint8_type, cgv::media::RGB > rgb8
 declare rgb color type
 
typedef cgv::media::color< cgv::type::uint8_type, cgv::media::RGB, cgv::media::OPACITY > rgba8
 declare rgba color type
 
typedef cgv::math::fvec< float, 2 > vec2
 declare type of 2d vectors
 
typedef cgv::math::fvec< float, 3 > vec3
 declare type of 3d vectors
 
typedef cgv::math::fvec< float, 4 > vec4
 declare type of homogeneous vectors
 
typedef cgv::math::vec< float > vecn
 declare type of vector with varying dimension
 
typedef cgv::math::fmat< float, 2, 2 > mat2
 declare type of 2x2 matrices
 
typedef cgv::math::fmat< float, 3, 3 > mat3
 declare type of 3x3 matrices
 
typedef cgv::math::fmat< float, 4, 4 > mat4
 declare type of 4x4 matrices
 
typedef cgv::math::fmat< float, 3, 4 > mat34
 declare type of 3x4 matrices which are often used to store a pose
 
typedef cgv::math::mat< float > matn
 declare type of matrices of varying dimensions
 
typedef cgv::math::fvec< double, 2 > dvec2
 declare type of 2d vectors
 
typedef cgv::math::fvec< double, 3 > dvec3
 declare type of 3d vectors
 
typedef cgv::math::fvec< double, 4 > dvec4
 declare type of homogeneous vectors
 
typedef cgv::math::vec< double > dvecn
 declare type of vector with varying dimension
 
typedef cgv::math::fmat< double, 2, 2 > dmat2
 declare type of 2x2 matrices
 
typedef cgv::math::fmat< double, 3, 3 > dmat3
 declare type of 3x3 matrices
 
typedef cgv::math::fmat< double, 4, 4 > dmat4
 declare type of 4x4 matrices
 
typedef cgv::math::fmat< double, 3, 4 > dmat34
 declare type of 3x4 matrices which are often used to store a pose
 
typedef cgv::math::mat< double > dmatn
 declare type of matrices of varying dimensions
 
typedef cgv::media::axis_aligned_box< float, 2 > box2
 declare type of 2d boxes
 
typedef cgv::media::axis_aligned_box< float, 3 > box3
 declare type of 3d boxes
 
typedef cgv::media::axis_aligned_box< float, 4 > box4
 declare type of 4d boxes
 
typedef cgv::media::axis_aligned_box< double, 2 > dbox2
 declare type of 2d boxes
 
typedef cgv::media::axis_aligned_box< double, 3 > dbox3
 declare type of 3d boxes
 
typedef cgv::media::axis_aligned_box< double, 4 > dbox4
 declare type of 4d boxes
 
typedef cgv::math::quaternion< float > quat
 declare type of quaternion
 
typedef cgv::math::quaternion< double > dquat
 declare type of double quaternion
 
typedef cgv::math::fvec< int32_t, 2 > ivec2
 declare type of 2d integer vectors
 
typedef cgv::math::fvec< int32_t, 3 > ivec3
 declare type of 3d integer vectors
 
typedef cgv::math::fvec< int32_t, 4 > ivec4
 declare type of 4d integer vectors
 
typedef cgv::math::fvec< uint32_t, 2 > uvec2
 declare type of 2d unsigned integer vectors
 
typedef cgv::math::fvec< uint32_t, 3 > uvec3
 declare type of 3d unsigned integer vectors
 
typedef cgv::math::fvec< uint32_t, 4 > uvec4
 declare type of 4d unsigned integer vectors
 

Public Member Functions

 mesh_render_info ()
 set vbo and vbe types
 
bool is_constructed () const
 check whether vbos are constructed
 
bool is_bound () const
 check whether attribute array binding is bound
 
template<typename T >
void construct (cgv::render::context &ctx, cgv::media::mesh::simple_mesh< T > &mesh)
 construct mesh render info from a given simple mesh and store attributes in vertex buffer objects
 
size_t get_nr_primitives () const
 return number of mesh primitives
 
const std::string & get_primitive_name (size_t i) const
 return name of i-th mesh primitive
 
size_t get_nr_fragments () const
 return number of mesh fragments that are of distinct primitive and material
 
size_t get_material_index (size_t i) const
 return material index of i-th fragment
 
size_t get_primitive_index (size_t i) const
 return group index of i-th fragment
 
void draw_primitive (cgv::render::context &ctx, size_t primitive_index, bool skip_opaque=false, bool skip_blended=false, bool use_materials=true)
 draw triangles of given mesh part or whole mesh in case part_index is not given (=-1)
 
bool bind (context &ctx, shader_program &prog, bool force_success, int aa_index=-1)
 override to restrict bind function to first aa as second is used for wireframe rendering
 
bool bind_wireframe (context &ctx, shader_program &prog, bool force_success)
 bind all or specific aa to the passed shader program
 
void draw_wireframe (cgv::render::context &ctx)
 draw array elements forming the edges of the wireframe
 
void destruct (cgv::render::context &ctx)
 destruct render mesh info and free vertex buffer objects
 
const std::vector< textured_material * > & get_materials () const
 give read access to materials
 
const std::vector< vertex_buffer * > & get_vbos () const
 give read access to vbos
 
const std::vector< attribute_array > & get_aas () const
 give read access to aabs
 
const std::vector< texture * > & get_textures () const
 give read access to texture
 
const std::vector< draw_call > & get_draw_calls () const
 give read access to draw calls
 
std::vector< textured_material * > & ref_materials ()
 give write access to materials
 
std::vector< vertex_buffer * > & ref_vbos ()
 give write access to vbos
 
std::vector< attribute_array > & ref_aas ()
 give write access to aabs
 
std::vector< texture * > & ref_textures ()
 give write access to texture
 
std::vector< draw_call > & ref_draw_calls ()
 give write access to draw calls
 
void draw_all (context &ctx, bool skip_opaque=false, bool skip_blended=false, bool use_materials=true)
 execute all draw calls
 

Protected Member Functions

void construct_vbos_base (cgv::render::context &c, const cgv::media::mesh::simple_mesh_base &mesh, std::vector< idx_type > &vertex_indices, std::vector< vec3i > &unique_triples, std::vector< idx_type > &triangle_element_buffer, std::vector< idx_type > &edge_element_buffer)
 helper function to construct vbos
 
void finish_construct_vbos_base (cgv::render::context &ctx, const std::vector< idx_type > &triangle_element_buffer, const std::vector< idx_type > &edge_element_buffer)
 helper function for mesh render info consrtuctions
 
void construct_draw_calls (cgv::render::context &ctx)
 bind the attribute array to the given shader program
 
void draw (context &ctx, const draw_call &dc, const draw_call *prev_dc=0, const draw_call *next_dc=0, bool use_materials=true)
 perform a single render call
 

Protected Attributes

std::vector< std::string > primitive_names
 store list of primitive names
 
std::vector< vec3imaterial_primitive_start
 index triple storing the material index, the primitive index and the offset (element index) in the triangle element buffer
 
bool include_tex_coords
 store whether tex coords are in vbo
 
bool include_normals
 store whether normals are in vbo
 
bool include_colors
 store whether colors are in vbo
 
size_t nr_vertices
 number of vertices
 
size_t nr_edge_elements
 number of edges in the wireframe representation
 
size_t nr_triangle_elements
 number of triangles in the triangulation
 
size_t element_size
 size of single coordinate
 
draw_call wire_draw_call
 draw call for wireframe rendering
 
cgv::render::type_descriptor position_descr
 type description of position attribute
 
cgv::render::type_descriptor tex_coords_descr
 type description of tex coordinate attribute
 
size_t color_increment
 color type size in bytes
 
cgv::media::ColorType ct
 color type
 
std::vector< textured_material * > materials
 store materials
 
std::vector< texture * > textures
 store textures
 
std::vector< vertex_buffer * > vbos
 store buffers
 
std::vector< attribute_array > aas
 store attribute bindings
 
std::vector< draw_call > draw_calls
 store vector of render calls
 

Detailed Description

the mesh_render_info structure manages vertex buffer objects for attribute and element buffers as well as an attribute array binding object. The vertex buffer can be constructed from a simple mesh and the attribute array binding is bound to a specific shader program which defines the attribute locations.


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