Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | List of all members
cinder::TriMesh2d Class Reference

#include <TriMesh.h>

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

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::appendColorsRgb ( const Color rgbs,
size_t  num 
)

Appends multiple RGB colors to the TriMesh.

void cinder::TriMesh2d::appendColorsRgba ( const ColorA rgbas,
size_t  num 
)

Appends multiple RGBA colors to the TriMesh.

void cinder::TriMesh2d::appendTexCoords ( const Vec2f texcoords,
size_t  num 
)

Appends multiple texcoords to the TriMesh.

void cinder::TriMesh2d::appendTriangle ( uint32_t  v0,
uint32_t  v1,
uint32_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 ( const 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.

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

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

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

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

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

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<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.

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

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<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.

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

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

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.

std::vector<uint32_t>& cinder::TriMesh2d::getIndices ( )

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

const std::vector<uint32_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: