74 lines
2.0 KiB
C++
74 lines
2.0 KiB
C++
|
|
#ifndef MATERIAL_H
|
|
#define MATERIAL_H MATERIAL_H
|
|
|
|
#include <FreeImage.h>
|
|
|
|
#include "Color.h"
|
|
|
|
class Material
|
|
{
|
|
public:
|
|
Material()
|
|
{
|
|
m_ambient_color = Color::white;
|
|
m_diffuse_color = Color::white;
|
|
m_specular_color = Color::white;
|
|
m_shininess = 50.0;
|
|
m_reflectance = 0.0;
|
|
m_transparency = 0.0;
|
|
m_refraction = 1.0;
|
|
m_texture = NULL;
|
|
}
|
|
|
|
void setAmbientColor(const Color & ambient)
|
|
{
|
|
m_ambient_color = ambient;
|
|
}
|
|
const Color & getAmbientColor() const { return m_ambient_color; }
|
|
|
|
void setDiffuseColor(const Color & diffuse)
|
|
{
|
|
m_diffuse_color = diffuse;
|
|
}
|
|
const Color & getDiffuseColor() const { return m_diffuse_color; }
|
|
|
|
void setSpecularColor(const Color & specular)
|
|
{
|
|
m_specular_color = specular;
|
|
}
|
|
const Color & getSpecularColor() const { return m_specular_color; }
|
|
|
|
void setShininess(double shininess) { m_shininess = shininess; }
|
|
double getShininess() const { return m_shininess; }
|
|
|
|
void setReflectance(double reflectance) { m_reflectance = reflectance; }
|
|
double getReflectance() const { return m_reflectance; }
|
|
|
|
void setRefraction(double refraction)
|
|
{
|
|
if (refraction > 0.0)
|
|
m_refraction = refraction;
|
|
}
|
|
double getRefraction() const { return m_refraction; }
|
|
|
|
void setTransparency(double t) { m_transparency = t; }
|
|
double getTransparency() const { return m_transparency; }
|
|
|
|
void setTexture(FIBITMAP * fib) { m_texture = fib; }
|
|
FIBITMAP * getTexture() const { return m_texture; }
|
|
|
|
protected:
|
|
Color m_ambient_color;
|
|
Color m_diffuse_color;
|
|
Color m_specular_color;
|
|
double m_shininess;
|
|
double m_reflectance;
|
|
double m_refraction;
|
|
double m_transparency;
|
|
FIBITMAP * m_texture;
|
|
};
|
|
|
|
#endif
|
|
|