Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
scene.hpp
1 
15 #pragma once
16 
17 #include <string>
18 #include <list>
19 #include "physics/photon.hpp"
20 
21 namespace rt{
22 
23 class Object;
24 class Light;
25 class vector;
26 class image;
27 class Entity;
28 
42 class Scene{
43 public:
50  Scene(const std::string & name, const color & ambient_color = color::WHITE);
51 
55  inline const std::string & name() const{
56  return _name;
57  }
58 
64  Entity *append(Entity *e);
65 
69  void remove(Entity *e);
70 
79  const std::list<const Object *> & objects() const;
88  const std::list<const Light *> & lights() const;
89 
93  const photon & ambientLight() const;
94 
100  void update();
101 
102 private:
103  std::string _name;
104 
105  std::list<Entity *> _roots;
106 
107  std::list<const Object *> _objs;
108  std::list<const Light *> _lights;
109 
110  struct{
111  rt::photon light;
112  image *img;
113  }_ambient;
114 };
115 
116 }
Basic space entity.
Definition: entity.hpp:50
static color WHITE
default white color.
Definition: color.hpp:33
const std::list< const Light * > & lights() const
Scene lights.
Definition: scene.cpp:36
Entity * append(Entity *e)
Add a new root entity to the scene.
Definition: scene.cpp:16
const std::string & name() const
The name of the scene.
Definition: scene.hpp:55
const std::list< const Object * > & objects() const
Scene objects.
Definition: scene.cpp:32
Complete scene.
Definition: scene.hpp:42
Scene(const std::string &name, const color &ambient_color=color::WHITE)
Make a new scene.
Definition: scene.cpp:10
Definition: bitmap.cpp:4
RGBA color representation.
Definition: color.hpp:31
const photon & ambientLight() const
The ambient light of the scene.
Definition: scene.cpp:40
void update()
Update object and light lists required for the render.
Definition: scene.cpp:44
Light photon class.
Definition: photon.hpp:28
Image surface.
Definition: image.hpp:31