15 #include <QtGui/qopengl.h>
17 #include <QSharedPointer>
31 typedef QSharedPointer<const ccMaterial>
CShared;
33 typedef QSharedPointer<ccMaterial>
Shared;
42 inline const QString&
getName()
const {
return m_name; }
45 return m_textureFilename;
54 m_diffuseFront =
color;
58 m_diffuseBack =
color;
62 return m_diffuseFront;
75 inline void setIllum(
int illum) { m_illum = illum; }
77 inline int getIllum()
const {
return m_illum; }
145 bool skipDiffuse)
const;
154 const QString& absoluteFilename = QString(),
155 bool mirrorImage =
false);
196 const QString& absoluteFilename);
217 const QString& absoluteFilename);
238 bool toFile(QFile& out,
short dataVersion)
const override;
std::shared_ptr< core::Tensor > image
Mesh (triangle) material.
float getClearcoatRoughness() const
Returns clearcoat roughness.
void setMetallic(float val)
Sets metallic factor (PBR)
bool isSerializable() const override
Returns whether object is serializable of not.
static void AddTexture(const QImage &image, const QString &absoluteFilename)
Adds a texture to the global texture DB.
QString getUniqueIdentifier() const
Returns unique identifier (UUID)
TextureMapType
Texture map types for PBR materials.
bool compare(const ccMaterial &mtl) const
Compares this material with another one.
bool loadAndSetTextureMap(TextureMapType type, const QString &absoluteFilename)
Load and set a specific texture map type.
float m_clearcoatRoughness
short minimumFileVersion() const override
Returns the minimum file version required to save this instance.
bool hasTexture() const
Returns whether the material has an associated texture or not.
GLuint getTextureID() const
Returns the texture ID (if any)
float getRoughness() const
Returns roughness factor.
void setSheen(float val)
Sets sheen factor (PBR)
float getSheen() const
Returns sheen factor.
std::map< TextureMapType, std::vector< QString > > m_textureFilenames
float getAmbientOcclusion() const
Returns ambient occlusion factor.
ecvColor::Rgbaf m_diffuseBack
void setAmbientOcclusion(float val)
Sets ambient occlusion factor (PBR)
ecvColor::Rgbaf m_specular
static QImage GetTexture(const QString &absoluteFilename)
Returns the texture image associated to a given name.
void setShininess(float val)
Sets shininess (both front - 100% - and back - 80%)
bool toFile(QFile &out, short dataVersion) const override
void setDiffuseFront(const ecvColor::Rgbaf &color)
Sets diffuse color (front)
float getMetallic() const
Returns metallic factor.
QSharedPointer< const ccMaterial > CShared
Const + Shared type.
std::vector< QString > getTextureFilenames(TextureMapType type) const
Get all texture filenames for a specific map type.
float getShininessFront() const
Returns front shininess.
ecvColor::Rgbaf m_diffuseFront
void releaseTexture()
Release the texture.
QString getTextureFilename(TextureMapType type) const
Get texture filename for a specific map type (returns first one)
void applyGL(const QOpenGLContext *context, bool lightEnabled, bool skipDiffuse) const
Apply parameters (OpenGL)
void setName(QString name)
Sets the material name.
void setIllum(int illum)
Sets illum mode.
const ecvColor::Rgbaf & getEmission() const
Returns emission color.
void setEmission(const ecvColor::Rgbaf &color)
Sets emission color.
int getIllum() const
Returns illum mode.
void setDiffuseBack(const ecvColor::Rgbaf &color)
Sets diffuse color (back)
const ecvColor::Rgbaf & getSpecular() const
Returns specular color.
void setAmbient(const ecvColor::Rgbaf &color)
Sets ambient color.
void setTexture(const QImage &image, const QString &absoluteFilename=QString(), bool mirrorImage=false)
Sets texture.
void setShininessFront(float val)
Sets shininess (front)
const ecvColor::Rgbaf & getDiffuseFront() const
Returns front diffuse color.
bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads data from binary stream.
void setRoughness(float val)
Sets roughness factor (PBR)
ecvColor::Rgbaf m_emission
const QImage & getTexture() const
Returns the texture (if any)
void setShininessBack(float val)
Sets shininess (back)
QSharedPointer< ccMaterial > Shared
Shared type.
void setDiffuse(const ecvColor::Rgbaf &color)
Sets diffuse color (both front and back)
bool hasTextureMap(TextureMapType type) const
Check if a specific texture map type exists.
float getShininessBack() const
Returns back shininess.
const QString & getTextureFilename() const
Returns the texture filename (if any)
void setAnisotropy(float val)
Sets anisotropy factor (PBR)
void setClearcoat(float val)
Sets clearcoat factor (PBR)
void setSpecular(const ecvColor::Rgbaf &color)
Sets specular color.
float getClearcoat() const
Returns clearcoat factor.
QString m_textureFilename
std::vector< std::pair< TextureMapType, QString > > getAllTextureFilenames() const
Get all texture map filenames.
const ecvColor::Rgbaf & getAmbient() const
Returns ambient color.
bool loadAndSetTexture(const QString &absoluteFilename)
Loads texture from file (and set it if successful)
float getAnisotropy() const
Returns anisotropy factor.
ccMaterial(const QString &name=QString("default"))
Default constructor.
ccMaterial(const ccMaterial &mtl)
Copy constructor.
void setClearcoatRoughness(float val)
Sets clearcoat roughness (PBR)
ecvColor::Rgbaf m_ambient
void setTransparency(float val)
Sets transparency (all colors)
const QString & getName() const
Returns the material name.
static void ReleaseTextures()
Release all texture objects.
const ecvColor::Rgbaf & getDiffuseBack() const
Returns back diffuse color.
Serializable object interface.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
constexpr ColorCompType OPACITY