From 0678e6cdf447440562a2876e2d555f6fb8fcc870 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 13 Dec 2024 09:13:24 +0000 Subject: [PATCH] Fixed io support for new member variables --- src/vsg/animation/CameraSampler.cpp | 43 ++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/src/vsg/animation/CameraSampler.cpp b/src/vsg/animation/CameraSampler.cpp index 79fb98ab0..4dadabca4 100644 --- a/src/vsg/animation/CameraSampler.cpp +++ b/src/vsg/animation/CameraSampler.cpp @@ -56,14 +56,24 @@ void CameraKeyframes::read(Input& input) input.read(1, &rotation.value); } - // read scale key frames + // read field of view key frames uint32_t num_fieldOfViews = input.readValue("fieldOfViews"); fieldOfViews.resize(num_fieldOfViews); - for (auto& scale : fieldOfViews) + for (auto& fov : fieldOfViews) { - input.matchPropertyName("projection"); - input.read(1, &scale.time); - input.read(1, &scale.value); + input.matchPropertyName("fov"); + input.read(1, &fov.time); + input.read(1, &fov.value); + } + + // read near/far key frames + uint32_t num_nearFars = input.readValue("nearFars"); + nearFars.resize(num_nearFars); + for (auto& nf : nearFars) + { + input.matchPropertyName("nearfar"); + input.read(1, &nf.time); + input.read(1, &nf.value); } } @@ -94,14 +104,33 @@ void CameraKeyframes::write(Output& output) const } // write scale key frames - output.writeValue("fieldOfViews", fieldOfViews.size()); for (const auto& scale : fieldOfViews) { - output.writePropertyName("projection"); + output.writePropertyName("fov"); output.write(1, &scale.time); output.write(1, &scale.value); output.writeEndOfLine(); } + + // write field of view key frames + output.writeValue("fieldOfViews", fieldOfViews.size()); + for (const auto& fov : fieldOfViews) + { + output.writePropertyName("fov"); + output.write(1, &fov.time); + output.write(1, &fov.value); + output.writeEndOfLine(); + } + + // read near/far key frames + output.writeValue("nearFars", nearFars.size()); + for (const auto& nf : nearFars) + { + output.writePropertyName("nearfar"); + output.write(1, &nf.time); + output.write(1, &nf.value); + output.writeEndOfLine(); + } } ////////////////////////////////////////////////////////////////////////////////////////////////////