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; }
94 void setShininess(
float val);
105 void setTransparency(
float val);
143 void applyGL(
const QOpenGLContext*
context,
145 bool skipDiffuse)
const;
148 bool hasTexture()
const;
153 void setTexture(
const QImage&
image,
154 const QString& absoluteFilename = QString(),
155 bool mirrorImage =
false);
162 bool loadAndSetTexture(
const QString& absoluteFilename);
165 const QImage& getTexture()
const;
168 GLuint getTextureID()
const;
171 static QImage GetTexture(
const QString& absoluteFilename);
195 bool loadAndSetTextureMap(TextureMapType
type,
196 const QString& absoluteFilename);
199 QString getTextureFilename(TextureMapType
type)
const;
204 std::vector<QString> getTextureFilenames(TextureMapType
type)
const;
207 bool hasTextureMap(TextureMapType
type)
const;
212 std::vector<std::pair<TextureMapType, QString>> getAllTextureFilenames()
216 static void AddTexture(
const QImage&
image,
217 const QString& absoluteFilename);
222 static void ReleaseTextures();
227 void releaseTexture();
238 bool toFile(QFile& out,
short dataVersion)
const override;
243 LoadedIDMap& oldToNewIDMap)
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.
QString getUniqueIdentifier() const
Returns unique identifier (UUID)
TextureMapType
Texture map types for PBR materials.
float m_clearcoatRoughness
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
void setDiffuseFront(const ecvColor::Rgbaf &color)
Sets diffuse color (front)
float getMetallic() const
Returns metallic factor.
QSharedPointer< const ccMaterial > CShared
Const + Shared type.
float getShininessFront() const
Returns front shininess.
ecvColor::Rgbaf m_diffuseFront
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 setShininessFront(float val)
Sets shininess (front)
const ecvColor::Rgbaf & getDiffuseFront() const
Returns front diffuse color.
void setRoughness(float val)
Sets roughness factor (PBR)
ecvColor::Rgbaf m_emission
void setShininessBack(float val)
Sets shininess (back)
QSharedPointer< ccMaterial > Shared
Shared type.
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
const ecvColor::Rgbaf & getAmbient() const
Returns ambient color.
float getAnisotropy() const
Returns anisotropy factor.
void setClearcoatRoughness(float val)
Sets clearcoat roughness (PBR)
ecvColor::Rgbaf m_ambient
const QString & getName() const
Returns the material name.
const ecvColor::Rgbaf & getDiffuseBack() const
Returns back diffuse color.
Serializable object interface.
virtual short minimumFileVersion() const =0
Returns the minimum file version required to save this instance.
virtual bool toFile(QFile &out, short dataVersion) const
Saves data to binary stream.
virtual bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
Loads data from binary stream.
constexpr ColorCompType OPACITY