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

GLC_Cylinder : OpenGL 3D Cylinder. More...

#include <glc_cylinder.h>

+ Inheritance diagram for GLC_Cylinder:

Public Member Functions

Constructor / Destructor
 GLC_Cylinder (double dRadius, double dLength, int discretization=glc::GLC_POLYDISCRET)
 Construct an GLC_Cylinder.
 
 GLC_Cylinder (const GLC_Cylinder &sourceCylinder)
 Copy contructor.
 
virtual ~GLC_Cylinder ()
 Destructor.
 
Set Functions
void setLength (double Length)
 Set Cylinder length.
 
void setRadius (double Radius)
 Set Cylinder radius.
 
void setDiscretion (int TargetDiscret)
 Set Discretion.
 
void setEndedCaps (bool CapsEnded)
 End Caps.
 
- Public Member Functions inherited from GLC_Mesh
 GLC_Mesh ()
 Default constructor.
 
 GLC_Mesh (const GLC_Mesh &)
 Copy constructor.
 
GLC_Meshoperator= (const GLC_Mesh &)
 Overload "=" operator.
 
virtual ~GLC_Mesh ()
 Destructor.
 
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.
 
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.
 
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.
 
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.
 
- 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.
 

Private Member Functions

OpenGL Functions
virtual void glDraw (const GLC_RenderProperties &)
 Virtual interface for OpenGL Geometry set up.
 
Private services Functions
void createMeshAndWire ()
 Create the cylinder mesh and wire.
 

Private Attributes

double m_Radius
 Cylinder's radius.
 
double m_Length
 Cylinder length (Z Axis direction)
 
int m_Discret
 Cylinder polygon discretisation.
 
bool m_EndedIsCaped
 Cylinder is capped.
 

Static Private Attributes

static quint32 m_ChunkId = 0xA705
 Class chunk id.
 

Get Functions

double length (void) const
 Get Lenght of the Cylinder.
 
double radius (void) const
 Get Radius of cylinder.
 
int discretion (void) const
 Get Cylinder discretion.
 
virtual GLC_Geometryclone () const
 Return a copy of the Cylinder.
 
bool EndedIsCaped () const
 return true if cylinder's ended are capped
 
virtual const GLC_BoundingBoxboundingBox (void)
 return the cylinder bounding box
 
static quint32 chunckID ()
 Return the class Chunk ID.
 

Additional Inherited Members

- Public Types inherited from GLC_Mesh
typedef QHash< GLC_uint,
GLC_PrimitiveGroup * > 
LodPrimitiveGroups
 
typedef QHash< const int,
LodPrimitiveGroups * > 
PrimitiveGroupsHash
 
- Static Public Member Functions inherited from GLC_Mesh
static quint32 chunckID ()
 Return the class Chunk ID.
 
OpenGL Functions
- 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_Cylinder : OpenGL 3D Cylinder.

An GLC_Cylinder is a polygonnal geometry
It can be capped or not

Definition at line 39 of file glc_cylinder.h.

Constructor & Destructor Documentation

GLC_Cylinder::GLC_Cylinder ( double  dRadius,
double  dLength,
int  discretization = glc::GLC_POLYDISCRET 
)

Construct an GLC_Cylinder.

By default, discretion is set to #GLC_POLYDISCRET
By default, Axis of Cylinder is Z Axis dRadius must be > 0 dLength must be > 0

Definition at line 39 of file glc_cylinder.cpp.

References createMeshAndWire(), m_Length, and m_Radius.

Referenced by clone().

GLC_Cylinder::GLC_Cylinder ( const GLC_Cylinder sourceCylinder)

Copy contructor.

Definition at line 50 of file glc_cylinder.cpp.

References createMeshAndWire(), GLC_Mesh::isEmpty(), m_Discret, m_Length, and m_Radius.

GLC_Cylinder::~GLC_Cylinder ( )
virtual

Destructor.

Definition at line 61 of file glc_cylinder.cpp.

Member Function Documentation

const GLC_BoundingBox & GLC_Cylinder::boundingBox ( void  )
virtual

return the cylinder bounding box

Reimplemented from GLC_Mesh.

Definition at line 82 of file glc_cylinder.cpp.

References GLC_Mesh::boundingBox(), createMeshAndWire(), and GLC_Mesh::isEmpty().

quint32 GLC_Cylinder::chunckID ( )
static

Return the class Chunk ID.

Definition at line 70 of file glc_cylinder.cpp.

References m_ChunkId.

GLC_Geometry * GLC_Cylinder::clone ( ) const
virtual

Return a copy of the Cylinder.

Reimplemented from GLC_Mesh.

Definition at line 76 of file glc_cylinder.cpp.

References GLC_Cylinder().

void GLC_Cylinder::createMeshAndWire ( )
private
int GLC_Cylinder::discretion ( void  ) const
inline

Get Cylinder discretion.

Definition at line 79 of file glc_cylinder.h.

bool GLC_Cylinder::EndedIsCaped ( ) const
inline

return true if cylinder's ended are capped

Definition at line 86 of file glc_cylinder.h.

void GLC_Cylinder::glDraw ( const GLC_RenderProperties renderProperties)
privatevirtual

Virtual interface for OpenGL Geometry set up.

This Virtual function is implemented here.
Throw GLC_OpenGlException

Reimplemented from GLC_Mesh.

Definition at line 141 of file glc_cylinder.cpp.

References createMeshAndWire(), GLC_Mesh::glDraw(), and GLC_Mesh::isEmpty().

double GLC_Cylinder::length ( void  ) const
inline

Get Lenght of the Cylinder.

Definition at line 71 of file glc_cylinder.h.

double GLC_Cylinder::radius ( void  ) const
inline

Get Radius of cylinder.

Definition at line 75 of file glc_cylinder.h.

void GLC_Cylinder::setDiscretion ( int  TargetDiscret)

Set Discretion.

Discretion must be > 0

Definition at line 113 of file glc_cylinder.cpp.

References GLC_Mesh::clearMeshWireAndBoundingBox(), and m_Discret.

void GLC_Cylinder::setEndedCaps ( bool  CapsEnded)

End Caps.

Definition at line 126 of file glc_cylinder.cpp.

References GLC_Mesh::clearMeshWireAndBoundingBox(), and m_EndedIsCaped.

void GLC_Cylinder::setLength ( double  Length)

Set Cylinder length.

Length must be > 0

Definition at line 95 of file glc_cylinder.cpp.

References GLC_Mesh::clearMeshWireAndBoundingBox(), and m_Length.

void GLC_Cylinder::setRadius ( double  Radius)

Set Cylinder radius.

Radius must be > 0

Definition at line 104 of file glc_cylinder.cpp.

References GLC_Mesh::clearMeshWireAndBoundingBox(), and m_Radius.

Member Data Documentation

quint32 GLC_Cylinder::m_ChunkId = 0xA705
staticprivate

Class chunk id.

Definition at line 154 of file glc_cylinder.h.

Referenced by chunckID().

int GLC_Cylinder::m_Discret
private

Cylinder polygon discretisation.

Definition at line 148 of file glc_cylinder.h.

Referenced by createMeshAndWire(), GLC_Cylinder(), and setDiscretion().

bool GLC_Cylinder::m_EndedIsCaped
private

Cylinder is capped.

Definition at line 151 of file glc_cylinder.h.

Referenced by createMeshAndWire(), and setEndedCaps().

double GLC_Cylinder::m_Length
private

Cylinder length (Z Axis direction)

Definition at line 145 of file glc_cylinder.h.

Referenced by createMeshAndWire(), GLC_Cylinder(), and setLength().

double GLC_Cylinder::m_Radius
private

Cylinder's radius.

Definition at line 142 of file glc_cylinder.h.

Referenced by createMeshAndWire(), GLC_Cylinder(), and setRadius().


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

©2005-2013 Laurent Ribon