1 //
2 // Copyright © 2013 Linaro Limited
3 //
4 // This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
5 //
6 // glmark2 is free software: you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the Free Software
8 // Foundation, either version 3 of the License, or (at your option) any later
9 // version.
10 //
11 // glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU General Public License along with
17 // glmark2.  If not, see <http://www.gnu.org/licenses/>.
18 //
19 // Authors:
20 //  Jesse Barker
21 //  Alexandros Frantzis
22 //
23 #ifndef GLMARK2_SCENE_COLLECTION_H_
24 #define GLMARK2_SCENE_COLLECTION_H_
25 
26 #include <vector>
27 #include "scene.h"
28 
29 
30 class SceneCollection
31 {
32 public:
SceneCollection(Canvas & canvas)33     SceneCollection(Canvas& canvas)
34     {
35         add_scenes(canvas);
36     }
~SceneCollection()37     ~SceneCollection() { Util::dispose_pointer_vector(scenes_); }
register_scenes()38     void register_scenes()
39     {
40         for (std::vector<Scene*>::const_iterator iter = scenes_.begin();
41              iter != scenes_.end();
42              iter++)
43         {
44             Benchmark::register_scene(**iter);
45         }
46     }
get()47     const std::vector<Scene*>& get() { return scenes_; }
48 
49 private:
50     std::vector<Scene*> scenes_;
51 
52     //
53     // Creates all the available scenes and adds them to the supplied vector.
54     //
55     // @param scenes the vector to add the scenes to
56     // @param canvas the canvas to create the scenes with
57     //
add_scenes(Canvas & canvas)58     void add_scenes(Canvas& canvas)
59     {
60         scenes_.push_back(new SceneDefaultOptions(canvas));
61         scenes_.push_back(new SceneBuild(canvas));
62         scenes_.push_back(new SceneTexture(canvas));
63         scenes_.push_back(new SceneShading(canvas));
64         scenes_.push_back(new SceneConditionals(canvas));
65         scenes_.push_back(new SceneFunction(canvas));
66         scenes_.push_back(new SceneLoop(canvas));
67         scenes_.push_back(new SceneBump(canvas));
68         scenes_.push_back(new SceneEffect2D(canvas));
69         scenes_.push_back(new ScenePulsar(canvas));
70         scenes_.push_back(new SceneDesktop(canvas));
71         scenes_.push_back(new SceneBuffer(canvas));
72         scenes_.push_back(new SceneIdeas(canvas));
73         scenes_.push_back(new SceneTerrain(canvas));
74         scenes_.push_back(new SceneJellyfish(canvas));
75         scenes_.push_back(new SceneShadow(canvas));
76         scenes_.push_back(new SceneRefract(canvas));
77         scenes_.push_back(new SceneClear(canvas));
78 
79     }
80 };
81 #endif // GLMARK2_SCENE_COLLECTION_H_
82