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

GLC_3DViewInstance : GLC_3DRep + bounding box. More...

#include <glc_3dviewinstance.h>

+ Inheritance diagram for GLC_3DViewInstance:

Public Types

enum  Viewable { FullViewable = 120, PartialViewable = 121, NoViewable = 122 }
 Viewable instance property. More...
 

Public Member Functions

Constructor / Destructor
 GLC_3DViewInstance ()
 Default constructor.
 
 GLC_3DViewInstance (GLC_Geometry *pGeom)
 Contruct instance from a geometry.
 
 GLC_3DViewInstance (GLC_Geometry *pGeom, GLC_uint id)
 Contruct instance from a geometry and the given UID.
 
 GLC_3DViewInstance (const GLC_3DRep &)
 Contruct instance from a 3DRep.
 
 GLC_3DViewInstance (const GLC_3DRep &rep, GLC_uint id)
 Contruct instance from a 3DRep and the given UID.
 
 GLC_3DViewInstance (const GLC_3DViewInstance &)
 Copy constructor.
 
GLC_3DViewInstanceoperator= (const GLC_3DViewInstance &)
 Assignement operator.
 
 ~GLC_3DViewInstance ()
 Destructor.
 
- Public Member Functions inherited from GLC_Object
 GLC_Object (const QString &name=QString())
 Default constructor.
 
 GLC_Object (GLC_uint id, const QString &name=QString())
 Construct a GLC_Object with the given UID.
 
 GLC_Object (const GLC_Object &sourceObject)
 Construct a GLC_Object from the given GLC_Object.
 
virtual ~GLC_Object ()
 Virtual destructor.
 
GLC_uint id () const
 Return this object id.
 
const QString name () const
 Return this object name.
 
bool operator== (const GLC_Object &obj)
 Return true if this object is equal to the given object.
 
void setId (const GLC_uint id)
 Set this object Id.
 
void setName (const QString &name)
 Set this object Name.
 
GLC_Objectoperator= (const GLC_Object &)
 Set this object from the given object.
 

Private Member Functions

void computeBoundingBox (void)
 compute the instance bounding box
 
void clear ()
 Clear current instance.
 
int choseLod (const GLC_BoundingBox &, GLC_Viewport *, bool)
 Compute LOD.
 

Private Attributes

GLC_3DRep m_3DRep
 The 3D rep of the instance.
 
GLC_BoundingBoxm_pBoundingBox
 BoundingBox of the instance.
 
GLC_Matrix4x4 m_AbsoluteMatrix
 Geometry matrix.
 
bool m_IsBoundingBoxValid
 Bounding box validity.
 
GLC_RenderProperties m_RenderProperties
 The 3DViewInstance rendering properties.
 
bool m_IsVisible
 Visibility.
 
GLubyte m_colorId [4]
 The instance color ID.
 
int m_DefaultLOD
 The Default LOD.
 
Viewable m_ViewableFlag
 Flag to know if the instance is viewable.
 
QVector< bool > m_ViewableGeomFlag
 vector of Flag to know if geometies of this instance are viewable
 

Static Private Attributes

static QMutex m_Mutex
 A Mutex.
 
static int m_GlobalDefaultLOD = 10
 The global default LOD.
 

Get Functions

bool isTransparent () const
 Return true if the all instance's mesh are transparent.
 
bool hasTransparentMaterials () const
 Return true if the instance contains mesh which contains transparent material.
 
bool isEmpty () const
 Return true if the instance as no geometry.
 
bool isSelected (void) const
 Return true if the instance is selected.
 
int numberOfGeometry () const
 Return the number of geometry.
 
GLC_GeometrygeomAt (int index) const
 Return the geometry at the specified position.
 
GLC_BoundingBox boundingBox ()
 Get the bounding box.
 
bool boundingBoxValidity () const
 Get the validity of the Bounding Box.
 
const GLC_Matrix4x4matrix () const
 Return transfomation 4x4Matrix.
 
GLC_3DViewInstance deepCopy () const
 Make a deep copy of the instance.
 
GLC_3DViewInstance instanciate ()
 Instanciate the instance.
 
GLenum polygonMode () const
 Get the Polygon mode off the instance.
 
GLC_RenderPropertiesrenderPropertiesHandle ()
 Return an handle to the renderProperties.
 
bool isVisible () const
 Get the visibility state of instance.
 
GLC_3DViewInstance::Viewable viewableFlag () const
 Return true if the instance is viewable.
 
bool isGeomViewable (int index) const
 Return true if the geom at the index is viewable.
 
unsigned int numberOfFaces () const
 Get number of faces.
 
unsigned int numberOfVertex () const
 Get number of vertex.
 
unsigned int numberOfMaterials () const
 Get number of materials.
 
QSet< GLC_Material * > materialSet () const
 Get materials List.
 
int defaultLodValue () const
 Return the default LOD Value.
 
GLC_3DRep representation () const
 Return the instance representation.
 
int numberOfBody () const
 Return the number of body contains in the 3DRep.
 
static int globalDefaultLod ()
 Return the global default LOD value.
 

Set Functions

bool addGeometry (GLC_Geometry *pGeom)
 Set the instance Geometry.
 
void removeEmptyGeometry ()
 Remove empty geometries.
 
void reverseGeometriesNormals ()
 Reverse geometry normals.
 
GLC_3DViewInstancetranslate (double Tx, double Ty, double Tz)
 Translate Instance.
 
GLC_3DViewInstancetranslate (const GLC_Vector3d &v)
 Translate Instance.
 
GLC_3DViewInstancemultMatrix (const GLC_Matrix4x4 &MultMat)
 Move instance with a 4x4Matrix.
 
GLC_3DViewInstancesetMatrix (const GLC_Matrix4x4 &SetMat)
 Replace the instance Matrix.
 
GLC_3DViewInstanceresetMatrix (void)
 Reset the instance Matrix.
 
void setPolygonMode (GLenum Face, GLenum Mode)
 Polygon's display style.
 
void select (bool primitive)
 Select the instance.
 
void unselect (void)
 Unselect the instance.
 
void setVisibility (bool visibility)
 Set instance visibility.
 
void setId (const GLC_uint id)
 Set Instance Id.
 
void setDefaultLodValue (int lod)
 Set the default LOD value.
 
bool setViewable (GLC_3DViewInstance::Viewable flag)
 Set the viewable flag.
 
void setGeomViewable (int index, bool flag)
 Set the viewable flag of a geometry.
 
void setRenderProperties (const GLC_RenderProperties &renderProperties)
 Set the renderProperties of this 3DView instance.
 
void setVboUsage (bool usage)
 Set VBO usage.
 
static void setGlobalDefaultLod (int)
 Set the global default LOD value.
 

OpenGL Functions

void render (glc::RenderFlag renderFlag=glc::ShadingFlag, bool useLod=false, GLC_Viewport *pView=NULL)
 Display the instance.
 
void renderForBodySelection ()
 Display the instance in Body selection mode.
 
int renderForPrimitiveSelection (GLC_uint)
 Display the instance in Primitive selection mode of the specified body id and return the body index.
 
void OpenglVisProperties ()
 Set instance visualisation properties.
 

Additional Inherited Members

- Protected Attributes inherited from GLC_Object
GLC_uint m_Uid
 The Unique ID of an GLC_Object.
 
QString m_Name
 Name of an GLC_Object.
 
QMutex m_Mutex
 GLC_Object Mutex.
 

Detailed Description

GLC_3DViewInstance : GLC_3DRep + bounding box.

An GLC_3DViewInstance contain :

Definition at line 54 of file glc_3dviewinstance.h.

Member Enumeration Documentation

Viewable instance property.

Enumerator
FullViewable 
PartialViewable 
NoViewable 

Definition at line 58 of file glc_3dviewinstance.h.

Constructor & Destructor Documentation

GLC_3DViewInstance::GLC_3DViewInstance ( )

Default constructor.

Definition at line 42 of file glc_3dviewinstance.cpp.

References glc::encodeRgbId(), m_colorId, and GLC_Object::m_Uid.

GLC_3DViewInstance::GLC_3DViewInstance ( GLC_Geometry pGeom)

Contruct instance from a geometry.

Definition at line 59 of file glc_3dviewinstance.cpp.

References glc::encodeRgbId(), m_3DRep, m_colorId, GLC_Object::m_Uid, GLC_Rep::name(), and GLC_Object::setName().

GLC_3DViewInstance::GLC_3DViewInstance ( GLC_Geometry pGeom,
GLC_uint  id 
)

Contruct instance from a geometry and the given UID.

Definition at line 77 of file glc_3dviewinstance.cpp.

References glc::encodeRgbId(), m_3DRep, m_colorId, GLC_Object::m_Uid, GLC_Rep::name(), and GLC_Object::setName().

GLC_3DViewInstance::GLC_3DViewInstance ( const GLC_3DRep rep)

Contruct instance from a 3DRep.

Definition at line 95 of file glc_3dviewinstance.cpp.

References glc::encodeRgbId(), m_colorId, and GLC_Object::m_Uid.

GLC_3DViewInstance::GLC_3DViewInstance ( const GLC_3DRep rep,
GLC_uint  id 
)

Contruct instance from a 3DRep and the given UID.

Definition at line 112 of file glc_3dviewinstance.cpp.

References glc::encodeRgbId(), m_colorId, and GLC_Object::m_Uid.

GLC_3DViewInstance::GLC_3DViewInstance ( const GLC_3DViewInstance inputNode)

Copy constructor.

Definition at line 130 of file glc_3dviewinstance.cpp.

References glc::encodeRgbId(), m_colorId, m_pBoundingBox, and GLC_Object::m_Uid.

GLC_3DViewInstance::~GLC_3DViewInstance ( )

Destructor.

Definition at line 184 of file glc_3dviewinstance.cpp.

References clear().

Member Function Documentation

bool GLC_3DViewInstance::addGeometry ( GLC_Geometry pGeom)

Set the instance Geometry.

Definition at line 263 of file glc_3dviewinstance.cpp.

References GLC_3DRep::addGeom(), GLC_3DRep::contains(), and m_3DRep.

Referenced by GLC_RepFlyMover::createRepresentation().

GLC_BoundingBox GLC_3DViewInstance::boundingBox ( void  )
bool GLC_3DViewInstance::boundingBoxValidity ( ) const
inline

Get the validity of the Bounding Box.

Definition at line 130 of file glc_3dviewinstance.h.

Referenced by boundingBox().

int GLC_3DViewInstance::choseLod ( const GLC_BoundingBox boundingBox,
GLC_Viewport pView,
bool  useLod 
)
private
void GLC_3DViewInstance::clear ( void  )
private

Clear current instance.

Definition at line 489 of file glc_3dviewinstance.cpp.

References m_IsBoundingBoxValid, and m_pBoundingBox.

Referenced by operator=(), and ~GLC_3DViewInstance().

void GLC_3DViewInstance::computeBoundingBox ( void  )
private
GLC_3DViewInstance GLC_3DViewInstance::deepCopy ( ) const
int GLC_3DViewInstance::defaultLodValue ( ) const
inline

Return the default LOD Value.

Definition at line 181 of file glc_3dviewinstance.h.

GLC_Geometry* GLC_3DViewInstance::geomAt ( int  index) const
inline
static int GLC_3DViewInstance::globalDefaultLod ( )
inlinestatic

Return the global default LOD value.

Definition at line 193 of file glc_3dviewinstance.h.

bool GLC_3DViewInstance::hasTransparentMaterials ( ) const
inline
GLC_3DViewInstance GLC_3DViewInstance::instanciate ( )

Instanciate the instance.

Definition at line 247 of file glc_3dviewinstance.cpp.

References glc::encodeRgbId(), glc::GLC_GenID(), m_colorId, and GLC_Object::m_Uid.

bool GLC_3DViewInstance::isEmpty ( void  ) const
inline

Return true if the instance as no geometry.

Definition at line 107 of file glc_3dviewinstance.h.

bool GLC_3DViewInstance::isGeomViewable ( int  index) const
inline

Return true if the geom at the index is viewable.

Definition at line 161 of file glc_3dviewinstance.h.

bool GLC_3DViewInstance::isSelected ( void  ) const
inline
bool GLC_3DViewInstance::isTransparent ( ) const
inline
bool GLC_3DViewInstance::isVisible ( ) const
inline
QSet<GLC_Material*> GLC_3DViewInstance::materialSet ( ) const
inline

Get materials List.

Definition at line 177 of file glc_3dviewinstance.h.

const GLC_Matrix4x4& GLC_3DViewInstance::matrix ( ) const
inline

Return transfomation 4x4Matrix.

Definition at line 134 of file glc_3dviewinstance.h.

Referenced by GLC_OctreeNode::updateViewableInstances().

GLC_3DViewInstance & GLC_3DViewInstance::multMatrix ( const GLC_Matrix4x4 MultMat)
int GLC_3DViewInstance::numberOfBody ( ) const
inline

Return the number of body contains in the 3DRep.

Definition at line 189 of file glc_3dviewinstance.h.

References GLC_3DRep::numberOfBody().

Referenced by GLC_OctreeNode::updateViewableInstances().

unsigned int GLC_3DViewInstance::numberOfFaces ( ) const
inline

Get number of faces.

Definition at line 165 of file glc_3dviewinstance.h.

int GLC_3DViewInstance::numberOfGeometry ( ) const
inline

Return the number of geometry.

Definition at line 115 of file glc_3dviewinstance.h.

unsigned int GLC_3DViewInstance::numberOfMaterials ( ) const
inline

Get number of materials.

Definition at line 173 of file glc_3dviewinstance.h.

unsigned int GLC_3DViewInstance::numberOfVertex ( ) const
inline

Get number of vertex.

Definition at line 169 of file glc_3dviewinstance.h.

void GLC_3DViewInstance::OpenglVisProperties ( )
inlineprivate

Set instance visualisation properties.

Definition at line 303 of file glc_3dviewinstance.h.

References GLC_Context::current(), and GLC_Context::glcMultMatrix().

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

GLC_3DViewInstance & GLC_3DViewInstance::operator= ( const GLC_3DViewInstance inputNode)
GLenum GLC_3DViewInstance::polygonMode ( ) const
inline

Get the Polygon mode off the instance.

Polygon Mode can Be : GL_POINT, GL_LINE, or GL_FILL

Definition at line 145 of file glc_3dviewinstance.h.

void GLC_3DViewInstance::removeEmptyGeometry ( )
inline

Remove empty geometries.

Definition at line 210 of file glc_3dviewinstance.h.

void GLC_3DViewInstance::render ( glc::RenderFlag  renderFlag = glc::ShadingFlag,
bool  useLod = false,
GLC_Viewport pView = NULL 
)
void GLC_3DViewInstance::renderForBodySelection ( )
int GLC_3DViewInstance::renderForPrimitiveSelection ( GLC_uint  bodyId)
GLC_RenderProperties* GLC_3DViewInstance::renderPropertiesHandle ( )
inline
GLC_3DRep GLC_3DViewInstance::representation ( ) const
inline

Return the instance representation.

Definition at line 185 of file glc_3dviewinstance.h.

Referenced by GLC_3dsToWorld::create3DRep(), and GLC_Axis::create3DviewInstance().

GLC_3DViewInstance & GLC_3DViewInstance::resetMatrix ( void  )

Reset the instance Matrix.

Definition at line 304 of file glc_3dviewinstance.cpp.

References m_AbsoluteMatrix, m_IsBoundingBoxValid, and GLC_Matrix4x4::setToIdentity().

void GLC_3DViewInstance::reverseGeometriesNormals ( )
inline

Reverse geometry normals.

Definition at line 214 of file glc_3dviewinstance.h.

Referenced by GLC_StructOccurence::reverseNormals().

void GLC_3DViewInstance::select ( bool  primitive)
inline

Select the instance.

Definition at line 242 of file glc_3dviewinstance.h.

Referenced by GLC_3DViewCollection::select(), and GLC_3DViewCollection::selectAll().

void GLC_3DViewInstance::setDefaultLodValue ( int  lod)
inline

Set the default LOD value.

Definition at line 261 of file glc_3dviewinstance.h.

void GLC_3DViewInstance::setGeomViewable ( int  index,
bool  flag 
)
inline

Set the viewable flag of a geometry.

Definition at line 270 of file glc_3dviewinstance.h.

Referenced by GLC_OctreeNode::updateViewableInstances().

void GLC_3DViewInstance::setGlobalDefaultLod ( int  lod)
static

Set the global default LOD value.

Definition at line 212 of file glc_3dviewinstance.cpp.

References m_GlobalDefaultLOD, and m_Mutex.

void GLC_3DViewInstance::setId ( const GLC_uint  id)
inline

Set Instance Id.

Definition at line 254 of file glc_3dviewinstance.h.

References glc::encodeRgbId(), and GLC_Object::setId().

GLC_3DViewInstance & GLC_3DViewInstance::setMatrix ( const GLC_Matrix4x4 SetMat)
void GLC_3DViewInstance::setPolygonMode ( GLenum  Face,
GLenum  Mode 
)
inline

Polygon's display style.

Face Polygon Mode can be : GL_FRONT_AND_BACK, GL_FRONT, or GL_BACK mode can be : GL_POINT, GL_LINE, or GL_FILL

Definition at line 238 of file glc_3dviewinstance.h.

void GLC_3DViewInstance::setRenderProperties ( const GLC_RenderProperties renderProperties)
inline

Set the renderProperties of this 3DView instance.

Definition at line 278 of file glc_3dviewinstance.h.

Referenced by GLC_StructOccurence::create3DViewInstance(), GLC_StructOccurence::GLC_StructOccurence(), and GLC_StructOccurence::setRenderProperties().

void GLC_3DViewInstance::setVboUsage ( bool  usage)

Set VBO usage.

Definition at line 218 of file glc_3dviewinstance.cpp.

References m_3DRep, and GLC_3DRep::setVboUsage().

bool GLC_3DViewInstance::setViewable ( GLC_3DViewInstance::Viewable  flag)
inline
void GLC_3DViewInstance::setVisibility ( bool  visibility)
inline
GLC_3DViewInstance & GLC_3DViewInstance::translate ( double  Tx,
double  Ty,
double  Tz 
)

Translate Instance.

Definition at line 277 of file glc_3dviewinstance.cpp.

References multMatrix().

Referenced by GLC_Axis::create3DviewInstance(), and GLC_Factory::createBox().

GLC_3DViewInstance& GLC_3DViewInstance::translate ( const GLC_Vector3d v)
inline

Translate Instance.

Definition at line 221 of file glc_3dviewinstance.h.

References GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

void GLC_3DViewInstance::unselect ( void  )
inline

Unselect the instance.

Definition at line 246 of file glc_3dviewinstance.h.

Referenced by GLC_3DViewCollection::unselectAll().

GLC_3DViewInstance::Viewable GLC_3DViewInstance::viewableFlag ( ) const
inline

Return true if the instance is viewable.

Definition at line 157 of file glc_3dviewinstance.h.

Referenced by GLC_3DViewCollection::glDrawInstancesOf().

Member Data Documentation

GLC_3DRep GLC_3DViewInstance::m_3DRep
private
GLC_Matrix4x4 GLC_3DViewInstance::m_AbsoluteMatrix
private

Geometry matrix.

Definition at line 339 of file glc_3dviewinstance.h.

Referenced by choseLod(), computeBoundingBox(), deepCopy(), multMatrix(), operator=(), render(), resetMatrix(), and setMatrix().

GLubyte GLC_3DViewInstance::m_colorId[4]
private

The instance color ID.

Definition at line 351 of file glc_3dviewinstance.h.

Referenced by GLC_3DViewInstance(), instanciate(), operator=(), and render().

int GLC_3DViewInstance::m_DefaultLOD
private

The Default LOD.

Definition at line 354 of file glc_3dviewinstance.h.

Referenced by choseLod(), operator=(), render(), and renderForBodySelection().

int GLC_3DViewInstance::m_GlobalDefaultLOD = 10
staticprivate

The global default LOD.

Definition at line 366 of file glc_3dviewinstance.h.

Referenced by setGlobalDefaultLod().

bool GLC_3DViewInstance::m_IsBoundingBoxValid
private

Bounding box validity.

Definition at line 342 of file glc_3dviewinstance.h.

Referenced by boundingBox(), clear(), deepCopy(), multMatrix(), operator=(), resetMatrix(), and setMatrix().

bool GLC_3DViewInstance::m_IsVisible
private

Visibility.

Definition at line 348 of file glc_3dviewinstance.h.

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

QMutex GLC_3DViewInstance::m_Mutex
staticprivate

A Mutex.

Definition at line 363 of file glc_3dviewinstance.h.

Referenced by setGlobalDefaultLod().

GLC_BoundingBox* GLC_3DViewInstance::m_pBoundingBox
private

BoundingBox of the instance.

Definition at line 336 of file glc_3dviewinstance.h.

Referenced by boundingBox(), clear(), computeBoundingBox(), deepCopy(), GLC_3DViewInstance(), and operator=().

GLC_RenderProperties GLC_3DViewInstance::m_RenderProperties
private

The 3DViewInstance rendering properties.

Definition at line 345 of file glc_3dviewinstance.h.

Referenced by deepCopy(), hasTransparentMaterials(), isTransparent(), operator=(), render(), renderForBodySelection(), and renderForPrimitiveSelection().

Viewable GLC_3DViewInstance::m_ViewableFlag
private

Flag to know if the instance is viewable.

Definition at line 357 of file glc_3dviewinstance.h.

Referenced by deepCopy(), operator=(), and setViewable().

QVector<bool> GLC_3DViewInstance::m_ViewableGeomFlag
private

vector of Flag to know if geometies of this instance are viewable

Definition at line 360 of file glc_3dviewinstance.h.

Referenced by operator=(), render(), and setViewable().


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

©2005-2013 Laurent Ribon