48 #pragma warning (disable : 4786) 130 virtual cMesh*
copy(
const bool a_duplicateMaterialData =
false,
131 const bool a_duplicateTextureData =
false,
132 const bool a_duplicateMeshData =
false,
133 const bool a_buildCollisionDetector =
false);
144 const bool a_applyToVertices =
false,
145 const bool a_applyToTextures =
false,
146 const bool a_affectChildren =
false);
156 virtual void markForUpdate(
const bool a_affectChildren =
false);
166 unsigned int newVertex(
const double a_x = 0.0,
167 const double a_y = 0.0,
168 const double a_z = 0.0,
169 const double a_normalX = 1.0,
170 const double a_normalY = 0.0,
171 const double a_normalZ = 0.0,
172 const double a_textureCoordX = 0.0,
173 const double a_textureCoordY = 0.0,
174 const double a_textureCoordZ = 0.0);
196 unsigned int newTriangle(
const unsigned int a_indexVertex0,
197 const unsigned int a_indexVertex1,
198 const unsigned int a_indexVertex2);
310 void scaleXYZ(
const double a_scaleX,
const double a_scaleY,
const double a_scaleZ);
314 const bool a_updateCollisionDetector =
true);
349 const bool a_duplicateMaterialData,
350 const bool a_duplicateTextureData,
351 const bool a_duplicateMeshData,
352 const bool a_buildCollisionDetector);
355 virtual void scaleObject(
const double& a_scaleFactor) {
scaleXYZ(a_scaleFactor, a_scaleFactor, a_scaleFactor); }
360 const unsigned int a_IDN);
422 #ifndef DOXYGEN_SHOULD_SKIP_THIS 446 cEdge() {
m_parent = NULL; m_triangle = 0; m_vertex0 = 0; m_vertex1 = 0; }
449 cEdge(
cMesh* a_parent,
464 void set(
cMesh* a_parent,
491 inline bool operator<(
const cEdge& a_edge0,
const cEdge& a_edge1)
495 cVector3d edge0Vertex0 = a_edge0.m_parent->m_vertices->getLocalPos(a_edge0.m_vertex0);
496 cVector3d edge0Vertex1 = a_edge0.m_parent->m_vertices->getLocalPos(a_edge0.m_vertex1);
497 cVector3d edge1Vertex0 = a_edge1.m_parent->m_vertices->getLocalPos(a_edge1.m_vertex0);
498 cVector3d edge1Vertex1 = a_edge1.m_parent->m_vertices->getLocalPos(a_edge1.m_vertex1);
501 if (
cAbs(edge0Vertex0.
x() - edge1Vertex0.
x()) <= tol)
503 if (
cAbs(edge0Vertex0.
y() - edge1Vertex0.
y()) <= tol)
505 if (
cAbs(edge0Vertex0.
z() - edge1Vertex0.
z()) <= tol)
507 if (
cAbs(edge0Vertex1.
x() - edge1Vertex1.
x()) <= tol)
509 if (
cAbs(edge0Vertex1.
y() - edge1Vertex1.
y()) <= tol)
511 return (edge0Vertex1.
z() < edge1Vertex1.
z());
515 return (edge0Vertex1.
y() < edge1Vertex1.
y());
520 return (edge0Vertex1.
x() < edge1Vertex1.
x());
525 return (edge0Vertex0.
z() < edge1Vertex0.
z());
530 return (edge0Vertex0.
y() < edge1Vertex0.
y());
535 return (edge0Vertex0.
x() < edge1Vertex0.
x());
540 #endif // DOXYGEN_SHOULD_SKIP_THIS This class implements a 3D vector.
Definition: CVector3d.h:88
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
double m_normalsLength
Length of each normal (for graphic rendering of normals).
Definition: CMesh.h:379
virtual void createBruteForceCollisionDetector()
This method builds a brute force collision detector for this mesh.
Definition: CMesh.cpp:996
void scaleXYZ(const double a_scaleX, const double a_scaleY, const double a_scaleZ)
This method scale this mesh by using different scale factors along X, Y and Z axes.
Definition: CMesh.cpp:563
virtual void scaleObject(const double &a_scaleFactor)
This method scales this object by a scale factor.
Definition: CMesh.h:355
void computeLocalInteraction(const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN)
This method updates the relationship between the tool and the current object.
Definition: CMesh.cpp:1052
virtual void setTransparencyLevel(const float a_level, const bool a_applyToVertices=false, const bool a_applyToTextures=false, const bool a_affectChildren=false)
This method sets the alpha value at each vertex and in all of my material colors. ...
Definition: CMesh.cpp:634
bool m_showNormals
If true, then normals are displayed.
Definition: CMesh.h:373
void setEdgeLineWidth(const double a_width)
This method sets the line width of edges.
Definition: CMesh.h:253
void setNormalsProperties(const double a_length, const cColorf &a_color)
This method sets the graphic properties for normal-rendering.
Definition: CMesh.cpp:739
cDisplayList m_displayListEdges
Display list for edges.
Definition: CMesh.h:388
This class provides support for OpenGL display lists.
Definition: CDisplayList.h:76
void computeAllNormals()
This method computes all triangle normals.
Definition: CMesh.cpp:493
void setNormalsLength(const double a_length)
This method set the length of normals for display purposes.
Definition: CMesh.h:272
virtual void renderMesh(cRenderOptions &a_options)
This method renders all triangles, material and texture properties.
Definition: CMesh.cpp:1385
void setVertexColor(const cColorf &a_color)
This method sets the color of each vertex.
Definition: CMesh.cpp:663
virtual void renderTangents(cRenderOptions &a_options)
This method draws a small line for each tangent and bi-tangent.
Definition: CMesh.cpp:1189
std::vector< cEdge > m_edges
Array of Edges.
Definition: CMesh.h:417
bool m_showTriangles
If true, then triangles are displayed.
Definition: CMesh.h:370
void setShowTangents(const bool a_showTangents)
This method enables or disables the rendering of tangents and bi-tangents.
Definition: CMesh.h:284
cVertexArrayPtr m_vertices
Array of vertices.
Definition: CMesh.h:411
cColorf m_edgeLineColor
Color used to render lines representing edges.
Definition: CMesh.h:401
std::shared_ptr< cMaterial > cMaterialPtr
Definition: CMaterial.h:67
bool m_showEdges
If true, then show edges.
Definition: CMesh.h:382
virtual void render(cRenderOptions &a_options)
This method renders this object graphically using OpenGL.
Definition: CMesh.cpp:1069
void setShowNormals(const bool a_showNormals)
This method enables or disables the rendering of vertex normals.
Definition: CMesh.h:263
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition: CGenericObject.h:112
bool getShowTriangles() const
This method returns whether rendering of triangles is enabled.
Definition: CMesh.h:227
virtual void createAABBCollisionDetector(const double a_radius)
This method builds an AABB collision detector for this mesh.
Definition: CMesh.cpp:1017
virtual void renderEdges(cRenderOptions &a_options)
This method draws all edges of the mesh.
Definition: CMesh.cpp:1296
cMesh(cMaterialPtr a_material=cMaterialPtr())
Constructor of cMesh.
Definition: CMesh.cpp:76
virtual void updateGlobalPositions(const bool a_frameOnly)
This method updates the global position of each vertex.
Definition: CMesh.cpp:587
virtual cMesh * copy(const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
This method creates a copy of itself.
Definition: CMesh.cpp:154
unsigned int newTriangle(const unsigned int a_indexVertex0, const unsigned int a_indexVertex1, const unsigned int a_indexVertex2)
This method creates a new triangle by passing vertex indices.
Definition: CMesh.cpp:363
unsigned int getNumVertices() const
This method returns the number of stored vertices.
Definition: CMesh.h:183
Implements a base class for all objects.
bool getShowTangents() const
This method returns whether rendering of tangents and bi-tangents is enabled.
Definition: CMesh.h:287
bool removeTriangle(const unsigned int a_index)
This method removes a triangle from the triangle array.
Definition: CMesh.cpp:451
bool m_showTangents
If true, then tangents and bitangents are displayed.
Definition: CMesh.h:376
virtual void reverseAllNormals()
This method reverses all surface normals.
Definition: CMesh.cpp:719
This class implements a 3D polygonal mesh.
Definition: CMesh.h:108
unsigned int getNumTriangles()
This method returns the number of stored triangles.
Definition: CMesh.cpp:277
cColorf m_normalsColor
Color used to render lines representing normals.
Definition: CMesh.h:398
T cAbs(const T &a_value)
This function computes an absolute value.
Definition: CMaths.h:173
cTriangleArrayPtr m_triangles
Array of triangles.
Definition: CMesh.h:414
std::shared_ptr< cVertexArray > cVertexArrayPtr
Definition: CVertexArray.h:107
virtual void renderNormals(cRenderOptions &a_options)
This method draws a small line for each vertex normal.
Definition: CMesh.cpp:1119
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
Implements color properties.
void computeAllEdges(double a_angleThresholdDeg=40.0)
This method creates a list of edges by providing a threshold angle in degrees.
Definition: CMesh.cpp:831
double y() const
This method returns vector component y.
Definition: CVector3d.h:226
double x() const
This method returns vector component x.
Definition: CVector3d.h:220
Implements material properties.
void clearAllEdges()
This method clears all edges.
Definition: CMesh.cpp:967
void setEdgeProperties(const double a_width, const cColorf &a_color)
This method sets the graphic properties for edge-rendering.
Definition: CMesh.cpp:983
Definition: CAudioBuffer.cpp:56
unsigned int newVertex(const double a_x=0.0, const double a_y=0.0, const double a_z=0.0, const double a_normalX=1.0, const double a_normalY=0.0, const double a_normalZ=0.0, const double a_textureCoordX=0.0, const double a_textureCoordY=0.0, const double a_textureCoordZ=0.0)
This method creates a new vertex and adds it to the vertex list.
Definition: CMesh.cpp:300
cGenericObject * m_parent
Parent object.
Definition: CGenericObject.h:729
void setShowTriangles(const bool a_showTriangles)
This method enables or disables the rendering of triangles.
Definition: CMesh.h:224
void clear()
This method clears all triangles and vertices of mesh.
Definition: CMesh.cpp:471
virtual void offsetVertices(const cVector3d &a_offset, const bool a_updateCollisionDetector=true)
This method shifts all vertex positions by the specified amount.
Definition: CMesh.cpp:686
std::shared_ptr< cTriangleArray > cTriangleArrayPtr
Definition: CTriangleArray.h:65
virtual cVector3d getCenterOfMass()
This method computes the center of mass of this mesh, based on vertex positions.
Definition: CMesh.cpp:251
virtual void markForUpdate(const bool a_affectChildren=false)
This method invalidates any existing display lists and marks the mesh for update. ...
Definition: CMesh.cpp:609
virtual ~cMesh()
Destructor of cMesh.
Definition: CMesh.cpp:134
bool getShowNormals() const
This method returns whether rendering of normals is enabled.
Definition: CMesh.h:266
void copyMeshProperties(cMesh *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
This method copies all properties of this mesh to another.
Definition: CMesh.cpp:185
void computeBTN()
This method computes the normal matrix vectors for all triangles.
Definition: CMesh.cpp:547
double m_edgeLineWidth
Width of edge lines.
Definition: CMesh.h:385
void setShowEdges(const bool a_showEdges)
This method enables or disables the rendering of edges.
Definition: CMesh.h:243
bool getShowEdges() const
This method returns whether rendering of edges is enabled.
Definition: CMesh.h:246
virtual void updateBoundaryBox()
This method updates the boundary box dimensions based on the vertices.
Definition: CMesh.cpp:753
double z() const
This method returns vector component z.
Definition: CVector3d.h:232