48#pragma warning (disable : 4786)
133 virtual cMesh*
copy(
const bool a_duplicateMaterialData =
false,
134 const bool a_duplicateTextureData =
false,
135 const bool a_duplicateMeshData =
false,
136 const bool a_buildCollisionDetector =
false);
147 const bool a_applyToVertices =
false,
148 const bool a_applyToTextures =
false,
149 const bool a_affectChildren =
false,
150 const bool a_affectComponents =
true);
160 virtual void markForUpdate(
const bool a_affectChildren =
false,
const bool a_affectComponents =
true);
170 unsigned int newVertex(
const double a_x = 0.0,
171 const double a_y = 0.0,
172 const double a_z = 0.0,
173 const double a_normalX = 1.0,
174 const double a_normalY = 0.0,
175 const double a_normalZ = 0.0,
176 const double a_textureCoordX = 0.0,
177 const double a_textureCoordY = 0.0,
178 const double a_textureCoordZ = 0.0);
200 unsigned int newTriangle(
const unsigned int a_indexVertex0,
201 const unsigned int a_indexVertex1,
202 const unsigned int a_indexVertex2);
314 void scaleXYZ(
const double a_scaleX,
const double a_scaleY,
const double a_scaleZ);
318 const bool a_updateCollisionDetector =
true);
322 const bool a_updateCollisionDetector =
true);
357 const bool a_duplicateMaterialData,
358 const bool a_duplicateTextureData,
359 const bool a_duplicateMeshData,
360 const bool a_buildCollisionDetector);
363 virtual void scaleObject(
const double& a_scaleFactor) {
scaleXYZ(a_scaleFactor, a_scaleFactor, a_scaleFactor); }
368 const unsigned int a_IDN);
430#ifndef DOXYGEN_SHOULD_SKIP_THIS
454 cEdge() { m_parent = NULL; m_triangle = 0; m_vertex0 = 0; m_vertex1 = 0; }
457 cEdge(cMesh* a_parent,
472 void set(cMesh* a_parent,
499inline bool operator<(
const cEdge& a_edge0,
const cEdge& a_edge1)
503 cVector3d edge0Vertex0 = a_edge0.m_parent->m_vertices->getLocalPos(a_edge0.m_vertex0);
504 cVector3d edge0Vertex1 = a_edge0.m_parent->m_vertices->getLocalPos(a_edge0.m_vertex1);
505 cVector3d edge1Vertex0 = a_edge1.m_parent->m_vertices->getLocalPos(a_edge1.m_vertex0);
506 cVector3d edge1Vertex1 = a_edge1.m_parent->m_vertices->getLocalPos(a_edge1.m_vertex1);
509 if (
cAbs(edge0Vertex0.x() - edge1Vertex0.x()) <= tol)
511 if (
cAbs(edge0Vertex0.y() - edge1Vertex0.y()) <= tol)
513 if (
cAbs(edge0Vertex0.z() - edge1Vertex0.z()) <= tol)
515 if (
cAbs(edge0Vertex1.x() - edge1Vertex1.x()) <= tol)
517 if (
cAbs(edge0Vertex1.y() - edge1Vertex1.y()) <= tol)
519 return (edge0Vertex1.z() < edge1Vertex1.z());
523 return (edge0Vertex1.y() < edge1Vertex1.y());
528 return (edge0Vertex1.x() < edge1Vertex1.x());
533 return (edge0Vertex0.z() < edge1Vertex0.z());
538 return (edge0Vertex0.y() < edge1Vertex0.y());
543 return (edge0Vertex0.x() < edge1Vertex0.x());
Implements color properties.
Implements a base class for all objects.
Implements material properties.
This class provides support for OpenGL display lists.
Definition CDisplayList.h:77
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition CGenericObject.h:113
This class implements a 3D polygonal mesh.
Definition CMesh.h:109
cColorf m_normalsColor
Color used to render lines representing normals.
Definition CMesh.h:406
bool m_showTangents
If true, then tangents and bitangents are displayed.
Definition CMesh.h:384
bool removeTriangle(const unsigned int a_index)
This method removes a triangle from the triangle array.
Definition CMesh.cpp:451
virtual void renderTangents(cRenderOptions &a_options)
This method draws a small line for each tangent and bi-tangent.
Definition CMesh.cpp:1249
virtual void setTransparencyLevel(const float a_level, const bool a_applyToVertices=false, const bool a_applyToTextures=false, const bool a_affectChildren=false, const bool a_affectComponents=true)
This method sets the alpha value at each vertex and in all of my material colors.
Definition CMesh.cpp:635
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
void setShowTriangles(const bool a_showTriangles)
This method enables or disables the rendering of triangles.
Definition CMesh.h:228
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
bool getShowNormals() const
This method returns whether rendering of normals is enabled.
Definition CMesh.h:270
virtual std::string getClassName()
This method returns the name of the object class.
Definition CMesh.h:130
virtual void renderMesh(cRenderOptions &a_options)
This method renders all triangles, material and texture properties.
Definition CMesh.cpp:1445
virtual void rotateVertices(const cMatrix3d &a_rotation, const bool a_updateCollisionDetector=true)
This method rotates all vertex positions by applying a local rotation matrix.
Definition CMesh.cpp:722
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:1088
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:688
unsigned int getNumTriangles()
This method returns the number of stored triangles.
Definition CMesh.cpp:277
void setEdgeLineWidth(const double a_width)
This method sets the line width of edges.
Definition CMesh.h:257
void setNormalsProperties(const double a_length, const cColorf &a_color)
This method sets the graphic properties for normal-rendering.
Definition CMesh.cpp:775
std::vector< cEdge > m_edges
Array of Edges.
Definition CMesh.h:425
void computeAllEdges(double a_angleThresholdDeg=40.0)
This method creates a list of edges by providing a threshold angle in degrees.
Definition CMesh.cpp:867
virtual void updateBoundaryBox()
This method updates the boundary box dimensions based on the vertices.
Definition CMesh.cpp:789
cDisplayList m_displayListEdges
Display list for edges.
Definition CMesh.h:396
void setNormalsLength(const double a_length)
This method set the length of normals for display purposes.
Definition CMesh.h:276
void clearAllEdges()
This method clears all edges.
Definition CMesh.cpp:1003
bool m_showNormals
If true, then normals are displayed.
Definition CMesh.h:381
virtual void updateGlobalPositions(const bool a_frameOnly)
This method updates the global position of each vertex.
Definition CMesh.cpp:587
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 cVector3d getCenterOfMass()
This method computes the center of mass of this mesh, based on vertex positions.
Definition CMesh.cpp:251
cVertexArrayPtr m_vertices
Array of vertices.
Definition CMesh.h:419
unsigned int getNumVertices() const
This method returns the number of stored vertices.
Definition CMesh.h:187
bool getShowTriangles() const
This method returns whether rendering of triangles is enabled.
Definition CMesh.h:231
cColorf m_edgeLineColor
Color used to render lines representing edges.
Definition CMesh.h:409
cTriangleArrayPtr m_triangles
Array of triangles.
Definition CMesh.h:422
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
virtual void createBruteForceCollisionDetector()
This method builds a brute force collision detector for this mesh.
Definition CMesh.cpp:1032
void setShowEdges(const bool a_showEdges)
This method enables or disables the rendering of edges.
Definition CMesh.h:247
virtual void renderNormals(cRenderOptions &a_options)
This method draws a small line for each vertex normal.
Definition CMesh.cpp:1155
void setVertexColor(const cColorf &a_color)
This method sets the color of each vertex.
Definition CMesh.cpp:665
void setEdgeProperties(const double a_width, const cColorf &a_color)
This method sets the graphic properties for edge-rendering.
Definition CMesh.cpp:1019
virtual ~cMesh()
Destructor of cMesh.
Definition CMesh.cpp:134
virtual void render(cRenderOptions &a_options)
This method renders this object graphically using OpenGL.
Definition CMesh.cpp:1105
bool m_showEdges
If true, then show edges.
Definition CMesh.h:390
double m_edgeLineWidth
Width of edge lines.
Definition CMesh.h:393
void computeAllNormals()
This method computes all triangle normals.
Definition CMesh.cpp:493
virtual void createAABBCollisionDetector(const double a_radius)
This method builds an AABB collision detector for this mesh.
Definition CMesh.cpp:1053
void clear()
This method clears all triangles and vertices of mesh.
Definition CMesh.cpp:471
virtual void scaleObject(const double &a_scaleFactor)
This method scales this object by a scale factor.
Definition CMesh.h:363
bool getShowTangents() const
This method returns whether rendering of tangents and bi-tangents is enabled.
Definition CMesh.h:291
void setShowTangents(const bool a_showTangents)
This method enables or disables the rendering of tangents and bi-tangents.
Definition CMesh.h:288
virtual void renderEdges(cRenderOptions &a_options)
This method draws all edges of the mesh.
Definition CMesh.cpp:1356
double m_normalsLength
Length of each normal (for graphic rendering of normals).
Definition CMesh.h:387
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
bool getShowEdges() const
This method returns whether rendering of edges is enabled.
Definition CMesh.h:250
void computeBTN()
This method computes the normal matrix vectors for all triangles.
Definition CMesh.cpp:547
virtual void reverseAllNormals()
This method reverses all surface normals.
Definition CMesh.cpp:755
bool m_showTriangles
If true, then triangles are displayed.
Definition CMesh.h:378
virtual void markForUpdate(const bool a_affectChildren=false, const bool a_affectComponents=true)
This method invalidates any existing display lists and marks the mesh for update.
Definition CMesh.cpp:610
void setShowNormals(const bool a_showNormals)
This method enables or disables the rendering of vertex normals.
Definition CMesh.h:267
Definition CAudioBuffer.cpp:57
T cAbs(const T &a_value)
This function computes an absolute value.
Definition CMaths.h:198
std::shared_ptr< cMaterial > cMaterialPtr
Definition CMaterial.h:69
std::shared_ptr< cVertexArray > cVertexArrayPtr
Definition CVertexArray.h:108
std::shared_ptr< cTriangleArray > cTriangleArrayPtr
Definition CTriangleArray.h:66
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This class implements a 3D matrix.
Definition CMatrix3d.h:98
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83
This class implements a 3D vector.
Definition CVector3d.h:89