Skip to content

Commit 6185c73

Browse files
committed
Four bug fixes to issues found by an AI code audit!
1 parent 8896d78 commit 6185c73

3 files changed

Lines changed: 30 additions & 14 deletions

File tree

include/vsg/maths/mat4.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,8 @@ namespace vsg
236236
t_vec3<T> operator*(const t_vec3<T>& lhs, const t_mat4<T>& rhs)
237237
{
238238
T inv = numbers<T>::one() / (lhs[0] * rhs[3][0] + lhs[1] * rhs[3][1] + lhs[2] * rhs[3][2] + rhs[3][3]);
239-
return t_vec3<T>(lhs[0] * rhs[0][0] + lhs[1] * rhs[0][1] + lhs[2] * rhs[0][2] + rhs[0][3] * inv,
240-
lhs[0] * rhs[1][0] + lhs[1] * rhs[1][1] + lhs[2] * rhs[1][2] + rhs[1][3] * inv,
241-
lhs[0] * rhs[2][0] + lhs[1] * rhs[2][1] + lhs[2] * rhs[2][2] + rhs[2][3] * inv);
239+
return t_vec3<T>((lhs[0] * rhs[0][0] + lhs[1] * rhs[0][1] + lhs[2] * rhs[0][2] + rhs[0][3]) * inv,
240+
(lhs[0] * rhs[1][0] + lhs[1] * rhs[1][1] + lhs[2] * rhs[1][2] + rhs[1][3]) * inv,
241+
(lhs[0] * rhs[2][0] + lhs[1] * rhs[2][1] + lhs[2] * rhs[2][2] + rhs[2][3]) * inv);
242242
}
243-
244243
} // namespace vsg

src/vsg/animation/CameraSampler.cpp

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ void CameraKeyframes::read(Input& input)
4545
input.readObjects("path", track.value);
4646
}
4747

48+
if (input.version_greater_equal(1, 1, 15))
49+
{
50+
// read origin key frames
51+
uint32_t num_origins = input.readValue<uint32_t>("origins");
52+
origins.resize(num_origins);
53+
for (auto& origin : origins)
54+
{
55+
input.matchPropertyName("origin");
56+
input.read(1, &origin.time);
57+
input.read(1, &origin.value);
58+
}
59+
}
60+
4861
// read position key frames
4962
uint32_t num_positions = input.readValue<uint32_t>("positions");
5063
positions.resize(num_positions);
@@ -103,6 +116,19 @@ void CameraKeyframes::write(Output& output) const
103116
output.writeObjects("path", track.value);
104117
}
105118

119+
if (output.version_greater_equal(1, 1, 15))
120+
{
121+
// write origin key frames
122+
output.writeValue<uint32_t>("origins", origins.size());
123+
for (const auto& origin : origins)
124+
{
125+
output.writePropertyName("origin");
126+
output.write(1, &origin.time);
127+
output.write(1, &origin.value);
128+
output.writeEndOfLine();
129+
}
130+
}
131+
106132
// write position key frames
107133
output.writeValue<uint32_t>("positions", positions.size());
108134
for (const auto& position : positions)
@@ -123,15 +149,6 @@ void CameraKeyframes::write(Output& output) const
123149
output.writeEndOfLine();
124150
}
125151

126-
// write scale key frames
127-
for (const auto& scale : fieldOfViews)
128-
{
129-
output.writePropertyName("fov");
130-
output.write(1, &scale.time);
131-
output.write(1, &scale.value);
132-
output.writeEndOfLine();
133-
}
134-
135152
// write field of view key frames
136153
output.writeValue<uint32_t>("fieldOfViews", fieldOfViews.size());
137154
for (const auto& fov : fieldOfViews)

src/vsg/state/ColorBlendState.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int ColorBlendState::compare(const Object& rhs_object) const
8585
if ((result = compare_value(logicOpEnable, rhs.logicOpEnable))) return result;
8686
if ((result = compare_value(logicOp, rhs.logicOp))) return result;
8787
if ((result = compare_value_container(attachments, rhs.attachments))) return result;
88-
return compare_values(blendConstants, rhs.blendConstants, 3);
88+
return compare_values(blendConstants, rhs.blendConstants, 4);
8989
}
9090

9191
void ColorBlendState::read(Input& input)

0 commit comments

Comments
 (0)