GLC_Material : OpenGL surface material properties. More...
#include <glc_material.h>
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_Material & | operator= (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_uint > | m_OtherUsage |
| Set of id of other objects that uses this material. | |
| GLC_Texture * | m_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_Texture * | textureHandle () const |
| Return the texture handle. | |
| uint | hashCode () const |
| Return the material hash code. | |
| static quint32 | chunckID () |
| Return the class Chunk ID. | |
GLC_Material : OpenGL surface material properties.
An GLC_Material specifies surface material properties
Definition at line 49 of file glc_material.h.
| 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.
| 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 | ) |
Add the id to the other used Set.
This method is thread safe
Definition at line 409 of file glc_material.cpp.
References GLC_Object::m_Mutex, and m_OtherUsage.
Referenced by GLC_RenderProperties::GLC_RenderProperties(), GLC_RenderProperties::operator=(), GLC_RenderProperties::setOverwriteMaterial(), GLC_SelectionMaterial::useMaterial(), and GLC_RenderProperties::useMaterial().
| 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] |
| 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 | ) |
Remove the id to the other used Set.
This method is thread safe
Definition at line 425 of file glc_material.cpp.
References GLC_Object::m_Mutex, m_OtherUsage, and GLC_Object::m_Uid.
Referenced by GLC_RenderProperties::clear(), GLC_RenderProperties::clearOverwritePrimitiveMaterials(), GLC_RenderProperties::setOverwriteMaterial(), GLC_RenderProperties::unUseMaterial(), GLC_SelectionMaterial::useDefautSelectionColor(), and GLC_SelectionMaterial::useMaterial().
| QColor GLC_Material::diffuseColor | ( | ) | const |
Get diffuse color.
Definition at line 172 of file glc_material.cpp.
References m_DiffuseColor.
Referenced by glExecute(), operator<<(), GLC_ObjMtlLoader::processMayaSpecific(), GLC_PointSprite::render(), GLC_WorldTo3dxml::writeMaterial(), and GLC_WorldTo3dxml::writeSurfaceAttributes().
| 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] |
Execute OpenGL Material with overWrite transparency.
Definition at line 548 of file glc_material.cpp.
References ambientColor(), GLC_Shader::currentShaderHandle(), diffuseColor(), emissiveColor(), GLC_Texture::glcBindTexture(), GLC_State::glslUsed(), GLC_Shader::hasActiveShader(), m_pTexture, m_Shininess, GLC_Shader::programShaderHandle(), and specularColor().
| void GLC_Material::glExecute | ( | ) | [virtual] |
Execute OpenGL Material.
Definition at line 476 of file glc_material.cpp.
References ambientColor(), GLC_Shader::currentShaderHandle(), diffuseColor(), emissiveColor(), GLC_Texture::glcBindTexture(), GLC_State::glslUsed(), GLC_Shader::hasActiveShader(), m_pTexture, m_Shininess, GLC_Shader::programShaderHandle(), and specularColor().
Referenced by GLC_SelectionMaterial::glExecute(), GLC_Geometry::glPropGeom(), GLC_Mesh::normalRenderLoop(), GLC_Mesh::OverwriteMaterialRenderLoop(), GLC_Mesh::OverwriteTransparencyRenderLoop(), GLC_Mesh::primitiveRenderLoop(), GLC_Mesh::primitiveSelectedRenderLoop(), GLC_PointSprite::render(), GLC_ImagePlane::render(), GLC_Mesh::vboDrawPrimitivesGroupOf(), GLC_Mesh::vboDrawSelectedPrimitivesGroupOf(), GLC_Mesh::vertexArrayDrawPrimitivesGroupOf(), and GLC_Mesh::vertexArrayDrawSelectedPrimitivesGroupOf().
| 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 |
Return the material hash code.
Definition at line 257 of file glc_material.cpp.
References GLC_Texture::fileName(), m_AmbientColor, m_DiffuseColor, m_EmissiveColor, m_Opacity, m_pTexture, m_Shininess, m_SpecularColor, and qHash().
Referenced by GLC_3dxmlToWorld::factorizeMaterial(), and GLC_3dxmlToWorld::getMaterial().
| bool GLC_Material::hasTexture | ( | ) | const [inline] |
Return true is material has attached texture.
Definition at line 95 of file glc_material.h.
Referenced by GLC_PointSprite::GLC_PointSprite(), GLC_Geometry::glPropGeom(), operator<<(), GLC_ObjMtlLoader::processMayaSpecific(), GLC_WorldTo3dxml::writeCATRepresentationImage(), GLC_WorldTo3dxml::writeMaterial(), and GLC_WorldTo3dxml::writeMaterialToCatMaterialRef().
| 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] |
Return true if the material is transparent.
Definition at line 124 of file glc_material.h.
Referenced by GLC_Geometry::addMaterial(), GLC_3DViewInstance::isTransparent(), GLC_RenderProperties::needToRenderWithTransparency(), GLC_Mesh::normalRenderLoop(), GLC_Mesh::OverwriteMaterialRenderLoop(), GLC_Mesh::primitiveRenderLoop(), GLC_Mesh::primitiveSelectedRenderLoop(), GLC_Geometry::removeMaterial(), GLC_Mesh::vboDrawPrimitivesGroupOf(), and GLC_Mesh::vertexArrayDrawPrimitivesGroupOf().
| bool GLC_Material::isUnused | ( | ) | const [inline] |
Return true if the material is used.
Definition at line 91 of file glc_material.h.
Referenced by GLC_RenderProperties::clear(), GLC_RenderProperties::clearOverwritePrimitiveMaterials(), GLC_Geometry::removeMaterial(), GLC_RenderProperties::setOverwriteMaterial(), GLC_RenderProperties::unUseMaterial(), GLC_SelectionMaterial::useDefautSelectionColor(), and GLC_SelectionMaterial::useMaterial().
| 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 | ( | ) |
| void GLC_Material::setAmbientColor | ( | const QColor & | ambientColor | ) |
Set Ambiant Color.
Definition at line 313 of file glc_material.cpp.
References m_AmbientColor, and m_Opacity.
Referenced by GLC_ObjMtlLoader::extractRGBValue(), GLC_3dxmlToWorld::getMaterial(), GLC_ColladaToWorld::loadCommonColorOrTexture(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), and operator>>().
| void GLC_Material::setDiffuseColor | ( | const QColor & | diffuseColor | ) |
Set Diffuse color.
Definition at line 320 of file glc_material.cpp.
References m_DiffuseColor, and m_Opacity.
Referenced by GLC_ObjMtlLoader::extractRGBValue(), GLC_ColladaToWorld::loadCommonColorOrTexture(), GLC_3dxmlToWorld::loadDefaultViewProperty(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), GLC_Axis::mouseReleased(), operator>>(), GLC_ObjMtlLoader::processMayaSpecific(), GLC_Axis::select(), and GLC_Line::setColor().
| 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 | ) |
Set the material opacity.
Definition at line 442 of file glc_material.cpp.
References m_AmbientColor, m_DiffuseColor, m_EmissiveColor, m_Opacity, m_SpecularColor, and m_WhereUsed.
Referenced by GLC_CuttingPlane::create3DviewInstance(), GLC_ObjMtlLoader::extractOneValue(), GLC_3dxmlToWorld::getMaterial(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), GLC_ColladaToWorld::loadTransparency(), and operator>>().
| void GLC_Material::setShininess | ( | GLfloat | Shininess | ) | [inline] |
Set Shininess.
Definition at line 181 of file glc_material.h.
Referenced by GLC_ObjMtlLoader::extractOneValue(), GLC_3dxmlToWorld::getMaterial(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), GLC_ColladaToWorld::loadShininess(), and operator>>().
| void GLC_Material::setSpecularColor | ( | const QColor & | specularColor | ) |
Set Specular color.
Definition at line 327 of file glc_material.cpp.
References m_Opacity, and m_SpecularColor.
Referenced by GLC_ObjMtlLoader::extractRGBValue(), GLC_3dxmlToWorld::getMaterial(), GLC_ColladaToWorld::loadCommonColorOrTexture(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), and operator>>().
| void GLC_Material::setTexture | ( | GLC_Texture * | pTexture | ) |
Set Texture.
Definition at line 341 of file glc_material.cpp.
References glLoadTexture(), and m_pTexture.
Referenced by GLC_ObjMtlLoader::extractTextureFileName(), GLC_ImagePlane::GLC_ImagePlane(), GLC_ColladaToWorld::linkTexturesToMaterials(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), operator>>(), and setMaterial().
| 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.
| 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.
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] |
Diffuse Color.
Definition at line 248 of file glc_material.h.
Referenced by diffuseColor(), GLC_Material(), hashCode(), initDiffuseColor(), operator==(), setDiffuseColor(), setMaterial(), and setOpacity().
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] |
Material opacity.
Definition at line 268 of file glc_material.h.
Referenced by hashCode(), operator==(), setAmbientColor(), setDiffuseColor(), setEmissiveColor(), setMaterial(), setOpacity(), and setSpecularColor().
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] |
Material's texture.
Definition at line 265 of file glc_material.h.
Referenced by GLC_Material(), glExecute(), glLoadTexture(), hashCode(), operator==(), removeTexture(), setMaterial(), setTexture(), textureFileName(), textureID(), textureIsLoaded(), and ~GLC_Material().
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().