GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Protected Attributes | Private Attributes | List of all members
GLC_Geometry Class Referenceabstract

GLC_Geometry : parent class for all geometry. More...

#include <glc_geometry.h>

+ Inheritance diagram for GLC_Geometry:

Public Member Functions

Constructor / Destructor
 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.
 
Get Functions
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.
 
virtual const GLC_BoundingBoxboundingBox (void)=0
 Return the geometry bounding box.
 
bool boundingBoxIsValid () const
 Return true if the bounding box is valid.
 
virtual GLC_Geometryclone () const =0
 Clone the geometry.
 
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.
 
virtual unsigned int faceCount (int lod=0) const
 Get the number of faces.
 
virtual unsigned int VertexCount () const
 Get the number of vertex.
 
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.
 
virtual double volume ()
 Return the volume of this geometry.
 
bool vboIsUsed () const
 Return true if this geometry will try to use VBO.
 
Set Functions
virtual void clear ()
 Clear the content of the geometry and makes it empty.
 
virtual void replaceMasterMaterial (GLC_Material *)
 Replace the Master material.
 
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.
 
virtual void reverseNormals ()
 Reverse normal.
 
virtual void setCurrentLod (const int)
 Set the lod Index.
 
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 copyVboToClientSide ()
 Copy VBO to the Client Side.
 
virtual void releaseVboClientSide (bool update=false)
 Release client VBO.
 
virtual void setVboUsage (bool usage)
 Set VBO usage.
 

Protected Member Functions

Protected services Functions
void removeMaterial (GLC_uint)
 Remove the specified material from the geometry.
 
void clearWireAndBoundingBox ()
 Clear the wire data and the bounding box of this geometry.
 

Protected Attributes

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.
 

Private Member Functions

Private services Functions
void clearGeometry ()
 Clear the content of this object and makes it empty.
 

Private Attributes

bool m_IsWire
 Geometry type is wire.
 
int m_TransparentMaterialNumber
 The number of transparent materials.
 
GLC_uint m_Id
 The Unique id of an Geometry.
 
QString m_Name
 Name of geometry.
 
bool m_UseVbo
 VBO usage flag.
 

OpenGL Functions

virtual void glLoadTexture (void)
 Load each textures of materials.
 
virtual void render (const GLC_RenderProperties &)
 Virtual interface for OpenGL execution.
 
virtual void glDraw (const GLC_RenderProperties &)=0
 Virtual interface for OpenGL Geometry set up.
 
virtual void glPropGeom (const GLC_RenderProperties &)
 Virtual interface for OpenGL Geometry properties.
 

Detailed Description

GLC_Geometry : parent class for all geometry.

GLC_Geometry is a abstract class.

Main attributes of GLC_Geometry:

GLC_Geometry provides :

Empty virtual method for setting the current level of detail (between 0 and 100) : GLC_Geometry::setCurrentLod()

Definition at line 63 of file glc_geometry.h.

Constructor & Destructor Documentation

GLC_Geometry::GLC_Geometry ( const QString &  name,
const bool  type 
)

Default constructor.

Definition at line 35 of file glc_geometry.cpp.

GLC_Geometry::GLC_Geometry ( const GLC_Geometry sourceGeom)

Copy constructor.

Definition at line 53 of file glc_geometry.cpp.

References m_MaterialHash, and m_pBoundingBox.

GLC_Geometry::~GLC_Geometry ( )
virtual

Destructor.

Definition at line 106 of file glc_geometry.cpp.

References m_MaterialHash, and m_pBoundingBox.

Member Function Documentation

void GLC_Geometry::addMaterial ( GLC_Material pMaterial)
GLC_uint GLC_Geometry::addVerticeGroup ( const GLfloatVector vector)
inline
virtual const GLC_BoundingBox& GLC_Geometry::boundingBox ( void  )
pure virtual
bool GLC_Geometry::boundingBoxIsValid ( ) const
inline

Return true if the bounding box is valid.

Definition at line 138 of file glc_geometry.h.

void GLC_Geometry::clear ( )
virtual

Clear the content of the geometry and makes it empty.

Reimplemented in GLC_Mesh, GLC_PointCloud, GLC_Polylines, and GLC_Line.

Definition at line 150 of file glc_geometry.cpp.

References clearGeometry().

Referenced by GLC_Mesh::clear(), and operator=().

void GLC_Geometry::clearGeometry ( )
private

Clear the content of this object and makes it empty.

Definition at line 367 of file glc_geometry.cpp.

References GLC_WireData::clear(), m_GeometryIsValid, m_IsSelected, m_IsWire, m_MaterialHash, m_Name, m_pBoundingBox, m_TransparentMaterialNumber, m_UseColorPerVertex, and m_WireData.

Referenced by clear().

void GLC_Geometry::clearWireAndBoundingBox ( )
inlineprotected
virtual GLC_Geometry* GLC_Geometry::clone ( ) const
pure virtual
void GLC_Geometry::colorPerVertex ( const bool  colorPerVertex)
inline

Set the color per vertex usage.

Definition at line 219 of file glc_geometry.h.

bool GLC_Geometry::containsMaterial ( const GLC_uint  key) const
inline

Return true if Material key is in the mesh.

Definition at line 131 of file glc_geometry.h.

Referenced by GLC_Mesh::loadFromDataStream(), removeMaterial(), GLC_3DRep::replaceMaterial(), GLC_Mesh::replaceMaterial(), and GLC_Mesh::setCurrentMaterial().

void GLC_Geometry::copyVboToClientSide ( )
virtual

Copy VBO to the Client Side.

Reimplemented in GLC_Mesh.

Definition at line 233 of file glc_geometry.cpp.

References GLC_WireData::copyVboToClientSide(), and m_WireData.

Referenced by GLC_3DRep::copyVboToClientSide(), and GLC_Mesh::copyVboToClientSide().

unsigned int GLC_Geometry::faceCount ( int  lod = 0) const
virtual

Get the number of faces.

Reimplemented in GLC_Mesh.

Definition at line 130 of file glc_geometry.cpp.

GLC_Material* GLC_Geometry::firstMaterial ( void  ) const
inline
virtual void GLC_Geometry::glDraw ( const GLC_RenderProperties )
protectedpure virtual

Virtual interface for OpenGL Geometry set up.

This Virtual function have to be implemented in concrete class.

Implemented in GLC_Mesh, GLC_Cylinder, GLC_Arrow, GLC_Circle, GLC_ExtrudedMesh, GLC_Box, GLC_PointCloud, GLC_Cone, GLC_Sphere, GLC_PointSprite, GLC_Disc, GLC_Polylines, GLC_Rectangle, GLC_Line, and GLC_Point.

Referenced by render().

void GLC_Geometry::glLoadTexture ( void  )
virtual

Load each textures of materials.

Definition at line 257 of file glc_geometry.cpp.

References m_MaterialHash.

void GLC_Geometry::glPropGeom ( const GLC_RenderProperties renderProperties)
protectedvirtual
bool GLC_Geometry::hasMaterial ( ) const
inline
bool GLC_Geometry::hasTransparentMaterials ( ) const
inline

Return true if the geometry contains transparent materials.

Definition at line 149 of file glc_geometry.h.

Referenced by GLC_3DViewInstance::hasTransparentMaterials().

GLC_uint GLC_Geometry::id ( ) const
inline
bool GLC_Geometry::isTransparent ( ) const
inline
bool GLC_Geometry::isValid ( void  ) const
inline

Return true if the geometry is valid.

Definition at line 97 of file glc_geometry.h.

GLfloat GLC_Geometry::lineWidth ( ) const
inline

Return the line width.

Definition at line 167 of file glc_geometry.h.

Referenced by glPropGeom().

GLC_Material* GLC_Geometry::material ( const GLC_uint  key) const
inline

Return the specified mesh sub material.

Definition at line 119 of file glc_geometry.h.

Referenced by GLC_Mesh::copyIndex(), GLC_Mesh::MaterialOfPrimitiveId(), and GLC_WorldTo3dxml::writeGeometryFace().

int GLC_Geometry::materialCount ( ) const
inline

Return the number of materials.

Definition at line 115 of file glc_geometry.h.

Referenced by GLC_Mesh::copyIndex().

QList<GLC_uint> GLC_Geometry::materialIds ( ) const
inline

Get materials ID List.

Definition at line 127 of file glc_geometry.h.

Referenced by GLC_WorldTo3dxml::writeGeometry().

QSet<GLC_Material*> GLC_Geometry::materialSet ( ) const
inline

Get materials Set.

Definition at line 123 of file glc_geometry.h.

Referenced by GLC_WorldTo3ds::create3dsMeshFromGLC_Mesh(), and GLC_Mesh::volume().

QString GLC_Geometry::name ( ) const
inline
GLC_Geometry & GLC_Geometry::operator= ( const GLC_Geometry sourceGeom)
void GLC_Geometry::releaseVboClientSide ( bool  update = false)
virtual

Release client VBO.

Reimplemented in GLC_Mesh.

Definition at line 238 of file glc_geometry.cpp.

References m_WireData, and GLC_WireData::releaseVboClientSide().

Referenced by GLC_3DRep::releaseVboClientSide(), and GLC_Mesh::releaseVboClientSide().

void GLC_Geometry::removeMaterial ( GLC_uint  id)
protected
void GLC_Geometry::render ( const GLC_RenderProperties renderProperties)
virtual
void GLC_Geometry::replaceMasterMaterial ( GLC_Material pMaterial)
virtual

Replace the Master material.

Reimplemented in GLC_Mesh.

Definition at line 156 of file glc_geometry.cpp.

References addMaterial(), firstMaterial(), m_IsWire, m_MaterialHash, and removeMaterial().

Referenced by GLC_Axis::create3DviewInstance(), and GLC_Octree::createBoxWithMaterial().

virtual void GLC_Geometry::reverseNormals ( )
inlinevirtual

Reverse normal.

Reimplemented in GLC_Mesh.

Definition at line 232 of file glc_geometry.h.

virtual void GLC_Geometry::setCurrentLod ( const int  )
inlinevirtual

Set the lod Index.

The value must be between 0 and 100

Reimplemented in GLC_Mesh.

Definition at line 236 of file glc_geometry.h.

Referenced by GLC_3DViewInstance::render(), GLC_3DViewInstance::renderForBodySelection(), and GLC_3DViewInstance::renderForPrimitiveSelection().

void GLC_Geometry::setId ( const GLC_uint  id)
inline

Set Geometry Id.

Definition at line 239 of file glc_geometry.h.

void GLC_Geometry::setLineWidth ( GLfloat  lineWidth)
inline
void GLC_Geometry::setName ( const QString  name)
inline
void GLC_Geometry::setVboUsage ( bool  usage)
virtual

Set VBO usage.

Reimplemented in GLC_Mesh.

Definition at line 243 of file glc_geometry.cpp.

References m_UseVbo, m_WireData, GLC_WireData::setVboUsage(), and GLC_State::vboSupported().

Referenced by GLC_Mesh::setVboUsage().

void GLC_Geometry::setWireColor ( const QColor &  color)
bool GLC_Geometry::typeIsWire ( ) const
inline

Return true if the geometry type is wireframe.

Definition at line 157 of file glc_geometry.h.

Referenced by GLC_Mesh::glDraw().

void GLC_Geometry::updateTransparentMaterialNumber ( )

Update the transparent material number.

Definition at line 177 of file glc_geometry.cpp.

References m_MaterialHash, m_TransparentMaterialNumber, and m_WireColor.

bool GLC_Geometry::usedColorPerVertex ( ) const
inline

Return true if color per vertex is used.

Definition at line 153 of file glc_geometry.h.

bool GLC_Geometry::vboIsUsed ( ) const
inline

Return true if this geometry will try to use VBO.

Definition at line 198 of file glc_geometry.h.

Referenced by GLC_Mesh::getFansIndex(), GLC_Mesh::getStripsIndex(), GLC_Mesh::getTrianglesIndex(), GLC_Mesh::glDraw(), and GLC_Mesh::reverseNormals().

unsigned int GLC_Geometry::VertexCount ( ) const
virtual

Get the number of vertex.

Reimplemented in GLC_Mesh.

Definition at line 136 of file glc_geometry.cpp.

double GLC_Geometry::volume ( )
virtual

Return the volume of this geometry.

Reimplemented in GLC_Mesh.

Definition at line 141 of file glc_geometry.cpp.

QColor GLC_Geometry::wireColor ( ) const
inline

Return this geometry wire color.

Definition at line 171 of file glc_geometry.h.

bool GLC_Geometry::wireDataIsEmpty ( ) const
inline

Return true if wire data is empty.

Definition at line 175 of file glc_geometry.h.

Referenced by GLC_WorldTo3dxml::writeGeometry().

int GLC_Geometry::wirePolylineCount ( ) const
inline

Return the number of wire polylines.

Definition at line 183 of file glc_geometry.h.

Referenced by GLC_WorldTo3dxml::writeEdges().

GLuint GLC_Geometry::wirePolylineOffset ( int  index) const
inline

Return the polyline offset from the given index.

Definition at line 187 of file glc_geometry.h.

Referenced by GLC_WorldTo3dxml::writeEdges().

GLsizei GLC_Geometry::wirePolylineSize ( int  index) const
inline

Return the polyline size from the given index.

Definition at line 191 of file glc_geometry.h.

Referenced by GLC_WorldTo3dxml::writeEdges().

GLfloatVector GLC_Geometry::wirePositionVector ( ) const
inline

Return the wire position vector.

Definition at line 179 of file glc_geometry.h.

Referenced by GLC_WorldTo3dxml::writeEdges().

Member Data Documentation

bool GLC_Geometry::m_GeometryIsValid
protected
GLC_uint GLC_Geometry::m_Id
private

The Unique id of an Geometry.

Generated on creation

Definition at line 360 of file glc_geometry.h.

Referenced by operator=().

bool GLC_Geometry::m_IsSelected
protected
bool GLC_Geometry::m_IsWire
private

Geometry type is wire.

Definition at line 353 of file glc_geometry.h.

Referenced by clearGeometry(), glPropGeom(), operator=(), render(), and replaceMasterMaterial().

GLfloat GLC_Geometry::m_LineWidth
protected

The line width.

Definition at line 344 of file glc_geometry.h.

Referenced by glPropGeom(), and operator=().

MaterialHash GLC_Geometry::m_MaterialHash
protected
QString GLC_Geometry::m_Name
private

Name of geometry.

Definition at line 363 of file glc_geometry.h.

Referenced by clearGeometry(), and operator=().

GLC_BoundingBox* GLC_Geometry::m_pBoundingBox
protected
int GLC_Geometry::m_TransparentMaterialNumber
private

The number of transparent materials.

Definition at line 356 of file glc_geometry.h.

Referenced by addMaterial(), clearGeometry(), operator=(), removeMaterial(), setWireColor(), and updateTransparentMaterialNumber().

bool GLC_Geometry::m_UseColorPerVertex
protected

Color per vertex usage.

Definition at line 332 of file glc_geometry.h.

Referenced by clearGeometry(), and operator=().

bool GLC_Geometry::m_UseVbo
private

VBO usage flag.

Definition at line 366 of file glc_geometry.h.

Referenced by operator=(), and setVboUsage().

QColor GLC_Geometry::m_WireColor
protected
GLC_WireData GLC_Geometry::m_WireData
protected

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

©2005-2013 Laurent Ribon