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

aquadran aquadran at gmail.com
Mon Oct 18 20:54:23 UTC 2021


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:
f7cf2917a2 STARK: Cleanup light shader code


Commit: f7cf2917a2da6640b0ea36fb1ea8b4ef892b23e9
    https://github.com/scummvm/scummvm/commit/f7cf2917a2da6640b0ea36fb1ea8b4ef892b23e9
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-10-18T22:54:17+02:00

Commit Message:
STARK: Cleanup light shader code

Changed paths:
    engines/stark/shaders/stark_prop.vertex


diff --git a/engines/stark/shaders/stark_prop.vertex b/engines/stark/shaders/stark_prop.vertex
index af35c1381c..8ea49401aa 100644
--- a/engines/stark/shaders/stark_prop.vertex
+++ b/engines/stark/shaders/stark_prop.vertex
@@ -48,12 +48,17 @@ vec3 directionalLight(vec3 direction, vec3 color) {
 
 vec3 spotLight(vec3 position, vec3 color, float falloffNear, float falloffFar, vec3 direction, float cosInnerAngle, float cosOuterAngle) {
 	vec3 vertexToLight = position - eyePosition.xyz;
+
+	float dist = length(vertexToLight);
+	float attn = clamp((falloffFar - dist) / max(0.001, falloffFar - falloffNear), 0.0, 1.0);
+
 	vertexToLight = normalize(vertexToLight);
+	float incidence = max(0.0, dot(eyeNormal, vertexToLight));
 
 	float cosAngle = max(0.0, dot(vertexToLight, -direction));
 	float cone = clamp((cosAngle - cosInnerAngle) / max(0.001, cosOuterAngle - cosInnerAngle), 0.0, 1.0);
 
-	return pointLight(position, color, falloffNear, falloffFar) * cone;
+	return color * attn * incidence * cone;
 }
 
 void main() {




More information about the Scummvm-git-logs mailing list