added Color::operator*=(), added jitter computation to reflectance and transparency recursion, recursing now but there is still a jitter or recursion issue
git-svn-id: svn://anubis/fart/trunk@182 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
1f00625379
commit
e233056880
9 files changed
+71
-22
No files matched your search
@@ -71,6 +71,14 @@ Color & Color::operator-=(const Color & other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Color & Color::operator*=(double scale)
|
||||
{
|
||||
r *= scale;
|
||||
g *= scale;
|
||||
b *= scale;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Color operator+(const Color & c1, const Color & c2)
|
||||
{
|
||||
return Color(c1.r + c2.r, c1.g + c2.g, c1.b + c2.b);
|
||||
|
||||
@@ -21,6 +21,7 @@ class Color
|
||||
Color operator/(double scale) const;
|
||||
Color & operator+=(const Color & other);
|
||||
Color & operator-=(const Color & other);
|
||||
Color & operator*=(double scale);
|
||||
|
||||
static const Color black;
|
||||
static const Color white;
|
||||
|
||||
@@ -8,4 +8,5 @@ Material::Material()
|
||||
m_specular_color = Color::white;
|
||||
m_shininess = 50.0;
|
||||
m_reflectance = 0.0;
|
||||
m_transparency = 0.0;
|
||||
}
|
||||
@@ -33,12 +33,16 @@ class Material
|
||||
void setReflectance(double reflectance) { m_reflectance = reflectance; }
|
||||
double getReflectance() const { return m_reflectance; }
|
||||
|
||||
void setTransparency(double t) { m_transparency = t; }
|
||||
double getTransparency() const { return m_transparency; }
|
||||
|
||||
protected:
|
||||
Color m_ambient_color;
|
||||
Color m_diffuse_color;
|
||||
Color m_specular_color;
|
||||
double m_shininess;
|
||||
double m_reflectance;
|
||||
double m_transparency;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user