Source: raytracer/scene.h
|
|
|
|
/* *************************************************************************
scene.h - description
-------------------
begin : Wed Oct 16 2002
copyright : (C) 2002 by Micha Riser
email : mriser@gmx.net
************************************************************************* */
/* *************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
************************************************************************* */
#ifndef SCENE_H
#define SCENE_H
#include<list>
using std::list;
#include "csg.h"
#include "colour.h"
#include "cameraray.h"
#include "material3d.h"
#include "object3d.h"
#include "lightcache.h"
#include "lightlist.h"
class LightSource;
/**Describes objects, materials and light source in space.
*@author Micha Riser
*/
class Scene {
public: // Public attributes
/**List of lights in the scene.
*/
list<LightSource*> lights;
/**"The" object of the scene.
*/
CSG object;
/**Maximal recursive tracing level.
*/
int maxtracelevel;
/**Desired precision of the colour.
*/
FLT colourprecision;
/**Light cache for scattering media.
*/
mutable LightCache lightcache;
public: // Constructors and destructor
Scene(): object(CSG::UNION), maxtracelevel(100), colourprecision(1.0/100), lightcache(this),
bgcolour(Colour5(0,0,0,0,1)) {
// lightcache.setType(LightCache::NEAREST,200000);
lightcache.setType(LightCache::EXACT,10000);
}
~Scene();
public: // Public methods
/**Add object to scene.
*/
void addObject(Object3D* o) {object.addObject(o);}
/**Add light source to scene.
*/
void addLight(LightSource* l) {lights.push_back(l);}
/**Finish the scene creation process.
*/
void finishParsing() {object.close();}
/**Set objects' default material.
*/
void setDefaultMaterial(const Material3D& m) {object.setMaterial(m);}
/**Set background colour.
*/
void setBGColour(Colour5 c) {bgcolour = c;}
/**Intersect scene with ray originating from camera.
*@returns resulting colour
*/
Colour5 intersect(CameraRay &shoot);
/**Get a list of lights shining to a certain position.
*@param location position
*@param maxblockingerror maximal error from blocking/non-blocking of light
*/
LightList* getLightList(const Vector3& location, CLR& maxblockingerror) const;
private: // Private attributes
Colour5 bgcolour;
private: // Private methods
Colour5 intersectRec(CameraRay& shoot);
};
#endif
| Generated by: micha@laptop on Thu Oct 24 20:25:24 2002, using kdoc 2.0a53. |