[Scummvm-git-logs] scummvm master -> c1c1897dbe79c76735a59d04190fc04be68ffadd

aquadran noreply at scummvm.org
Sat Oct 12 07:03:11 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:
c1c1897dbe WINTERMUTE: Added DXComputeBoundingBox to math


Commit: c1c1897dbe79c76735a59d04190fc04be68ffadd
    https://github.com/scummvm/scummvm/commit/c1c1897dbe79c76735a59d04190fc04be68ffadd
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-10-12T09:03:07+02:00

Commit Message:
WINTERMUTE: Added DXComputeBoundingBox to math

Changed paths:
    engines/wintermute/base/gfx/xskinmesh.cpp
    engines/wintermute/base/gfx/xskinmesh.h


diff --git a/engines/wintermute/base/gfx/xskinmesh.cpp b/engines/wintermute/base/gfx/xskinmesh.cpp
index 6ebb2ceb014..dfc46c0eb23 100644
--- a/engines/wintermute/base/gfx/xskinmesh.cpp
+++ b/engines/wintermute/base/gfx/xskinmesh.cpp
@@ -72,6 +72,38 @@ uint32 DXGetFVFVertexSize(uint32 fvf) {
 	return size;
 }
 
+bool DXComputeBoundingBox(DXVector3 *pfirstposition, uint32 numvertices, uint32 dwstride, DXVector3 *pmin, DXVector3 *pmax) {
+	DXVector3 vec;
+	uint32 i;
+
+	if (!pfirstposition || !pmin || !pmax )
+		return false;
+
+	*pmin = *pfirstposition;
+	*pmax = *pmin;
+
+	for (i = 0; i < numvertices; i++) {
+		vec = *((DXVector3 *)((byte *)pfirstposition + dwstride * i));
+
+		if (vec._x < pmin->_x)
+			pmin->_x = vec._x;
+		if (vec._x > pmax->_x)
+			pmax->_x = vec._x;
+
+		if (vec._y < pmin->_y)
+			pmin->_y = vec._y;
+		if (vec._y > pmax->_y)
+			pmax->_y = vec._y;
+
+		if (vec._z < pmin->_z)
+			pmin->_z = vec._z;
+		if (vec._z > pmax->_z)
+			pmax->_z = vec._z;
+	}
+
+	return true;
+}
+
 static bool createMesh(uint32 numFaces, uint32 numVertices, uint32 fvf, DXMesh **mesh) {
 	if (!mesh)
 		return false;
diff --git a/engines/wintermute/base/gfx/xskinmesh.h b/engines/wintermute/base/gfx/xskinmesh.h
index 5512bb5ce88..cf645eaaae8 100644
--- a/engines/wintermute/base/gfx/xskinmesh.h
+++ b/engines/wintermute/base/gfx/xskinmesh.h
@@ -161,6 +161,7 @@ public:
 
 bool DXLoadSkinMesh(XFileData *fileData, DXBuffer &materialsOut, uint32 &numMaterialsOut, DXSkinInfo **skinInfoOut, DXMesh **meshOut);
 uint32 DXGetFVFVertexSize(uint32 fvf);
+bool DXComputeBoundingBox(DXVector3 *pfirstposition, uint32 numvertices, uint32 dwstride, DXVector3 *pmin, DXVector3 *pmax);
 
 } // namespace Wintermute
 




More information about the Scummvm-git-logs mailing list