#include <Scene.hh>

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, Color > | ColMap |
| 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< Light > | LightIterator |
| typedef Iterator< Object > | ObjectIterator |
| typedef Iterator< Texture > | TextureIterator |
| typedef Iterator< Material > | MaterialIterator |
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 Color & | GetBackground () const |
| Double | GetAtmosphere () const |
| const Camera & | GetCamera () const |
Private Member Functions | |
| void | CreateLibrary () |
| void | DumpLibrary () |
| Color | ParseColor (xmlNodePtr Node) |
| Math::Vector | ParseVector (xmlNodePtr Node) |
| Double | ParseIdx (xmlNodePtr Node) |
| const Material * | GetMaterial (const std::string &id) |
| const Texture * | GetTexture (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... | |
typedef std::map<std::string, Color>::iterator World::Scene::ColIter [private] |
typedef std::map<std::string, const Texture *>::iterator World::Scene::TexIter [private] |
typedef std::map<std::string, const Material *>::iterator World::Scene::MatIter [private] |
typedef std::map<std::string, const Double>::iterator World::Scene::IdxIter [private] |
| typedef Iterator<Light> World::Scene::LightIterator |
| typedef Iterator<Object> World::Scene::ObjectIterator |
| typedef Iterator<Texture> World::Scene::TextureIterator |
| World::Scene::Scene | ( | const Camera & | C = Camera(), |
|
| const Color & | Background = ColLib::Black(), |
|||
| const Double | AtmosphereIdx = MatLib::IdxAir | |||
| ) | [inline] |
| World::Scene::~Scene | ( | ) |
| 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().


| 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().

| 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().


| 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().


| 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().


| 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().

| 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().

| 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().


| 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().


| 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().


| 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().


| 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().


| 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().


| void World::Scene::Purge | ( | ) |
| 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().

| 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().

| 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().

| 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().

| Bool World::Scene::Collide | ( | const Render::Ray & | R, | |
| Double & | RayPos, | |||
| const Object *& | O | |||
| ) | const |
Finds nearest collision of ray with scene object.
Definition at line 50 of file Scene.cc.
References World::Object::Collide(), and Objects.
Referenced by Render::Raytracer::Trace(), and Render::Raytracer::TraceLights().


| Bool World::Scene::ParseFile | ( | const std::string & | File | ) |
Reader
Definition at line 601 of file SceneXML.cc.
References AtmosphereIdx, Background, ColMap, CreateLibrary(), DumpLibrary(), World::IsToken(), MatMap, World::OmitComments(), ParseCamera(), ParseColor(), ParseIdx(), ParseLight(), ParseMaterial(), ParsePlane(), ParseSphere(), ParseTexture(), TexMap, and World::ToStr().

| 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().

| 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().

| const Camera& World::Scene::GetCamera | ( | ) | const [inline] |
Scene camera
Definition at line 210 of file Scene.hh.
References C.
Referenced by Render::Raytracer::Render().

std::vector<Material *> World::Scene::Materials [private] |
std::vector<Texture *> World::Scene::Textures [private] |
std::vector<Object *> World::Scene::Objects [private] |
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().
Color World::Scene::Background [private] |
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 World::Scene::C [private] |
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().
1.5.5