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 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.

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.

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 38 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 58 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 75 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 103 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 128 of file glc_material.cpp.

References m_pTexture.

GLC_Material::~GLC_Material ( void   )  [virtual]

Remove material where used geometry.

Definition at line 150 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 371 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 166 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 160 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 391 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 184 of file glc_material.cpp.

References m_EmissiveColor.

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

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

Load the texture.

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

References m_DiffuseColor.

Referenced by GLC_Material().

void GLC_Material::initOtherColor ( void   )  [private]

Init other color.

Definition at line 625 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]

Return the material opacity.

Definition at line 131 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 156 of file glc_material.h.

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

Return true if materials are equivalent.

Definition at line 229 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 361 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 334 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 277 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]

Get Shininess.

Definition at line 111 of file glc_material.h.

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

QColor GLC_Material::specularColor (  )  const

Get specular color.

Definition at line 178 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 189 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 139 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 202 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 216 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 639 of file glc_material.cpp.

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

Definition at line 662 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 [static, private]

Class chunk id.

Definition at line 271 of file glc_material.h.

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

QColor GLC_Material::m_DiffuseColor [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]

Set of id of other objects that uses this material.

Definition at line 262 of file glc_material.h.

Referenced by addUsage(), and delUsage().

GLfloat GLC_Material::m_Shininess [private]

Shiness.

Definition at line 256 of file glc_material.h.

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

Specular Color.

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

SourceForge.net Logo

©2005-2011 Laurent Ribon