//---------------------------------------------------------------------------- // William Baxter III's Ray Tracer // // Project for Comp 238, Raster Graphics // University of North Carolina at Chapel Hill // // $Id:$ //---------------------------------------------------------------------------- #ifndef WB3SCENE_H #define WB3SCENE_H #include #include "wb3TArray.h" #include "wb3Artifact.hpp" class wb3Light; typedef wb3TArray wb3LightArray; // A scene is just an artifact container with // (1) a background color // and (2) a list of lights class wb3Scene : public wb3Artifact { public: wb3Scene(wb3Artifact *pArtifact); wb3Scene(wb3Artifact *pArtifact, float BGColor[3]); ~wb3Scene() {}; void SetArtifact(wb3Artifact *obj); wb3Artifact *GetArtifact() const; void SetCamera(Camera *cam); Camera *GetCamera() const; void AddLight(wb3Light *pLight); const wb3LightArray& GetLights() const; virtual const wb3Artifact* Intersect(const Ray3f& r, float *idist, const wb3Artifact* ignore =0) const; virtual void GetNormal(const Ray3f& r, const Vec3f &isect, Vec3f& normal) const; virtual void Shade(const wb3Scene* scene, const wb3Artifact* from, const wb3Artifact* hit, const Ray3f& r, const Vec3f &isect, Vec3f& color, Vec3f& attenuation, int hits) const; protected: Vec3f m_fBGColor; wb3Artifact *m_pArtifact; Camera *m_pCam; wb3LightArray m_Lights; static wb3Material m_DummyMaterial; }; //---------------------------------------------------------------------------- inline void wb3Scene::SetArtifact(wb3Artifact *pObj) { m_pArtifact = pObj; } //---------------------------------------------------------------------------- inline wb3Artifact* wb3Scene::GetArtifact() const { return m_pArtifact; } //---------------------------------------------------------------------------- inline void wb3Scene::SetCamera(Camera *pCam) { m_pCam = pCam; } //---------------------------------------------------------------------------- inline Camera* wb3Scene::GetCamera() const { return m_pCam; } //---------------------------------------------------------------------------- inline void wb3Scene::AddLight(wb3Light *pLight) { m_Lights.Add(pLight); } //---------------------------------------------------------------------------- inline const wb3LightArray& wb3Scene::GetLights() const { return m_Lights; } //---------------------------------------------------------------------------- #endif