diff -r 2c154aad7f33 -r 303583d2fb97 include/scene.h --- a/include/scene.h Sat Apr 12 02:02:45 2008 +0200 +++ b/include/scene.h Mon Apr 14 12:51:50 2008 +0200 @@ -132,12 +132,13 @@ { public: Colour colour; + Texture *texture; Float ambient, diffuse, specular, shininess; // Phong constants Float reflectivity; // how much reflective is the surface Float transmissivity, refract_index; // part of light which can be refracted; index of refraction - Texture *texture; + bool smooth; // triangle smoothing - Material(const Colour &acolour): colour(acolour), texture(NULL) + Material(const Colour &acolour): colour(acolour), texture(NULL), smooth(false) { ambient = 0.2; diffuse = 0.8; @@ -153,6 +154,7 @@ void setReflectivity(const Float refl) { reflectivity = refl; }; void setTransmissivity(const Float trans, const Float rindex) { transmissivity = trans; refract_index = rindex; }; + void setSmooth(bool sm) { smooth = sm; }; }; /** @@ -247,6 +249,7 @@ { public: Vector3 N; + NormalVertex(const NormalVertex *v): Vertex(v->P), N(v->N) {}; NormalVertex(const Vector3 &aP): Vertex(aP) {}; NormalVertex(const Vector3 &aP, const Vector3 &aN): Vertex(aP), N(aN) {}; const Vector3 &getNormal() { return N; }; @@ -271,7 +274,6 @@ Float pla[6], plb[6], plc[6]; #endif Vector3 N; - bool smooth; const Vector3 smooth_normal(const Vector3 &P) const { #ifdef TRI_BARI_PRE @@ -300,11 +302,8 @@ bool intersect(const Ray &ray, Float &dist) const; bool intersect_all(const Ray &ray, Float dist, vector &allts) const {return false;}; bool intersect_bbox(const BBox &bbox) const; - const Vector3 normal(const Vector3 &P) const { return (smooth ? smooth_normal(P) : N); }; + const Vector3 normal(const Vector3 &P) const { return (material->smooth ? smooth_normal(P) : N); }; const Vector3 getNormal() const { return N; }; - void setSmooth() { smooth = true; };//(typeid(*A) == typeid(*B) == typeid(*C) == typeid(NormalVertex)); }; - void setFlat() { smooth = false; }; - bool getSmooth() const { return smooth; }; BBox get_bbox() const; };