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

GLC_Material : OpenGL surface material properties. More...

#include <glc_material.h>

+ Inheritance diagram for GLC_Material:

Public Member Functions

Constructor / Destructor
 GLC_Material ()
 
 GLC_Material (const QColor &)
 
 GLC_Material (const QString &name, const GLfloat *)
 
 GLC_Material (GLC_Texture *pTexture, const QString &name=QString())
 Construct textured GLC_Material.
 
 GLC_Material (const GLC_Material &InitMaterial)
 Copy constructor.
 
virtual ~GLC_Material (void)
 Remove material where used geometry.
 
Set Functions
GLC_Materialoperator= (const GLC_Material &mat)
 Assignement operator.
 
void setMaterial (const GLC_Material *)
 Set Material properties.
 
void setAmbientColor (const QColor &ambientColor)
 Set Ambiant Color.
 
void setDiffuseColor (const QColor &diffuseColor)
 Set Diffuse color.
 
void setSpecularColor (const QColor &specularColor)
 Set Specular color.
 
void setEmissiveColor (const QColor &lightEmission)
 Set Emissive.
 
void setShininess (GLfloat Shininess)
 Set Shininess.
 
void setTexture (GLC_Texture *pTexture)
 Set Texture.
 
void removeTexture ()
 remove Material Texture
 
bool addGLC_Geom (GLC_Geometry *pGeom)
 Add Geometry to the "where used" hash table.
 
bool delGLC_Geom (GLC_uint Key)
 Remove Geometry to the "where used" hash table.
 
bool addUsage (GLC_uint)
 Add the id to the other used Set.
 
bool delUsage (GLC_uint)
 Remove the id to the other used Set.
 
void setOpacity (const qreal)
 Set the material opacity.
 
OpenGL Functions
void glLoadTexture (QGLContext *pContext=NULL)
 Load the texture.
 
virtual void glExecute ()
 Execute OpenGL Material.
 
virtual void glExecute (float)
 Execute OpenGL Material with overWrite transparency.
 
- 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 initDiffuseColor (void)
 Init Ambiant Color.
 
void initOtherColor (void)
 Init other color.
 

Private Attributes

QColor m_AmbientColor
 Ambiant Color.
 
QColor m_DiffuseColor
 Diffuse Color.
 
QColor m_SpecularColor
 Specular Color.
 
QColor m_EmissiveColor
 emmisive lighting
 
GLfloat m_Shininess
 Shiness.
 
WhereUsed m_WhereUsed
 Hash table of geomtries which used this material.
 
QSet< GLC_uintm_OtherUsage
 Set of id of other objects that uses this material.
 
GLC_Texturem_pTexture
 Material's texture.
 
qreal m_Opacity
 Material opacity.
 

Static Private Attributes

static quint32 m_ChunkId = 0xA703
 Class chunk id.
 

Friends

QDataStream & operator<< (QDataStream &, const GLC_Material &)
 Non-member stream operator.
 
QDataStream & operator>> (QDataStream &, GLC_Material &)
 

Get Functions

bool isUnused () const
 Return true if the material is used.
 
bool hasTexture () const
 Return true is material has attached texture.
 
QColor ambientColor () const
 Get Ambiant color.
 
QColor diffuseColor () const
 Get diffuse color.
 
QColor specularColor () const
 Get specular color.
 
QColor emissiveColor () const
 Get the emissive color.
 
GLfloat shininess () const
 Get Shininess.
 
QString textureFileName () const
 Get the texture File Name.
 
GLuint textureID () const
 Get Texture Id.
 
bool textureIsLoaded () const
 return true if the texture is loaded
 
bool isTransparent () const
 Return true if the material is transparent.
 
bool operator== (const GLC_Material &) const
 Return true if materials are equivalent.
 
double opacity () const
 Return the material opacity.
 
int numberOfUsage () const
 Return the number of this material usage.
 
GLC_TexturetextureHandle () const
 Return the texture handle.
 
uint hashCode () const
 Return the material hash code.
 
static quint32 chunckID ()
 Return the class Chunk ID.
 

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_Material : OpenGL surface material properties.

An GLC_Material specifies surface material properties

Definition at line 49 of file glc_material.h.

Constructor & Destructor Documentation

GLC_Material::GLC_Material ( )

Construct Colored GLC_Material Default constructor

Definition at line 39 of file glc_material.cpp.

References initDiffuseColor(), and initOtherColor().

GLC_Material::GLC_Material ( const QColor &  diffuseColor)

By default, Ambiant Color is dark grey

Definition at line 59 of file glc_material.cpp.

References initOtherColor().

GLC_Material::GLC_Material ( const QString &  name,
const GLfloat *  pDiffuseColor 
)

By default, Ambiant Color is dark grey

Definition at line 76 of file glc_material.cpp.

References initDiffuseColor(), initOtherColor(), and m_DiffuseColor.

GLC_Material::GLC_Material ( GLC_Texture pTexture,
const QString &  name = QString() 
)

Construct textured GLC_Material.

Definition at line 104 of file glc_material.cpp.

References initDiffuseColor(), initOtherColor(), and m_pTexture.

GLC_Material::GLC_Material ( const GLC_Material InitMaterial)

Copy constructor.

Hast usage table are not copying

Definition at line 129 of file glc_material.cpp.

References m_pTexture.

GLC_Material::~GLC_Material ( void  )
virtual

Remove material where used geometry.

Definition at line 151 of file glc_material.cpp.

References m_pTexture.

Member Function Documentation

bool GLC_Material::addGLC_Geom ( GLC_Geometry pGeom)

Add Geometry to the "where used" hash table.

This method is thread safe

Definition at line 372 of file glc_material.cpp.

References GLC_Geometry::id(), GLC_Object::m_Mutex, and m_WhereUsed.

Referenced by GLC_Geometry::addMaterial().

bool GLC_Material::addUsage ( GLC_uint  id)
QColor GLC_Material::ambientColor ( ) const
quint32 GLC_Material::chunckID ( )
static

Return the class Chunk ID.

Definition at line 161 of file glc_material.cpp.

References m_ChunkId.

bool GLC_Material::delGLC_Geom ( GLC_uint  Key)

Remove Geometry to the "where used" hash table.

This method is thread safe

Definition at line 392 of file glc_material.cpp.

References GLC_Object::m_Mutex, and m_WhereUsed.

Referenced by GLC_Geometry::removeMaterial().

bool GLC_Material::delUsage ( GLC_uint  id)
QColor GLC_Material::diffuseColor ( ) const
QColor GLC_Material::emissiveColor ( ) const

Get the emissive color.

Definition at line 185 of file glc_material.cpp.

References m_EmissiveColor.

Referenced by glExecute(), operator<<(), and GLC_WorldTo3dxml::writeMaterial().

void GLC_Material::glExecute ( )
virtual
void GLC_Material::glExecute ( float  overwriteTransparency)
virtual
void GLC_Material::glLoadTexture ( QGLContext *  pContext = NULL)

Load the texture.

Definition at line 464 of file glc_material.cpp.

References GLC_Texture::glLoadTexture(), and m_pTexture.

Referenced by setTexture().

uint GLC_Material::hashCode ( ) const
bool GLC_Material::hasTexture ( ) const
inline
void GLC_Material::initDiffuseColor ( void  )
private

Init Ambiant Color.

Definition at line 623 of file glc_material.cpp.

References m_DiffuseColor.

Referenced by GLC_Material().

void GLC_Material::initOtherColor ( void  )
private

Init other color.

Definition at line 629 of file glc_material.cpp.

References m_AmbientColor, m_EmissiveColor, and m_SpecularColor.

Referenced by GLC_Material().

bool GLC_Material::isTransparent ( ) const
inline
bool GLC_Material::isUnused ( ) const
inline
int GLC_Material::numberOfUsage ( ) const
inline

Return the number of this material usage.

Definition at line 135 of file glc_material.h.

double GLC_Material::opacity ( ) const
inline
GLC_Material& GLC_Material::operator= ( const GLC_Material mat)
inline

Assignement operator.

The Hash Table WhereUse is not modified

Definition at line 156 of file glc_material.h.

bool GLC_Material::operator== ( const GLC_Material mat) const

Return true if materials are equivalent.

Definition at line 230 of file glc_material.cpp.

References m_AmbientColor, m_DiffuseColor, m_EmissiveColor, m_Opacity, m_pTexture, m_Shininess, and m_SpecularColor.

void GLC_Material::removeTexture ( )

remove Material Texture

Definition at line 362 of file glc_material.cpp.

References m_pTexture.

void GLC_Material::setAmbientColor ( const QColor &  ambientColor)
void GLC_Material::setDiffuseColor ( const QColor &  diffuseColor)
void GLC_Material::setEmissiveColor ( const QColor &  lightEmission)

Set Emissive.

Definition at line 335 of file glc_material.cpp.

References m_EmissiveColor, and m_Opacity.

Referenced by GLC_ColladaToWorld::loadCommonColorOrTexture(), and operator>>().

void GLC_Material::setMaterial ( const GLC_Material pMat)

Set Material properties.

The Hash Table WhereUse is not modified

Definition at line 278 of file glc_material.cpp.

References m_AmbientColor, m_DiffuseColor, m_EmissiveColor, m_Opacity, m_pTexture, m_Shininess, m_SpecularColor, m_WhereUsed, and setTexture().

void GLC_Material::setOpacity ( const qreal  alpha)
void GLC_Material::setShininess ( GLfloat  Shininess)
inline
void GLC_Material::setSpecularColor ( const QColor &  specularColor)
void GLC_Material::setTexture ( GLC_Texture pTexture)
GLfloat GLC_Material::shininess ( ) const
inline
QColor GLC_Material::specularColor ( ) const
QString GLC_Material::textureFileName ( ) const

Get the texture File Name.

Definition at line 190 of file glc_material.cpp.

References GLC_Texture::fileName(), and m_pTexture.

Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material().

GLC_Texture* GLC_Material::textureHandle ( ) const
inline
GLuint GLC_Material::textureID ( ) const

Get Texture Id.

Definition at line 203 of file glc_material.cpp.

References GLC_Texture::GL_ID(), and m_pTexture.

bool GLC_Material::textureIsLoaded ( ) const

return true if the texture is loaded

Definition at line 217 of file glc_material.cpp.

References GLC_Texture::isLoaded(), and m_pTexture.

Friends And Related Function Documentation

QDataStream& operator<< ( QDataStream &  ,
const GLC_Material  
)
friend

Non-member stream operator.

Definition at line 643 of file glc_material.cpp.

QDataStream& operator>> ( QDataStream &  ,
GLC_Material  
)
friend

Definition at line 666 of file glc_material.cpp.

Member Data Documentation

QColor GLC_Material::m_AmbientColor
private

Ambiant Color.

Definition at line 246 of file glc_material.h.

Referenced by ambientColor(), hashCode(), initOtherColor(), operator==(), setAmbientColor(), setMaterial(), and setOpacity().

quint32 GLC_Material::m_ChunkId = 0xA703
staticprivate

Class chunk id.

Definition at line 271 of file glc_material.h.

Referenced by chunckID(), operator<<(), and operator>>().

QColor GLC_Material::m_DiffuseColor
private
QColor GLC_Material::m_EmissiveColor
private

emmisive lighting

Definition at line 253 of file glc_material.h.

Referenced by emissiveColor(), hashCode(), initOtherColor(), operator==(), setEmissiveColor(), setMaterial(), and setOpacity().

qreal GLC_Material::m_Opacity
private
QSet<GLC_uint> GLC_Material::m_OtherUsage
private

Set of id of other objects that uses this material.

Definition at line 262 of file glc_material.h.

Referenced by addUsage(), and delUsage().

GLC_Texture* GLC_Material::m_pTexture
private
GLfloat GLC_Material::m_Shininess
private

Shiness.

Definition at line 256 of file glc_material.h.

Referenced by glExecute(), hashCode(), operator==(), and setMaterial().

QColor GLC_Material::m_SpecularColor
private

Specular Color.

Definition at line 250 of file glc_material.h.

Referenced by hashCode(), initOtherColor(), operator==(), setMaterial(), setOpacity(), setSpecularColor(), and specularColor().

WhereUsed GLC_Material::m_WhereUsed
private

Hash table of geomtries which used this material.

Definition at line 259 of file glc_material.h.

Referenced by addGLC_Geom(), delGLC_Geom(), setMaterial(), and setOpacity().


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

©2005-2013 Laurent Ribon