raylib-cpp
C++ object-oriented wrapper library for raylib.
VrSimulator.hpp
1 /*
2 * LICENSE: zlib/libpng
3 *
4 * raylib-cpp is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
5 * BSD-like license that allows static linking with closed source software:
6 *
7 * Copyright (c) 2020 Rob Loach (@RobLoach)
8 *
9 * This software is provided "as-is", without any express or implied warranty. In no event
10 * will the authors be held liable for any damages arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose, including commercial
13 * applications, and to alter it and redistribute it freely, subject to the following restrictions:
14 *
15 * 1. The origin of this software must not be misrepresented; you must not claim that you
16 * wrote the original software. If you use this software in a product, an acknowledgment
17 * in the product documentation would be appreciated but is not required.
18 *
19 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
20 * as being the original software.
21 *
22 * 3. This notice may not be removed or altered from any source distribution.
23 */
24 
25 #ifndef RAYLIB_CPP_INCLUDE_VRSIMULATOR_HPP_
26 #define RAYLIB_CPP_INCLUDE_VRSIMULATOR_HPP_
27 
28 #include "./raylib.hpp"
29 #include "./raylib-cpp-utils.hpp"
30 
31 namespace raylib {
32 class VrSimulator {
33  public:
35  Init();
36  }
37 
38  VrSimulator(::VrDeviceInfo info, ::Shader distortion) {
39  Init();
40  Set(info, distortion);
41  }
42 
46  inline void Init() {
47  InitVrSimulator();
48  }
49 
54  Close();
55  }
56 
60  inline bool IsReady() const {
61  return ::IsVrSimulatorReady();
62  }
63 
67  inline VrSimulator& Update(::Camera *camera) {
68  ::UpdateVrTracking(camera);
69  return *this;
70  }
71 
75  inline VrSimulator& Update(const ::Camera& camera) {
76  const ::Camera* cameraPointer = reinterpret_cast<const Camera*>(&camera);
77  ::UpdateVrTracking((::Camera*)cameraPointer);
78  return *this;
79  }
80 
84  inline VrSimulator& Set(::VrDeviceInfo info, ::Shader distortion) {
85  ::SetVrConfiguration(info, distortion);
86  return *this;
87  }
88 
92  inline VrSimulator& Toggle() {
93  ::ToggleVrMode();
94  return *this;
95  }
96 
101  ::BeginVrDrawing();
102  return *this;
103  }
104 
109  ::EndVrDrawing();
110  return *this;
111  }
112 
116  inline void Close() {
117  ::CloseVrSimulator();
118  }
119 };
120 } // namespace raylib
121 
122 #endif // RAYLIB_CPP_INCLUDE_VRSIMULATOR_HPP_
raylib
Provides all the classes associated with raylib-cpp.
Definition: AudioDevice.hpp:31
raylib::VrSimulator::~VrSimulator
~VrSimulator()
Close VR simulator for current device.
Definition: VrSimulator.hpp:53
raylib::VrSimulator::Update
VrSimulator & Update(const ::Camera &camera)
Update VR tracking (position and orientation) and camera.
Definition: VrSimulator.hpp:75
raylib::VrSimulator::Toggle
VrSimulator & Toggle()
Enable/Disable VR experience.
Definition: VrSimulator.hpp:92
raylib::VrSimulator::VrSimulator
VrSimulator(::VrDeviceInfo info, ::Shader distortion)
Definition: VrSimulator.hpp:38
raylib::Camera3D
Definition: Camera3D.hpp:33
raylib::VrSimulator::Update
VrSimulator & Update(::Camera *camera)
Update VR tracking (position and orientation) and camera.
Definition: VrSimulator.hpp:67
raylib::VrSimulator::Init
void Init()
Init VR simulator for selected device parameters.
Definition: VrSimulator.hpp:46
raylib::VrSimulator::EndDrawing
VrSimulator & EndDrawing()
End VR simulator stereo rendering.
Definition: VrSimulator.hpp:108
raylib::Shader
Definition: Shader.hpp:35
raylib::VrSimulator::Close
void Close()
Close VR simulator for current device.
Definition: VrSimulator.hpp:116
raylib::VrSimulator::IsReady
bool IsReady() const
Detect if VR simulator is ready.
Definition: VrSimulator.hpp:60
raylib::VrSimulator
Definition: VrSimulator.hpp:32
raylib::VrSimulator::VrSimulator
VrSimulator()
Definition: VrSimulator.hpp:34
raylib::VrSimulator::Set
VrSimulator & Set(::VrDeviceInfo info, ::Shader distortion)
Set stereo rendering configuration parameters.
Definition: VrSimulator.hpp:84
raylib::VrSimulator::BeginDrawing
VrSimulator & BeginDrawing()
Begin VR simulator stereo rendering.
Definition: VrSimulator.hpp:100