From 4d7c14a2515bf34eed6c48454da9f0f13242dc0d Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Thu, 26 Oct 2023 23:49:42 +0200 Subject: [PATCH 1/5] Reorder vsg include header alphabetical --- vsgvr/src/vsgvr/app/CompositionLayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsgvr/src/vsgvr/app/CompositionLayer.cpp b/vsgvr/src/vsgvr/app/CompositionLayer.cpp index b0cc6e9..745f393 100644 --- a/vsgvr/src/vsgvr/app/CompositionLayer.cpp +++ b/vsgvr/src/vsgvr/app/CompositionLayer.cpp @@ -31,9 +31,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include #include #include -#include #include "../xr/Macros.cpp" From 20d53492bdd2dee94e00b111e00f9bf6050df14b Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Thu, 26 Oct 2023 23:51:28 +0200 Subject: [PATCH 2/5] Fixed issue that the declaration for vsg:createHeadLight() was not found Fix #51 --- vsgvr/src/vsgvr/app/CompositionLayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/vsgvr/src/vsgvr/app/CompositionLayer.cpp b/vsgvr/src/vsgvr/app/CompositionLayer.cpp index 745f393..eaf1d2c 100644 --- a/vsgvr/src/vsgvr/app/CompositionLayer.cpp +++ b/vsgvr/src/vsgvr/app/CompositionLayer.cpp @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include #include From 340faa0c2f0a5fd2c4cb682be88ce12a38658911 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 20 Mar 2024 14:03:11 +0100 Subject: [PATCH 3/5] Fix api change of vsg::FrameStamp::create() Fix #53 --- vsgvr/include/vsgvr/app/Viewer.h | 10 +++++++++- vsgvr/src/vsgvr/app/Viewer.cpp | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/vsgvr/include/vsgvr/app/Viewer.h b/vsgvr/include/vsgvr/app/Viewer.h index cc6d4a5..ae716a1 100644 --- a/vsgvr/include/vsgvr/app/Viewer.h +++ b/vsgvr/include/vsgvr/app/Viewer.h @@ -106,8 +106,15 @@ namespace vsgvr { /// **must** call releaseFrame() once after rendering, even if this method returns false. /// /// @return Whether the application should render. - bool advanceToNextFrame(); +#if VSG_VERSION_MAJOR >= 1 && VSG_VERSION_MINOR >= 1 + /// hint for setting the FrameStamp::simulationTime to time since start_point() + static constexpr double UseTimeSinceStartPoint = std::numeric_limits::max(); + + bool advanceToNextFrame(double simulationTime = UseTimeSinceStartPoint); +#else + bool advanceToNextFrame(); +#endif /// Submit rendering tasks to Vulkan void recordAndSubmit(); @@ -167,6 +174,7 @@ namespace vsgvr { XrFrameState _frameState; vsg::ref_ptr _frameStamp; std::vector _layers; + vsg::clock::time_point _start_time_point; }; } diff --git a/vsgvr/src/vsgvr/app/Viewer.cpp b/vsgvr/src/vsgvr/app/Viewer.cpp index 60390e0..d5ab0c4 100644 --- a/vsgvr/src/vsgvr/app/Viewer.cpp +++ b/vsgvr/src/vsgvr/app/Viewer.cpp @@ -107,7 +107,11 @@ namespace vsgvr return PollEventsResult::RunningDontRender; } +#if VSG_VERSION_MAJOR >= 1 && VSG_VERSION_MINOR >= 1 + bool Viewer::advanceToNextFrame(double simulationTime) +#else bool Viewer::advanceToNextFrame() +#endif { // Viewer::acquireNextFrame _frameState = XrFrameState(); @@ -128,12 +132,28 @@ namespace vsgvr if (!_frameStamp) { // first frame, initialize to frame count and indices to 0 +#if VSG_VERSION_MAJOR >= 1 && VSG_VERSION_MINOR >= 1 + + _start_time_point = t; + + if (simulationTime == UseTimeSinceStartPoint) simulationTime = 0.0; + _frameStamp = vsg::FrameStamp::create(t, 0, simulationTime); +#else _frameStamp = vsg::FrameStamp::create(t, 0); +#endif } else { // after first frame so increment frame count and indices +#if VSG_VERSION_MAJOR >= 1 && VSG_VERSION_MINOR >= 1 + if (simulationTime == UseTimeSinceStartPoint) + { + simulationTime = std::chrono::duration(t - _start_time_point).count(); + } + _frameStamp = vsg::FrameStamp::create(t, _frameStamp->frameCount + 1, simulationTime); +#else _frameStamp = vsg::FrameStamp::create(t, _frameStamp->frameCount + 1); +#endif } for (auto& layer : compositionLayers) From 1bcb172304e7747a20e8e6b808a14418144a61ef Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 6 May 2024 15:09:41 +0200 Subject: [PATCH 4/5] Adjust to use vsg version 1.1.3 api --- vsgvr/src/vsgvr/app/CompositionLayer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vsgvr/src/vsgvr/app/CompositionLayer.cpp b/vsgvr/src/vsgvr/app/CompositionLayer.cpp index eaf1d2c..03f2304 100644 --- a/vsgvr/src/vsgvr/app/CompositionLayer.cpp +++ b/vsgvr/src/vsgvr/app/CompositionLayer.cpp @@ -29,10 +29,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include +// see https://github.com/vsg-dev/VulkanSceneGraph/issues/1184 +#define VSG_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) +#define VSG_VERSION VSG_VERSION_CHECK(VSG_VERSION_MAJOR, VSG_VERSION_MINOR, VSG_VERSION_PATCH) + #include #include #include + +#if VSG_VERSION >= VSG_VERSION_CHECK(1, 1, 3) +#include +#else #include +#endif #include #include From 242af98ce7d017e8560f285fde6ee3d4e7556a07 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 6 May 2024 15:10:09 +0200 Subject: [PATCH 5/5] Fix warning related to overwriting local member --- vsgvr/src/vsgvr/app/UserOrigin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsgvr/src/vsgvr/app/UserOrigin.cpp b/vsgvr/src/vsgvr/app/UserOrigin.cpp index 1242553..622c5bd 100644 --- a/vsgvr/src/vsgvr/app/UserOrigin.cpp +++ b/vsgvr/src/vsgvr/app/UserOrigin.cpp @@ -26,8 +26,8 @@ namespace vsgvr { UserOrigin::UserOrigin() {} - UserOrigin::UserOrigin(vsg::dmat4 matrix) - : Inherit(matrix) + UserOrigin::UserOrigin(vsg::dmat4 _matrix) + : Inherit(_matrix) {} UserOrigin::UserOrigin(vsg::dvec3 position, vsg::dquat orientation, vsg::dvec3 scale)