[Scummvm-git-logs] scummvm master -> 7fc0e2d1108e370133b07e7eecf842d8b03762e6

antoniou79 noreply at scummvm.org
Mon Nov 14 16:54:50 UTC 2022


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:
7fc0e2d110 BLADERUNNER: optimize math calculations.


Commit: 7fc0e2d1108e370133b07e7eecf842d8b03762e6
    https://github.com/scummvm/scummvm/commit/7fc0e2d1108e370133b07e7eecf842d8b03762e6
Author: Carlo Bramini (30959007+carlo-bramini at users.noreply.github.com)
Date: 2022-11-14T18:54:45+02:00

Commit Message:
BLADERUNNER: optimize math calculations.

This patch just moves the calls to sin() and cos() outside the declaration of the rotation matrix, so that those values are calculated only one time, as it has been already done in other parts of this source code.

Changed paths:
    engines/bladerunner/slice_renderer.cpp


diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp
index f1ac0ca803b..5cd88ac2120 100644
--- a/engines/bladerunner/slice_renderer.cpp
+++ b/engines/bladerunner/slice_renderer.cpp
@@ -612,10 +612,13 @@ void SliceRenderer::drawShadowInWorld(int transparency, Graphics::Surface &surfa
 		0.0f, 1.0f, 0.0f, _position.y,
 		0.0f, 0.0f, 1.0f, _position.z);
 
+	float s = sin(_facing);
+	float c = cos(_facing);
+
 	Matrix4x3 mRotation(
-		cos(_facing), -sin(_facing), 0.0f, 0.0f,
-		sin(_facing),  cos(_facing), 0.0f, 0.0f,
-		        0.0f,          0.0f, 1.0f, 0.0f);
+		   c,   -s, 0.0f, 0.0f,
+		   s,    c, 0.0f, 0.0f,
+		0.0f, 0.0f, 1.0f, 0.0f);
 
 	Matrix4x3 mScale(
 		_frameScale.x,          0.0f,              0.0f, 0.0f,




More information about the Scummvm-git-logs mailing list