World::Scene Class Reference

#include <Scene.hh>

Collaboration diagram for World::Scene:

Collaboration graph
[legend]

List of all members.


Detailed Description

Collision detection and scene management.

This object holds scene structure, allows to check collisions with all scene objects and allows iteration of scene lights. Scene frees in it's destructor memory allocated for objects in the scene (they must be added to the structure with Add* functions.

Definition at line 60 of file Scene.hh.

std::map< std::string, ColorColMap
std::map< std::string, const
Texture * > 
TexMap
std::map< std::string, const
Material * > 
MatMap
std::map< std::string, const
Double > 
IdxMap
typedef std::map< std::string,
Color >::iterator 
ColIter
typedef std::map< std::string,
const Texture * >::iterator 
TexIter
typedef std::map< std::string,
const Material * >::iterator 
MatIter
typedef std::map< std::string,
const Double >::iterator 
IdxIter

Public Types

typedef Iterator< LightLightIterator
typedef Iterator< ObjectObjectIterator
typedef Iterator< TextureTextureIterator
typedef Iterator< MaterialMaterialIterator

Public Member Functions

 Scene (const Camera &C=Camera(), const Color &Background=ColLib::Black(), const Double AtmosphereIdx=MatLib::IdxAir)
 ~Scene ()
void Purge ()
void AddObject (Object *O)
void AddLight (Light *L)
void AddMaterial (Material *M)
void AddTexture (Texture *T)
Bool Collide (const Render::Ray &R, Double &RayPos, const Object *&O) const
Bool ParseFile (const std::string &File)
const ColorGetBackground () const
Double GetAtmosphere () const
const CameraGetCamera () const

Private Member Functions

void CreateLibrary ()
void DumpLibrary ()
Color ParseColor (xmlNodePtr Node)
Math::Vector ParseVector (xmlNodePtr Node)
Double ParseIdx (xmlNodePtr Node)
const MaterialGetMaterial (const std::string &id)
const TextureGetTexture (const std::string &id)
void ParseTexture (xmlNodePtr Node)
void ParseMaterial (xmlNodePtr Node)
void ParseLight (xmlNodePtr Node)
void ParseCamera (xmlNodePtr Node)
void ParseSphere (xmlNodePtr Node)
void ParsePlane (xmlNodePtr Node)

Private Attributes

std::vector< Material * > Materials
std::vector< Texture * > Textures
std::vector< Object * > Objects
std::vector< Light * > Lights
Color Background
Double AtmosphereIdx
Camera C

Classes

class  Iterator
 Template class for simplified scene iterators. More...

Member Typedef Documentation

typedef std::map<std::string, Color>::iterator World::Scene::ColIter [private]

Loaded items + default items library

Definition at line 128 of file Scene.hh.

typedef std::map<std::string, const Texture *>::iterator World::Scene::TexIter [private]

Loaded items + default items library

Definition at line 129 of file Scene.hh.

typedef std::map<std::string, const Material *>::iterator World::Scene::MatIter [private]

Loaded items + default items library

Definition at line 130 of file Scene.hh.

typedef std::map<std::string, const Double>::iterator World::Scene::IdxIter [private]

Loaded items + default items library

Definition at line 131 of file Scene.hh.

Concretized iterators

Definition at line 238 of file Scene.hh.

Concretized iterators

Definition at line 239 of file Scene.hh.

Concretized iterators

Definition at line 240 of file Scene.hh.

Concretized iterators

Definition at line 241 of file Scene.hh.


Constructor & Destructor Documentation

World::Scene::Scene ( const Camera C = Camera(),
const Color Background = ColLib::Black(),
const Double  AtmosphereIdx = MatLib::IdxAir 
) [inline]

Initialize scene management

Definition at line 136 of file Scene.hh.

References Lights, Materials, Objects, and Textures.

World::Scene::~Scene (  ) 

Free memory

Definition at line 21 of file Scene.cc.

References Purge().

Here is the call graph for this function:


Member Function Documentation

void World::Scene::CreateLibrary (  )  [private]

Create basic library of color, texture, indices names

Definition at line 185 of file SceneXML.cc.

References World::TexLib::Black(), World::ColLib::Black(), World::TexLib::Blue(), World::ColLib::Blue(), ColMap, World::TexLib::Gray(), World::ColLib::Gray(), World::TexLib::Green(), World::ColLib::Green(), IdxMap, World::TexLib::Red(), World::ColLib::Red(), TexMap, World::TexLib::White(), and World::ColLib::White().

Referenced by ParseFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void World::Scene::DumpLibrary (  )  [private]

Debug function. Dumps currently used id library

Definition at line 163 of file SceneXML.cc.

References ColMap, MatMap, and TexMap.

Referenced by ParseFile().

Here is the caller graph for this function:

Color World::Scene::ParseColor ( xmlNodePtr  Node  )  [private]

Parse color (return it and name it)

Definition at line 213 of file SceneXML.cc.

References ColMap, World::GetProp(), and World::ToDouble().

Referenced by ParseFile(), ParseLight(), and ParseTexture().

Here is the call graph for this function:

Here is the caller graph for this function:

Math::Vector World::Scene::ParseVector ( xmlNodePtr  Node  )  [private]

Parse vector (return it's value only)

Definition at line 261 of file SceneXML.cc.

References World::GetProp(), and World::ToDouble().

Referenced by ParseCamera(), ParseLight(), ParsePlane(), and ParseSphere().

Here is the call graph for this function:

Here is the caller graph for this function:

Double World::Scene::ParseIdx ( xmlNodePtr  Node  )  [private]

Parse named or given refractive index

Definition at line 374 of file SceneXML.cc.

References World::GetDoubleProp(), World::GetProp(), World::MatLib::IdxGlass, IdxMap, and World::IsDouble().

Referenced by ParseFile(), and ParseMaterial().

Here is the call graph for this function:

Here is the caller graph for this function:

const Material * World::Scene::GetMaterial ( const std::string &  id  )  [private]

Lookup material in library

Definition at line 285 of file SceneXML.cc.

References MatMap.

Referenced by ParseMaterial(), ParsePlane(), and ParseSphere().

Here is the caller graph for this function:

const Texture * World::Scene::GetTexture ( const std::string &  id  )  [private]

Lookup texture in library

Definition at line 277 of file SceneXML.cc.

References TexMap.

Referenced by ParseMaterial(), and ParseTexture().

Here is the caller graph for this function:

void World::Scene::ParseTexture ( xmlNodePtr  Node  )  [private]

Texture parser

Definition at line 294 of file SceneXML.cc.

References AddTexture(), C, World::EnsureColorTag(), World::GetID(), World::GetProp(), GetTexture(), World::OmitComments(), ParseColor(), TexMap, and World::ToDouble().

Referenced by ParseFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void World::Scene::ParseMaterial ( xmlNodePtr  Node  )  [private]

Material parser

Definition at line 394 of file SceneXML.cc.

References AddMaterial(), World::TexLib::Black(), World::GetDoubleProp(), GetMaterial(), World::GetProp(), GetTexture(), World::TexLib::Green(), MatMap, ParseIdx(), and World::TexLib::White().

Referenced by ParseFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void World::Scene::ParseLight ( xmlNodePtr  Node  )  [private]

Point/Ambient light parser

Definition at line 442 of file SceneXML.cc.

References AddLight(), C, World::EnsureColorTag(), World::GetProp(), World::IsToken(), World::OmitComments(), ParseColor(), and ParseVector().

Referenced by ParseFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void World::Scene::ParseCamera ( xmlNodePtr  Node  )  [private]

Parse camera data

Definition at line 489 of file SceneXML.cc.

References C, World::Camera::DegreeToFOV(), World::GetDoubleProp(), World::IsToken(), World::OmitComments(), and ParseVector().

Referenced by ParseFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void World::Scene::ParseSphere ( xmlNodePtr  Node  )  [private]

Sphere parser

Definition at line 531 of file SceneXML.cc.

References AddObject(), World::GetDoubleProp(), GetMaterial(), World::GetProp(), World::MatLib::Gray(), World::IsToken(), World::OmitComments(), and ParseVector().

Referenced by ParseFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void World::Scene::ParsePlane ( xmlNodePtr  Node  )  [private]

Plane parser

Definition at line 568 of file SceneXML.cc.

References AddObject(), World::GetDoubleProp(), GetMaterial(), World::GetProp(), World::MatLib::Gray(), World::IsToken(), World::OmitComments(), and ParseVector().

Referenced by ParseFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void World::Scene::Purge (  ) 

Frees all added to scene objects

Definition at line 26 of file Scene.cc.

References Lights, Materials, Objects, and Textures.

Referenced by ~Scene().

Here is the caller graph for this function:

void World::Scene::AddObject ( Object O  )  [inline]

Add object to scene. It will be freed by scene destructor

Definition at line 156 of file Scene.hh.

References Objects.

Referenced by ParsePlane(), ParseSphere(), Testcases::Render(), and Testcases::Scene().

Here is the caller graph for this function:

void World::Scene::AddLight ( Light L  )  [inline]

Add light to the scene. It will be freed by scene destructor

Definition at line 165 of file Scene.hh.

References Lights.

Referenced by ParseLight(), Testcases::Render(), and Testcases::Scene().

Here is the caller graph for this function:

void World::Scene::AddMaterial ( Material M  )  [inline]

Add material to the scene. It will be freed by scene destructor

Definition at line 174 of file Scene.hh.

References Materials.

Referenced by ParseMaterial().

Here is the caller graph for this function:

void World::Scene::AddTexture ( Texture T  )  [inline]

Add texture to the scene. It will be freed by scene destructor

Definition at line 183 of file Scene.hh.

References Textures.

Referenced by ParseTexture().

Here is the caller graph for this function:

Bool World::Scene::Collide ( const Render::Ray R,
Double &  RayPos,
const Object *&  O 
) const

Finds nearest collision of ray with scene object.

Bug:
This should be implemented using an octree, not a vector.

Definition at line 50 of file Scene.cc.

References World::Object::Collide(), and Objects.

Referenced by Render::Raytracer::Trace(), and Render::Raytracer::TraceLights().

Here is the call graph for this function:

Here is the caller graph for this function:

Bool World::Scene::ParseFile ( const std::string &  File  ) 

const Color& World::Scene::GetBackground (  )  const [inline]

Scene background accessor

Definition at line 200 of file Scene.hh.

References Background.

Referenced by Render::Raytracer::Render().

Here is the caller graph for this function:

Double World::Scene::GetAtmosphere (  )  const [inline]

Scene atmosphere accessor

Definition at line 205 of file Scene.hh.

References AtmosphereIdx.

Referenced by Render::Raytracer::Render(), and Render::Raytracer::Trace().

Here is the caller graph for this function:

const Camera& World::Scene::GetCamera (  )  const [inline]

Scene camera

Definition at line 210 of file Scene.hh.

References C.

Referenced by Render::Raytracer::Render().

Here is the caller graph for this function:


Member Data Documentation

std::vector<Material *> World::Scene::Materials [private]

Scene materials to be freed

Definition at line 62 of file Scene.hh.

Referenced by AddMaterial(), Purge(), and Scene().

std::vector<Texture *> World::Scene::Textures [private]

Scene textures to be freed

Definition at line 65 of file Scene.hh.

Referenced by AddTexture(), Purge(), and Scene().

std::vector<Object *> World::Scene::Objects [private]

Scene objects to be freed, we check collisions with this objects.

Bug:
rewrite implementation to use octree

Definition at line 70 of file Scene.hh.

Referenced by AddObject(), Collide(), Purge(), and Scene().

std::vector<Light *> World::Scene::Lights [private]

Lights we iterate during shadowpass. Freed during scene destruction

Definition at line 74 of file Scene.hh.

Referenced by AddLight(), Purge(), and Scene().

Scene background color

Definition at line 77 of file Scene.hh.

Referenced by GetBackground(), and ParseFile().

Double World::Scene::AtmosphereIdx [private]

Atmosphere refractive index

Definition at line 80 of file Scene.hh.

Referenced by GetAtmosphere(), and ParseFile().

Camera used to render the scene

Definition at line 83 of file Scene.hh.

Referenced by GetCamera(), ParseCamera(), ParseLight(), and ParseTexture().

std::map<std::string, Color> World::Scene::ColMap [private]

Loaded items + default items library

Definition at line 123 of file Scene.hh.

Referenced by CreateLibrary(), DumpLibrary(), ParseColor(), and ParseFile().

std::map<std::string, const Texture *> World::Scene::TexMap [private]

Loaded items + default items library

Definition at line 124 of file Scene.hh.

Referenced by CreateLibrary(), DumpLibrary(), GetTexture(), ParseFile(), and ParseTexture().

std::map<std::string, const Material *> World::Scene::MatMap [private]

Loaded items + default items library

Definition at line 125 of file Scene.hh.

Referenced by DumpLibrary(), GetMaterial(), ParseFile(), and ParseMaterial().

std::map<std::string, const Double> World::Scene::IdxMap [private]

Loaded items + default items library

Definition at line 126 of file Scene.hh.

Referenced by CreateLibrary(), and ParseIdx().


The documentation for this class was generated from the following files:

Generated on Wed Mar 12 00:36:54 2008 for blaRAY by  doxygen 1.5.5