00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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:
00049
00050
Scene(): object(), lights(), referencecount(0), maxtracelevel(100),
00051 colourprecision(1.0/100), lightcache(
this), bgcolour(
ColourA(0,0,0,1)) {
00052
00053
00054
00055 lightcache.
setType(200000);
00056
00057 }
00058
00059 ~
Scene();
00060
00061
public:
00064 void addObject(
Object3D* o) {object.addObject(o);}
00065
00068
void addLight(
LightSource* l);
00069
00072 void finishParsing() {object.close(); }
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:
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:
00126
ColourA intersectRec(
CameraRay& shoot);
00127
00128 };
00129
00130
#endif