Update raylib

This commit is contained in:
Rob Loach
2021-04-15 17:44:07 -04:00
parent a8037e4f87
commit decdf5cd9f
8 changed files with 86 additions and 110 deletions

View File

@@ -39,7 +39,7 @@ install(FILES
Vector2.hpp
Vector3.hpp
Vector4.hpp
VrSimulator.hpp
VrStereoConfig.hpp
Wave.hpp
Window.hpp
DESTINATION include

View File

@@ -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
*/

View File

@@ -27,11 +27,11 @@ class Mesh : public ::Mesh {
/**
* Load meshes from model file
*/
static std::vector<Mesh> Load(const std::string& fileName) {
int count = 0;
::Mesh* meshes = LoadMeshes(fileName.c_str(), &count);
return std::vector<Mesh>(meshes, meshes + count);
}
// static std::vector<Mesh> Load(const std::string& fileName) {
// int count = 0;
// ::Mesh* meshes = LoadMeshes(fileName.c_str(), &count);
// return std::vector<Mesh>(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);
}
/**

View File

@@ -291,11 +291,6 @@ class Vector3 : public ::Vector3 {
return *this;
}
inline Vector3& DrawGizmo() {
::DrawGizmo(*this);
return *this;
}
/**
* Detect collision between two spheres
*/

View File

@@ -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<const Camera*>(&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_

View File

@@ -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_

View File

@@ -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"

2
vendor/raylib vendored