106 { mIndices.push_back( v0 ); mIndices.push_back( v1 ); mIndices.push_back( v2 ); }
123 const std::vector<Vec3f>&
getVertices()
const {
return mVertices; }
127 const std::vector<Vec3f>&
getNormals()
const {
return mNormals; }
143 const std::vector<uint32_t>&
getIndices()
const {
return mIndices; }
159 std::vector<Vec3f> mVertices;
160 std::vector<Vec3f> mNormals;
161 std::vector<Color> mColorsRGB;
162 std::vector<ColorA> mColorsRGBA;
163 std::vector<Vec2f> mTexCoords;
164 std::vector<uint32_t> mIndices;
197 { mIndices.push_back( v0 ); mIndices.push_back( v1 ); mIndices.push_back( v2 ); }
214 const std::vector<Vec2f>&
getVertices()
const {
return mVertices; }
230 const std::vector<uint32_t>&
getIndices()
const {
return mIndices; }
236 std::vector<Vec2f> mVertices;
237 std::vector<Color> mColorsRgb;
238 std::vector<ColorA> mColorsRgba;
239 std::vector<Vec2f> mTexCoords;
240 std::vector<uint32_t> mIndices;
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] }.
Definition: TriMesh.h:230
Rectf calcBoundingBox() const
Calculates the bounding box of all vertices.
Definition: TriMesh.cpp:279
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...
Definition: TriMesh.h:196
AxisAlignedBox3f calcBoundingBox() const
Calculates the bounding box of all vertices.
Definition: TriMesh.cpp:90
void appendColorRgba(const ColorA &rgba)
this sets the color used by a triangle generated by the TriMesh
Definition: TriMesh.h:91
size_t getNumVertices() const
Returns the total number of indices contained by a TriMesh. This should be number of triangles/3...
Definition: TriMesh.h:206
size_t getNumTriangles() const
Returns the total number of triangles contained by a TriMesh. This should be number of indices*3...
Definition: TriMesh.h:204
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 ...
Definition: TriMesh.h:127
std::vector< Vec2f > & getVertices()
Returns all the vertices for a mesh in a std::vector as Vec2f objects.
Definition: TriMesh.h:212
void recalculateNormals()
Adds or replaces normals by calculating them from the vertices and faces.
Definition: TriMesh.cpp:210
void read(DataSourceRef in)
This reads a TriMesh in from a data file that was serialized using the write() function.
Definition: TriMesh.cpp:142
void clear()
Definition: TriMesh.cpp:238
void appendTexCoords(const Vec2f *texcoords, size_t num)
Appends multiple texcoords to the TriMesh.
Definition: TriMesh.cpp:78
std::vector< Vec3f > & getVertices()
Returns all the vertices for a mesh in a std::vector as Vec3f objects.
Definition: TriMesh.h:121
void write(DataTargetRef out) const
This writes a TriMesh to a proprietary file format to be read using the read() function.
Definition: TriMesh.cpp:181
void appendNormal(const Vec3f &v)
Appends a normal.
Definition: TriMesh.h:83
void appendColorsRgba(const ColorA *rgbas, size_t num)
Appends multiple RGBA colors to the TriMesh.
Definition: TriMesh.cpp:73
bool hasColorsRGBA() const
Definition: TriMesh.h:73
void appendTexCoord(const Vec2f &v)
appends a texture coordinate in [-1,1] space to be applied to generated triangles.
Definition: TriMesh.h:93
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 trian...
Definition: TriMesh.h:218
size_t getNumVertices() const
Returns the total number of indices contained by a TriMesh. This should be number of triangles/3...
Definition: TriMesh.h:115
size_t getNumIndices() const
Returns the total number of indices contained by a TriMesh. This should be number of triangles/3...
Definition: TriMesh.h:111
void appendColorRgba(const ColorA &rgba)
this sets the color used by a triangle generated by the TriMesh
Definition: TriMesh.h:182
const std::vector< Vec2f > & getVertices() const
Returns all the vertices for a mesh in a std::vector as Vec2f objects.
Definition: TriMesh.h:214
void appendColorRgb(const Color &rgb)
this sets the color used by a triangle generated by the TriMesh
Definition: TriMesh.h:89
const std::vector< Vec2f > & getTexCoords() const
Returns a std::vector of Texture coordinates as Vec2fs. There will be one texture coord for each vert...
Definition: TriMesh.h:139
GLfloat GLfloat v1
Definition: GLee.h:2445
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] }.
Definition: TriMesh.h:141
bool hasTexCoords() const
Definition: TriMesh.h:173
std::vector< Vec2f > & getTexCoords()
Returns a std::vector of Texture coordinates as Vec2fs. There will be one texture coord for each vert...
Definition: TriMesh.h:137
void appendColorsRgba(const ColorA *rgbas, size_t num)
Appends multiple RGBA colors to the TriMesh.
Definition: TriMesh.cpp:262
bool hasTexCoords() const
Definition: TriMesh.h:74
bool hasColorsRgb() const
Definition: TriMesh.h:171
void appendVertices(const Vec2f *verts, size_t num)
Appends multiple vertices which can be referred to with appendTriangle() or appendIndices() ...
Definition: TriMesh.cpp:247
std::vector< ColorA > & getColorsRGBA()
Returns a std::vector of RGBA colors of the triangles faces. There will be one of these for each tria...
Definition: TriMesh.h:220
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: GLee.h:963
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.
Definition: TriMesh.cpp:83
void appendVertices(const Vec3f *verts, size_t num)
Appends multiple vertices to the TriMesh which can be referred to with appendTriangle() or appendIndi...
Definition: TriMesh.cpp:41
GLuint GLenum GLenum transform
Definition: GLee.h:10032
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 ...
Definition: TriMesh.h:125
std::vector< Vec2f > & getTexCoords()
Returns a std::vector of Texture coordinates as Vec2fs. There will be one texture coord for each vert...
Definition: TriMesh.h:224
void appendTexCoords(const Vec2f *texcoords, size_t num)
Appends multiple texcoords to the TriMesh.
Definition: TriMesh.cpp:267
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.
Definition: TriMesh.cpp:272
GLfloat GLfloat GLfloat v2
Definition: GLee.h:2451
std::vector< Color > & getColorsRGB()
Returns a std::vector of RGB colors of the triangles faces. There will be one of these for each trian...
Definition: TriMesh.h:216
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 tria...
Definition: TriMesh.h:222
void appendIndices(const uint32_t *indices, size_t num)
Appends num vertices to the TriMesh2d pointed to by indices.
Definition: TriMesh.cpp:252
void appendColorsRgb(const Color *rgbs, size_t num)
Appends multiple RGB colors to the TriMesh.
Definition: TriMesh.cpp:68
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] }.
Definition: TriMesh.h:228
const GLdouble * v
Definition: GLee.h:1384
GLuint GLuint num
Definition: GLee.h:10873
GLboolean GLboolean GLboolean b
Definition: GLee.h:2964
bool hasColorsRGB() const
Definition: TriMesh.h:72
void appendTexCoord(const Vec2f &v)
appends a texture coordinate in [-1,1] space to be applied to generated triangles.
Definition: TriMesh.h:184
void appendNormals(const Vec3f *normals, size_t num)
appendNormals functions similarly to the appendVertices method, appending multiple normals to be asso...
Definition: TriMesh.cpp:57
void appendVertex(const Vec3f &v)
Creates a vertex which can be referred to with appendTriangle() or appendIndices() ...
Definition: TriMesh.h:77
const GLubyte * c
Definition: GLee.h:8491
size_t getNumTriangles() const
Returns the total number of triangles contained by a TriMesh. This should be number of indices*3...
Definition: TriMesh.h:113
bool hasNormals() const
Definition: TriMesh.h:71
void appendColorRgb(const Color &rgb)
this sets the color used by a triangle generated by the TriMesh
Definition: TriMesh.h:180
GLuint in
Definition: GLee.h:10861
std::vector< ColorA > & getColorsRGBA()
Returns a std::vector of RGBA colors of the triangles faces. There will be one of these for each tria...
Definition: TriMesh.h:133
GLboolean GLboolean GLboolean GLboolean a
Definition: GLee.h:2964
std::shared_ptr< class DataTarget > DataTargetRef
Definition: DataTarget.h:33
const std::vector< Vec3f > & getVertices() const
Returns all the vertices for a mesh in a std::vector as Vec3f objects.
Definition: TriMesh.h:123
GLfloat v0
Definition: GLee.h:2439
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 tria...
Definition: TriMesh.h:135
void appendColorsRgb(const Color *rgbs, size_t num)
Appends multiple RGB colors to the TriMesh.
Definition: TriMesh.cpp:257
void clear()
Definition: TriMesh.cpp:31
void appendIndices(const uint32_t *indices, size_t num)
Appends num vertices to the TriMesh pointed to by indices.
Definition: TriMesh.cpp:52
Definition: AxisAlignedBox.h:31
const std::vector< Vec2f > & getTexCoords() const
Returns a std::vector of Texture coordinates as Vec2fs. There will be one texture coord for each vert...
Definition: TriMesh.h:226
std::shared_ptr< class DataSource > DataSourceRef
Definition: DataSource.h:35
Definition: TriMesh.h:167
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] }.
Definition: TriMesh.h:143
void appendVertex(const Vec2f &v)
Creates a vertex which can be referred to with appendTriangle() or appendIndices() ...
Definition: TriMesh.h:176
size_t getNumIndices() const
Returns the total number of indices contained by a TriMesh. This should be number of triangles/3...
Definition: TriMesh.h:202
std::vector< Color > & getColorsRGB()
Returns a std::vector of RGB colors of the triangles faces. There will be one of these for each trian...
Definition: TriMesh.h:129
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 trian...
Definition: TriMesh.h:131
bool hasColorsRgba() const
Definition: TriMesh.h:172
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...
Definition: TriMesh.h:105