GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Private Attributes | Static Private Attributes | Friends | List of all members
GLC_Mesh Class Reference

GLC_Mesh : OpenGL 3D Mesh. More...

#include <glc_mesh.h>

+ Inheritance diagram for GLC_Mesh:

Public Types

typedef QHash< GLC_uint,
GLC_PrimitiveGroup * > 
LodPrimitiveGroups
 
typedef QHash< const int,
LodPrimitiveGroups * > 
PrimitiveGroupsHash
 

Public Member Functions

Constructor / Destructor
 GLC_Mesh ()
 Default constructor.
 
 GLC_Mesh (const GLC_Mesh &)
 Copy constructor.
 
GLC_Meshoperator= (const GLC_Mesh &)
 Overload "=" operator.
 
virtual ~GLC_Mesh ()
 Destructor.
 
Set Functions
virtual void clear ()
 Clear the content of the mesh and super class and makes them empty.
 
void clearMeshWireAndBoundingBox ()
 Clear only the content off the mesh and makes it empty.
 
void addVertice (const GLfloatVector &vertices)
 Add vertices coordinate.
 
void addNormals (const GLfloatVector &normals)
 Add Normals.
 
void addTexels (const GLfloatVector &texels)
 Add texel.
 
void addColors (const GLfloatVector &colors)
 Add Colors.
 
GLC_uint addTriangles (GLC_Material *, const IndexList &, const int lod=0, double accuracy=0.0)
 Add triangles.
 
GLC_uint addTrianglesStrip (GLC_Material *, const IndexList &, const int lod=0, double accuracy=0.0)
 Add triangles Strip and return his id.
 
GLC_uint addTrianglesFan (GLC_Material *, const IndexList &, const int lod=0, double accuracy=0.0)
 Add triangles Fan and return his id.
 
void reverseNormals ()
 Reverse mesh normal.
 
void setColorPearVertex (bool flag)
 Set color per vertex flag to use indexed color.
 
void finish ()
 Copy vertex list in a vector list for Vertex Array Use.
 
virtual void setCurrentLod (const int)
 Set the lod Index.
 
virtual void replaceMasterMaterial (GLC_Material *)
 Replace the Master material.
 
void replaceMaterial (const GLC_uint, GLC_Material *)
 Replace the material specified by id with another one.
 
void setNextPrimitiveLocalId (GLC_uint id)
 Set the mesh next primitive local id.
 
void setWireColor (const QColor &color)
 Set the mesh wire color.
 
virtual void copyVboToClientSide ()
 Copy VBO to the Client Side.
 
virtual void releaseVboClientSide (bool update)
 Release client VBO.
 
virtual void setVboUsage (bool usage)
 Set VBO usage.
 
Binary serialisation Functions
void loadFromDataStream (QDataStream &, const MaterialHash &, const QHash< GLC_uint, GLC_uint > &)
 Load the mesh from binary data stream.
 
void saveToDataStream (QDataStream &) const
 Save the mesh to binary data stream.
 
- Public Member Functions inherited from GLC_Geometry
 GLC_Geometry (const QString &name, const bool type)
 Default constructor.
 
 GLC_Geometry (const GLC_Geometry &sourceGeom)
 Copy constructor.
 
GLC_Geometryoperator= (const GLC_Geometry &sourceGeom)
 Overload "=" operator.
 
virtual ~GLC_Geometry ()
 Destructor.
 
GLC_uint id () const
 Get Object ID.
 
QString name () const
 Get Object Name.
 
bool isValid (void) const
 Return true if the geometry is valid.
 
bool hasMaterial () const
 Return true if the geometry has material.
 
GLC_MaterialfirstMaterial (void) const
 Return first material of geometry.
 
int materialCount () const
 Return the number of materials.
 
GLC_Materialmaterial (const GLC_uint key) const
 Return the specified mesh sub material.
 
QSet< GLC_Material * > materialSet () const
 Get materials Set.
 
QList< GLC_uintmaterialIds () const
 Get materials ID List.
 
bool containsMaterial (const GLC_uint key) const
 Return true if Material key is in the mesh.
 
bool boundingBoxIsValid () const
 Return true if the bounding box is valid.
 
bool isTransparent () const
 Get the geometry transparency.
 
bool hasTransparentMaterials () const
 Return true if the geometry contains transparent materials.
 
bool usedColorPerVertex () const
 Return true if color per vertex is used.
 
bool typeIsWire () const
 Return true if the geometry type is wireframe.
 
GLfloat lineWidth () const
 Return the line width.
 
QColor wireColor () const
 Return this geometry wire color.
 
bool wireDataIsEmpty () const
 Return true if wire data is empty.
 
GLfloatVector wirePositionVector () const
 Return the wire position vector.
 
int wirePolylineCount () const
 Return the number of wire polylines.
 
GLuint wirePolylineOffset (int index) const
 Return the polyline offset from the given index.
 
GLsizei wirePolylineSize (int index) const
 Return the polyline size from the given index.
 
bool vboIsUsed () const
 Return true if this geometry will try to use VBO.
 
void addMaterial (GLC_Material *)
 Add material to the geometry.
 
void colorPerVertex (const bool colorPerVertex)
 Set the color per vertex usage.
 
void updateTransparentMaterialNumber ()
 Update the transparent material number.
 
void setId (const GLC_uint id)
 Set Geometry Id.
 
void setName (const QString name)
 Set geometry name.
 
GLC_uint addVerticeGroup (const GLfloatVector &vector)
 Add a vertice group to the geometry and returns its id.
 
void setLineWidth (GLfloat lineWidth)
 Set Line width.
 
void setWireColor (const QColor &color)
 Set this geometry wire color.
 
virtual void glLoadTexture (void)
 Load each textures of materials.
 
virtual void render (const GLC_RenderProperties &)
 Virtual interface for OpenGL execution.
 

Protected Member Functions

OpenGL Functions
virtual void glDraw (const GLC_RenderProperties &)
 Virtual interface for OpenGL Geometry set up.
 
- Protected Member Functions inherited from GLC_Geometry
void removeMaterial (GLC_uint)
 Remove the specified material from the geometry.
 
void clearWireAndBoundingBox ()
 Clear the wire data and the bounding box of this geometry.
 
virtual void glPropGeom (const GLC_RenderProperties &)
 Virtual interface for OpenGL Geometry properties.
 

Private Member Functions

Private services Functions
GLC_uint setCurrentMaterial (GLC_Material *, const int, double)
 Set the current material.
 
void fillVbosAndIbos ()
 Fill VBOs and IBOs.
 
void finishSerialized ()
 Set primitive group offset after loading mesh from binary.
 
void moveIndexToMeshDataLod ()
 Move Indexs from the primitive groups to the mesh Data LOD and Set IBOs offsets.
 
void vboDrawPrimitivesOf (GLC_PrimitiveGroup *)
 Use VBO to Draw primitives from the specified GLC_PrimitiveGroup.
 
void vertexArrayDrawPrimitivesOf (GLC_PrimitiveGroup *)
 Use Vertex Array to Draw primitives from the specified GLC_PrimitiveGroup.
 
void vboDrawInSelectionModePrimitivesOf (GLC_PrimitiveGroup *)
 Use VBO to Draw primitives in selection mode from the specified GLC_PrimitiveGroup.
 
void vertexArrayDrawInSelectionModePrimitivesOf (GLC_PrimitiveGroup *)
 Use Vertex Array to Draw primitives in selection mode from the specified GLC_PrimitiveGroup.
 
void vboDrawPrimitivesGroupOf (GLC_PrimitiveGroup *, GLC_Material *, bool, bool, QHash< GLC_uint, GLC_Material * > *)
 Use VBO to Draw primitives with specific materials from the specified GLC_PrimitiveGroup.
 
void vertexArrayDrawPrimitivesGroupOf (GLC_PrimitiveGroup *, GLC_Material *, bool, bool, QHash< GLC_uint, GLC_Material * > *)
 Use Vertex Array to Draw primitives with specific materials from the specified GLC_PrimitiveGroup.
 
void vboDrawSelectedPrimitivesGroupOf (GLC_PrimitiveGroup *, GLC_Material *, bool, bool, const GLC_RenderProperties &)
 Use VBO to Draw primitives with selection materials from the specified GLC_PrimitiveGroup.
 
void vertexArrayDrawSelectedPrimitivesGroupOf (GLC_PrimitiveGroup *, GLC_Material *, bool, bool, const GLC_RenderProperties &)
 Use Vertex Array to Draw primitives with selection materials from the specified GLC_PrimitiveGroup.
 
void activateVboAndIbo ()
 Activate mesh VBOs and IBO of the current LOD.
 
void activateVertexArray ()
 Activate vertex Array.
 
void normalRenderLoop (const GLC_RenderProperties &, bool)
 The normal display loop.
 
void OverwriteMaterialRenderLoop (const GLC_RenderProperties &, bool)
 The overwrite material render loop.
 
void OverwriteTransparencyRenderLoop (const GLC_RenderProperties &, bool)
 The overwrite transparency render loop.
 
void OverwriteTransparencyAndMaterialRenderLoop (const GLC_RenderProperties &, bool)
 The overwrite transparency and material render loop.
 
void bodySelectionRenderLoop (bool)
 The body selection render loop.
 
void primitiveSelectionRenderLoop (bool)
 The primitive selection render loop.
 
void primitiveRenderLoop (const GLC_RenderProperties &, bool)
 The primitive render loop.
 
void primitiveSelectedRenderLoop (const GLC_RenderProperties &, bool)
 The primitive Selected render loop.
 
void outlineSilhouetteRenderLoop (const GLC_RenderProperties &, bool)
 The outline silhouette render loop (draws in special colors for edge detection, passes extra data encoded in color)
 
void copyIndex (int lod, GLC_Mesh *pLodMesh, QHash< GLuint, GLuint > &sourceToTargetIndexMap, QHash< GLuint, GLuint > &tagetToSourceIndexMap, int &maxIndex, int targetLod)
 Copy index of this mesh from the given LOD into the given mesh.
 
void copyBulkData (GLC_Mesh *pLodMesh, const QHash< GLuint, GLuint > &tagetToSourceIndexMap, int maxIndex)
 Copy Bulk data.
 
IndexList equivalentTrianglesIndexOfstripsIndex (int lodIndex, GLC_uint materialId)
 Return the equivalent triangles index of the strips index of given LOD and material ID.
 
IndexList equivalentTrianglesIndexOfFansIndex (int lodIndex, GLC_uint materialId)
 Return the equivalent triangles index of the fan index of given LOD and material ID.
 

Private Attributes

GLC_uint m_NextPrimitiveLocalId
 The next primitive local id.
 
PrimitiveGroupsHash m_PrimitiveGroups
 The hash table of Hash table of primitive group.
 
GLC_uint m_DefaultMaterialId
 The default material Id.
 
unsigned int m_NumberOfVertice
 Mesh number of vertice.
 
unsigned int m_NumberOfNormals
 Mesh number of normals.
 
bool m_ColorPearVertex
 Color pear vertex.
 
GLC_MeshData m_MeshData
 Data of the mesh (Bulk Data + LOD with indexs)
 
int m_CurrentLod
 The current LOD index.
 

Static Private Attributes

static quint32 m_ChunkId = 0xA701
 Class chunk id.
 

Friends

QDataStream & operator<< (QDataStream &, const GLC_Mesh &)
 
QDataStream & operator>> (QDataStream &, GLC_Mesh &)
 

Get Functions

virtual unsigned int faceCount (int lod) const
 Get number of faces.
 
virtual unsigned int VertexCount () const
 Get number of vertex.
 
unsigned int numberOfNormals () const
 Get number of normals.
 
virtual const GLC_BoundingBoxboundingBox (void)
 return the mesh bounding box
 
virtual GLC_Geometryclone () const
 Return a copy of the Mesh as GLC_Geometry pointer.
 
bool ColorPearVertexIsAcivated () const
 Return true if color pear vertex is activated.
 
int lodCount () const
 Return the number of lod.
 
GLfloatVector positionVector () const
 Return the Position Vector.
 
GLfloatVector normalVector () const
 Return the normal Vector.
 
GLfloatVector texelVector () const
 Return the texel Vector.
 
bool containsTriangles (int lod, GLC_uint materialId) const
 Return true if the mesh contains triangles in the specified LOD.
 
QVector< GLuint > getTrianglesIndex (int lod, GLC_uint materialId) const
 Return the triangle index.
 
IndexList getEquivalentTrianglesStripsFansIndex (int lod, GLC_uint materialId)
 Return the equivalent triangle index of (triangle, strip and fan)
 
int numberOfTriangles (int lod, GLC_uint materialId) const
 Return the number of triangles in the specified LOD.
 
bool containsStrips (int lod, GLC_uint materialId) const
 Return true if the mesh contains trips in the specified LOD with the specified material id.
 
QList< QVector< GLuint > > getStripsIndex (int lod, GLC_uint materialId) const
 Return the strips index.
 
int numberOfStrips (int lod, GLC_uint materialId) const
 Return the number of strips in the specified LOD with the specified material id.
 
bool containsFans (int lod, GLC_uint materialId) const
 Return true if the mesh contains fans in the specified LOD with the specified material id.
 
QList< QVector< GLuint > > getFansIndex (int lod, GLC_uint materialId) const
 Return the fans index.
 
int numberOfFans (int lod, GLC_uint materialId) const
 Return the number of fans in the specified LOD with the specified material id.
 
bool containsLod (int lod) const
 Return true if the mesh contains the specified LOD.
 
bool lodContainsMaterial (int lod, GLC_uint materialId) const
 Return true if the specified LOD contains the specified material.
 
double getLodAccuracy (int lod) const
 Return the specified LOD accuracy.
 
GLC_uint nextPrimitiveLocalId () const
 Return the next primitive local id.
 
GLC_MaterialMaterialOfPrimitiveId (GLC_uint id, int lod=0) const
 Return the GLC_Material applyed on the given primitive id of the given lod.
 
QSet< GLC_uintsetOfPrimitiveId () const
 Return the set of primitives id.
 
bool isEmpty () const
 Return true if the mesh position data is empty.
 
QColor wireColor () const
 Return the mesh wire color.
 
GLC_MeshcreateMeshOfGivenLod (int lodIndex)
 Create a mesh of the given LOD index.
 
GLC_MeshcreateMeshFromGivenLod (int lodIndex)
 Create a mesh from the given LOD index.
 
GLC_MeshtransformVertice (const GLC_Matrix4x4 &matrix)
 Transform mesh vertice by the given matrix.
 
virtual double volume ()
 Return the volume of this mesh.
 
static quint32 chunckID ()
 Return the class Chunk ID.
 

Additional Inherited Members

- Protected Attributes inherited from GLC_Geometry
bool m_GeometryIsValid
 Geometry validity.
 
GLC_BoundingBoxm_pBoundingBox
 Bounding box.
 
MaterialHash m_MaterialHash
 Material Hash table.
 
bool m_UseColorPerVertex
 Color per vertex usage.
 
bool m_IsSelected
 Selection state.
 
GLC_WireData m_WireData
 Wire Data.
 
QColor m_WireColor
 The wire color.
 
GLfloat m_LineWidth
 The line width.
 

Detailed Description

GLC_Mesh : OpenGL 3D Mesh.

An GLC_Mesh is Mesh composed of triangles, strips and fan

Definition at line 49 of file glc_mesh.h.

Member Typedef Documentation

Definition at line 55 of file glc_mesh.h.

Definition at line 56 of file glc_mesh.h.

Constructor & Destructor Documentation

GLC_Mesh::GLC_Mesh ( )

Default constructor.

Definition at line 32 of file glc_mesh.cpp.

Referenced by clone(), createMeshFromGivenLod(), and createMeshOfGivenLod().

GLC_Mesh::GLC_Mesh ( const GLC_Mesh mesh)

Copy constructor.

Definition at line 46 of file glc_mesh.cpp.

References m_PrimitiveGroups.

GLC_Mesh::~GLC_Mesh ( )
virtual

Destructor.

Definition at line 123 of file glc_mesh.cpp.

References m_PrimitiveGroups.

Member Function Documentation

void GLC_Mesh::activateVboAndIbo ( )
inlineprivate
void GLC_Mesh::activateVertexArray ( )
inlineprivate
void GLC_Mesh::addColors ( const GLfloatVector colors)
inline

Add Colors.

Definition at line 233 of file glc_mesh.h.

Referenced by GLC_OffToWorld::CreateWorldFromOff().

void GLC_Mesh::addNormals ( const GLfloatVector normals)
inline
void GLC_Mesh::addTexels ( const GLfloatVector texels)
inline
GLC_uint GLC_Mesh::addTriangles ( GLC_Material pMaterial,
const IndexList indexList,
const int  lod = 0,
double  accuracy = 0.0 
)
GLC_uint GLC_Mesh::addTrianglesFan ( GLC_Material pMaterial,
const IndexList indexList,
const int  lod = 0,
double  accuracy = 0.0 
)
GLC_uint GLC_Mesh::addTrianglesStrip ( GLC_Material pMaterial,
const IndexList indexList,
const int  lod = 0,
double  accuracy = 0.0 
)
void GLC_Mesh::addVertice ( const GLfloatVector vertices)
inline
void GLC_Mesh::bodySelectionRenderLoop ( bool  vboIsUsed)
private

The body selection render loop.

Definition at line 1415 of file glc_mesh.cpp.

References GLC_State::isInSelectionMode(), m_CurrentLod, m_PrimitiveGroups, vboDrawPrimitivesOf(), and vertexArrayDrawPrimitivesOf().

Referenced by glDraw().

const GLC_BoundingBox & GLC_Mesh::boundingBox ( void  )
virtual
quint32 GLC_Mesh::chunckID ( )
static

Return the class Chunk ID.

Definition at line 144 of file glc_mesh.cpp.

References m_ChunkId.

void GLC_Mesh::clear ( )
virtual

Clear the content of the mesh and super class and makes them empty.

Reimplemented from GLC_Geometry.

Definition at line 592 of file glc_mesh.cpp.

References GLC_Geometry::clear(), and clearMeshWireAndBoundingBox().

Referenced by finish().

void GLC_Mesh::clearMeshWireAndBoundingBox ( )
GLC_Geometry * GLC_Mesh::clone ( ) const
virtual

Return a copy of the Mesh as GLC_Geometry pointer.

Implements GLC_Geometry.

Reimplemented in GLC_Box, GLC_Cylinder, GLC_ExtrudedMesh, GLC_Cone, GLC_Sphere, GLC_Rectangle, and GLC_Disc.

Definition at line 191 of file glc_mesh.cpp.

References GLC_Mesh().

bool GLC_Mesh::ColorPearVertexIsAcivated ( ) const
inline

Return true if color pear vertex is activated.

Definition at line 100 of file glc_mesh.h.

bool GLC_Mesh::containsFans ( int  lod,
GLC_uint  materialId 
) const

Return true if the mesh contains fans in the specified LOD with the specified material id.

Definition at line 328 of file glc_mesh.cpp.

References m_PrimitiveGroups.

Referenced by copyIndex(), equivalentTrianglesIndexOfFansIndex(), getEquivalentTrianglesStripsFansIndex(), getFansIndex(), volume(), and GLC_WorldTo3dxml::writeGeometryFace().

bool GLC_Mesh::containsLod ( int  lod) const
inline

Return true if the mesh contains the specified LOD.

Definition at line 153 of file glc_mesh.h.

bool GLC_Mesh::containsStrips ( int  lod,
GLC_uint  materialId 
) const

Return true if the mesh contains trips in the specified LOD with the specified material id.

Definition at line 264 of file glc_mesh.cpp.

References m_PrimitiveGroups.

Referenced by copyIndex(), equivalentTrianglesIndexOfstripsIndex(), getEquivalentTrianglesStripsFansIndex(), getStripsIndex(), volume(), and GLC_WorldTo3dxml::writeGeometryFace().

bool GLC_Mesh::containsTriangles ( int  lod,
GLC_uint  materialId 
) const

Return true if the mesh contains triangles in the specified LOD.

Definition at line 197 of file glc_mesh.cpp.

References m_PrimitiveGroups.

Referenced by copyIndex(), getEquivalentTrianglesStripsFansIndex(), getTrianglesIndex(), volume(), and GLC_WorldTo3dxml::writeGeometryFace().

void GLC_Mesh::copyBulkData ( GLC_Mesh pLodMesh,
const QHash< GLuint, GLuint > &  tagetToSourceIndexMap,
int  maxIndex 
)
private
void GLC_Mesh::copyIndex ( int  lod,
GLC_Mesh pLodMesh,
QHash< GLuint, GLuint > &  sourceToTargetIndexMap,
QHash< GLuint, GLuint > &  tagetToSourceIndexMap,
int &  maxIndex,
int  targetLod 
)
private
void GLC_Mesh::copyVboToClientSide ( )
virtual

Copy VBO to the Client Side.

Reimplemented from GLC_Geometry.

Definition at line 817 of file glc_mesh.cpp.

References GLC_MeshData::copyVboToClientSide(), GLC_Geometry::copyVboToClientSide(), and m_MeshData.

Referenced by createMeshFromGivenLod(), createMeshOfGivenLod(), and transformVertice().

GLC_Mesh * GLC_Mesh::createMeshFromGivenLod ( int  lodIndex)
GLC_Mesh * GLC_Mesh::createMeshOfGivenLod ( int  lodIndex)
IndexList GLC_Mesh::equivalentTrianglesIndexOfFansIndex ( int  lodIndex,
GLC_uint  materialId 
)
private

Return the equivalent triangles index of the fan index of given LOD and material ID.

Definition at line 1740 of file glc_mesh.cpp.

References containsFans(), and getFansIndex().

Referenced by getEquivalentTrianglesStripsFansIndex(), and volume().

IndexList GLC_Mesh::equivalentTrianglesIndexOfstripsIndex ( int  lodIndex,
GLC_uint  materialId 
)
private

Return the equivalent triangles index of the strips index of given LOD and material ID.

Definition at line 1705 of file glc_mesh.cpp.

References containsStrips(), and getStripsIndex().

Referenced by getEquivalentTrianglesStripsFansIndex(), and volume().

unsigned int GLC_Mesh::faceCount ( int  lod) const
virtual

Get number of faces.

Reimplemented from GLC_Geometry.

Definition at line 150 of file glc_mesh.cpp.

References m_MeshData, and GLC_MeshData::trianglesCount().

Referenced by GLC_ObjToWorld::addCurrentObjMeshToWorld(), and GLC_WorldTo3ds::create3dsMeshFromGLC_Mesh().

void GLC_Mesh::fillVbosAndIbos ( )
private
void GLC_Mesh::finish ( )
void GLC_Mesh::finishSerialized ( )
private

Set primitive group offset after loading mesh from binary.

Definition at line 1175 of file glc_mesh.cpp.

References m_PrimitiveGroups.

Referenced by loadFromDataStream().

IndexList GLC_Mesh::getEquivalentTrianglesStripsFansIndex ( int  lod,
GLC_uint  materialId 
)

Return the equivalent triangle index of (triangle, strip and fan)

Definition at line 231 of file glc_mesh.cpp.

References containsFans(), containsStrips(), containsTriangles(), equivalentTrianglesIndexOfFansIndex(), equivalentTrianglesIndexOfstripsIndex(), and getTrianglesIndex().

Referenced by GLC_WorldTo3ds::create3dsMeshFromGLC_Mesh().

QList< QVector< GLuint > > GLC_Mesh::getFansIndex ( int  lod,
GLC_uint  materialId 
) const
double GLC_Mesh::getLodAccuracy ( int  lod) const
inline

Return the specified LOD accuracy.

The specified LOD must exists

Definition at line 165 of file glc_mesh.h.

Referenced by GLC_WorldTo3dxml::writeGeometry().

QList< QVector< GLuint > > GLC_Mesh::getStripsIndex ( int  lod,
GLC_uint  materialId 
) const
QVector< GLuint > GLC_Mesh::getTrianglesIndex ( int  lod,
GLC_uint  materialId 
) const
void GLC_Mesh::glDraw ( const GLC_RenderProperties renderProperties)
protectedvirtual

Virtual interface for OpenGL Geometry set up.

This Virtual function is implemented here.

Implements GLC_Geometry.

Reimplemented in GLC_Cylinder, GLC_ExtrudedMesh, GLC_Box, GLC_Cone, GLC_Sphere, GLC_Disc, and GLC_Rectangle.

Definition at line 945 of file glc_mesh.cpp.

References activateVboAndIbo(), activateVertexArray(), GLC_RenderStatistics::addBodies(), GLC_RenderStatistics::addTriangles(), glc::BodySelection, bodySelectionRenderLoop(), GLC_MeshData::createVBOs(), GLC_Context::current(), fillVbosAndIbos(), GLC_Context::glcEnableLighting(), GLC_WireData::glDraw(), GLC_RenderProperties::hashOfOverwritePrimitiveMaterialsIsEmpty(), GLC_MeshData::initPositionSize(), GLC_WireData::isEmpty(), GLC_State::isInSelectionMode(), m_ColorPearVertex, m_CurrentLod, GLC_Geometry::m_GeometryIsValid, GLC_Geometry::m_IsSelected, m_MeshData, GLC_Geometry::m_WireColor, GLC_Geometry::m_WireData, normalRenderLoop(), glc::NormalRenderMode, glc::OutlineSilhouetteRenderFlag, outlineSilhouetteRenderLoop(), glc::OverwriteMaterial, OverwriteMaterialRenderLoop(), glc::OverwritePrimitiveMaterial, glc::OverwriteTransparency, glc::OverwriteTransparencyAndMaterial, OverwriteTransparencyAndMaterialRenderLoop(), OverwriteTransparencyRenderLoop(), GLC_MeshData::positionSizeIsSet(), primitiveRenderLoop(), glc::PrimitiveSelected, primitiveSelectedRenderLoop(), glc::PrimitiveSelection, primitiveSelectionRenderLoop(), GLC_RenderProperties::renderingFlag(), GLC_RenderProperties::renderingMode(), GLC_RenderProperties::savedRenderingMode(), GLC_RenderProperties::setOfSelectedPrimitiveIdIsEmpty(), GLC_MeshData::trianglesCount(), GLC_Geometry::typeIsWire(), GLC_Geometry::vboIsUsed(), GLC_State::vboSupported(), and glc::WireRenderFlag.

Referenced by GLC_Rectangle::glDraw(), GLC_Disc::glDraw(), GLC_Sphere::glDraw(), GLC_Cone::glDraw(), GLC_Box::glDraw(), GLC_ExtrudedMesh::glDraw(), and GLC_Cylinder::glDraw().

bool GLC_Mesh::isEmpty ( void  ) const
inline
void GLC_Mesh::loadFromDataStream ( QDataStream &  stream,
const MaterialHash materialHash,
const QHash< GLC_uint, GLC_uint > &  materialIdMap 
)

Load the mesh from binary data stream.

The MaterialHash contains a hash table of GLC_Material that the mesh can use The QHash<GLC_uint, GLC_uint> is used to map serialised material ID to the new constructed materials

Definition at line 839 of file glc_mesh.cpp.

References GLC_Geometry::addMaterial(), GLC_Geometry::containsMaterial(), finishSerialized(), lodCount(), m_ChunkId, m_MeshData, m_NumberOfNormals, m_NumberOfVertice, m_PrimitiveGroups, GLC_Geometry::m_WireData, GLC_Geometry::setName(), and setNextPrimitiveLocalId().

Referenced by operator>>().

bool GLC_Mesh::lodContainsMaterial ( int  lod,
GLC_uint  materialId 
) const
inline

Return true if the specified LOD contains the specified material.

Definition at line 157 of file glc_mesh.h.

Referenced by GLC_WorldTo3dxml::writeGeometry().

int GLC_Mesh::lodCount ( ) const
inline
GLC_Material * GLC_Mesh::MaterialOfPrimitiveId ( GLC_uint  id,
int  lod = 0 
) const
void GLC_Mesh::moveIndexToMeshDataLod ( )
private

Move Indexs from the primitive groups to the mesh Data LOD and Set IBOs offsets.

Move Indexs from the primitive groups to the mesh Data LOD and Set Index offsets

Definition at line 1231 of file glc_mesh.cpp.

References GLC_MeshData::indexVectorHandle(), GLC_MeshData::indexVectorSize(), m_MeshData, and m_PrimitiveGroups.

Referenced by finish().

GLC_uint GLC_Mesh::nextPrimitiveLocalId ( ) const
inline

Return the next primitive local id.

Definition at line 172 of file glc_mesh.h.

Referenced by saveToDataStream().

void GLC_Mesh::normalRenderLoop ( const GLC_RenderProperties renderProperties,
bool  vboIsUsed 
)
private
GLfloatVector GLC_Mesh::normalVector ( ) const
inline

Return the normal Vector.

Definition at line 112 of file glc_mesh.h.

Referenced by GLC_Cone::createMeshAndWire(), and GLC_WorldTo3dxml::writeGeometry().

int GLC_Mesh::numberOfFans ( int  lod,
GLC_uint  materialId 
) const

Return the number of fans in the specified LOD with the specified material id.

Return the number of fans.

Definition at line 338 of file glc_mesh.cpp.

References m_PrimitiveGroups.

unsigned int GLC_Mesh::numberOfNormals ( ) const
inline

Get number of normals.

Definition at line 90 of file glc_mesh.h.

int GLC_Mesh::numberOfStrips ( int  lod,
GLC_uint  materialId 
) const

Return the number of strips in the specified LOD with the specified material id.

Definition at line 319 of file glc_mesh.cpp.

References m_PrimitiveGroups.

int GLC_Mesh::numberOfTriangles ( int  lod,
GLC_uint  materialId 
) const

Return the number of triangles in the specified LOD.

Definition at line 255 of file glc_mesh.cpp.

References m_PrimitiveGroups.

GLC_Mesh & GLC_Mesh::operator= ( const GLC_Mesh mesh)
void GLC_Mesh::outlineSilhouetteRenderLoop ( const GLC_RenderProperties renderProperties,
bool  vboIsUsed 
)
private
void GLC_Mesh::OverwriteMaterialRenderLoop ( const GLC_RenderProperties renderProperties,
bool  vboIsUsed 
)
private
void GLC_Mesh::OverwriteTransparencyAndMaterialRenderLoop ( const GLC_RenderProperties renderProperties,
bool  vboIsUsed 
)
private
void GLC_Mesh::OverwriteTransparencyRenderLoop ( const GLC_RenderProperties renderProperties,
bool  vboIsUsed 
)
private
GLfloatVector GLC_Mesh::positionVector ( ) const
inline

Return the Position Vector.

Definition at line 108 of file glc_mesh.h.

Referenced by GLC_WorldTo3ds::create3dsMeshFromGLC_Mesh(), and GLC_WorldTo3dxml::writeGeometry().

void GLC_Mesh::primitiveRenderLoop ( const GLC_RenderProperties renderProperties,
bool  vboIsUsed 
)
private
void GLC_Mesh::primitiveSelectedRenderLoop ( const GLC_RenderProperties renderProperties,
bool  vboIsUsed 
)
private
void GLC_Mesh::primitiveSelectionRenderLoop ( bool  vboIsUsed)
private

The primitive selection render loop.

Definition at line 1434 of file glc_mesh.cpp.

References GLC_State::isInSelectionMode(), m_CurrentLod, m_PrimitiveGroups, vboDrawInSelectionModePrimitivesOf(), and vertexArrayDrawInSelectionModePrimitivesOf().

Referenced by glDraw().

void GLC_Mesh::releaseVboClientSide ( bool  update)
virtual

Release client VBO.

Reimplemented from GLC_Geometry.

Definition at line 823 of file glc_mesh.cpp.

References m_MeshData, GLC_MeshData::releaseVboClientSide(), and GLC_Geometry::releaseVboClientSide().

Referenced by createMeshFromGivenLod(), createMeshOfGivenLod(), and transformVertice().

void GLC_Mesh::replaceMasterMaterial ( GLC_Material pMat)
virtual
void GLC_Mesh::replaceMaterial ( const GLC_uint  oldId,
GLC_Material pMat 
)
void GLC_Mesh::reverseNormals ( )
virtual
void GLC_Mesh::saveToDataStream ( QDataStream &  stream) const

Save the mesh to binary data stream.

Definition at line 898 of file glc_mesh.cpp.

References m_ChunkId, m_MeshData, m_NumberOfNormals, m_NumberOfVertice, m_PrimitiveGroups, GLC_Geometry::m_WireData, GLC_Geometry::name(), and nextPrimitiveLocalId().

Referenced by operator<<().

void GLC_Mesh::setColorPearVertex ( bool  flag)
inline

Set color per vertex flag to use indexed color.

Definition at line 249 of file glc_mesh.h.

Referenced by GLC_OffToWorld::CreateWorldFromOff().

void GLC_Mesh::setCurrentLod ( const int  value)
virtual

Set the lod Index.

Reimplemented from GLC_Geometry.

Definition at line 741 of file glc_mesh.cpp.

References GLC_MeshData::lodCount(), m_CurrentLod, and m_MeshData.

GLC_uint GLC_Mesh::setCurrentMaterial ( GLC_Material pMaterial,
const int  lod,
double  accuracy 
)
private
void GLC_Mesh::setNextPrimitiveLocalId ( GLC_uint  id)
inline

Set the mesh next primitive local id.

Definition at line 265 of file glc_mesh.h.

References GLC_Geometry::id().

Referenced by loadFromDataStream().

QSet< GLC_uint > GLC_Mesh::setOfPrimitiveId ( ) const
void GLC_Mesh::setVboUsage ( bool  usage)
virtual

Set VBO usage.

Reimplemented from GLC_Geometry.

Definition at line 829 of file glc_mesh.cpp.

References isEmpty(), m_MeshData, GLC_MeshData::setVboUsage(), and GLC_Geometry::setVboUsage().

void GLC_Mesh::setWireColor ( const QColor &  color)
inline

Set the mesh wire color.

Definition at line 269 of file glc_mesh.h.

GLfloatVector GLC_Mesh::texelVector ( ) const
inline
GLC_Mesh & GLC_Mesh::transformVertice ( const GLC_Matrix4x4 matrix)
void GLC_Mesh::vboDrawInSelectionModePrimitivesOf ( GLC_PrimitiveGroup pCurrentGroup)
inlineprivate
void GLC_Mesh::vboDrawPrimitivesGroupOf ( GLC_PrimitiveGroup pCurrentGroup,
GLC_Material pCurrentMaterial,
bool  materialIsRenderable,
bool  isTransparent,
QHash< GLC_uint, GLC_Material * > *  pMaterialHash 
)
inlineprivate
void GLC_Mesh::vboDrawPrimitivesOf ( GLC_PrimitiveGroup pCurrentGroup)
inlineprivate
void GLC_Mesh::vboDrawSelectedPrimitivesGroupOf ( GLC_PrimitiveGroup pCurrentGroup,
GLC_Material pCurrentMaterial,
bool  materialIsRenderable,
bool  isTransparent,
const GLC_RenderProperties renderProperties 
)
inlineprivate
void GLC_Mesh::vertexArrayDrawInSelectionModePrimitivesOf ( GLC_PrimitiveGroup pCurrentGroup)
inlineprivate
void GLC_Mesh::vertexArrayDrawPrimitivesGroupOf ( GLC_PrimitiveGroup pCurrentGroup,
GLC_Material pCurrentMaterial,
bool  materialIsRenderable,
bool  isTransparent,
QHash< GLC_uint, GLC_Material * > *  pMaterialHash 
)
inlineprivate
void GLC_Mesh::vertexArrayDrawPrimitivesOf ( GLC_PrimitiveGroup pCurrentGroup)
inlineprivate
void GLC_Mesh::vertexArrayDrawSelectedPrimitivesGroupOf ( GLC_PrimitiveGroup pCurrentGroup,
GLC_Material pCurrentMaterial,
bool  materialIsRenderable,
bool  isTransparent,
const GLC_RenderProperties renderProperties 
)
inlineprivate
unsigned int GLC_Mesh::VertexCount ( ) const
virtual

Get number of vertex.

Reimplemented from GLC_Geometry.

Definition at line 156 of file glc_mesh.cpp.

References m_NumberOfVertice.

double GLC_Mesh::volume ( )
virtual
QColor GLC_Mesh::wireColor ( ) const
inline

Return the mesh wire color.

Definition at line 186 of file glc_mesh.h.

References GLC_Geometry::m_WireColor.

Referenced by GLC_WorldTo3dxml::writeEdges().

Friends And Related Function Documentation

QDataStream& operator<< ( QDataStream &  ,
const GLC_Mesh  
)
friend
QDataStream& operator>> ( QDataStream &  ,
GLC_Mesh  
)
friend

Member Data Documentation

quint32 GLC_Mesh::m_ChunkId = 0xA701
staticprivate

Class chunk id.

Definition at line 433 of file glc_mesh.h.

Referenced by chunckID(), loadFromDataStream(), and saveToDataStream().

bool GLC_Mesh::m_ColorPearVertex
private

Color pear vertex.

Definition at line 424 of file glc_mesh.h.

Referenced by activateVboAndIbo(), activateVertexArray(), clearMeshWireAndBoundingBox(), glDraw(), and operator=().

int GLC_Mesh::m_CurrentLod
private
GLC_uint GLC_Mesh::m_DefaultMaterialId
private

The default material Id.

Definition at line 415 of file glc_mesh.h.

Referenced by clearMeshWireAndBoundingBox(), operator=(), and setCurrentMaterial().

GLC_MeshData GLC_Mesh::m_MeshData
private
GLC_uint GLC_Mesh::m_NextPrimitiveLocalId
private

The next primitive local id.

Definition at line 409 of file glc_mesh.h.

Referenced by addTriangles(), addTrianglesFan(), addTrianglesStrip(), clearMeshWireAndBoundingBox(), and operator=().

unsigned int GLC_Mesh::m_NumberOfNormals
private

Mesh number of normals.

Definition at line 421 of file glc_mesh.h.

Referenced by clearMeshWireAndBoundingBox(), loadFromDataStream(), operator=(), and saveToDataStream().

unsigned int GLC_Mesh::m_NumberOfVertice
private

Mesh number of vertice.

Definition at line 418 of file glc_mesh.h.

Referenced by clearMeshWireAndBoundingBox(), loadFromDataStream(), operator=(), saveToDataStream(), and VertexCount().

PrimitiveGroupsHash GLC_Mesh::m_PrimitiveGroups
private

The documentation for this class was generated from the following files:

©2005-2013 Laurent Ribon