![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Mesh (triangle) material. More...
#include <ecvMaterial.h>


Public Types | |
| enum class | TextureMapType { DIFFUSE , AMBIENT , SPECULAR , NORMAL , METALLIC , ROUGHNESS , SHININESS , EMISSIVE , OPACITY , DISPLACEMENT , REFLECTION , SHEEN , CLEARCOAT , CLEARCOAT_ROUGHNESS , ANISOTROPY } |
| Texture map types for PBR materials. More... | |
| typedef QSharedPointer< const ccMaterial > | CShared |
| Const + Shared type. More... | |
| typedef QSharedPointer< ccMaterial > | Shared |
| Shared type. More... | |
Public Types inherited from ccSerializableObject | |
| enum | DeserializationFlags { DF_POINT_COORDS_64_BITS , DF_SCALAR_VAL_32_BITS = 2 } |
| Deserialization flags (bit-field) More... | |
| typedef QMultiMap< unsigned, unsigned > | LoadedIDMap |
| Map of loaded unique IDs (old ID --> new ID) More... | |
Public Member Functions | |
| ccMaterial (const QString &name=QString("default")) | |
| Default constructor. More... | |
| ccMaterial (const ccMaterial &mtl) | |
| Copy constructor. More... | |
| const QString & | getName () const |
| Returns the material name. More... | |
| const QString & | getTextureFilename () const |
| Returns the texture filename (if any) More... | |
| void | setName (QString name) |
| Sets the material name. More... | |
| void | setDiffuse (const ecvColor::Rgbaf &color) |
| Sets diffuse color (both front and back) More... | |
| void | setDiffuseFront (const ecvColor::Rgbaf &color) |
| Sets diffuse color (front) More... | |
| void | setDiffuseBack (const ecvColor::Rgbaf &color) |
| Sets diffuse color (back) More... | |
| const ecvColor::Rgbaf & | getDiffuseFront () const |
| Returns front diffuse color. More... | |
| const ecvColor::Rgbaf & | getDiffuseBack () const |
| Returns back diffuse color. More... | |
| void | setAmbient (const ecvColor::Rgbaf &color) |
| Sets ambient color. More... | |
| const ecvColor::Rgbaf & | getAmbient () const |
| Returns ambient color. More... | |
| void | setIllum (int illum) |
| Sets illum mode. More... | |
| int | getIllum () const |
| Returns illum mode. More... | |
| void | setSpecular (const ecvColor::Rgbaf &color) |
| Sets specular color. More... | |
| const ecvColor::Rgbaf & | getSpecular () const |
| Returns specular color. More... | |
| void | setEmission (const ecvColor::Rgbaf &color) |
| Sets emission color. More... | |
| const ecvColor::Rgbaf & | getEmission () const |
| Returns emission color. More... | |
| void | setShininess (float val) |
| Sets shininess (both front - 100% - and back - 80%) More... | |
| void | setShininessFront (float val) |
| Sets shininess (front) More... | |
| void | setShininessBack (float val) |
| Sets shininess (back) More... | |
| float | getShininessFront () const |
| Returns front shininess. More... | |
| float | getShininessBack () const |
| Returns back shininess. More... | |
| void | setTransparency (float val) |
| Sets transparency (all colors) More... | |
| void | setMetallic (float val) |
| Sets metallic factor (PBR) More... | |
| float | getMetallic () const |
| Returns metallic factor. More... | |
| void | setRoughness (float val) |
| Sets roughness factor (PBR) More... | |
| float | getRoughness () const |
| Returns roughness factor. More... | |
| void | setSheen (float val) |
| Sets sheen factor (PBR) More... | |
| float | getSheen () const |
| Returns sheen factor. More... | |
| void | setClearcoat (float val) |
| Sets clearcoat factor (PBR) More... | |
| float | getClearcoat () const |
| Returns clearcoat factor. More... | |
| void | setClearcoatRoughness (float val) |
| Sets clearcoat roughness (PBR) More... | |
| float | getClearcoatRoughness () const |
| Returns clearcoat roughness. More... | |
| void | setAnisotropy (float val) |
| Sets anisotropy factor (PBR) More... | |
| float | getAnisotropy () const |
| Returns anisotropy factor. More... | |
| void | setAmbientOcclusion (float val) |
| Sets ambient occlusion factor (PBR) More... | |
| float | getAmbientOcclusion () const |
| Returns ambient occlusion factor. More... | |
| void | applyGL (const QOpenGLContext *context, bool lightEnabled, bool skipDiffuse) const |
| Apply parameters (OpenGL) More... | |
| bool | hasTexture () const |
| Returns whether the material has an associated texture or not. More... | |
| void | setTexture (const QImage &image, const QString &absoluteFilename=QString(), bool mirrorImage=false) |
| Sets texture. More... | |
| bool | loadAndSetTexture (const QString &absoluteFilename) |
| Loads texture from file (and set it if successful) More... | |
| const QImage & | getTexture () const |
| Returns the texture (if any) More... | |
| GLuint | getTextureID () const |
| Returns the texture ID (if any) More... | |
| bool | loadAndSetTextureMap (TextureMapType type, const QString &absoluteFilename) |
| Load and set a specific texture map type. More... | |
| QString | getTextureFilename (TextureMapType type) const |
| Get texture filename for a specific map type (returns first one) More... | |
| std::vector< QString > | getTextureFilenames (TextureMapType type) const |
| Get all texture filenames for a specific map type. More... | |
| bool | hasTextureMap (TextureMapType type) const |
| Check if a specific texture map type exists. More... | |
| std::vector< std::pair< TextureMapType, QString > > | getAllTextureFilenames () const |
| Get all texture map filenames. More... | |
| void | releaseTexture () |
| Release the texture. More... | |
| bool | compare (const ccMaterial &mtl) const |
| Compares this material with another one. More... | |
| bool | isSerializable () const override |
| Returns whether object is serializable of not. More... | |
| bool | toFile (QFile &out, short dataVersion) const override |
| short | minimumFileVersion () const override |
| Returns the minimum file version required to save this instance. More... | |
| bool | fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override |
| Loads data from binary stream. More... | |
| QString | getUniqueIdentifier () const |
| Returns unique identifier (UUID) More... | |
Public Member Functions inherited from ccSerializableObject | |
| virtual | ~ccSerializableObject ()=default |
| Destructor. More... | |
Static Public Member Functions | |
| static QImage | GetTexture (const QString &absoluteFilename) |
| Returns the texture image associated to a given name. More... | |
| static void | AddTexture (const QImage &image, const QString &absoluteFilename) |
| Adds a texture to the global texture DB. More... | |
| static void | ReleaseTextures () |
| Release all texture objects. More... | |
Static Public Member Functions inherited from ccSerializableObject | |
| static bool | WriteError () |
| Sends a custom error message (write error) and returns 'false'. More... | |
| static bool | ReadError () |
| Sends a custom error message (read error) and returns 'false'. More... | |
| static bool | MemoryError () |
| Sends a custom error message (not enough memory) and returns 'false'. More... | |
| static bool | CorruptError () |
| Sends a custom error message (corrupted file) and returns 'false'. More... | |
Protected Attributes | |
| QString | m_name |
| QString | m_textureFilename |
| QString | m_uniqueID |
| int | m_illum |
| ecvColor::Rgbaf | m_diffuseFront |
| ecvColor::Rgbaf | m_diffuseBack |
| ecvColor::Rgbaf | m_ambient |
| ecvColor::Rgbaf | m_specular |
| ecvColor::Rgbaf | m_emission |
| float | m_shininessFront |
| float | m_shininessBack |
| float | m_metallic |
| float | m_roughness |
| float | m_sheen |
| float | m_clearcoat |
| float | m_clearcoatRoughness |
| float | m_anisotropy |
| float | m_ambientOcclusion |
| std::map< TextureMapType, std::vector< QString > > | m_textureFilenames |
Mesh (triangle) material.
Definition at line 28 of file ecvMaterial.h.
| typedef QSharedPointer<const ccMaterial> ccMaterial::CShared |
Const + Shared type.
Definition at line 31 of file ecvMaterial.h.
| typedef QSharedPointer<ccMaterial> ccMaterial::Shared |
Shared type.
Definition at line 33 of file ecvMaterial.h.
|
strong |
Texture map types for PBR materials.
| Enumerator | |
|---|---|
| DIFFUSE | |
| AMBIENT | |
| SPECULAR | |
| NORMAL | |
| METALLIC | |
| ROUGHNESS | |
| SHININESS | |
| EMISSIVE | |
| OPACITY | |
| DISPLACEMENT | |
| REFLECTION | |
| SHEEN | |
| CLEARCOAT | |
| CLEARCOAT_ROUGHNESS | |
| ANISOTROPY | |
Definition at line 176 of file ecvMaterial.h.
|
explicit |
Default constructor.
| ccMaterial::ccMaterial | ( | const ccMaterial & | mtl | ) |
Copy constructor.
|
static |
Adds a texture to the global texture DB.
Referenced by define_ccMaterial().
| void ccMaterial::applyGL | ( | const QOpenGLContext * | context, |
| bool | lightEnabled, | ||
| bool | skipDiffuse | ||
| ) | const |
Apply parameters (OpenGL)
| bool ccMaterial::compare | ( | const ccMaterial & | mtl | ) | const |
Compares this material with another one.
Referenced by define_ccMaterial().
|
overridevirtual |
Loads data from binary stream.
| in | input file (already opened) |
| dataVersion | file version (for version-specific deserialization) |
| flags | deserialization flags (see ccSerializableObject::DeserializationFlags) |
| oldToNewIDMap | map to link old IDs with new IDs |
Note: When implementing, use dataVersion checks to handle differentversions:
Reimplemented from ccSerializableObject.
Referenced by define_ccMaterial().
| std::vector<std::pair<TextureMapType, QString> > ccMaterial::getAllTextureFilenames | ( | ) | const |
Get all texture map filenames.
Returns all textures including multiple textures of the same type
|
inline |
Returns ambient color.
Definition at line 72 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Returns ambient occlusion factor.
Definition at line 140 of file ecvMaterial.h.
|
inline |
Returns anisotropy factor.
Definition at line 135 of file ecvMaterial.h.
|
inline |
Returns clearcoat factor.
Definition at line 125 of file ecvMaterial.h.
|
inline |
Returns clearcoat roughness.
Definition at line 130 of file ecvMaterial.h.
|
inline |
Returns back diffuse color.
Definition at line 65 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Returns front diffuse color.
Definition at line 61 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Returns emission color.
Definition at line 91 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
|
inline |
Returns metallic factor.
Definition at line 110 of file ecvMaterial.h.
|
inline |
Returns the material name.
Definition at line 42 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Returns roughness factor.
Definition at line 115 of file ecvMaterial.h.
|
inline |
Returns sheen factor.
Definition at line 120 of file ecvMaterial.h.
|
inline |
Returns back shininess.
Definition at line 102 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Returns front shininess.
Definition at line 100 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Returns specular color.
Definition at line 84 of file ecvMaterial.h.
Referenced by define_ccMaterial().
| const QImage& ccMaterial::getTexture | ( | ) | const |
Returns the texture (if any)
Referenced by define_ccMaterial().
|
static |
Returns the texture image associated to a given name.
Referenced by define_ccMaterial(), and ToFbxMesh().
|
inline |
Returns the texture filename (if any)
Definition at line 44 of file ecvMaterial.h.
Referenced by define_ccMaterial().
| QString ccMaterial::getTextureFilename | ( | TextureMapType | type | ) | const |
Get texture filename for a specific map type (returns first one)
| std::vector<QString> ccMaterial::getTextureFilenames | ( | TextureMapType | type | ) | const |
Get all texture filenames for a specific map type.
Returns all textures of the specified type (e.g., all map_Kd textures)
| GLuint ccMaterial::getTextureID | ( | ) | const |
Returns the texture ID (if any)
Referenced by define_ccMaterial().
|
inline |
Returns unique identifier (UUID)
Definition at line 246 of file ecvMaterial.h.
Referenced by define_ccMaterial().
| bool ccMaterial::hasTexture | ( | ) | const |
Returns whether the material has an associated texture or not.
Referenced by define_ccMaterial().
| bool ccMaterial::hasTextureMap | ( | TextureMapType | type | ) | const |
Check if a specific texture map type exists.
|
inlineoverridevirtual |
Returns whether object is serializable of not.
Reimplemented from ccSerializableObject.
Definition at line 235 of file ecvMaterial.h.
Referenced by define_ccMaterial().
| bool ccMaterial::loadAndSetTexture | ( | const QString & | absoluteFilename | ) |
Loads texture from file (and set it if successful)
If the filename is not already in DB, the corresponding file will be loaded.
Referenced by define_ccMaterial().
| bool ccMaterial::loadAndSetTextureMap | ( | TextureMapType | type, |
| const QString & | absoluteFilename | ||
| ) |
Load and set a specific texture map type.
|
overridevirtual |
Returns the minimum file version required to save this instance.
To be overridden by subclasses to indicate their minimum required version. This enables the system to determine:
Implements ccSerializableObject.
Referenced by define_ccMaterial().
| void ccMaterial::releaseTexture | ( | ) |
Release the texture.
Referenced by define_ccMaterial().
|
static |
Release all texture objects.
Should be called BEFORE the global shared context is destroyed.
Referenced by define_ccMaterial().
|
inline |
Sets ambient color.
Definition at line 70 of file ecvMaterial.h.
References color.
Referenced by define_ccMaterial().
|
inline |
Sets ambient occlusion factor (PBR)
Definition at line 138 of file ecvMaterial.h.
|
inline |
Sets anisotropy factor (PBR)
Definition at line 133 of file ecvMaterial.h.
|
inline |
Sets clearcoat factor (PBR)
Definition at line 123 of file ecvMaterial.h.
|
inline |
Sets clearcoat roughness (PBR)
Definition at line 128 of file ecvMaterial.h.
| void ccMaterial::setDiffuse | ( | const ecvColor::Rgbaf & | color | ) |
Sets diffuse color (both front and back)
Referenced by define_ccMaterial().
|
inline |
Sets diffuse color (back)
Definition at line 57 of file ecvMaterial.h.
References color.
Referenced by define_ccMaterial().
|
inline |
Sets diffuse color (front)
Definition at line 53 of file ecvMaterial.h.
References color.
Referenced by define_ccMaterial().
|
inline |
Sets emission color.
Definition at line 87 of file ecvMaterial.h.
References color.
Referenced by define_ccMaterial().
|
inline |
|
inline |
Sets metallic factor (PBR)
Definition at line 108 of file ecvMaterial.h.
|
inline |
Sets the material name.
Definition at line 48 of file ecvMaterial.h.
References name.
Referenced by define_ccMaterial().
|
inline |
Sets roughness factor (PBR)
Definition at line 113 of file ecvMaterial.h.
|
inline |
Sets sheen factor (PBR)
Definition at line 118 of file ecvMaterial.h.
| void ccMaterial::setShininess | ( | float | val | ) |
Sets shininess (both front - 100% - and back - 80%)
Referenced by define_ccMaterial().
|
inline |
Sets shininess (back)
Definition at line 98 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Sets shininess (front)
Definition at line 96 of file ecvMaterial.h.
Referenced by define_ccMaterial().
|
inline |
Sets specular color.
Definition at line 80 of file ecvMaterial.h.
References color.
Referenced by define_ccMaterial().
| void ccMaterial::setTexture | ( | const QImage & | image, |
| const QString & | absoluteFilename = QString(), |
||
| bool | mirrorImage = false |
||
| ) |
Sets texture.
If no filename is provided, a random one will be generated.
Referenced by define_ccMaterial().
| void ccMaterial::setTransparency | ( | float | val | ) |
Sets transparency (all colors)
Referenced by define_ccMaterial().
|
overridevirtual |
Reimplemented from ccSerializableObject.
Referenced by define_ccMaterial().
|
protected |
Definition at line 256 of file ecvMaterial.h.
|
protected |
Definition at line 269 of file ecvMaterial.h.
|
protected |
Definition at line 268 of file ecvMaterial.h.
|
protected |
Definition at line 266 of file ecvMaterial.h.
|
protected |
Definition at line 267 of file ecvMaterial.h.
|
protected |
Definition at line 255 of file ecvMaterial.h.
|
protected |
Definition at line 254 of file ecvMaterial.h.
|
protected |
Definition at line 258 of file ecvMaterial.h.
|
protected |
Definition at line 252 of file ecvMaterial.h.
|
protected |
Definition at line 263 of file ecvMaterial.h.
|
protected |
Definition at line 249 of file ecvMaterial.h.
|
protected |
Definition at line 264 of file ecvMaterial.h.
|
protected |
Definition at line 265 of file ecvMaterial.h.
|
protected |
Definition at line 260 of file ecvMaterial.h.
|
protected |
Definition at line 259 of file ecvMaterial.h.
|
protected |
Definition at line 257 of file ecvMaterial.h.
|
protected |
Definition at line 250 of file ecvMaterial.h.
|
protected |
Definition at line 273 of file ecvMaterial.h.
|
protected |
Definition at line 251 of file ecvMaterial.h.