![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Mesh (triangle) material. More...
#include <ecvMaterial.h>
Public Types | |
| enum | TextureMapType { TextureMapType::DIFFUSE, TextureMapType::AMBIENT, TextureMapType::SPECULAR, TextureMapType::NORMAL, TextureMapType::METALLIC, TextureMapType::ROUGHNESS, TextureMapType::SHININESS, TextureMapType::EMISSIVE, TextureMapType::OPACITY, TextureMapType::DISPLACEMENT, TextureMapType::REFLECTION, TextureMapType::SHEEN, TextureMapType::CLEARCOAT, TextureMapType::CLEARCOAT_ROUGHNESS, TextureMapType::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.
| typedef QSharedPointer<const ccMaterial> ccMaterial::CShared |
Const + Shared type.
| typedef QSharedPointer<ccMaterial> ccMaterial::Shared |
Shared type.
|
strong |
|
explicit |
Default constructor.
References setShininess().
| ccMaterial::ccMaterial | ( | const ccMaterial & | mtl | ) |
Copy constructor.
|
static |
Adds a texture to the global texture DB.
References image, and s_textureDB.
Referenced by define_ccMaterial().
| void ccMaterial::applyGL | ( | const QOpenGLContext * | context, |
| bool | lightEnabled, | ||
| bool | skipDiffuse | ||
| ) | const |
Apply parameters (OpenGL)
References context.
| bool ccMaterial::compare | ( | const ccMaterial & | mtl | ) | const |
Compares this material with another one.
References m_ambient, m_diffuseBack, m_diffuseFront, m_emission, m_illum, m_name, m_shininessBack, m_shininessFront, m_specular, and m_textureFilename.
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< ccMaterial::TextureMapType, QString > > ccMaterial::getAllTextureFilenames | ( | ) | const |
Get all texture map filenames.
Returns all textures including multiple textures of the same type
References m_textureFilenames, cloudViewer::core::make_pair(), and result.
|
inline |
Returns ambient color.
Referenced by define_ccMaterial(), and PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns ambient occlusion factor.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns anisotropy factor.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns clearcoat factor.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns clearcoat roughness.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns back diffuse color.
Referenced by define_ccMaterial().
|
inline |
Returns front diffuse color.
Referenced by define_ccMaterial(), and PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns emission color.
Referenced by define_ccMaterial(), and PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns illum mode.
Referenced by define_ccMaterial().
|
inline |
Returns metallic factor.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns the material name.
Referenced by define_ccMaterial(), PclUtils::renders::MaterialConverter::FromCCMaterial(), and PclUtils::renders::MaterialConverter::HasPBREncoding().
|
inline |
Returns roughness factor.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns sheen factor.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns back shininess.
Referenced by define_ccMaterial().
|
inline |
Returns front shininess.
Referenced by define_ccMaterial(), and PclUtils::renders::MaterialConverter::FromCCMaterial().
|
inline |
Returns specular color.
Referenced by define_ccMaterial(), and PclUtils::renders::MaterialConverter::FromCCMaterial().
| const QImage & ccMaterial::getTexture | ( | ) | const |
Returns the texture (if any)
References m_textureFilename, and s_textureDB.
Referenced by define_ccMaterial(), getTextureID(), and ccGenericMesh::updateTextures().
|
static |
Returns the texture image associated to a given name.
References s_textureDB.
Referenced by PclUtils::renders::MultiTextureRenderer::Apply(), define_ccMaterial(), PclUtils::renders::TextureLoader::LoadFromCCMaterial(), PclUtils::renders::TextureLoader::LoadFromPCLMaterial(), ccMaterialSet::saveAsMTL(), and ToFbxMesh().
|
inline |
Returns the texture filename (if any)
Referenced by define_ccMaterial(), and PclUtils::renders::MaterialConverter::FromCCMaterial().
| QString ccMaterial::getTextureFilename | ( | TextureMapType | type | ) | const |
Get texture filename for a specific map type (returns first one)
References m_textureFilenames, and type.
| 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)
References m_textureFilenames, and type.
Referenced by PclUtils::renders::MaterialConverter::FromCCMaterial().
| GLuint ccMaterial::getTextureID | ( | ) | const |
Returns the texture ID (if any)
References getTexture(), and image.
Referenced by define_ccMaterial().
|
inline |
Returns unique identifier (UUID)
Referenced by define_ccMaterial().
| bool ccMaterial::hasTexture | ( | ) | const |
Returns whether the material has an associated texture or not.
References m_textureFilename, and s_textureDB.
Referenced by define_ccMaterial().
| bool ccMaterial::hasTextureMap | ( | TextureMapType | type | ) | const |
Check if a specific texture map type exists.
References m_textureFilenames, and type.
Referenced by PclUtils::renders::MaterialConverter::HasPBREncoding().
|
inlineoverridevirtual |
Returns whether object is serializable of not.
Reimplemented from ccSerializableObject.
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.
References image, m_textureFilename, s_textureDB, setTexture(), CVTools::ToNativeSeparators(), and CVLog::Warning().
Referenced by define_ccMaterial(), and ccGenericMesh::updateTextures().
| bool ccMaterial::loadAndSetTextureMap | ( | TextureMapType | type, |
| const QString & | absoluteFilename | ||
| ) |
Load and set a specific texture map type.
References DIFFUSE, image, m_textureFilename, m_textureFilenames, CVLog::PrintDebug(), CVLog::PrintVerbose(), s_textureDB, CVTools::ToNativeSeparators(), type, and CVLog::Warning().
|
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.
References m_textureFilename, CVLog::Print(), and s_textureDB.
Referenced by define_ccMaterial().
|
static |
Release all texture objects.
Should be called BEFORE the global shared context is destroyed.
References s_textureDB.
Referenced by define_ccMaterial(), and ecvApplicationBase::ecvApplicationBase().
|
inline |
|
inline |
Sets ambient occlusion factor (PBR)
|
inline |
Sets anisotropy factor (PBR)
|
inline |
Sets clearcoat factor (PBR)
|
inline |
Sets clearcoat roughness (PBR)
| void ccMaterial::setDiffuse | ( | const ecvColor::Rgbaf & | color | ) |
Sets diffuse color (both front and back)
References color, setDiffuseBack(), and setDiffuseFront().
Referenced by define_ccMaterial().
|
inline |
|
inline |
|
inline |
|
inline |
Sets illum mode.
Referenced by define_ccMaterial().
|
inline |
Sets metallic factor (PBR)
|
inline |
|
inline |
Sets roughness factor (PBR)
|
inline |
Sets sheen factor (PBR)
| void ccMaterial::setShininess | ( | float | val | ) |
Sets shininess (both front - 100% - and back - 80%)
References setShininessBack(), and setShininessFront().
Referenced by ccMaterial(), and define_ccMaterial().
|
inline |
Sets shininess (back)
Referenced by define_ccMaterial(), and setShininess().
|
inline |
Sets shininess (front)
Referenced by define_ccMaterial(), and setShininess().
|
inline |
| 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.
References image, m_textureFilename, m_uniqueID, CVLog::PrintDebug(), s_textureDB, size, CVTools::ToNativeSeparators(), and CVLog::Warning().
Referenced by define_ccMaterial(), and loadAndSetTexture().
| void ccMaterial::setTransparency | ( | float | val | ) |
Sets transparency (all colors)
References ecvColor::RgbaTpl< Type >::a, m_ambient, m_diffuseBack, m_diffuseFront, m_emission, and m_specular.
Referenced by define_ccMaterial().
|
overridevirtual |
Reimplemented from ccSerializableObject.
Referenced by define_ccMaterial().
|
protected |
Referenced by compare(), and setTransparency().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by compare(), and setTransparency().
|
protected |
Referenced by compare(), and setTransparency().
|
protected |
Referenced by compare(), and setTransparency().
|
protected |
Referenced by compare().
|
protected |
|
protected |
Referenced by compare().
|
protected |
|
protected |
|
protected |
Referenced by compare(), and setTransparency().
|
protected |
Referenced by compare(), getTexture(), hasTexture(), loadAndSetTexture(), loadAndSetTextureMap(), releaseTexture(), and setTexture().
|
protected |
Referenced by getAllTextureFilenames(), getTextureFilename(), getTextureFilenames(), hasTextureMap(), and loadAndSetTextureMap().
|
protected |
Referenced by setTexture().