Main Page | Class Hierarchy | Class List | File List | Class Members

scene.h

00001 /* ************************************************************************* 00002 scene.h - description 00003 ------------------- 00004 begin : Wed Oct 16 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: scene_8h-source.html,v 1.1 2005/02/04 21:02:27 micha Exp $ 00009 00010 ************************************************************************* */ 00011 00012 /* ************************************************************************* 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 ************************************************************************* */ 00020 00021 #ifndef SCENE_H 00022 #define SCENE_H 00023 00024 #include<list> 00025 00026 #include "csg.h" 00027 #include "colour.h" 00028 #include "cameraray.h" 00029 #include "material3d.h" 00030 #include "object3d.h" 00031 #include "lightcache.h" 00032 #include "lightlist.h" 00033 00034 class LightSource; 00035 00039 class Scene { 00040 00041 friend class CameraPerspective; 00042 friend class Media3D; 00043 friend class Media3DSingle; 00044 friend class LightRay; 00045 friend class CameraRay; 00046 00047 00048 public: // Constructors and destructor 00049 00050 Scene(): object(), lights(), referencecount(0), maxtracelevel(100), 00051 colourprecision(1.0/100), lightcache(this), bgcolour(ColourA(0,0,0,1)) { 00052 00053 // lightcache.setType(LightCache::NEAREST,200000); 00054 // lightcache.setType(LightCache::NEW,200000); 00055 lightcache.setType(/*LightCache::EXACT,*/200000); 00056 00057 } 00058 00059 ~Scene(); 00060 00061 public: // Public methods 00064 void addObject(Object3D* o) {object.addObject(o);} 00065 00068 void addLight(LightSource* l); 00069 00072 void finishParsing() {object.close(); /*object.prepareToRender();*/} 00073 00076 void setDefaultMaterial(const Material3D& m) {object.setMaterial(m);} 00077 00080 void setBGColour(ColourA c) {bgcolour = c;} 00081 00085 ColourA intersect(CameraRay &shoot); 00086 00090 LightList* getLightList(const Vector3& location) const; 00091 00092 private: // Prviate attributes 00093 00096 CSGUnion object; 00097 00103 std::list<LightSource*> lights; 00104 00107 int referencecount; 00108 00111 int maxtracelevel; 00112 00115 FLT colourprecision; 00116 00119 mutable LightCache lightcache; 00120 00123 ColourA bgcolour; 00124 00125 private: // Private methods 00126 ColourA intersectRec(CameraRay& shoot); 00127 00128 }; 00129 00130 #endif

Generated on Thu Jan 27 12:16:06 2005 for raytracer.kdevelop by doxygen 1.3.8