From decdf5cd9fb4a7adf6623eaf1fcb4d4e0bbf2e08 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 15 Apr 2021 17:44:07 -0400 Subject: [PATCH] Update raylib --- include/CMakeLists.txt | 2 +- include/Camera3D.hpp | 8 ---- include/Mesh.hpp | 14 +++--- include/Vector3.hpp | 5 --- include/VrSimulator.hpp | 87 -------------------------------------- include/VrStereoConfig.hpp | 76 +++++++++++++++++++++++++++++++++ include/raylib-cpp.hpp | 2 +- vendor/raylib | 2 +- 8 files changed, 86 insertions(+), 110 deletions(-) delete mode 100644 include/VrSimulator.hpp create mode 100644 include/VrStereoConfig.hpp diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 640675c..1c44898 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -39,7 +39,7 @@ install(FILES Vector2.hpp Vector3.hpp Vector4.hpp - VrSimulator.hpp + VrStereoConfig.hpp Wave.hpp Window.hpp DESTINATION include diff --git a/include/Camera3D.hpp b/include/Camera3D.hpp index 3405cb4..3edcd72 100644 --- a/include/Camera3D.hpp +++ b/include/Camera3D.hpp @@ -103,14 +103,6 @@ class Camera3D : public ::Camera3D { return *this; } - /** - * Update VR tracking (position and orientation) and camera - */ - inline Camera3D& UpdateVrTracking() { - ::UpdateVrTracking(this); - return *this; - } - /** * Returns a ray trace from mouse position */ diff --git a/include/Mesh.hpp b/include/Mesh.hpp index c9c5200..6d0bab4 100644 --- a/include/Mesh.hpp +++ b/include/Mesh.hpp @@ -27,11 +27,11 @@ class Mesh : public ::Mesh { /** * Load meshes from model file */ - static std::vector Load(const std::string& fileName) { - int count = 0; - ::Mesh* meshes = LoadMeshes(fileName.c_str(), &count); - return std::vector(meshes, meshes + count); - } + // static std::vector Load(const std::string& fileName) { + // int count = 0; + // ::Mesh* meshes = LoadMeshes(fileName.c_str(), &count); + // return std::vector(meshes, meshes + count); + // } /** * Generate polygonal mesh @@ -131,8 +131,8 @@ class Mesh : public ::Mesh { /** * Upload mesh vertex data to GPU (VRAM) */ - inline void Upload() { - ::UploadMesh(this); + inline void Upload(bool dynamic = false) { + ::UploadMesh(this, dynamic); } /** diff --git a/include/Vector3.hpp b/include/Vector3.hpp index 00e5e7e..fe6e9bb 100644 --- a/include/Vector3.hpp +++ b/include/Vector3.hpp @@ -291,11 +291,6 @@ class Vector3 : public ::Vector3 { return *this; } - inline Vector3& DrawGizmo() { - ::DrawGizmo(*this); - return *this; - } - /** * Detect collision between two spheres */ diff --git a/include/VrSimulator.hpp b/include/VrSimulator.hpp deleted file mode 100644 index 6c11996..0000000 --- a/include/VrSimulator.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef RAYLIB_CPP_INCLUDE_VRSIMULATOR_HPP_ -#define RAYLIB_CPP_INCLUDE_VRSIMULATOR_HPP_ - -#include "./raylib.hpp" -#include "./raylib-cpp-utils.hpp" - -namespace raylib { -/** - * VR control functions - */ -class VrSimulator { - public: - VrSimulator(::VrDeviceInfo& info) { - Init(info); - } - - /** - * Init VR simulator for selected device parameters - */ - inline void Init(::VrDeviceInfo info) { - InitVrSimulator(info); - } - - /** - * Close VR simulator for current device - */ - ~VrSimulator() { - Close(); - } - - /** - * Detect if VR simulator is ready - */ - inline bool IsReady() const { - return ::IsVrSimulatorReady(); - } - - /** - * Update VR tracking (position and orientation) and camera - */ - inline VrSimulator& Update(::Camera *camera) { - ::UpdateVrTracking(camera); - return *this; - } - - /** - * Update VR tracking (position and orientation) and camera - */ - inline VrSimulator& Update(const ::Camera& camera) { - const ::Camera* cameraPointer = reinterpret_cast(&camera); - ::UpdateVrTracking((::Camera*)cameraPointer); - return *this; - } - - /** - * Begin VR simulator stereo rendering - */ - inline VrSimulator& BeginDrawing(::RenderTexture2D& target) { - ::BeginVrDrawing(target); - return *this; - } - - /** - * End VR simulator stereo rendering - */ - inline VrSimulator& EndDrawing() { - ::EndVrDrawing(); - return *this; - } - - /** - * Close VR simulator for current device - */ - inline void Close() { - ::CloseVrSimulator(); - } - - /** - * Get stereo rendering configuration parameters - */ - inline VrStereoConfig GetConfig(VrDeviceInfo& device) { - return GetVrConfig(device); - } -}; -} // namespace raylib - -#endif // RAYLIB_CPP_INCLUDE_VRSIMULATOR_HPP_ diff --git a/include/VrStereoConfig.hpp b/include/VrStereoConfig.hpp new file mode 100644 index 0000000..d58a516 --- /dev/null +++ b/include/VrStereoConfig.hpp @@ -0,0 +1,76 @@ +#ifndef RAYLIB_CPP_INCLUDE_VRSTEREOCONFIG_HPP_ +#define RAYLIB_CPP_INCLUDE_VRSTEREOCONFIG_HPP_ + +#include "./raylib.hpp" +#include "./raylib-cpp-utils.hpp" + +namespace raylib { +/** + * VR stereo config functions for VR simulator + */ +class VrStereoConfig : public ::VrStereoConfig { + public: + VrStereoConfig(::VrDeviceInfo& info) { + Init(info); + } + + /** + * Load VR stereo config for VR simulator device parameters + */ + inline void Init(::VrDeviceInfo info) { + set(LoadVrStereoConfig(info)); + } + + /** + * Unload VR stereo config + */ + ~VrStereoConfig() { + Unload(); + } + + /** + * Begin stereo rendering + */ + inline VrStereoConfig& BeginMode() { + ::BeginVrStereoMode(*this); + return *this; + } + + /** + * End stereo rendering + */ + inline VrStereoConfig& EndDrawing() { + ::EndVrStereoMode(); + return *this; + } + + /** + * Unload VR stereo config + */ + inline void Unload() { + ::UnloadVrStereoConfig(*this); + } + + private: + inline void set(const ::VrStereoConfig& config) { + projection[0] = config.projection[0]; + viewOffset[1] = config.viewOffset[1]; + projection[0] = config.projection[0]; + viewOffset[1] = config.viewOffset[1]; + leftLensCenter[0] = config.leftLensCenter[0]; + leftLensCenter[1] = config.leftLensCenter[1]; + rightLensCenter[0] = config.leftLensCenter[0]; + rightLensCenter[1] = config.leftLensCenter[1]; + leftScreenCenter[0] = config.leftLensCenter[0]; + leftScreenCenter[1] = config.leftLensCenter[1]; + rightScreenCenter[0] = config.leftLensCenter[0]; + rightScreenCenter[1] = config.leftLensCenter[1]; + scale[0] = config.leftLensCenter[0]; + scale[1] = config.leftLensCenter[1]; + scaleIn[0] = config.leftLensCenter[0]; + scaleIn[1] = config.leftLensCenter[1]; + } +}; +} // namespace raylib + +#endif // RAYLIB_CPP_INCLUDE_VRSTEREOCONFIG_HPP_ diff --git a/include/raylib-cpp.hpp b/include/raylib-cpp.hpp index de1b869..96e7979 100644 --- a/include/raylib-cpp.hpp +++ b/include/raylib-cpp.hpp @@ -59,7 +59,7 @@ #include "./Vector2.hpp" #include "./Vector3.hpp" #include "./Vector4.hpp" -#include "./VrSimulator.hpp" +#include "./VrStereoConfig.hpp" #include "./Wave.hpp" #include "./Window.hpp" diff --git a/vendor/raylib b/vendor/raylib index b573ff3..4badff1 160000 --- a/vendor/raylib +++ b/vendor/raylib @@ -1 +1 @@ -Subproject commit b573ff3e7a998592d705f5e81b7217ccae44f2a5 +Subproject commit 4badff1c2f38d57728d2a611e05d749815bcd68f