Skip to content

Commit 0678e6c

Browse files
committed
Fixed io support for new member variables
1 parent afb1a0a commit 0678e6c

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

src/vsg/animation/CameraSampler.cpp

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,24 @@ void CameraKeyframes::read(Input& input)
5656
input.read(1, &rotation.value);
5757
}
5858

59-
// read scale key frames
59+
// read field of view key frames
6060
uint32_t num_fieldOfViews = input.readValue<uint32_t>("fieldOfViews");
6161
fieldOfViews.resize(num_fieldOfViews);
62-
for (auto& scale : fieldOfViews)
62+
for (auto& fov : fieldOfViews)
6363
{
64-
input.matchPropertyName("projection");
65-
input.read(1, &scale.time);
66-
input.read(1, &scale.value);
64+
input.matchPropertyName("fov");
65+
input.read(1, &fov.time);
66+
input.read(1, &fov.value);
67+
}
68+
69+
// read near/far key frames
70+
uint32_t num_nearFars = input.readValue<uint32_t>("nearFars");
71+
nearFars.resize(num_nearFars);
72+
for (auto& nf : nearFars)
73+
{
74+
input.matchPropertyName("nearfar");
75+
input.read(1, &nf.time);
76+
input.read(1, &nf.value);
6777
}
6878
}
6979

@@ -94,14 +104,33 @@ void CameraKeyframes::write(Output& output) const
94104
}
95105

96106
// write scale key frames
97-
output.writeValue<uint32_t>("fieldOfViews", fieldOfViews.size());
98107
for (const auto& scale : fieldOfViews)
99108
{
100-
output.writePropertyName("projection");
109+
output.writePropertyName("fov");
101110
output.write(1, &scale.time);
102111
output.write(1, &scale.value);
103112
output.writeEndOfLine();
104113
}
114+
115+
// write field of view key frames
116+
output.writeValue<uint32_t>("fieldOfViews", fieldOfViews.size());
117+
for (const auto& fov : fieldOfViews)
118+
{
119+
output.writePropertyName("fov");
120+
output.write(1, &fov.time);
121+
output.write(1, &fov.value);
122+
output.writeEndOfLine();
123+
}
124+
125+
// read near/far key frames
126+
output.writeValue<uint32_t>("nearFars", nearFars.size());
127+
for (const auto& nf : nearFars)
128+
{
129+
output.writePropertyName("nearfar");
130+
output.write(1, &nf.time);
131+
output.write(1, &nf.value);
132+
output.writeEndOfLine();
133+
}
105134
}
106135

107136
////////////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)