Robotics Library  0.6.2
Scene.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef _RL_SG_SCENE_H_
28 #define _RL_SG_SCENE_H_
29 
30 #include <string>
31 #include <vector>
32 #include <Inventor/actions/SoCallbackAction.h>
33 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
34 
35 namespace rl
36 {
37  namespace sg
38  {
39  class Model;
40 
41  class Scene
42  {
43  public:
44  typedef ::std::vector< Model* >::iterator Iterator;
45 
46  Scene();
47 
48  virtual ~Scene();
49 
50  virtual void add(Model* model);
51 
52  Iterator begin();
53 
54  virtual Model* create() = 0;
55 
56  Iterator end();
57 
58  Model* getModel(const ::std::size_t& i) const;
59 
60  virtual ::std::string getName() const;
61 
62  ::std::size_t getNumModels() const;
63 
64  void load(const ::std::string& filename, const bool& doBoundingBoxPoints = false, const bool& doPoints = false);
65 
66  virtual void remove(Model* model);
67 
68  virtual void setName(const ::std::string& name);
69 
70  protected:
72 
73  ::std::vector< Model* > models;
74 
75  private:
76  static void triangleCallback(void* userData, SoCallbackAction* action, const SoPrimitiveVertex* v1, const SoPrimitiveVertex* v2, const SoPrimitiveVertex* v3);
77 
78  ::std::string name;
79  };
80  }
81 }
82 
83 #endif // _RL_SG_SCENE_H_
rl::sg::Scene::create
virtual Model * create()=0
rl::sg::Scene::add
virtual void add(Model *model)
Definition: Scene.cpp:68
rl::sg::Scene::isScalingSupported
bool isScalingSupported
Definition: Scene.h:71
rl::sg::Scene::load
void load(const ::std::string &filename, const bool &doBoundingBoxPoints=false, const bool &doPoints=false)
Definition: Scene.cpp:104
rl::sg::Scene::setName
virtual void setName(const ::std::string &name)
Definition: Scene.cpp:325
rl::sg::Scene::getModel
Model * getModel(const ::std::size_t &i) const
Definition: Scene.cpp:86
rl::sg::Scene::triangleCallback
static void triangleCallback(void *userData, SoCallbackAction *action, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3)
Definition: Scene.cpp:331
rl::sg::Scene::Scene
Scene()
Definition: Scene.cpp:56
rl::sg::Scene::remove
virtual void remove(Model *model)
Definition: Scene.cpp:314
rl::sg::Model
Definition: Model.h:43
rl::sg::Scene::getName
virtual ::std::string getName() const
Definition: Scene.cpp:92
rl::sg::Scene::Iterator
::std::vector< Model * >::iterator Iterator
Definition: Scene.h:44
rl::sg::Scene::models
::std::vector< Model * > models
Definition: Scene.h:73
rl::sg::Scene::end
Iterator end()
Definition: Scene.cpp:80
rl::sg::Scene::~Scene
virtual ~Scene()
Definition: Scene.cpp:63
rl::sg::Scene::begin
Iterator begin()
Definition: Scene.cpp:74
rl::sg::Scene::getNumModels
::std::size_t getNumModels() const
Definition: Scene.cpp:98
rl::sg::Scene
Definition: Scene.h:42
rl::sg::Scene::name
::std::string name
Definition: Scene.h:78
rl
Definition: Ati.cpp:35