[Scummvm-git-logs] scummvm master -> 40d2f85202562a7bd7e605a782165f36874c282a

aquadran noreply at scummvm.org
Thu Oct 17 20:36:29 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:
40d2f85202 WINTERMUTE: Convert few more functions to use DX math


Commit: 40d2f85202562a7bd7e605a782165f36874c282a
    https://github.com/scummvm/scummvm/commit/40d2f85202562a7bd7e605a782165f36874c282a
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-10-17T22:36:24+02:00

Commit Message:
WINTERMUTE: Convert few more functions to use DX math

Changed paths:
    engines/wintermute/ad/ad_actor_3dx.cpp
    engines/wintermute/ad/ad_attach_3dx.cpp
    engines/wintermute/ad/ad_attach_3dx.h


diff --git a/engines/wintermute/ad/ad_actor_3dx.cpp b/engines/wintermute/ad/ad_actor_3dx.cpp
index d96ff0d4a30..a7717e72cfa 100644
--- a/engines/wintermute/ad/ad_actor_3dx.cpp
+++ b/engines/wintermute/ad/ad_actor_3dx.cpp
@@ -504,9 +504,10 @@ bool AdActor3DX::displayShadowVolume() {
 			continue;
 		}
 
-		Math::Matrix4 viewMat;
-		viewMat.setData(*boneMat);
-		at->displayShadowVol(viewMat, lightVector, extrusionDepth, true);
+		DXMatrix viewMatrix, worldMatrix;
+		worldMatrix = DXMatrix(_worldMatrix.getData());
+		DXMatrixMultiply(&viewMatrix, &worldMatrix, boneMat);
+		at->displayShadowVol(viewMatrix, lightVector, extrusionDepth, true);
 	}
 
 	// restore model's world matrix and render the shadow volume
diff --git a/engines/wintermute/ad/ad_attach_3dx.cpp b/engines/wintermute/ad/ad_attach_3dx.cpp
index 06238a21130..db4b583ea3e 100644
--- a/engines/wintermute/ad/ad_attach_3dx.cpp
+++ b/engines/wintermute/ad/ad_attach_3dx.cpp
@@ -84,7 +84,12 @@ bool AdAttach3DX::update() {
 
 //////////////////////////////////////////////////////////////////////////
 bool AdAttach3DX::displayAttachable(const Math::Matrix4 &viewMat, bool registerObjects) {
-	Math::Matrix4 finalMat = _owner->_worldMatrix * viewMat * _worldMatrix;
+	DXMatrix finalMatrix, worldMatrix, viewMatrix;
+	worldMatrix = DXMatrix(_worldMatrix.getData());
+	viewMatrix = DXMatrix(viewMat.getData());
+	DXMatrixMultiply(&finalMatrix, &worldMatrix, &viewMatrix);
+	Math::Matrix4 finalMat;
+	finalMat.setData(finalMatrix);
 	_gameRef->_renderer3D->setWorldTransform(finalMat);
 
 	if (_xmodel) {
@@ -104,8 +109,12 @@ bool AdAttach3DX::displayAttachable(const Math::Matrix4 &viewMat, bool registerO
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool AdAttach3DX::displayShadowVol(const Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth, bool update) {
-	Math::Matrix4 finalMat = modelMat * _worldMatrix;
+bool AdAttach3DX::displayShadowVol(const DXMatrix &modelMat, const Math::Vector3d &light, float extrusionDepth, bool update) {
+	DXMatrix finalMatrix, worldMatrix;
+	worldMatrix = DXMatrix(_worldMatrix.getData());
+	DXMatrixMultiply(&finalMatrix, &modelMat, &worldMatrix);
+	Math::Matrix4 finalMat;
+	finalMat.setData(finalMatrix);
 
 	if (_xmodel) {
 		if (update) {
diff --git a/engines/wintermute/ad/ad_attach_3dx.h b/engines/wintermute/ad/ad_attach_3dx.h
index 3e90ce26fd0..ed6d11c8e3f 100644
--- a/engines/wintermute/ad/ad_attach_3dx.h
+++ b/engines/wintermute/ad/ad_attach_3dx.h
@@ -42,7 +42,7 @@ public:
 	bool init(const char *modelFile, const char *name, const char *parentBone);
 	bool update() override;
 	bool displayAttachable(const Math::Matrix4 &viewMat, bool registerObjects);
-	bool displayShadowVol(const Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth, bool update);
+	bool displayShadowVol(const DXMatrix &modelMat, const Math::Vector3d &light, float extrusionDepth, bool update);
 	bool invalidateDeviceObjects() override;
 	bool restoreDeviceObjects() override;
 




More information about the Scummvm-git-logs mailing list