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:
parent
04b8ea5f9e
commit
18c0c8d45f
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ class Vector
|
||||
Vector proj(const Vector & target) const;
|
||||
Vector reflect(const Vector & target) const;
|
||||
|
||||
private:
|
||||
protected:
|
||||
double m_array[3];
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user