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_applyToTextures =
false,
145 const bool a_affectChildren =
false);
155 virtual void markForUpdate(
const bool a_affectChildren =
false);
165 unsigned int newVertex(
const double a_x = 0.0,
166 const double a_y = 0.0,
167 const double a_z = 0.0,
168 const double a_normalX = 1.0,
169 const double a_normalY = 0.0,
170 const double a_normalZ = 0.0,
171 const double a_textureCoordX = 0.0,
172 const double a_textureCoordY = 0.0,
173 const double a_textureCoordZ = 0.0);
195 unsigned int newTriangle(
const unsigned int a_indexVertex0,
196 const unsigned int a_indexVertex1,
197 const unsigned int a_indexVertex2);
300 void scaleXYZ(
const double a_scaleX,
const double a_scaleY,
const double a_scaleZ);
304 const bool a_updateCollisionDetector =
true);
336 const bool a_duplicateMaterialData,
337 const bool a_duplicateTextureData,
338 const bool a_duplicateMeshData,
339 const bool a_buildCollisionDetector);
342 virtual void scaleObject(
const double& a_scaleFactor) {
scaleXYZ(a_scaleFactor, a_scaleFactor, a_scaleFactor); }
347 const unsigned int a_IDN);
406 #ifndef DOXYGEN_SHOULD_SKIP_THIS
430 cEdge() { m_parent = NULL; m_triangle = 0; m_vertex0 = 0; m_vertex1 = 0; }
433 cEdge(cMesh* a_parent,
448 void set(cMesh* a_parent,
475 inline bool operator<(
const cEdge& a_edge0,
const cEdge& a_edge1)
479 cVector3d edge0Vertex0 = a_edge0.m_parent->m_vertices->getLocalPos(a_edge0.m_vertex0);
480 cVector3d edge0Vertex1 = a_edge0.m_parent->m_vertices->getLocalPos(a_edge0.m_vertex1);
481 cVector3d edge1Vertex0 = a_edge1.m_parent->m_vertices->getLocalPos(a_edge1.m_vertex0);
482 cVector3d edge1Vertex1 = a_edge1.m_parent->m_vertices->getLocalPos(a_edge1.m_vertex1);
485 if (
cAbs(edge0Vertex0.x() - edge1Vertex0.x()) <= tol)
487 if (
cAbs(edge0Vertex0.y() - edge1Vertex0.y()) <= tol)
489 if (
cAbs(edge0Vertex0.z() - edge1Vertex0.z()) <= tol)
491 if (
cAbs(edge0Vertex1.x() - edge1Vertex1.x()) <= tol)
493 if (
cAbs(edge0Vertex1.y() - edge1Vertex1.y()) <= tol)
495 return (edge0Vertex1.z() < edge1Vertex1.z());
499 return (edge0Vertex1.y() < edge1Vertex1.y());
504 return (edge0Vertex1.x() < edge1Vertex1.x());
509 return (edge0Vertex0.z() < edge1Vertex0.z());
514 return (edge0Vertex0.y() < edge1Vertex0.y());
519 return (edge0Vertex0.x() < edge1Vertex0.x());
524 #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:363
virtual void createBruteForceCollisionDetector()
This method builds a brute force collision detector for this mesh.
Definition: CMesh.cpp:976
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:546
virtual void scaleObject(const double &a_scaleFactor)
This method scales this object by a scale factor.
Definition: CMesh.h:342
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:1036
bool m_showNormals
If true, then normals are displayed.
Definition: CMesh.h:360
void setEdgeLineWidth(const double a_width)
This method sets the line width of edges.
Definition: CMesh.h:252
void setNormalsProperties(const double a_length, const cColorf &a_color)
This method sets the graphic properties for normal-rendering.
Definition: CMesh.cpp:718
cDisplayList m_displayListEdges
Display list for edges.
Definition: CMesh.h:372
This class provides support for OpenGL display lists.
Definition: CDisplayList.h:76
void computeAllNormals()
This method computes all triangle normals, optionally propagating the operation to my children...
Definition: CMesh.cpp:487
void setNormalsLength(const double a_length)
This method set the length of normals for display purposes.
Definition: CMesh.h:271
virtual void renderMesh(cRenderOptions &a_options)
This method renders all triangles, material and texture properties.
Definition: CMesh.cpp:1254
void setVertexColor(const cColorf &a_color)
This method sets the color of each vertex.
Definition: CMesh.cpp:642
std::vector< cEdge > m_edges
Array of Edges.
Definition: CMesh.h:401
bool m_showTriangles
If true, then triangles are displayed.
Definition: CMesh.h:357
cVertexArrayPtr m_vertices
Array of vertices.
Definition: CMesh.h:395
cColorf m_edgeLineColor
Color used to render lines representing edges.
Definition: CMesh.h:385
std::shared_ptr< cMaterial > cMaterialPtr
Definition: CMaterial.h:67
bool m_showEdges
If true, then show edges.
Definition: CMesh.h:366
virtual void render(cRenderOptions &a_options)
This method renders this object graphically using OpenGL.
Definition: CMesh.cpp:1053
void setShowNormals(const bool a_showNormals)
This method enables or disables the rendering of vertex normals.
Definition: CMesh.h:262
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:226
virtual void createAABBCollisionDetector(const double a_radius)
This method builds an AABB collision detector for this mesh.
Definition: CMesh.cpp:1001
virtual void renderEdges(cRenderOptions &a_options)
This method draws all edges of the mesh.
Definition: CMesh.cpp:1165
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:570
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:151
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:360
unsigned int getNumVertices() const
This method returns the number of stored vertices.
Definition: CMesh.h:182
Implements a base class for all objects.
bool removeTriangle(const unsigned int a_index)
This method removes a triangle from the triangle array.
Definition: CMesh.cpp:448
virtual void reverseAllNormals()
This method reverses all surface normals.
Definition: CMesh.cpp:698
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:274
cColorf m_normalsColor
Color used to render lines representing normals.
Definition: CMesh.h:382
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:398
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:1095
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:810
Implements material properties.
void clearAllEdges()
This method clears all edges.
Definition: CMesh.cpp:947
void setEdgeProperties(const double a_width, const cColorf &a_color)
This method sets the graphic properties for edge-rendering.
Definition: CMesh.cpp:963
virtual void setTransparencyLevel(const float a_level, 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:616
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:297
void setShowTriangles(const bool a_showTriangles)
This method enables or disables the rendering of triangles.
Definition: CMesh.h:223
void clear()
This method clears all triangles and vertices of mesh.
Definition: CMesh.cpp:468
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:665
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:248
virtual void markForUpdate(const bool a_affectChildren=false)
This method invalidates any existing display lists and marks the mesh for update. ...
Definition: CMesh.cpp:592
virtual ~cMesh()
Destructor of cMesh.
Definition: CMesh.cpp:131
bool getShowNormals() const
This method returns whether rendering of normals is enabled.
Definition: CMesh.h:265
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:182
double m_edgeLineWidth
Width of edge lines.
Definition: CMesh.h:369
void setShowEdges(const bool a_showEdges)
This method enables or disables the rendering of edges.
Definition: CMesh.h:242
bool getShowEdges() const
This method returns whether rendering of edges is enabled.
Definition: CMesh.h:245
virtual void updateBoundaryBox()
This method updates the boundary box dimensions based on the vertices.
Definition: CMesh.cpp:732