scene.hpp
Go to the documentation of this file.
1 /*
2 ** TP CPE Lyon
3 ** Copyright (C) 2013 Damien Rohmer
4 **
5 ** This program is free software: you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation, either version 3 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 
20 #ifndef SCENE_HPP
21 #define SCENE_HPP
22 
23 #include <vector>
24 
25 #include <exception_cpe.hpp>
26 #include <light.hpp>
27 #include <object3d.hpp>
28 #include <color.hpp>
29 #include <light.hpp>
30 #include <camera.hpp>
31 #include <material.hpp>
32 
33 
34 namespace cpe
35 {
36 
37 
38 
39 
40 
45  class scene
46  {
47  public:
48 
49  // ********************************************* //
50  // ********************************************* //
51  // CONSTRUCTOR
52  // ********************************************* //
53  // ********************************************* //
54 
56  scene();
57 
58  // ********************************************* //
59  // ********************************************* //
60  // ADD/DELETE OBJECTS
61  // ********************************************* //
62  // ********************************************* //
63 
65  void clean_memory();
66 
67 
68 
70  void add(const object3d* obj,const material& material);
72  void add(const light& light_parameter);
73 
75  int N_object() const;
77  int N_light() const;
78 
79 
80  // ********************************************* //
81  // ********************************************* //
82  // ADD/DELETE OBJECTS
83  // ********************************************* //
84  // ********************************************* //
85 
87  const object3d* get_object(unsigned int k_object) const;
89  const light& get_light(unsigned int k_light) const;
91  const material& get_material(unsigned int k_material) const;
92 
94  void set_camera(const camera& cam);
96  const camera& get_camera() const;
97 
98  private:
99 
100  // ********************************************* //
101  // ********************************************* //
102  // INTERNAL STORAGE
103  // ********************************************* //
104  // ********************************************* //
105 
107  std::vector<const object3d*> v_object;
109  std::vector<material> v_material;
111  std::vector<light> v_light;
114 
115  };
116 
117 
118 
119 
120 
123  {
124  public:
125 
129  exception_scene3d(const std::string& msg_data,const std::string& file_data,const std::string& caller_data,const int& line_data):exception_cpe(msg_data,file_data,caller_data,line_data){}
130  };
131 
132 }
133 #endif