[Scummvm-git-logs] scummvm master -> 66840cc9c63ef01d2fc8a28535781ecf022e2e44
aquadran
noreply at scummvm.org
Mon Oct 14 14:25:54 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:
66840cc9c6 WINTERMUTE: Sync convert3Dto2D function with original
Commit: 66840cc9c63ef01d2fc8a28535781ecf022e2e44
https://github.com/scummvm/scummvm/commit/66840cc9c63ef01d2fc8a28535781ecf022e2e44
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2024-10-14T16:25:48+02:00
Commit Message:
WINTERMUTE: Sync convert3Dto2D function with original
Changed paths:
engines/wintermute/ad/ad_scene_geometry.cpp
diff --git a/engines/wintermute/ad/ad_scene_geometry.cpp b/engines/wintermute/ad/ad_scene_geometry.cpp
index 12551f8daa3..fb4e3ae639a 100644
--- a/engines/wintermute/ad/ad_scene_geometry.cpp
+++ b/engines/wintermute/ad/ad_scene_geometry.cpp
@@ -1314,24 +1314,18 @@ bool AdSceneGeometry::persist(BasePersistenceManager *persistMgr) {
}
//////////////////////////////////////////////////////////////////////////
-bool AdSceneGeometry::convert3Dto2D(Math::Vector3d *pos, int32 *x, int32 *y) {
- Math::Matrix4 worldMat;
- worldMat.setToIdentity();
-
- Math::Vector3d vect2D;
- int viewportTmp[4];
- // TODO: gluMathProject expects an OpenGL viewport,
- // hence the first coordinates specify the lower left corner
- // wme works with a Direct3D viewport, though
- // so check if this does work
- viewportTmp[0] = _drawingViewport.left;
- viewportTmp[1] = _drawingViewport.bottom;
- viewportTmp[2] = _drawingViewport.width();
- viewportTmp[3] = _drawingViewport.height();
- Math::Matrix4 modelViewMatrix = _lastViewMat * worldMat;
- Math::gluMathProject(*pos, modelViewMatrix.getData(), _lastProjMat.getData(), viewportTmp, vect2D);
- *x = vect2D.x() + _lastScrollX;
- *y = vect2D.y() + _lastScrollY;
+bool AdSceneGeometry::convert3Dto2D(Math::Vector3d *position, int32 *x, int32 *y) {
+ DXMatrix worldMat;
+ DXMatrixIdentity(&worldMat);
+ DXMatrix projMat = DXMatrix(_lastProjMat.getData());
+ DXMatrixTranspose(&projMat, &projMat);
+ DXMatrix viewMat = DXMatrix(_lastViewMat.getData());
+ DXMatrixTranspose(&viewMat, &viewMat);
+
+ DXVector3 vect2D, pos = DXVector3(position->x(), position->y(), position->z());
+ DXVec3Project(&vect2D, &pos, &_drawingViewport, &projMat, &viewMat, &worldMat);
+ *x = vect2D._x + _lastScrollX;
+ *y = vect2D._y + _lastScrollY;
return true;
}
More information about the Scummvm-git-logs
mailing list