From 2fd29c5193a0b9e6d3920f0512ce3ca37b00bf7e Mon Sep 17 00:00:00 2001 From: Peter Kohaut Date: Thu, 24 Jan 2019 22:56:10 +0100 Subject: BLADERUNNER: Fixed fog rendering Fogs were not animated. Clean up of the fog calculation routines. --- engines/bladerunner/vector.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'engines/bladerunner/vector.h') diff --git a/engines/bladerunner/vector.h b/engines/bladerunner/vector.h index d5d6365a81..52883cb587 100644 --- a/engines/bladerunner/vector.h +++ b/engines/bladerunner/vector.h @@ -55,8 +55,11 @@ public: Vector3(float ax, float ay, float az) : x(ax), y(ay), z(az) {} - float length() { return sqrt(x * x + y * y + z * z); } - Vector3 normalize() { + inline float length() { + return sqrt(x * x + y * y + z * z); + } + + inline Vector3 normalize() { float len = length(); if (len == 0) { return Vector3(0.0f, 0.0f, 0.0f); @@ -64,13 +67,17 @@ public: return Vector3(x / len, y / len, z / len); } - static Vector3 cross(Vector3 a, Vector3 b) { + inline static Vector3 cross(Vector3 a, Vector3 b) { return Vector3( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); } + inline static float dot(Vector3 a, Vector3 b) { + return a.x * b.x + a.y * b.y + a.z * b.z; + } + Vector2 xz() const { return Vector2(x, z); } -- cgit v1.2.3