[Scummvm-git-logs] scummvm master -> 689d698bd9aff6d713dacc819c5b0d6dbeb46a37
aquadran
noreply at scummvm.org
Sun Oct 13 07:50:33 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
689d698bd9 WINTERMUTE: Sync function names with original
Commit: 689d698bd9aff6d713dacc819c5b0d6dbeb46a37
https://github.com/scummvm/scummvm/commit/689d698bd9aff6d713dacc819c5b0d6dbeb46a37
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2024-10-13T09:50:28+02:00
Commit Message:
WINTERMUTE: Sync function names with original
Changed paths:
engines/wintermute/ad/ad_scene_geometry.cpp
engines/wintermute/base/gfx/xmesh.cpp
engines/wintermute/math/math_util.cpp
engines/wintermute/math/math_util.h
diff --git a/engines/wintermute/ad/ad_scene_geometry.cpp b/engines/wintermute/ad/ad_scene_geometry.cpp
index 6af0c269d03..c656c634918 100644
--- a/engines/wintermute/ad/ad_scene_geometry.cpp
+++ b/engines/wintermute/ad/ad_scene_geometry.cpp
@@ -427,11 +427,11 @@ float AdSceneGeometry::getHeightAt(Math::Vector3d pos, float tolerance, bool *in
float *v1 = _planes[i]->_mesh->getVertexPosition(triangle[1]);
float *v2 = _planes[i]->_mesh->getVertexPosition(triangle[2]);
- if (lineIntersectsTriangle(pos, dir,
- Math::Vector3d(v0[0], v0[1], v0[2]),
- Math::Vector3d(v1[0], v1[1], v1[2]),
- Math::Vector3d(v2[0], v2[1], v2[2]),
- intersection.x(), intersection.y(), intersection.z())) {
+ if (intersectTriangle(pos, dir,
+ Math::Vector3d(v0[0], v0[1], v0[2]),
+ Math::Vector3d(v1[0], v1[1], v1[2]),
+ Math::Vector3d(v2[0], v2[1], v2[2]),
+ intersection.x(), intersection.y(), intersection.z())) {
if (intersection.y() > pos.y() + tolerance) {
continue; // only fall down
}
@@ -464,17 +464,17 @@ bool AdSceneGeometry::directPathExists(Math::Vector3d *p1, Math::Vector3d *p2) {
Math::Vector3d intersection;
float dist;
- if (lineSegmentIntersectsTriangle(*p1, *p2, Math::Vector3d(v0[0], v0[1], v0[2]),
- Math::Vector3d(v1[0], v1[1], v1[2]),
- Math::Vector3d(v2[0], v2[1], v2[2]),
- intersection, dist)) {
- if (lineIntersectsTriangle(*p1, *p1 - *p2, v0, v1, v2,
- intersection.x(), intersection.y(), intersection.z())) {
+ if (pickGetIntersect(*p1, *p2, Math::Vector3d(v0[0], v0[1], v0[2]),
+ Math::Vector3d(v1[0], v1[1], v1[2]),
+ Math::Vector3d(v2[0], v2[1], v2[2]),
+ intersection, dist)) {
+ if (intersectTriangle(*p1, *p1 - *p2, v0, v1, v2,
+ intersection.x(), intersection.y(), intersection.z())) {
return false;
}
- if (lineIntersectsTriangle(*p2, *p2 - *p1, v0, v1, v2,
- intersection.x(), intersection.y(), intersection.z())) {
+ if (intersectTriangle(*p2, *p2 - *p1, v0, v1, v2,
+ intersection.x(), intersection.y(), intersection.z())) {
return false;
}
}
@@ -495,17 +495,17 @@ bool AdSceneGeometry::directPathExists(Math::Vector3d *p1, Math::Vector3d *p2) {
Math::Vector3d intersection;
float dist;
- if (lineSegmentIntersectsTriangle(*p1, *p2, Math::Vector3d(v0[0], v0[1], v0[2]),
- Math::Vector3d(v1[0], v1[1], v1[2]),
- Math::Vector3d(v2[0], v2[1], v2[2]),
- intersection, dist)) {
- if (lineIntersectsTriangle(*p1, *p1 - *p2, v0, v1, v2,
- intersection.x(), intersection.y(), intersection.z())) {
+ if (pickGetIntersect(*p1, *p2, Math::Vector3d(v0[0], v0[1], v0[2]),
+ Math::Vector3d(v1[0], v1[1], v1[2]),
+ Math::Vector3d(v2[0], v2[1], v2[2]),
+ intersection, dist)) {
+ if (intersectTriangle(*p1, *p1 - *p2, v0, v1, v2,
+ intersection.x(), intersection.y(), intersection.z())) {
return false;
}
- if (lineIntersectsTriangle(*p2, *p2 - *p1, v0, v1, v2,
- intersection.x(), intersection.y(), intersection.z())) {
+ if (intersectTriangle(*p2, *p2 - *p1, v0, v1, v2,
+ intersection.x(), intersection.y(), intersection.z())) {
return false;
}
}
@@ -532,12 +532,12 @@ Math::Vector3d AdSceneGeometry::getBlockIntersection(Math::Vector3d *p1, Math::V
Math::Vector3d intersection;
float dist;
- if (lineSegmentIntersectsTriangle(*p1, *p2, v0, v1, v2, intersection, dist)) {
- if (lineIntersectsTriangle(*p1, *p1 - *p2, v0, v1, v2, intersection.x(), intersection.y(), intersection.z())) {
+ if (pickGetIntersect(*p1, *p2, v0, v1, v2, intersection, dist)) {
+ if (intersectTriangle(*p1, *p1 - *p2, v0, v1, v2, intersection.x(), intersection.y(), intersection.z())) {
return intersection;
}
- if (lineIntersectsTriangle(*p2, *p2 - *p1, v0, v1, v2, intersection.x(), intersection.y(), intersection.z())) {
+ if (intersectTriangle(*p2, *p2 - *p1, v0, v1, v2, intersection.x(), intersection.y(), intersection.z())) {
return intersection;
}
}
@@ -646,11 +646,11 @@ bool AdSceneGeometry::convert2Dto3D(int x, int y, Math::Vector3d *pos) {
float *v2 = _planes[i]->_mesh->getVertexPosition(triangle[2]);
Math::Vector3d intersection;
- if (lineIntersectsTriangle(ray.getOrigin(), ray.getDirection(),
- Math::Vector3d(v0[0], v0[1], v0[2]),
- Math::Vector3d(v1[0], v1[1], v1[2]),
- Math::Vector3d(v2[0], v2[1], v2[2]),
- intersection.x(), intersection.y(), intersection.z())) {
+ if (intersectTriangle(ray.getOrigin(), ray.getDirection(),
+ Math::Vector3d(v0[0], v0[1], v0[2]),
+ Math::Vector3d(v1[0], v1[1], v1[2]),
+ Math::Vector3d(v2[0], v2[1], v2[2]),
+ intersection.x(), intersection.y(), intersection.z())) {
Math::Vector3d lineSegement = intersection - getActiveCamera()->_position;
float dist = lineSegement.getMagnitude();
diff --git a/engines/wintermute/base/gfx/xmesh.cpp b/engines/wintermute/base/gfx/xmesh.cpp
index c5c284d3b48..becd999559f 100644
--- a/engines/wintermute/base/gfx/xmesh.cpp
+++ b/engines/wintermute/base/gfx/xmesh.cpp
@@ -425,7 +425,7 @@ bool XMesh::pickPoly(Math::Vector3d *pickRayOrig, Math::Vector3d *pickRayDir) {
continue;
Math::Vector3d intersection;
- if (lineIntersectsTriangle(*pickRayOrig, *pickRayDir, v0, v1, v2, intersection.x(), intersection.y(), intersection.z())) {
+ if (intersectTriangle(*pickRayOrig, *pickRayDir, v0, v1, v2, intersection.x(), intersection.y(), intersection.z())) {
res = true;
break;
}
diff --git a/engines/wintermute/math/math_util.cpp b/engines/wintermute/math/math_util.cpp
index c129e0c6a9d..e692ee46fa8 100644
--- a/engines/wintermute/math/math_util.cpp
+++ b/engines/wintermute/math/math_util.cpp
@@ -53,9 +53,10 @@ float MathUtil::roundUp(float val) {
}
#ifdef ENABLE_WME3D
-bool lineIntersectsTriangle(const Math::Vector3d &origin, const Math::Vector3d &direction,
- const Math::Vector3d &v0, const Math::Vector3d &v1, const Math::Vector3d &v2,
- float &t, float &u, float &v) {
+
+bool intersectTriangle(const Math::Vector3d &origin, const Math::Vector3d &direction,
+ const Math::Vector3d &v0, const Math::Vector3d &v1, const Math::Vector3d &v2,
+ float &t, float &u, float &v) {
const float epsilon = 0.0001f;
Math::Vector3d edge1 = v1 - v0;
@@ -92,7 +93,7 @@ bool lineIntersectsTriangle(const Math::Vector3d &origin, const Math::Vector3d &
return true;
}
-bool lineSegmentIntersectsTriangle(const Math::Vector3d &lineStart, const Math::Vector3d &lineEnd,
+bool pickGetIntersect(const Math::Vector3d &lineStart, const Math::Vector3d &lineEnd,
const Math::Vector3d &v0, const Math::Vector3d &v1, const Math::Vector3d &v2,
Math::Vector3d &intersection, float &distance) {
const float epsilon = 0.0001f;
diff --git a/engines/wintermute/math/math_util.h b/engines/wintermute/math/math_util.h
index b4cce1d799b..7f181a078b8 100644
--- a/engines/wintermute/math/math_util.h
+++ b/engines/wintermute/math/math_util.h
@@ -46,13 +46,13 @@ public:
#define degToRad(_val) (_val * DX_PI * (1.0f / 180.0f))
#define radToDeg(_val) (_val * (180.0f / DX_PI))
-bool lineIntersectsTriangle(const Math::Vector3d &origin, const Math::Vector3d &direction,
+bool intersectTriangle(const Math::Vector3d &origin, const Math::Vector3d &direction,
const Math::Vector3d &v0, const Math::Vector3d &v1, const Math::Vector3d &v2,
float &t, float &u, float &v);
-
-bool lineSegmentIntersectsTriangle(const Math::Vector3d &lineStart, const Math::Vector3d &lineEnd,
+bool pickGetIntersect(const Math::Vector3d &lineStart, const Math::Vector3d &lineEnd,
const Math::Vector3d &v0, const Math::Vector3d &v1, const Math::Vector3d &v2,
Math::Vector3d &intersection, float &distance);
+
#endif
} // End of namespace Wintermute
More information about the Scummvm-git-logs
mailing list