![]() |
Cinder
0.9.1
|
#include <TriMesh.h>
Inherits cinder::geom::Source.
Classes | |
class | Format |
Public Member Functions | |
TriMesh (const Format &format=Format().positions().normals().texCoords()) | |
TriMesh (const geom::Source &source) | |
TriMesh (const geom::Source &source, const Format &format) | |
void | loadInto (geom::Target *target, const geom::AttribSet &requestedAttribs) const override |
geom::Source * | clone () const override |
void | clear () |
bool | hasNormals () const |
bool | hasTangents () const |
bool | hasBitangents () const |
bool | hasColors () const |
bool | hasColorsRgb () const |
bool | hasColorsRgba () const |
bool | hasTexCoords () const |
bool | hasTexCoords0 () const |
bool | hasTexCoords1 () const |
bool | hasTexCoords2 () const |
bool | hasTexCoords3 () const |
void | appendPosition (const vec2 &position) |
void | appendPosition (const vec3 &position) |
void | appendPosition (const vec4 &position) |
void | appendPositions (const vec2 *positions, size_t num) |
void | appendPositions (const vec3 *positions, size_t num) |
void | appendPositions (const vec4 *positions, size_t num) |
void | appendNormal (const vec3 &normal) |
void | appendNormals (const vec3 *normals, size_t num) |
void | appendTangent (const vec3 &tangent) |
void | appendTangents (const vec3 *tangents, size_t num) |
void | appendBitangent (const vec3 &bitangent) |
void | appendBitangents (const vec3 *bitangents, size_t num) |
void | appendColorRgb (const Color &color) |
void | appendColorRgba (const ColorA &color) |
void | appendTexCoord (const vec2 &v) |
void | appendTexCoord0 (const vec2 &v) |
void | appendTexCoord1 (const vec2 &v) |
void | appendTexCoord2 (const vec2 &v) |
void | appendTexCoord3 (const vec2 &v) |
void | appendTexCoord0 (const vec3 &v) |
void | appendTexCoord1 (const vec3 &v) |
void | appendTexCoord2 (const vec3 &v) |
void | appendTexCoord3 (const vec3 &v) |
void | appendTexCoord0 (const vec4 &v) |
void | appendTexCoord1 (const vec4 &v) |
void | appendTexCoord2 (const vec4 &v) |
void | appendTexCoord3 (const vec4 &v) |
void | appendColors (const Color *rgbs, size_t num) |
void | appendColors (const ColorA *rgbas, size_t num) |
void | appendTexCoords0 (const vec2 *texCoords, size_t num) |
void | appendTexCoords1 (const vec2 *texCoords, size_t num) |
void | appendTexCoords2 (const vec2 *texCoords, size_t num) |
void | appendTexCoords3 (const vec2 *texCoords, size_t num) |
void | appendTexCoords0 (const vec3 *texCoords, size_t num) |
void | appendTexCoords1 (const vec3 *texCoords, size_t num) |
void | appendTexCoords2 (const vec3 *texCoords, size_t num) |
void | appendTexCoords3 (const vec3 *texCoords, size_t num) |
void | appendTexCoords0 (const vec4 *texCoords, size_t num) |
void | appendTexCoords1 (const vec4 *texCoords, size_t num) |
void | appendTexCoords2 (const vec4 *texCoords, size_t num) |
void | appendTexCoords3 (const vec4 *texCoords, size_t num) |
void | appendTriangle (uint32_t v0, uint32_t v1, uint32_t v2) |
void | appendIndices (const uint32_t *indices, size_t num) |
size_t | getNumIndices () const override |
size_t | getNumTriangles () const |
size_t | getNumVertices () const override |
void | getTriangleVertices (size_t idx, vec3 *a, vec3 *b, vec3 *c) const |
void | getTriangleVertices (size_t idx, vec2 *a, vec2 *b, vec2 *c) const |
void | getTriangleNormals (size_t idx, vec3 *a, vec3 *b, vec3 *c) const |
void | getTriangleTangents (size_t idx, vec3 *a, vec3 *b, vec3 *c) const |
void | getTriangleBitangents (size_t idx, vec3 *a, vec3 *b, vec3 *c) const |
template<uint8_t DIM> | |
const VECDIM< DIM, float >::TYPE * | getPositions () const |
template<uint8_t DIM> | |
VECDIM< DIM, float >::TYPE * | getPositions () |
std::vector< vec3 > & | getNormals () |
const std::vector< vec3 > & | getNormals () const |
std::vector< vec3 > & | getTangents () |
const std::vector< vec3 > & | getTangents () const |
std::vector< vec3 > & | getBitangents () |
const std::vector< vec3 > & | getBitangents () const |
template<uint8_t DIM> | |
COLORDIM< DIM, float >::TYPE * | getColors () |
template<uint8_t DIM> | |
const COLORDIM< DIM, float >::TYPE * | getColors () const |
template<uint8_t DIM> | |
VECDIM< DIM, float >::TYPE * | getTexCoords0 () |
template<uint8_t DIM> | |
const VECDIM< DIM, float >::TYPE * | getTexCoords0 () const |
template<uint8_t DIM> | |
VECDIM< DIM, float >::TYPE * | getTexCoords1 () |
template<uint8_t DIM> | |
const VECDIM< DIM, float >::TYPE * | getTexCoords1 () const |
template<uint8_t DIM> | |
VECDIM< DIM, float >::TYPE * | getTexCoords2 () |
template<uint8_t DIM> | |
const VECDIM< DIM, float >::TYPE * | getTexCoords2 () const |
template<uint8_t DIM> | |
VECDIM< DIM, float >::TYPE * | getTexCoords3 () |
template<uint8_t DIM> | |
const VECDIM< DIM, float >::TYPE * | getTexCoords3 () const |
std::vector< uint32_t > & | getIndices () |
const std::vector< uint32_t > & | getIndices () const |
const std::vector< float > & | getBufferPositions () const |
std::vector< float > & | getBufferPositions () |
const std::vector< float > & | getBufferColors () const |
std::vector< float > & | getBufferColors () |
const std::vector< float > & | getBufferTexCoords0 () const |
std::vector< float > & | getBufferTexCoords0 () |
const std::vector< float > & | getBufferTexCoords1 () const |
std::vector< float > & | getBufferTexCoords1 () |
const std::vector< float > & | getBufferTexCoords2 () const |
std::vector< float > & | getBufferTexCoords2 () |
const std::vector< float > & | getBufferTexCoords3 () const |
std::vector< float > & | getBufferTexCoords3 () |
AxisAlignedBox | calcBoundingBox () const |
AxisAlignedBox | calcBoundingBox (const mat4 &transform) const |
void | read (const DataSourceRef &dataSource) |
void | write (const DataTargetRef &dataTarget) const |
void | write (const DataTargetRef &dataTarget, bool writeNormals, bool writeTangents) const |
void | write (const DataTargetRef &dataTarget, const std::set< geom::Attrib > &attribs) const |
bool | recalculateNormals (bool smooth=false, bool weighted=false) |
bool | recalculateTangents () |
bool | recalculateBitangents () |
void | subdivide (int division=2, bool normalize=false) |
geom::Primitive | getPrimitive () const override |
uint8_t | getAttribDims (geom::Attrib attr) const override |
geom::AttribSet | getAvailableAttribs () const override |
Static Public Member Functions | |
static TriMeshRef | create () |
static TriMeshRef | create (const Format &format) |
static TriMeshRef | create (const geom::Source &source) |
static TriMeshRef | create (const geom::Source &source, const Format &format) |
static Format | formatFromSource (const geom::Source &source) |
Protected Member Functions | |
void | initFromFormat (const TriMesh::Format &format) |
void | loadFromSource (const geom::Source &source) |
void | getAttribPointer (geom::Attrib attr, const float **resultPtr, size_t *resultStrideBytes, uint8_t *resultDims) const |
void | copyAttrib (geom::Attrib attr, uint8_t dims, size_t stride, const float *srcData, size_t count) |
bool | verticesEqual (uint32_t indexA, uint32_t indexB) const |
void | readImplV2 (const IStreamRef &in) |
void | readImplV1 (const IStreamRef &in) |
void | write (const DataTargetRef &dataTarget, uint32_t writeMask) const |
void | copyIndicesNonIndexed (uint16_t *dest) const |
void | copyIndicesNonIndexed (uint32_t *dest) const |
template<typename T > | |
void | forceCopyIndicesTrianglesImpl (T *dest) const |
Static Protected Member Functions | |
static uint32_t | toMask (geom::Attrib attrib) |
static geom::Attrib | fromMask (uint32_t attrib) |
Protected Attributes | |
uint8_t | mPositionsDims |
uint8_t | mNormalsDims |
uint8_t | mTangentsDims |
uint8_t | mBitangentsDims |
uint8_t | mColorsDims |
uint8_t | mTexCoords0Dims |
uint8_t | mTexCoords1Dims |
uint8_t | mTexCoords2Dims |
uint8_t | mTexCoords3Dims |
std::vector< float > | mPositions |
std::vector< float > | mColors |
std::vector< vec3 > | mNormals |
std::vector< vec3 > | mTangents |
std::vector< vec3 > | mBitangents |
std::vector< float > | mTexCoords0 |
std::vector< float > | mTexCoords1 |
std::vector< float > | mTexCoords2 |
std::vector< float > | mTexCoords3 |
std::vector< uint32_t > | mIndices |
Friends | |
class | TriMeshGeomTarget |
cinder::TriMesh::TriMesh | ( | const geom::Source & | source | ) |
cinder::TriMesh::TriMesh | ( | const geom::Source & | source, |
const Format & | format | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
Creates a suitable TriMesh::Format for representing a geom::Source source.
|
overridevirtual |
Implements cinder::geom::Source.
|
overridevirtual |
Implements cinder::geom::Source.
void cinder::TriMesh::clear | ( | ) |
bool cinder::TriMesh::hasNormals | ( | ) | const |
bool cinder::TriMesh::hasTangents | ( | ) | const |
bool cinder::TriMesh::hasBitangents | ( | ) | const |
bool cinder::TriMesh::hasColors | ( | ) | const |
bool cinder::TriMesh::hasColorsRgb | ( | ) | const |
bool cinder::TriMesh::hasColorsRgba | ( | ) | const |
bool cinder::TriMesh::hasTexCoords | ( | ) | const |
Returns whether the TriMesh has texture coordinates for unit 0.
bool cinder::TriMesh::hasTexCoords0 | ( | ) | const |
Returns whether the TriMesh has texture coordinates for unit 0.
bool cinder::TriMesh::hasTexCoords1 | ( | ) | const |
Returns whether the TriMesh has texture coordinates for unit 1.
bool cinder::TriMesh::hasTexCoords2 | ( | ) | const |
Returns whether the TriMesh has texture coordinates for unit 2.
bool cinder::TriMesh::hasTexCoords3 | ( | ) | const |
Returns whether the TriMesh has texture coordinates for unit 3.
void cinder::TriMesh::appendPosition | ( | const vec2 & | position | ) |
Appends a position which can be referred to with appendTriangle() or appendIndices()
void cinder::TriMesh::appendPosition | ( | const vec3 & | position | ) |
Appends a position which can be referred to with appendTriangle() or appendIndices()
void cinder::TriMesh::appendPosition | ( | const vec4 & | position | ) |
Appends a position which can be referred to with appendTriangle() or appendIndices()
void cinder::TriMesh::appendPositions | ( | const vec2 * | positions, |
size_t | num | ||
) |
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndices()
void cinder::TriMesh::appendPositions | ( | const vec3 * | positions, |
size_t | num | ||
) |
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndices()
void cinder::TriMesh::appendPositions | ( | const vec4 * | positions, |
size_t | num | ||
) |
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndices()
void cinder::TriMesh::appendNormal | ( | const vec3 & | normal | ) |
Appends a single normal.
void cinder::TriMesh::appendNormals | ( | const vec3 * | normals, |
size_t | num | ||
) |
Functions similarly to appendPositions(), appending multiple normals at once.
void cinder::TriMesh::appendTangent | ( | const vec3 & | tangent | ) |
Appends a single tangent.
void cinder::TriMesh::appendTangents | ( | const vec3 * | tangents, |
size_t | num | ||
) |
Functions similarly to appendPositions(), appending multiple tangents at once.
void cinder::TriMesh::appendBitangent | ( | const vec3 & | bitangent | ) |
Appends a single bitangent.
void cinder::TriMesh::appendBitangents | ( | const vec3 * | bitangents, |
size_t | num | ||
) |
Functions similarly to appendPositions(), appending multiple bitangents at once.
void cinder::TriMesh::appendColorRgb | ( | const Color & | color | ) |
Appends a single RGB color.
void cinder::TriMesh::appendColorRgba | ( | const ColorA & | color | ) |
Appends a single RGBA color.
void cinder::TriMesh::appendTexCoord | ( | const vec2 & | v | ) |
Synonym for appendTexCoord0; appends a texture coordinate for unit 0.
void cinder::TriMesh::appendTexCoord0 | ( | const vec2 & | v | ) |
appends a 2D texture coordinate for unit 0
void cinder::TriMesh::appendTexCoord1 | ( | const vec2 & | v | ) |
appends a 2D texture coordinate for unit 1
void cinder::TriMesh::appendTexCoord2 | ( | const vec2 & | v | ) |
appends a 2D texture coordinate for unit 2
void cinder::TriMesh::appendTexCoord3 | ( | const vec2 & | v | ) |
appends a 2D texture coordinate for unit 3
void cinder::TriMesh::appendTexCoord0 | ( | const vec3 & | v | ) |
appends a 3D texture coordinate for unit 0
void cinder::TriMesh::appendTexCoord1 | ( | const vec3 & | v | ) |
appends a 3D texture coordinate for unit 1
void cinder::TriMesh::appendTexCoord2 | ( | const vec3 & | v | ) |
appends a 3D texture coordinate for unit 2
void cinder::TriMesh::appendTexCoord3 | ( | const vec3 & | v | ) |
appends a 3D texture coordinate for unit 3
void cinder::TriMesh::appendTexCoord0 | ( | const vec4 & | v | ) |
appends a 4D texture coordinate for unit 0
void cinder::TriMesh::appendTexCoord1 | ( | const vec4 & | v | ) |
appends a 4D texture coordinate for unit 1
void cinder::TriMesh::appendTexCoord2 | ( | const vec4 & | v | ) |
appends a 4D texture coordinate for unit 2
void cinder::TriMesh::appendTexCoord3 | ( | const vec4 & | v | ) |
appends a 4D texture coordinate for unit 3
void cinder::TriMesh::appendColors | ( | const Color * | rgbs, |
size_t | num | ||
) |
Appends multiple RGB colors to the TriMesh.
void cinder::TriMesh::appendColors | ( | const ColorA * | rgbas, |
size_t | num | ||
) |
Appends multiple RGBA colors to the TriMesh.
void cinder::TriMesh::appendTexCoords0 | ( | const vec2 * | texCoords, |
size_t | num | ||
) |
Appends multiple 2D texcoords for unit 0.
void cinder::TriMesh::appendTexCoords1 | ( | const vec2 * | texCoords, |
size_t | num | ||
) |
Appends multiple 2D texcoords for unit 1.
void cinder::TriMesh::appendTexCoords2 | ( | const vec2 * | texCoords, |
size_t | num | ||
) |
Appends multiple 2D texcoords for unit 2.
void cinder::TriMesh::appendTexCoords3 | ( | const vec2 * | texCoords, |
size_t | num | ||
) |
Appends multiple 2D texcoords for unit 3.
void cinder::TriMesh::appendTexCoords0 | ( | const vec3 * | texCoords, |
size_t | num | ||
) |
Appends multiple 3D texcoords for unit 0.
void cinder::TriMesh::appendTexCoords1 | ( | const vec3 * | texCoords, |
size_t | num | ||
) |
Appends multiple 3D texcoords for unit 1.
void cinder::TriMesh::appendTexCoords2 | ( | const vec3 * | texCoords, |
size_t | num | ||
) |
Appends multiple 3D texcoords for unit 2.
void cinder::TriMesh::appendTexCoords3 | ( | const vec3 * | texCoords, |
size_t | num | ||
) |
Appends multiple 3D texcoords for unit 3.
void cinder::TriMesh::appendTexCoords0 | ( | const vec4 * | texCoords, |
size_t | num | ||
) |
Appends multiple 4D texcoords for unit 0.
void cinder::TriMesh::appendTexCoords1 | ( | const vec4 * | texCoords, |
size_t | num | ||
) |
Appends multiple 4D texcoords for unit 1.
void cinder::TriMesh::appendTexCoords2 | ( | const vec4 * | texCoords, |
size_t | num | ||
) |
Appends multiple 4D texcoords for unit 2.
void cinder::TriMesh::appendTexCoords3 | ( | const vec4 * | texCoords, |
size_t | num | ||
) |
Appends multiple 4D texcoords for unit 3.
void cinder::TriMesh::appendTriangle | ( | uint32_t | v0, |
uint32_t | v1, | ||
uint32_t | v2 | ||
) |
Appends a single triange whose 3 vertices are at indices v0, v1 and v2.
void cinder::TriMesh::appendIndices | ( | const uint32_t * | indices, |
size_t | num | ||
) |
Appends num indices to the TriMesh pointed to by indices.
|
overridevirtual |
Returns the total number of indices in the TriMesh.
Implements cinder::geom::Source.
size_t cinder::TriMesh::getNumTriangles | ( | ) | const |
Returns the total number of triangles contained by the TriMesh.
|
overridevirtual |
Returns the total number of indices contained by the TriMesh.
Implements cinder::geom::Source.
void cinder::TriMesh::getTriangleVertices | ( | size_t | idx, |
vec3 * | a, | ||
vec3 * | b, | ||
vec3 * | c | ||
) | const |
Copies the 3 vertices of triangle number idx into a, b and c. Assumes vertices are 3D.
void cinder::TriMesh::getTriangleVertices | ( | size_t | idx, |
vec2 * | a, | ||
vec2 * | b, | ||
vec2 * | c | ||
) | const |
Copies the 3 vertices of triangle number idx into a, b and c. Assumes vertices are 2D.
void cinder::TriMesh::getTriangleNormals | ( | size_t | idx, |
vec3 * | a, | ||
vec3 * | b, | ||
vec3 * | c | ||
) | const |
Copies the 3 normals of triangle number idx into a, b and c.
void cinder::TriMesh::getTriangleTangents | ( | size_t | idx, |
vec3 * | a, | ||
vec3 * | b, | ||
vec3 * | c | ||
) | const |
Copies the 3 tangents of triangle number idx into a, b and c.
void cinder::TriMesh::getTriangleBitangents | ( | size_t | idx, |
vec3 * | a, | ||
vec3 * | b, | ||
vec3 * | c | ||
) | const |
Copies the 3 bitangents of triangle number idx into a, b and c.
const VECDIM<DIM,float>::TYPE* cinder::TriMesh::getPositions | ( | ) | const |
Returns a pointer to the positions of the mesh as vec<DIM>*. For example, for a TriMesh with 3D vertices, call getPositions<3>().
VECDIM<DIM,float>::TYPE* cinder::TriMesh::getPositions | ( | ) |
Returns a pointer to the positions of theTriMesh as vec<DIM>*. For example, for a TriMesh with 3D vertices, call getPositions<3>().
std::vector<vec3>& cinder::TriMesh::getNormals | ( | ) |
Returns a reference to the std::vector<vec3> for the TriMesh's normals.
const std::vector<vec3>& cinder::TriMesh::getNormals | ( | ) | const |
Returns a reference to the std::vector<vec3> for the TriMesh's normals.
std::vector<vec3>& cinder::TriMesh::getTangents | ( | ) |
Returns a reference to the std::vector<vec3> for the TriMesh's tangents.
const std::vector<vec3>& cinder::TriMesh::getTangents | ( | ) | const |
Returns a reference to the std::vector<vec3> for the TriMesh's tangents.
std::vector<vec3>& cinder::TriMesh::getBitangents | ( | ) |
Returns a reference to the std::vector<vec3> for the TriMesh's bitangents.
const std::vector<vec3>& cinder::TriMesh::getBitangents | ( | ) | const |
Returns a reference to the std::vector<vec3> for the TriMesh's bitangents.
COLORDIM<DIM,float>::TYPE* cinder::TriMesh::getColors | ( | ) |
Returns a pointer to the colors of the TriMesh vec<DIM>*. For example, to get RGB colors, call getColors<3>().
const COLORDIM<DIM,float>::TYPE* cinder::TriMesh::getColors | ( | ) | const |
Returns a pointer to the colors of the TriMesh vec<DIM>*. For example, to get RGB colors, call getColors<3>().
VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords0 | ( | ) |
Returns a pointer to the TexCoord0 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord0 values, use getTexCoords0<2>().
const VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords0 | ( | ) | const |
Returns a pointer to the TexCoord0 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord0 values, use getTexCoords0<2>().
VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords1 | ( | ) |
Returns a pointer to the TexCoord1 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord1 values, use getTexCoords1<2>().
const VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords1 | ( | ) | const |
Returns a pointer to the TexCoord1 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord1 values, use getTexCoords1<2>().
VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords2 | ( | ) |
Returns a pointer to the TexCoord2 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord2 values, use getTexCoords2<2>().
const VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords2 | ( | ) | const |
Returns a pointer to the TexCoord2 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord2 values, use getTexCoords2<2>().
VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords3 | ( | ) |
Returns a pointer to the TexCoord3 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord3 values, use getTexCoords3<2>().
const VECDIM<DIM,float>::TYPE* cinder::TriMesh::getTexCoords3 | ( | ) | const |
Returns a pointer to the TexCoord3 values of the TriMesh vec<DIM>*. For example, if the TriMesh has 2D TexCoord3 values, use getTexCoords3<2>().
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] }.
const std::vector<float>& cinder::TriMesh::getBufferPositions | ( | ) | const |
Returns a const reference to the position buffer.
std::vector<float>& cinder::TriMesh::getBufferPositions | ( | ) |
Returns a reference to the position buffer.
const std::vector<float>& cinder::TriMesh::getBufferColors | ( | ) | const |
Returns a const reference to the colors buffer.
std::vector<float>& cinder::TriMesh::getBufferColors | ( | ) |
Returns a reference to the colors buffer.
const std::vector<float>& cinder::TriMesh::getBufferTexCoords0 | ( | ) | const |
Returns a const reference to the texCoords0 buffer.
std::vector<float>& cinder::TriMesh::getBufferTexCoords0 | ( | ) |
Returns a reference to the texCoords0 buffer.
const std::vector<float>& cinder::TriMesh::getBufferTexCoords1 | ( | ) | const |
Returns a const reference to the texCoords1 buffer.
std::vector<float>& cinder::TriMesh::getBufferTexCoords1 | ( | ) |
Returns a reference to the texCoords1 buffer.
const std::vector<float>& cinder::TriMesh::getBufferTexCoords2 | ( | ) | const |
Returns a const reference to the texCoords2 buffer.
std::vector<float>& cinder::TriMesh::getBufferTexCoords2 | ( | ) |
Returns a reference to the texCoords2 buffer.
const std::vector<float>& cinder::TriMesh::getBufferTexCoords3 | ( | ) | const |
Returns a const reference to the texCoords3 buffer.
std::vector<float>& cinder::TriMesh::getBufferTexCoords3 | ( | ) |
Returns a reference to the texCoords3 buffer.
AxisAlignedBox cinder::TriMesh::calcBoundingBox | ( | ) | const |
Calculates the bounding box of all vertices. Fails if the positions are not 3D.
AxisAlignedBox cinder::TriMesh::calcBoundingBox | ( | const mat4 & | transform | ) | const |
Calculates the bounding box of all vertices as transformed by transform. Fails if the positions are not 3D.
void cinder::TriMesh::read | ( | const DataSourceRef & | dataSource | ) |
Fills this TriMesh with the data from a binary file, which was created with TriMesh::write().
void cinder::TriMesh::write | ( | const DataTargetRef & | dataTarget | ) | const |
Writes this TriMesh out to a binary data file.
void cinder::TriMesh::write | ( | const DataTargetRef & | dataTarget, |
bool | writeNormals, | ||
bool | writeTangents | ||
) | const |
Writes this TriMesh out to a binary data file. If writeNormals or writeTangents is true
, normals and/or tangents are written to the file.
void cinder::TriMesh::write | ( | const DataTargetRef & | dataTarget, |
const std::set< geom::Attrib > & | attribs | ||
) | const |
Writes this TriMesh out to a binary data file. You can specify which attributes to write by supplying a list of attribs.
bool cinder::TriMesh::recalculateNormals | ( | bool | smooth = false , |
bool | weighted = false |
||
) |
Adds or replaces normals by calculating them from the vertices and faces. If smooth is TRUE, similar vertices are grouped together to calculate their average. This will not change the mesh, nor will it affect texture mapping. If weighted is TRUE, larger polygons contribute more to the calculated normal. Renormalization requires 3D vertices.
bool cinder::TriMesh::recalculateTangents | ( | ) |
Adds or replaces tangents by calculating them from the normals and texture coordinates. Requires 3D normals and 2D texture coordinates.
bool cinder::TriMesh::recalculateBitangents | ( | ) |
Adds or replaces bitangents by calculating them from the normals and tangents. Requires 3D normals and tangents.
void cinder::TriMesh::subdivide | ( | int | division = 2 , |
bool | normalize = false |
||
) |
TODO: optimize memory allocations.
Subdivide each triangle of the TriMesh into division times division triangles. Division less than 2 leaves the mesh unaltered. Optionally, vertices are normalized if normalize is TRUE.
|
overridevirtual |
Create TriMesh from vectors of vertex data.
Implements cinder::geom::Source.
|
overridevirtual |
Implements cinder::geom::Source.
|
overridevirtual |
Implements cinder::geom::Source.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Returns whether or not the vertex, color etc. at both indices is the same.
|
protected |
|
protected |
|
protected |
Writes this TriMesh out to a binary data file. The writeMask parameter can be used to specify what data should be included (e.g. toMask(POSITION) | toMask(COLOR) ) or what should be excluded (e.g. ~toMask( NORMAL ) & ~toMask( TEX_COORD_0) ).
|
staticprotected |
Converts a geom::Attrib to an attribute bitmask.
|
staticprotected |
Converts an attribute bitmask to a geom::Attrib.
|
protectedinherited |
Builds a sequential list of vertices to simulate an indexed geometry when Source is non-indexed. Assumes dest contains storage for getNumVertices() entries.
|
protectedinherited |
Builds a sequential list of vertices to simulate an indexed geometry when Source is non-indexed. Assumes dest contains storage for getNumVertices() entries.
|
protectedinherited |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |