Point Cloud Library (PCL)  1.9.1-dev
scene.h
1 #pragma once
2 
3 // PCL
4 #include "camera.h"
5 #include "object.h"
6 #include "outofcore_cloud.h"
7 #include "viewport.h"
8 
9 class Object;
10 
11 class Scene
12 {
13 private:
14 
15  static Scene *instance_;
16 
17  Scene ();
18  Scene (const Scene& op) = delete;
19  Scene&
20  operator= (const Scene& op) = delete;
21 
22 public:
23 
24  // Singleton
25  static Scene*
27  {
28  if (!Scene::instance_)
29  Scene::instance_ = new Scene ();
30 
31  return Scene::instance_;
32  }
33 
34  // Accessors - Cameras
35  // -----------------------------------------------------------------------------
36  void
37  addCamera (Camera *camera);
38 
39  std::vector<Camera*>
40  getCameras ();
41 
42  Camera*
43  getCamera (vtkCamera *camera);
44 
45  Camera*
46  getCamera (std::string name);
47 
48  // Accessors - Objects
49  // -----------------------------------------------------------------------------
50  void
51  addObject (Object *object);
52 
53  Object*
54  getObjectByName (std::string name);
55 
56  std::vector<Object*>
57  getObjects ();
58 
59  // Accessors - Viewports
60  // -----------------------------------------------------------------------------
61 
62  void
63  addViewport (Viewport *viewport);
64 
65  std::vector<Viewport*>
66  getViewports ();
67 
68  void
69  lock ()
70  {
71  render_mutex_.lock ();
72  }
73 
74  void
75  unlock ()
76  {
77  render_mutex_.unlock ();
78  }
79 
80 private:
81  std::vector<Camera*> cameras_;
82  std::vector<Viewport*> viewports_;
83  std::vector<Object*> objects_;
84 
85  std::mutex render_mutex_;
86 
87 };
std::vector< Camera * > getCameras()
static Scene * instance()
Definition: scene.h:26
Definition: camera.h:19
void addObject(Object *object)
Object * getObjectByName(std::string name)
Definition: scene.h:11
Camera * getCamera(vtkCamera *camera)
void unlock()
Definition: scene.h:75
std::vector< Object * > getObjects()
std::vector< Viewport * > getViewports()
void addCamera(Camera *camera)
Definition: object.h:18
void addViewport(Viewport *viewport)
void lock()
Definition: scene.h:69