[Scummvm-git-logs] scummvm master -> 51a8c3bc14a33ddcadd247069a9938b8326aa567

neuromancer noreply at scummvm.org
Thu Aug 3 06:13:17 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f8a0e2c50f FREESCAPE: fix invalid rectangles when they are rendered
51a8c3bc14 FREESCAPE: document corner case in Renderer::renderRectangle


Commit: f8a0e2c50f4f09ff36c4fe418afb4f458dee3cf1
    https://github.com/scummvm/scummvm/commit/f8a0e2c50f4f09ff36c4fe418afb4f458dee3cf1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-08-03T08:15:16+02:00

Commit Message:
FREESCAPE: fix invalid rectangles when they are rendered

Changed paths:
    engines/freescape/gfx.cpp


diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index a84688dc44c..01d7c1c5436 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -813,9 +813,20 @@ void Renderer::renderCube(const Math::Vector3d &origin, const Math::Vector3d &si
 	}
 }
 
-void Renderer::renderRectangle(const Math::Vector3d &origin, const Math::Vector3d &size, Common::Array<uint8> *colours) {
+void Renderer::renderRectangle(const Math::Vector3d &origin, const Math::Vector3d &originalSize, Common::Array<uint8> *colours) {
+
+	Math::Vector3d size = originalSize;
+	if (size.x() > 0 && size.y() > 0 && size.z() > 0) {
+		if (size.x() <= size.y() && size.x() <= size.z())
+			size.x() = 0;
+		else if (size.y() <= size.x() && size.y() <= size.z())
+			size.y() = 0;
+		else if (size.z() <= size.x() && size.z() <= size.y())
+			size.z() = 0;
+		else
+			error("Invalid size!");
+	}
 
-	assert(size.x() == 0 || size.y() == 0 || size.z() == 0);
 	polygonOffset(true);
 
 	float dx, dy, dz;


Commit: 51a8c3bc14a33ddcadd247069a9938b8326aa567
    https://github.com/scummvm/scummvm/commit/51a8c3bc14a33ddcadd247069a9938b8326aa567
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-08-03T08:15:16+02:00

Commit Message:
FREESCAPE: document corner case in Renderer::renderRectangle

Changed paths:
    engines/freescape/gfx.cpp


diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 01d7c1c5436..2a6ef480d61 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -817,6 +817,20 @@ void Renderer::renderRectangle(const Math::Vector3d &origin, const Math::Vector3
 
 	Math::Vector3d size = originalSize;
 	if (size.x() > 0 && size.y() > 0 && size.z() > 0) {
+		/* According to https://www.shdon.com/freescape/
+		If the bounding box is has all non-zero dimensions
+		and is thus a cube, the rectangle is rendered as a
+		slope at an angle with the plane of the polygon being
+		parallel to the X axis (its lower edge extends from
+		the base corner along the positive X direction).
+		In that case, when the player is at a Z coordinate
+		greater than (i.e. north of) the base corner,
+		it is rendered in the front face material, otherwise it
+		is rendered in the back face material. This implies
+		that the engine does its material selection as though
+		it were a rectangle perpendicular to the Z axis.
+		TODO: fix this case.
+		*/
 		if (size.x() <= size.y() && size.x() <= size.z())
 			size.x() = 0;
 		else if (size.y() <= size.x() && size.y() <= size.z())




More information about the Scummvm-git-logs mailing list