cinder::TriMesh2d Class Reference

#include <TriMesh.h>

List of all members.

Public Member Functions

void clear ()
bool hasColorsRgb () const
bool hasColorsRgba () const
bool hasTexCoords () const
void appendVertex (const Vec2f &v)
 Creates a vertex which can be referred to with appendTriangle() or appendIndices().
void appendVertices (const Vec2f *verts, size_t num)
 Appends multiple vertices which can be referred to with appendTriangle() or appendIndices().
void appendColorRgb (const Color &rgb)
 this sets the color used by a triangle generated by the TriMesh
void appendColorRgba (const ColorA &rgba)
 this sets the color used by a triangle generated by the TriMesh
void appendTexCoord (const Vec2f &v)
 appends a texture coordinate in [-1,1] space to be applied to generated triangles.
void appendTriangle (size_t v0, size_t v1, size_t v2)
 after creating three vertices, pass the indices of the three vertices to create a triangle from them.
void appendIndices (uint32_t *indices, size_t num)
 Appends num vertices to the TriMesh2d pointed to by indices.
size_t getNumIndices () const
 Returns the total number of indices contained by a TriMesh. This should be number of triangles/3.
size_t getNumTriangles () const
 Returns the total number of triangles contained by a TriMesh. This should be number of indices*3.
size_t getNumVertices () const
 Returns the total number of indices contained by a TriMesh. This should be number of triangles/3.
void getTriangleVertices (size_t idx, Vec2f *a, Vec2f *b, Vec2f *c) const
 Puts the 3 vertices of triangle number idx into a, b and c.
const std::vector< Vec2f > & getVertices () const
 Returns all the vertices for a mesh in a std::vector as Vec2f objects.
const std::vector< Color > & getColorsRGB () const
 Returns a std::vector of RGB colors of the triangles faces. There will be one of these for each triangle face in the mesh.
const std::vector< ColorA > & getColorsRGBA () const
 Returns a std::vector of RGBA colors of the triangles faces. There will be one of these for each triangle face in the mesh.
const std::vector< Vec2f > & getTexCoords () const
 Returns a std::vector of Texture coordinates as Vec2fs. There will be one texture coord for each vertex in the TriMesh.
const std::vector< size_t > & getIndices () const
 Trimesh indices are ordered such that the indices of triangle T are { indices[T*3+0], indices[T*3+1], indices[T*3+2] }.
Rectf calcBoundingBox () const
 Calculates the bounding box of all vertices.

Member Function Documentation

void cinder::TriMesh2d::clear (  ) 
bool cinder::TriMesh2d::hasColorsRgb (  )  const
bool cinder::TriMesh2d::hasColorsRgba (  )  const
bool cinder::TriMesh2d::hasTexCoords (  )  const
void cinder::TriMesh2d::appendVertex ( const Vec2f v  ) 

Creates a vertex which can be referred to with appendTriangle() or appendIndices().

void cinder::TriMesh2d::appendVertices ( const Vec2f verts,
size_t  num 
)

Appends multiple vertices which can be referred to with appendTriangle() or appendIndices().

void cinder::TriMesh2d::appendColorRgb ( const Color rgb  ) 

this sets the color used by a triangle generated by the TriMesh

void cinder::TriMesh2d::appendColorRgba ( const ColorA rgba  ) 

this sets the color used by a triangle generated by the TriMesh

void cinder::TriMesh2d::appendTexCoord ( const Vec2f v  ) 

appends a texture coordinate in [-1,1] space to be applied to generated triangles.

The coordinates are associated with the vertexes of the TriMesh, not the generated triangles when they are drawn

void cinder::TriMesh2d::appendTriangle ( size_t  v0,
size_t  v1,
size_t  v2 
)

after creating three vertices, pass the indices of the three vertices to create a triangle from them.

Until this is done, unlike in an OpenGL triangle strip, the triangle will not actually be generated and stored by the TriMesh

void cinder::TriMesh2d::appendIndices ( uint32_t *  indices,
size_t  num 
)

Appends num vertices to the TriMesh2d pointed to by indices.

size_t cinder::TriMesh2d::getNumIndices (  )  const

Returns the total number of indices contained by a TriMesh. This should be number of triangles/3.

size_t cinder::TriMesh2d::getNumTriangles (  )  const

Returns the total number of triangles contained by a TriMesh. This should be number of indices*3.

size_t cinder::TriMesh2d::getNumVertices (  )  const

Returns the total number of indices contained by a TriMesh. This should be number of triangles/3.

void cinder::TriMesh2d::getTriangleVertices ( size_t  idx,
Vec2f a,
Vec2f b,
Vec2f c 
) const

Puts the 3 vertices of triangle number idx into a, b and c.

const std::vector<Vec2f>& cinder::TriMesh2d::getVertices (  )  const

Returns all the vertices for a mesh in a std::vector as Vec2f objects.

const std::vector<Color>& cinder::TriMesh2d::getColorsRGB (  )  const

Returns a std::vector of RGB colors of the triangles faces. There will be one of these for each triangle face in the mesh.

const std::vector<ColorA>& cinder::TriMesh2d::getColorsRGBA (  )  const

Returns a std::vector of RGBA colors of the triangles faces. There will be one of these for each triangle face in the mesh.

const std::vector<Vec2f>& cinder::TriMesh2d::getTexCoords (  )  const

Returns a std::vector of Texture coordinates as Vec2fs. There will be one texture coord for each vertex in the TriMesh.

const std::vector<size_t>& cinder::TriMesh2d::getIndices (  )  const

Trimesh indices are ordered such that the indices of triangle T are { indices[T*3+0], indices[T*3+1], indices[T*3+2] }.

Rectf cinder::TriMesh2d::calcBoundingBox (  )  const

Calculates the bounding box of all vertices.


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