Skip to content

Commit

Permalink
Fixed io support for new member variables
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Dec 13, 2024
1 parent afb1a0a commit 0678e6c
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions src/vsg/animation/CameraSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>("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<uint32_t>("nearFars");
nearFars.resize(num_nearFars);
for (auto& nf : nearFars)
{
input.matchPropertyName("nearfar");
input.read(1, &nf.time);
input.read(1, &nf.value);
}
}

Expand Down Expand Up @@ -94,14 +104,33 @@ void CameraKeyframes::write(Output& output) const
}

// write scale key frames
output.writeValue<uint32_t>("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<uint32_t>("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<uint32_t>("nearFars", nearFars.size());
for (const auto& nf : nearFars)
{
output.writePropertyName("nearfar");
output.write(1, &nf.time);
output.write(1, &nf.value);
output.writeEndOfLine();
}
}

////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 0678e6c

Please sign in to comment.