00001 /* 00002 File: Shape.h 00003 00004 Copyright(C) C. Kotterink, Computed Graphics 00005 */ 00006 #ifndef SHAPE_H 00007 #define SHAPE_H 00008 00009 #include<Color4.h> 00010 #include<DynamicObject.h> 00011 #include<AABoundingBox.h> 00012 #include<ShadeBlend.h> 00013 #include<Ray.h> 00014 00015 #include<real.h> 00016 00017 class ObjectFile; 00018 00021 class Shape : public DynamicObject 00022 { 00023 DYNAMIC_OBJECT; 00024 public: 00025 static const real step; 00026 static const real infinity; 00027 00028 virtual ~Shape(); 00029 00030 void setShade(ShadeBlend *s) { 00031 shade = RefBlend(s); 00032 } 00033 00034 virtual Vertex3 normal(const Vertex3 &v); 00035 virtual real intersect( 00036 const Ray &ray, real t = step, real T = infinity); 00037 virtual Color4 calculateShade( 00038 const SurfaceInfo &s, Vertex3 &transformed, Scene &scene); 00039 virtual void transform(Matrix4 &m); 00040 00041 // Inherited from DynamicObject 00042 void parseSymbol(Token &t, ObjectFile &file); 00043 void writeParams(ostream &stream); 00044 00045 protected: 00046 typedef RefCount<ShadeBlend> RefBlend; 00047 // Inherited from DynamicObject 00048 void createSymbols(); 00049 00050 RefShade shade; 00051 00052 private: 00053 typedef DynamicObject super; 00054 }; 00055 00056 #endif