From 9e279a0c1fc72879f6bed0a23de7d6f0fc494483 Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Mon, 16 May 2016 10:49:00 +0000 Subject: [PATCH] Non luminous polygons seem to be effected by the lightModifier also. API seems to have no restriction in this regard, neither does the SDK. The ocean hunter requires this for some of the 2d stuff. Light modifier values only seem to exist between 0-16, which is strange for 5 bits of precision. Possibly top bit disables the effect and lower 4 bits are the value. This clearly differs from the SDK, but without this the values come out clearly wrong. --- Src/Graphics/New3D/New3D.cpp | 12 ++---------- Src/Graphics/New3D/PolyHeader.cpp | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Src/Graphics/New3D/New3D.cpp b/Src/Graphics/New3D/New3D.cpp index c22f694..9159a82 100644 --- a/Src/Graphics/New3D/New3D.cpp +++ b/Src/Graphics/New3D/New3D.cpp @@ -886,16 +886,8 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data) currentMesh->specularCoefficient = 0; // ph.SpecularValue(); } } - - /* - if (!ph.Luminous()) { - currentMesh->fogIntensity = 1.0f; - } - else { - currentMesh->fogIntensity = ph.LightModifier(); - }*/ - - currentMesh->fogIntensity = 1.0; + + currentMesh->fogIntensity = ph.LightModifier(); if (ph.TexEnabled()) { currentMesh->format = ph.TexFormat(); diff --git a/Src/Graphics/New3D/PolyHeader.cpp b/Src/Graphics/New3D/PolyHeader.cpp index f0048ce..63c7489 100644 --- a/Src/Graphics/New3D/PolyHeader.cpp +++ b/Src/Graphics/New3D/PolyHeader.cpp @@ -330,7 +330,7 @@ bool PolyHeader::Luminous() float PolyHeader::LightModifier() { - return (float)((header[6] >> 11) & 0x1F) * (1.0f / 31.0f); + return ((header[6] >> 11) & 0x1F) * (1.0f / 16.0f); } //