opensurgsim
OculusDevice.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2015, 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_DEVICES_OCULUS_OCULUSDEVICE_H
17 #define SURGSIM_DEVICES_OCULUS_OCULUSDEVICE_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "SurgSim/Input/CommonDevice.h"
23 
24 namespace SurgSim
25 {
26 namespace Devices
27 {
28 class OculusScaffold;
29 
30 SURGSIM_STATIC_REGISTRATION(OculusDevice);
31 
49 {
50 public:
53  explicit OculusDevice(const std::string& name);
54 
55  SURGSIM_CLASSNAME(SurgSim::Devices::OculusDevice);
56 
58  virtual ~OculusDevice();
59 
60  bool initialize() override;
61 
62  bool isInitialized() const override;
63 
66  void setNearPlane(float nearPlane);
67 
69  float getNearPlane() const;
70 
73  void setFarPlane(float farPlane);
74 
76  float getFarPlane() const;
77 
78 private:
79  friend class OculusScaffold;
80 
81  bool finalize() override;
82 
84  float m_nearPlane;
85 
87  float m_farPlane;
88 
90  std::shared_ptr<OculusScaffold> m_scaffold;
91 };
92 
93 }; // namespace Devices
94 }; // namespace SurgSim
95 
96 #endif // SURGSIM_DEVICES_OCULUS_OCULUSDEVICE_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
float getFarPlane() const
Definition: OculusDevice.cpp:93
A class that manages Oculus Rift DK2 devices.
Definition: OculusScaffold.h:42
void setNearPlane(float nearPlane)
Set the near plane.
Definition: OculusDevice.cpp:72
A class implementing the communication with Oculus Rift DK2.
Definition: OculusDevice.h:48
OculusDevice(const std::string &name)
Constructor.
Definition: OculusDevice.cpp:28
virtual ~OculusDevice()
Destructor.
Definition: OculusDevice.cpp:35
bool isInitialized() const override
Definition: OculusDevice.cpp:67
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
void setFarPlane(float farPlane)
Set the far plane.
Definition: OculusDevice.cpp:85
float getNearPlane() const
Definition: OculusDevice.cpp:80
bool initialize() override
Fully initialize the device.
Definition: OculusDevice.cpp:44