GLC_Material Class Reference

GLC_Material : OpenGL surface material properties. More...

#include <glc_material.h>

Inheritance diagram for GLC_Material:
GLC_Object

List of all members.

Public Member Functions

Constructor / Destructor

 GLC_Material ()
 GLC_Material (const QColor &)
 GLC_Material (const QString &name, const GLfloat *)
 GLC_Material (GLC_Texture *pTexture, const char *pName)
 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 setLightEmission (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 (void)
 Load the texture.
virtual void glExecute ()
 Execute OpenGL Material.
virtual void glExecute (float)
 Execute OpenGL Material with overWrite transparency.

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_LightEmission
 emmisive lighting
GLfloat m_fShininess
 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.

Detailed Description

GLC_Material : OpenGL surface material properties.

An GLC_Material specifies surface material properties

Definition at line 51 of file glc_material.h.


Constructor & Destructor Documentation

GLC_Material::GLC_Material (  ) 

Construct Colored GLC_Material Default constructor

Definition at line 40 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 60 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 77 of file glc_material.cpp.

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

GLC_Material::GLC_Material ( GLC_Texture pTexture,
const char *  pName 
)

Construct textured GLC_Material.

Definition at line 105 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 130 of file glc_material.cpp.

References m_pTexture.

GLC_Material::~GLC_Material ( void   )  [virtual]

Remove material where used geometry.

Definition at line 152 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 373 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

Get Ambiant color.

Definition at line 168 of file glc_material.cpp.

References m_AmbientColor.

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

quint32 GLC_Material::chunckID (  )  [static]

Return the class Chunk ID.

Definition at line 162 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 393 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 186 of file glc_material.cpp.

References m_LightEmission.

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

void GLC_Material::glExecute ( float  overwriteTransparency  )  [virtual]

Execute OpenGL Material with overWrite transparency.

Definition at line 525 of file glc_material.cpp.

References ambientColor(), diffuseColor(), emissiveColor(), GLC_Texture::glcBindTexture(), m_fShininess, m_pTexture, and specularColor().

void GLC_Material::glExecute (  )  [virtual]
void GLC_Material::glLoadTexture ( void   ) 

Load the texture.

Definition at line 465 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 580 of file glc_material.cpp.

References m_DiffuseColor.

Referenced by GLC_Material().

void GLC_Material::initOtherColor ( void   )  [private]

Init other color.

Definition at line 586 of file glc_material.cpp.

References m_AmbientColor, m_LightEmission, 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 137 of file glc_material.h.

double GLC_Material::opacity (  )  const [inline]

Return the material opacity.

Definition at line 133 of file glc_material.h.

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

GLC_Material& GLC_Material::operator= ( const GLC_Material mat  )  [inline]

Assignement operator.

The Hash Table WhereUse is not modified

Definition at line 158 of file glc_material.h.

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

Return true if materials are equivalent.

Definition at line 231 of file glc_material.cpp.

References m_AmbientColor, m_DiffuseColor, m_fShininess, m_LightEmission, m_Opacity, m_pTexture, and m_SpecularColor.

void GLC_Material::removeTexture (  ) 

remove Material Texture

Definition at line 363 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::setLightEmission ( const QColor &  lightEmission  ) 

Set Emissive.

Definition at line 336 of file glc_material.cpp.

References m_LightEmission, 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 279 of file glc_material.cpp.

References m_AmbientColor, m_DiffuseColor, m_fShininess, m_LightEmission, m_Opacity, m_pTexture, 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]

Get Shininess.

Definition at line 113 of file glc_material.h.

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

QColor GLC_Material::specularColor (  )  const

Get specular color.

Definition at line 180 of file glc_material.cpp.

References m_SpecularColor.

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

QString GLC_Material::textureFileName (  )  const

Get the texture File Name.

Definition at line 191 of file glc_material.cpp.

References GLC_Texture::fileName(), and m_pTexture.

GLC_Texture* GLC_Material::textureHandle (  )  const [inline]

Return the texture handle.

Definition at line 141 of file glc_material.h.

Referenced by operator<<(), GLC_WorldTo3dxml::writeCATRepresentationImage(), and GLC_WorldTo3dxml::writeImageFileIn3dxml().

GLuint GLC_Material::textureID (  )  const

Get Texture Id.

Definition at line 204 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 218 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 600 of file glc_material.cpp.

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

Definition at line 623 of file glc_material.cpp.


Member Data Documentation

QColor GLC_Material::m_AmbientColor [private]

Ambiant Color.

Definition at line 248 of file glc_material.h.

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

quint32 GLC_Material::m_ChunkId = 0xA703 [static, private]

Class chunk id.

Definition at line 273 of file glc_material.h.

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

QColor GLC_Material::m_DiffuseColor [private]
GLfloat GLC_Material::m_fShininess [private]

Shiness.

Definition at line 258 of file glc_material.h.

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

emmisive lighting

Definition at line 255 of file glc_material.h.

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

qreal GLC_Material::m_Opacity [private]

Set of id of other objects that uses this material.

Definition at line 264 of file glc_material.h.

Referenced by addUsage(), and delUsage().

Specular Color.

Definition at line 252 of file glc_material.h.

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

Hash table of geomtries which used this material.

Definition at line 261 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:

SourceForge.net Logo

©2005 Laurent Ribon