This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofMesh.h
Go to the documentation of this file.
100 void setFromTriangles( const std::vector<ofMeshFace_<V,N,C,T>>& tris, bool bUseFaceNormal=false );
573 ofMesh_<V,N,C,T> getMeshForIndices( ofIndexType startIndex, ofIndexType endIndex, ofIndexType startVertIndex, ofIndexType endVertIndex ) const;
722using ofMesh = ofMesh_<ofDefaultVertexType, ofDefaultNormalType, ofDefaultColorType, ofDefaultTexCoordType>;
723using ofMeshFace = ofMeshFace_<ofDefaultVertexType, ofDefaultNormalType, ofDefaultColorType, ofDefaultTexCoordType>;
Represents a set of vertices in 3D spaces with normals, colors, and texture coordinates at those poin...
Definition ofMesh.h:78
void setColorForIndices(ofIndexType startIndex, ofIndexType endIndex, C color)
Definition ofMesh.inl:1453
virtual void enableIndices()
Enable mesh indices. Use disableIndices() to turn indices off. Indices are enabled by default when th...
Definition ofMesh.inl:992
void removeVertices(ofIndexType startIndex, ofIndexType endIndex)
Removes the vertices at the startIndex in the vector and the endindex specified.
Definition ofMesh.inl:365
void setMode(ofPrimitiveMode mode)
Allows you to set the ofPrimitiveMode. The available modes are OF_PRIMITIVE_TRIANGLES,...
Definition ofMesh.inl:803
void addTriangle(ofIndexType index1, ofIndexType index2, ofIndexType index3)
Adding a triangle means using three of the vertices that have already been added to create a triangle...
Definition ofMesh.inl:343
virtual void enableTextures()
Enable mesh textures. Use disableTextures() to turn textures off. Textures are enabled by default whe...
Definition ofMesh.inl:976
N getNormal(ofIndexType i) const
\returns the normal at the index in the normals vector.
Definition ofMesh.inl:498
void removeIndices(ofIndexType startIndex, ofIndexType endIndex)
Definition ofMesh.inl:465
static ofMesh_ sphere(float radius, int res=12, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)
Definition ofMesh.inl:2006
virtual void enableNormals()
Enable mesh normals. Use disableNormals() to turn normals off. Normals are enabled by default when th...
Definition ofMesh.inl:984
void drawFaces() const
This draws the mesh as faces, meaning that you'll have a collection of faces.
Definition ofMesh.inl:943
bool hasIndices() const
/returns Whether the mesh has any indices assigned to it.
Definition ofMesh.inl:174
bool hasTexCoords() const
/returns Whether the mesh has any textures assigned to it.
Definition ofMesh.inl:166
void addColors(const std::vector< C > &cols)
This adds colors using a reference to a vector of ofColors. For each color in the vector,...
Definition ofMesh.inl:224
void setIndex(ofIndexType index, ofIndexType val)
This sets the index at i.
Definition ofMesh.inl:853
static ofMesh_ plane(float width, float height, int columns=2, int rows=2, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)
Definition ofMesh.inl:1931
std::size_t getNumNormals() const
This will tell you how many normals are contained in the mesh.
Definition ofMesh.inl:538
virtual void enableColors()
Enable mesh colors. Use disableColors() to turn colors off. Colors are enabled by default when they a...
Definition ofMesh.inl:968
static ofMesh_ cone(float radius, float height, int radiusSegments=12, int heightSegments=6, int capSegments=2, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)
A helper method that returns a cone made of triangles. The resolution settings for the radius,...
Definition ofMesh.inl:2521
void addNormal(const N &n)
Add a normal to the mesh as a 3D vector, typically perpendicular to the plane of the face....
Definition ofMesh.inl:244
void clearTexCoords()
Clear all the texture coordinates.
Definition ofMesh.inl:907
ofMesh_()
This creates the mesh, using OF_PRIMITIVE_TRIANGLES without any initial vertices.
Definition ofMesh.inl:17
bool hasNormals() const
/returnsWhether the mesh has any normals.
Definition ofMesh.inl:158
void draw() const
This draws the mesh using its primitive type, meaning that if you set them up to be triangles,...
Definition ofMesh.inl:951
bool hasColors() const
/returns Whether the mesh has any colors.
Definition ofMesh.inl:150
void setupIndicesAuto()
Allow you to set up the indices automatically when you add a vertex.
Definition ofMesh.inl:863
void load(const of::filesystem::path &path)
Loads a mesh from a file located at the provided path into the mesh. This will replace any existing d...
Definition ofMesh.inl:1091
void append(const ofMesh_ &mesh)
Add the vertices, normals, texture coordinates and indices of one mesh onto another mesh....
Definition ofMesh.inl:1065
void removeNormals(ofIndexType startIndex, ofIndexType endIndex)
Remove normal's from index to end index from normals vector.
Definition ofMesh.inl:390
void addTexCoords(const std::vector< T > &tCoords)
Add a vector of texture coordinates to a mesh, allowing you to push out many at once rather than addi...
Definition ofMesh.inl:285
std::vector< ofIndexType > & getIndices()
Use this if you plan to change the indices as part of this call as it will force a reset of the cache...
Definition ofMesh.inl:691
virtual void disableNormals()
Disable mesh normals. Use enableNormals() to turn normals back on.
Definition ofMesh.inl:1016
std::size_t getNumTexCoords() const
This will tell you how many texture coordinates are contained in the mesh.
Definition ofMesh.inl:546
void setColor(ofIndexType index, const C &c)
Set the color at the index in the colors vector.
Definition ofMesh.inl:833
void removeColors(ofIndexType startIndex, ofIndexType endIndex)
Remove colors at the index to the end index of the colors vector.
Definition ofMesh.inl:414
const std::vector< ofMeshFace_< V, N, C, T > > & getUniqueFaces() const
Definition ofMesh.inl:1647
void removeTexCoord(ofIndexType index)
Remove a Vec2f representing the texture coordinate.
Definition ofMesh.inl:428
static ofMesh_ cylinder(float radius, float height, int radiusSegments=12, int heightSegments=6, int numCapSegments=2, bool bCapped=true, ofPrimitiveMode mode=OF_PRIMITIVE_TRIANGLE_STRIP)
A helper method that returns a cylinder made of triangles. The resolution settings for the radius,...
Definition ofMesh.inl:2328
void flatNormals()
Duplicates vertices and updates normals to get a low-poly look.
Definition ofMesh.inl:1883
void removeVertex(ofIndexType index)
Removes the vertex at the index in the vector.
Definition ofMesh.inl:354
virtual void disableIndices()
Disable mesh indices. Use enableIndices() to turn indices back on.
Definition ofMesh.inl:1024
std::size_t getNumIndices() const
This will tell you how many indices are contained in the mesh.
Definition ofMesh.inl:554
ofMeshFace_< V, N, C, T > getFace(ofIndexType faceId) const
Definition ofMesh.inl:1634
void clear()
Removes all the vertices, colors, and indices from the mesh.
Definition ofMesh.inl:49
void addTexCoord(const T &t)
Add a Vec2f representing the texture coordinate. Because OF uses ARB textures these are in pixels rat...
Definition ofMesh.inl:274
void addIndices(const std::vector< ofIndexType > &inds)
This adds a vector of indices.
Definition ofMesh.inl:323
virtual void disableTextures()
Disable mesh textures. Use enableTextures() to turn textures back on.
Definition ofMesh.inl:1008
virtual void disableColors()
Disable mesh colors. Use enableColors() to turn colors back on.
Definition ofMesh.inl:1000
void removeColor(ofIndexType index)
Remove a color at the index in the colors vector.
Definition ofMesh.inl:403
void addVertex(const V &v)
Add a new vertex at the end of the current list of vertices. It is important to remember that the ord...
Definition ofMesh.inl:184
std::vector< N > getFaceNormals(bool perVetex=false) const
Get normals for each face As a default it only calculates the normal for the face as a whole but by s...
Definition ofMesh.inl:1690
ofPrimitiveMode getMode() const
\returns the primitive mode that the mesh is using.
Definition ofMesh.inl:482
void save(const of::filesystem::path &path, bool useBinary=false) const
Saves the mesh at the passed path in the PLY Format.
Definition ofMesh.inl:1331
void removeTexCoords(ofIndexType startIndex, ofIndexType endIndex)
Definition ofMesh.inl:439
static ofMesh_ icosphere(float radius, std::size_t iterations=2)
Definition ofMesh.inl:2134
C getColor(ofIndexType i) const
Get the color at the index in the colors vector.
Definition ofMesh.inl:506
void addNormals(const std::vector< N > &norms)
Add a vector of normals to a mesh, allowing you to push out many normals at once rather than adding o...
Definition ofMesh.inl:254
void clearIndices()
Remove all the indices of the mesh. This means that your mesh will be a point cloud.
Definition ofMesh.inl:917
void addColor(const C &c)
This adds a color to the mesh, the color will be associated with the vertex in the same position.
Definition ofMesh.inl:214
std::vector< T > & getTexCoords()
Get a vector representing the texture coordinates of the mesh Because OF uses ARB textures these are ...
Definition ofMesh.inl:683
void setFromTriangles(const std::vector< ofMeshFace_< V, N, C, T > > &tris, bool bUseFaceNormal=false)
Definition ofMesh.inl:1725
void drawWireframe() const
This draws the mesh as GL_LINES, meaning that you'll have a wireframe.
Definition ofMesh.inl:935
void addVertices(const std::vector< V > &verts)
Add a vector of vertices to a mesh, allowing you to push out many at once rather than adding one at a...
Definition ofMesh.inl:194
ofMesh_< V, N, C, T > getMeshForIndices(ofIndexType startIndex, ofIndexType endIndex) const
Definition ofMesh.inl:1467
static ofMesh_ axis(float size=1.0)
Returns an ofMesh representing an XYZ coordinate system.
Definition ofMesh.inl:2927
void drawVertices() const
This allows you draw just the vertices, meaning that you'll have a point cloud.
Definition ofMesh.inl:927
static ofMesh_ box(float width, float height, float depth, int resX=2, int resY=2, int resZ=2)
A helper method that returns a box made of triangles. The resolution settings for the width and heigh...
Definition ofMesh.inl:2671
An ofMeshFace_ is a face on one of the ofPrimitive instances. In the ofPrimitive a face consists of 3...
Definition ofMesh.h:680
void setTexCoord(ofIndexType index, const T &tCoord)
Definition ofMesh.inl:3029
#define c
ofMeshFace_< ofDefaultVertexType, ofDefaultNormalType, ofDefaultColorType, ofDefaultTexCoordType > ofMeshFace
Definition ofMesh.h:723