added diffuse and specular colors to Material, switched all "private:" to "protected:"

git-svn-id: svn://anubis/fart/trunk@69 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-01-30 02:26:46 +00:00
parent 04b8ea5f9e
commit 18c0c8d45f
8 changed files with 15 additions and 11 deletions

View File

@ -42,7 +42,7 @@ public:
int getWidth() { return m_info.width; }
int getHeight() { return m_info.height; }
private:
protected:
FILE * m_fp;
header_t m_header;
info_t m_info;

View File

@ -1,9 +1,10 @@
#include "Material.h"
const Material Material::white(Color::white);
const Material Material::white;
Material::Material(const Color & rgb)
Material::Material()
{
m_rgb = rgb;
m_diffuse_color = Color::white;
m_specular_color = Color::white;
}

View File

@ -7,11 +7,14 @@
class Material
{
public:
Material(const Color & rgb = Color::white);
/* static members */
static const Material white;
Material();
protected:
Color m_rgb;
Color m_diffuse_color;
Color m_specular_color;
};
#endif

View File

@ -32,7 +32,7 @@ class Scene
~Scene();
void render();
private:
protected:
/* private methods */
void load(const char * filename);
void renderPixel(int x, int y, unsigned char * pixel);

View File

@ -11,7 +11,7 @@ class Plane : public Shape
IntersectList intersect(const Ray & ray);
Vector getNormalAt(const Vector & pt);
private:
protected:
double m_a, m_b, m_c, m_d;
};

View File

@ -11,7 +11,7 @@ class Sphere : public Shape
IntersectList intersect(const Ray & ray);
Vector getNormalAt(const Vector & pt);
private:
protected:
double m_radius;
double m_radius2;
};

View File

@ -15,7 +15,7 @@ class Ray
Vector getPositionAt(double dist) const;
Vector operator[](double dist) const { return getPositionAt(dist); }
private:
protected:
Vector m_origin;
Vector m_direction;
};

View File

@ -17,7 +17,7 @@ class Vector
Vector proj(const Vector & target) const;
Vector reflect(const Vector & target) const;
private:
protected:
double m_array[3];
};