00001 /* 00002 toxic - A Global Illumination Renderer 00003 Copyright (C) 2003-2004 Francois Beaune 00004 Contact: http://toxicengine.sourceforge.net/ 00005 00006 This file is part of toxic. 00007 00008 toxic is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 toxic is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with toxic; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #ifndef TOXIC_RENDERER_SCENE_H 00024 #define TOXIC_RENDERER_SCENE_H 00025 00026 #include "common/math/point3.h" 00027 #include "common/math/vector3.h" 00028 #include "color3.h" 00029 #include "globals.h" 00030 #include "hit.h" 00031 #include "iobject.h" 00032 #include "ray.h" 00033 00034 #include <cassert> 00035 #include <vector> 00036 00037 namespace toxic { 00038 00039 class Context; 00040 class Hit; 00041 class ILight; 00042 00043 //! The scene is view-independant. 00044 //! It must contains at least one object (the root object). 00045 class Scene { 00046 public: 00047 Scene(); 00048 ~Scene(); //!< The scene deletes the root object when it is destructed. 00049 00050 //! Background color. Default is black. 00051 void SetBackgroundColor(const Color3 &color); 00052 const Color3 &GetBackgroundColor() const; 00053 00054 //! Sets an object as the root object. A scene *must* contains a root object. 00055 void SetRootObject(const IObject *object); 00056 const IObject *GetRootObject() const; 00057 00058 //! Ambient illumination. Default is none. 00059 //!\todo Move ambient illumination to a class derived from ILight. 00060 void SetAmbientIllumination(const Color3 &ambient); 00061 const Color3 &GetAmbientIllumination() const; 00062 00063 //! Light sources. 00064 void InsertLight(const ILight *light); 00065 int GetLightCount() const; 00066 const ILight *GetLight(int i) const; 00067 00068 bool Trace(const Context &context, const Ray &ray, Hit *hit = 0) const; 00069 00070 bool ArePointsMutuallyVisible( 00071 const Context &context, 00072 const sheep::Point3 &origin, //!< World space. 00073 const sheep::Vector3 &origin_normal, //!< World space. 00074 const sheep::Point3 &goal, //!< World space. 00075 Ray::Type ray_type = Ray::VISIBILITY_RAY 00076 ) const; 00077 00078 private: 00079 Color3 m_background_color; 00080 const IObject *m_root_object; 00081 Color3 m_ambient; 00082 std::vector<const ILight *> m_lights; 00083 }; 00084 00085 #include "scene.inl" 00086 00087 } 00088 00089 #endif // !TOXIC_RENDERER_SCENE_H
1.3.6