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 getWidth() { return m_info.width; }
|
||||||
int getHeight() { return m_info.height; }
|
int getHeight() { return m_info.height; }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
FILE * m_fp;
|
FILE * m_fp;
|
||||||
header_t m_header;
|
header_t m_header;
|
||||||
info_t m_info;
|
info_t m_info;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
#include "Material.h"
|
#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
|
class Material
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Material(const Color & rgb = Color::white);
|
/* static members */
|
||||||
static const Material white;
|
static const Material white;
|
||||||
|
|
||||||
|
Material();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Color m_rgb;
|
Color m_diffuse_color;
|
||||||
|
Color m_specular_color;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,7 +32,7 @@ class Scene
|
|||||||
~Scene();
|
~Scene();
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
/* private methods */
|
/* private methods */
|
||||||
void load(const char * filename);
|
void load(const char * filename);
|
||||||
void renderPixel(int x, int y, unsigned char * pixel);
|
void renderPixel(int x, int y, unsigned char * pixel);
|
||||||
|
@ -11,7 +11,7 @@ class Plane : public Shape
|
|||||||
IntersectList intersect(const Ray & ray);
|
IntersectList intersect(const Ray & ray);
|
||||||
Vector getNormalAt(const Vector & pt);
|
Vector getNormalAt(const Vector & pt);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
double m_a, m_b, m_c, m_d;
|
double m_a, m_b, m_c, m_d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class Sphere : public Shape
|
|||||||
IntersectList intersect(const Ray & ray);
|
IntersectList intersect(const Ray & ray);
|
||||||
Vector getNormalAt(const Vector & pt);
|
Vector getNormalAt(const Vector & pt);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
double m_radius;
|
double m_radius;
|
||||||
double m_radius2;
|
double m_radius2;
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ class Ray
|
|||||||
Vector getPositionAt(double dist) const;
|
Vector getPositionAt(double dist) const;
|
||||||
Vector operator[](double dist) const { return getPositionAt(dist); }
|
Vector operator[](double dist) const { return getPositionAt(dist); }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
Vector m_origin;
|
Vector m_origin;
|
||||||
Vector m_direction;
|
Vector m_direction;
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ class Vector
|
|||||||
Vector proj(const Vector & target) const;
|
Vector proj(const Vector & target) const;
|
||||||
Vector reflect(const Vector & target) const;
|
Vector reflect(const Vector & target) const;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
double m_array[3];
|
double m_array[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user