[Scummvm-git-logs] scummvm master -> 759674d50ba6929ec32b9a440ae2e7e2b77a7406
sev-
noreply at scummvm.org
Sun Mar 8 00:05:28 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
759674d50b QDENGINE: Fix sPlane4f strict aliasing violation
Commit: 759674d50ba6929ec32b9a440ae2e7e2b77a7406
https://github.com/scummvm/scummvm/commit/759674d50ba6929ec32b9a440ae2e7e2b77a7406
Author: Mohit Bankar (mohitbankar1212 at gmail.com)
Date: 2026-03-08T01:05:24+01:00
Commit Message:
QDENGINE: Fix sPlane4f strict aliasing violation
Directly normalize the float members instead of using the
pointer trick.
Changed paths:
engines/qdengine/qdcore/qd_camera.cpp
diff --git a/engines/qdengine/qdcore/qd_camera.cpp b/engines/qdengine/qdcore/qd_camera.cpp
index 413f4ede096..d22715a831e 100644
--- a/engines/qdengine/qdcore/qd_camera.cpp
+++ b/engines/qdengine/qdcore/qd_camera.cpp
@@ -47,7 +47,11 @@ struct sPlane4f {
A = (b.y - a.y) * (c.z - a.z) - (c.y - a.y) * (b.z - a.z);
B = (b.z - a.z) * (c.x - a.x) - (c.z - a.z) * (b.x - a.x);
C = (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
- GetNormal().normalize();
+ Vect3f vect(A, B, C);
+ vect.normalize();
+ A = vect.x;
+ B = vect.y;
+ C = vect.z;
D = -A * a.x - B * a.y - C * a.z;
}
inline void Set(const Vect3f &a, const Vect3f &b, const Vect3f &c) {
@@ -55,7 +59,11 @@ struct sPlane4f {
A = (b.y - a.y) * (c.z - a.z) - (c.y - a.y) * (b.z - a.z);
B = (b.z - a.z) * (c.x - a.x) - (c.z - a.z) * (b.x - a.x);
C = (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
- GetNormal().normalize();
+ Vect3f vect(A, B, C);
+ vect.normalize();
+ A = vect.x;
+ B = vect.y;
+ C = vect.z;
D = -A * a.x - B * a.y - C * a.z;
}
inline float GetDistance(const Vect3f &a) {
@@ -71,8 +79,8 @@ struct sPlane4f {
t = (A * a.x + B * a.y + C * a.z + D) / t;
return t;
}
- inline Vect3f &GetNormal() {
- return *(Vect3f *)&A;
+ inline Vect3f GetNormal() const {
+ return Vect3f(A, B, C);
}
inline void GetReflectionVector(const Vect3f &in, Vect3f &out) {
// out - поиÑк оÑÑажение векÑоÑа Ð¾Ñ Ð¿Ð»Ð¾ÑкоÑÑи
More information about the Scummvm-git-logs
mailing list