#include <TriMesh.h>
Public Member Functions | |
void | clear () |
bool | hasNormals () const |
bool | hasColorsRGB () const |
bool | hasColorsRGBA () const |
bool | hasTexCoords () const |
void | appendVertex (const Vec3f &v) |
Creates a vertex which can be referred to with appendTriangle() or appendIndices(). | |
void | appendVertices (const Vec3f *verts, size_t num) |
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndices(). | |
void | appendVertices (const Vec4d *verts, size_t num) |
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndices(). | |
void | appendNormal (const Vec3f &v) |
Appends a normal. | |
void | appendNormals (const Vec4d *normals, size_t num) |
appendNormals functions similarly to the appendVertices method, appending multiple normals to be associated with the triangle faces. | |
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 TriMesh 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, Vec3f *a, Vec3f *b, Vec3f *c) const |
Puts the 3 vertices of triangle number idx into a, b and c. | |
std::vector< Vec3f > & | getVertices () |
Returns all the vertices for a mesh in a std::vector as Vec3f objects. | |
const std::vector< Vec3f > & | getVertices () const |
Returns all the vertices for a mesh in a std::vector as Vec3f objects. | |
std::vector< Vec3f > & | getNormals () |
Returns all the normals for a mesh in a std::vector as Vec3f objects. There will be one of these for each triangle face in the mesh. | |
const std::vector< Vec3f > & | getNormals () const |
Returns all the normals for a mesh in a std::vector as Vec3f objects. There will be one of these for each triangle face in the mesh. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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] }. | |
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] }. | |
AxisAlignedBox3f | calcBoundingBox () const |
Calculates the bounding box of all vertices. | |
AxisAlignedBox3f | calcBoundingBox (const Matrix44f &transform) const |
Calculates the bounding box of all vertices as transformed by transform. | |
void | read (DataSourceRef in) |
This allows you read a TriMesh in from a data file, for instance an .obj file. At present .obj and .dat files are supported. | |
void | write (DataTargetRef out) const |
This allows to you write a mesh out to a data file. At present .obj and .dat files are supported. |
void cinder::TriMesh::clear | ( | ) |
bool cinder::TriMesh::hasNormals | ( | ) | const |
bool cinder::TriMesh::hasColorsRGB | ( | ) | const |
bool cinder::TriMesh::hasColorsRGBA | ( | ) | const |
bool cinder::TriMesh::hasTexCoords | ( | ) | const |
void cinder::TriMesh::appendVertex | ( | const Vec3f & | v | ) |
Creates a vertex which can be referred to with appendTriangle() or appendIndices().
void cinder::TriMesh::appendVertices | ( | const Vec3f * | verts, | |
size_t | num | |||
) |
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndices().
void cinder::TriMesh::appendVertices | ( | const Vec4d * | verts, | |
size_t | num | |||
) |
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndices().
void cinder::TriMesh::appendNormal | ( | const Vec3f & | v | ) |
Appends a normal.
void cinder::TriMesh::appendNormals | ( | const Vec4d * | normals, | |
size_t | num | |||
) |
appendNormals functions similarly to the appendVertices method, appending multiple normals to be associated with the triangle faces.
Normals and triangles are associated by index, so if you have created 3 vertices and one Triangle, you would append a single normal for the face of the triangles
void cinder::TriMesh::appendColorRGB | ( | const Color & | rgb | ) |
this sets the color used by a triangle generated by the TriMesh
void cinder::TriMesh::appendColorRGBA | ( | const ColorA & | rgba | ) |
this sets the color used by a triangle generated by the TriMesh
void cinder::TriMesh::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::TriMesh::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::TriMesh::appendIndices | ( | uint32_t * | indices, | |
size_t | num | |||
) |
Appends num vertices to the TriMesh pointed to by indices.
size_t cinder::TriMesh::getNumIndices | ( | ) | const |
Returns the total number of indices contained by a TriMesh. This should be number of triangles/3.
size_t cinder::TriMesh::getNumTriangles | ( | ) | const |
Returns the total number of triangles contained by a TriMesh. This should be number of indices*3.
size_t cinder::TriMesh::getNumVertices | ( | ) | const |
Returns the total number of indices contained by a TriMesh. This should be number of triangles/3.
Puts the 3 vertices of triangle number idx into a, b and c.
std::vector<Vec3f>& cinder::TriMesh::getVertices | ( | ) |
Returns all the vertices for a mesh in a std::vector as Vec3f objects.
const std::vector<Vec3f>& cinder::TriMesh::getVertices | ( | ) | const |
Returns all the vertices for a mesh in a std::vector as Vec3f objects.
std::vector<Vec3f>& cinder::TriMesh::getNormals | ( | ) |
Returns all the normals for a mesh in a std::vector as Vec3f objects. There will be one of these for each triangle face in the mesh.
const std::vector<Vec3f>& cinder::TriMesh::getNormals | ( | ) | const |
Returns all the normals for a mesh in a std::vector as Vec3f objects. There will be one of these for each triangle face in the mesh.
std::vector<Color>& cinder::TriMesh::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::TriMesh::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::TriMesh::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::TriMesh::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::TriMesh::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::TriMesh::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::TriMesh::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::TriMesh::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] }.
AxisAlignedBox3f cinder::TriMesh::calcBoundingBox | ( | ) | const |
Calculates the bounding box of all vertices.
AxisAlignedBox3f cinder::TriMesh::calcBoundingBox | ( | const Matrix44f & | transform | ) | const |
Calculates the bounding box of all vertices as transformed by transform.
void cinder::TriMesh::read | ( | DataSourceRef | in | ) |
This allows you read a TriMesh in from a data file, for instance an .obj file. At present .obj and .dat files are supported.
void cinder::TriMesh::write | ( | DataTargetRef | out | ) | const |
This allows to you write a mesh out to a data file. At present .obj and .dat files are supported.