src/SphereObject.h

Go to the documentation of this file.
00001 #ifndef SPHEREOBJECT_H
00002 #define SPHEREOBJECT_H
00003 
00004 
00005 #include "Object.h"
00006 #include "Sphere.h"
00007 
00008 
00014 class SphereObject : public Object
00015 {
00016 public:
00019     SphereObject();
00020 
00023     virtual ~SphereObject();
00024 
00029     virtual Object * createCopy()
00030     {
00031         return new SphereObject(*this);
00032     }
00033 
00036     virtual void setShader(Shader * sh)
00037     {
00038         mSphere->setShader(sh);
00039     }
00040 
00043     virtual void setCastShadows(bool b)
00044     {
00045         Object::setCastShadows(b);
00046         mSphere->setCastShadows(b);
00047     }
00048 
00049 protected:
00051     Sphere *    mSphere;
00052 
00053 
00059     SphereObject(const SphereObject & other);
00060 
00065     virtual bool doIntersect(Ray & localRay) const
00066     {
00067         return mSphere->intersect(localRay);
00068     }
00069 
00072     virtual void calcBounds()
00073     {
00074         mBoundingBox = mSphere->bounds();
00075     }
00076 
00079     virtual void buildAccelStructure()
00080     {
00081         calcBounds();
00082         // no need for acceleration structure
00083     }
00084 };
00085 
00086 
00087 #endif
00088 

Generated on Fri Feb 1 00:01:42 2008 for Grayfall by  doxygen 1.5.1