opensurgsim
ViewElement.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_VIEWELEMENT_H
17 #define SURGSIM_GRAPHICS_VIEWELEMENT_H
18 
19 #include "SurgSim/Framework/BasicSceneElement.h"
20 
21 namespace SurgSim
22 {
23 
24 namespace Input
25 {
26 class CommonDevice;
27 }
28 
29 namespace Graphics
30 {
31 
32 class Camera;
33 class View;
34 
40 {
41 public:
44  explicit ViewElement(const std::string& name);
45 
47  virtual ~ViewElement();
48 
51  virtual bool setView(std::shared_ptr<View> view);
52 
55  std::shared_ptr<View> getView();
56 
59  void setCamera(std::shared_ptr<Camera> camera);
60 
63  std::shared_ptr<Camera> getCamera();
64 
67  virtual std::shared_ptr<SurgSim::Input::CommonDevice> getKeyboardDevice() = 0;
68 
71  virtual void enableKeyboardDevice(bool val) = 0;
72 
75  virtual std::shared_ptr<SurgSim::Input::CommonDevice> getMouseDevice() = 0;
76 
79  virtual void enableMouseDevice(bool val) = 0;
80 
81 protected:
84  bool doInitialize() override;
85 
86 private:
88  std::shared_ptr<View> m_view;
89 
91  std::shared_ptr<Camera> m_camera;
92 };
93 
94 }; // namespace Graphics
95 }; // namespace SurgSim
96 
97 #endif // SURGSIM_GRAPHICS_VIEWELEMENT_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Simple concrete implementation of a scene element that does not have any higher logic.
Definition: BasicSceneElement.h:29
Basic SceneElement that wraps a View so that it can be added to the Scene.
Definition: ViewElement.h:39