Patate Lib  0.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Vitelotte::VGMeshRenderer< _Mesh, _PosProj, _ValueProj > Class Template Reference

Detailed Description

template<class _Mesh, typename _PosProj = DefaultPosProj <typename _Mesh::Vector>, typename _ValueProj = DefaultValueProj<typename _Mesh::Value>>
class Vitelotte::VGMeshRenderer< _Mesh, _PosProj, _ValueProj >

An OpenGL 3 renderer to display VGMesh objects.

Public Types

enum  { NORMAL_TRIANGLES = 0x01, SINGULAR_TRIANGLES = 0x02, ALL_TRIANGLES = NORMAL_TRIANGLES | SINGULAR_TRIANGLES }
 
enum  { NODES_TEXTURE_UNIT }
 
typedef _Mesh Mesh
 
typedef _PosProj PosProj
 
typedef _ValueProj ValueProj
 
typedef Mesh::Node Node
 
typedef Mesh::Vector Vector
 
typedef Mesh::Value Value
 
typedef Mesh::Vertex Vertex
 
typedef Mesh::Face Face
 
typedef VGMeshRendererResources Resources
 
typedef Eigen::Vector3f Vector3
 
typedef Eigen::Vector4f Vector4
 

Public Member Functions

 VGMeshRenderer (Resources *resources=0, const PosProj &posProj=PosProj(), const ValueProj &valueProj=ValueProj())
 
const PosProj & positionProjection () const
 
PosProj & positionProjection ()
 
const ValueProj & valueProjection () const
 
ValueProj & valueProjection ()
 
ColorSpace screenColorSpace () const
 
void setScreenColorSpace (ColorSpace cs) const
 
void setResources (Resources *resources)
 
void releaseGLResources ()
 
void updateBuffers (const Mesh &mesh)
 
void drawGeometry (unsigned geomFlags)
 
void render (const Eigen::Matrix4f &viewMatrix, float smoothness=8)
 
void renderWireframe (const Eigen::Matrix4f &viewMatrix, const Eigen::Vector2f &viewportSize, float lineWidth=1, const Eigen::Vector4f &color=Eigen::Vector4f(0, 0, 0, 1), float smoothness=8)
 

Protected Member Functions

Vector4 position (const Mesh &mesh, Vertex vx) const
 
Vector4 color (const Mesh &mesh, Node node) const
 
void initResources ()
 
template<typename Vec >
void createAndUploadBuffer (GLuint &glId, GLenum type, const Vec &data, GLenum usage=GL_DYNAMIC_DRAW)