GLC_lib
2.5.0
|
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. | |
![]() | |
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_Object & | operator= (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_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. | |
Additional Inherited Members | |
![]() | |
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. | |
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 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.
|
virtual |
Remove material where used geometry.
Definition at line 151 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 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 | ) |
Add the id to the other used Set.
This method is thread safe
Definition at line 410 of file glc_material.cpp.
References GLC_Object::id(), 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 167 of file glc_material.cpp.
References m_AmbientColor.
Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material(), glExecute(), operator<<(), setAmbientColor(), and GLC_WorldTo3dxml::writeMaterial().
|
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 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 | ) |
Remove the id to the other used Set.
This method is thread safe
Definition at line 426 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 173 of file glc_material.cpp.
References m_DiffuseColor.
Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material(), glExecute(), operator<<(), GLC_ObjMtlLoader::processMayaSpecific(), GLC_PointSprite::render(), setDiffuseColor(), GLC_WorldTo3dxml::writeMaterial(), GLC_WorldTo3dxml::writeOccurenceDefaultViewProperty(), and GLC_WorldTo3dxml::writeSurfaceAttributes().
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().
|
virtual |
Execute OpenGL Material.
Definition at line 477 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::OverwriteTransparencyAndMaterialRenderLoop(), GLC_Mesh::OverwriteTransparencyRenderLoop(), GLC_Mesh::primitiveRenderLoop(), GLC_Mesh::primitiveSelectedRenderLoop(), GLC_PointSprite::render(), GLC_Mesh::vboDrawPrimitivesGroupOf(), GLC_Mesh::vboDrawSelectedPrimitivesGroupOf(), GLC_Mesh::vertexArrayDrawPrimitivesGroupOf(), and GLC_Mesh::vertexArrayDrawSelectedPrimitivesGroupOf().
|
virtual |
Execute OpenGL Material with overWrite transparency.
Definition at line 551 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::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 |
Return the material hash code.
Definition at line 258 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::getMaterial().
|
inline |
Return true is material has attached texture.
Definition at line 95 of file glc_material.h.
Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material(), GLC_PointSprite::GLC_PointSprite(), GLC_Geometry::glPropGeom(), operator<<(), GLC_ObjMtlLoader::processMayaSpecific(), GLC_WorldTo3dxml::writeCATRepresentationImage(), GLC_WorldTo3dxml::writeMaterial(), and GLC_WorldTo3dxml::writeMaterialToCatMaterialRef().
|
private |
Init Ambiant Color.
Definition at line 623 of file glc_material.cpp.
References m_DiffuseColor.
Referenced by GLC_Material().
|
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().
|
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().
|
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().
|
inline |
Return the number of this material usage.
Definition at line 135 of file glc_material.h.
|
inline |
Return the material opacity.
Definition at line 131 of file glc_material.h.
Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material(), operator<<(), GLC_WorldTo3dxml::writeMaterial(), and GLC_WorldTo3dxml::writeOccurenceDefaultViewProperty().
|
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 | ( | ) |
void GLC_Material::setAmbientColor | ( | const QColor & | ambientColor | ) |
Set Ambiant Color.
Definition at line 314 of file glc_material.cpp.
References ambientColor(), 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 321 of file glc_material.cpp.
References diffuseColor(), m_DiffuseColor, and m_Opacity.
Referenced by GLC_ObjMtlLoader::extractRGBValue(), GLC_ColladaToWorld::loadCommonColorOrTexture(), GLC_3dxmlToWorld::loadGraphicProperties(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), GLC_3dxmlToWorld::loadV3DefaultViewProperty(), GLC_Axis::mouseReleased(), operator>>(), GLC_ObjMtlLoader::processMayaSpecific(), and GLC_Axis::select().
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 | ) |
Set the material opacity.
Definition at line 443 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_3dxmlToWorld::loadGraphicProperties(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), GLC_ColladaToWorld::loadTransparency(), and operator>>().
|
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 328 of file glc_material.cpp.
References m_Opacity, m_SpecularColor, and 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 342 of file glc_material.cpp.
References glLoadTexture(), and m_pTexture.
Referenced by GLC_ObjMtlLoader::extractTextureFileName(), GLC_ColladaToWorld::linkTexturesToMaterials(), GLC_3dsToWorld::loadMaterial(), GLC_3dxmlToWorld::loadMaterialDef(), operator>>(), and setMaterial().
|
inline |
Get Shininess.
Definition at line 111 of file glc_material.h.
Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material(), operator<<(), and GLC_WorldTo3dxml::writeMaterial().
QColor GLC_Material::specularColor | ( | ) | const |
Get specular color.
Definition at line 179 of file glc_material.cpp.
References m_SpecularColor.
Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material(), glExecute(), operator<<(), setSpecularColor(), and GLC_WorldTo3dxml::writeMaterial().
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().
|
inline |
Return the texture handle.
Definition at line 139 of file glc_material.h.
Referenced by GLC_WorldTo3ds::create3dsMaterialFromGLC_Material(), operator<<(), GLC_WorldTo3dxml::writeCATRepresentationImage(), and GLC_WorldTo3dxml::writeImageFileIn3dxml().
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.
|
friend |
Non-member stream operator.
Definition at line 643 of file glc_material.cpp.
|
friend |
Definition at line 666 of file glc_material.cpp.
|
private |
Ambiant Color.
Definition at line 246 of file glc_material.h.
Referenced by ambientColor(), hashCode(), initOtherColor(), operator==(), setAmbientColor(), setMaterial(), and setOpacity().
|
staticprivate |
Class chunk id.
Definition at line 271 of file glc_material.h.
Referenced by chunckID(), operator<<(), and operator>>().
|
private |
Diffuse Color.
Definition at line 248 of file glc_material.h.
Referenced by diffuseColor(), GLC_Material(), hashCode(), initDiffuseColor(), operator==(), setDiffuseColor(), setMaterial(), and setOpacity().
|
private |
emmisive lighting
Definition at line 253 of file glc_material.h.
Referenced by emissiveColor(), hashCode(), initOtherColor(), operator==(), setEmissiveColor(), setMaterial(), and setOpacity().
|
private |
Material opacity.
Definition at line 268 of file glc_material.h.
Referenced by hashCode(), operator==(), setAmbientColor(), setDiffuseColor(), setEmissiveColor(), setMaterial(), setOpacity(), and setSpecularColor().
|
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().
|
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().
|
private |
Shiness.
Definition at line 256 of file glc_material.h.
Referenced by glExecute(), hashCode(), operator==(), and setMaterial().
|
private |
Specular Color.
Definition at line 250 of file glc_material.h.
Referenced by hashCode(), initOtherColor(), operator==(), setMaterial(), setOpacity(), setSpecularColor(), and specularColor().
|
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().