[Scummvm-git-logs] scummvm master -> 3e2f5a3976a4d69fae4b41a1edf00e455e2f577a

aquadran aquadran at gmail.com
Sun Apr 4 09:36:22 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:
3e2f5a3976 STARK: A bit improved spot light type.


Commit: 3e2f5a3976a4d69fae4b41a1edf00e455e2f577a
    https://github.com/scummvm/scummvm/commit/3e2f5a3976a4d69fae4b41a1edf00e455e2f577a
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-04-04T11:36:12+02:00

Commit Message:
STARK: A bit improved spot light type.

Changed paths:
    engines/stark/gfx/opengl.cpp


diff --git a/engines/stark/gfx/opengl.cpp b/engines/stark/gfx/opengl.cpp
index 8c054e65b7..954a1d6d9d 100644
--- a/engines/stark/gfx/opengl.cpp
+++ b/engines/stark/gfx/opengl.cpp
@@ -121,6 +121,7 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
 		GLfloat lightDir[] = { 0.0f, 0.0f, -1.0f };
 		GLfloat cutoff = 180.0f;
 		GLfloat spotExp = 0.0f;
+		GLfloat l_attenuation = 0.0f;
 		GLfloat q_attenuation = 0.0f;
 
 		Math::Vector4d worldPosition;
@@ -135,12 +136,6 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
 		Math::Vector3d eyeDirection = viewMatrixRot * worldDirection;
 		eyeDirection.normalize();
 
-		Math::Vector4d params;
-		params.x() = l->falloffNear;
-		params.y() = l->falloffFar;
-		params.z() = l->innerConeAngle.getCosine();
-		params.w() = l->outerConeAngle.getCosine();
-
 		glDisable(GL_LIGHT0 + i);
 		switch (l->type) {
 			case LightEntry::kPoint:
@@ -167,13 +162,14 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
 				lightPos[0] = (GLfloat)eyePosition.x();
 				lightPos[1] = (GLfloat)eyePosition.y();
 				lightPos[2] = (GLfloat)eyePosition.z();
-				lightDir[0] = (GLfloat)eyeDirection.x();
-				lightDir[1] = (GLfloat)eyeDirection.y();
-				lightDir[2] = (GLfloat)eyeDirection.z();
+				lightDir[0] = -(GLfloat)eyeDirection.x();
+				lightDir[1] = -(GLfloat)eyeDirection.y();
+				lightDir[2] = -(GLfloat)eyeDirection.z();
 				// FIXME
-				q_attenuation = 1.0f;
-				spotExp = 1.0f;
-				cutoff = 180.f;
+				l_attenuation = 0.0000001f;
+				q_attenuation = 0.0000001f;
+				//spotExp = 0.0f;
+				//cutoff = (l->outerConeAngle.getDegrees() + l->innerConeAngle.getDegrees()) / 2.0f;
 				break;
 			case LightEntry::kAmbient:
 				ambientColor[0] = (GLfloat)l->color.x();
@@ -190,6 +186,7 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
 		glLightfv(GL_LIGHT0 + i, GL_SPOT_DIRECTION, lightDir);
 		glLightf(GL_LIGHT0 + i, GL_SPOT_EXPONENT, spotExp);
 		glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, cutoff);
+		glLightf(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, l_attenuation);
 		glLightf(GL_LIGHT0 + i, GL_QUADRATIC_ATTENUATION, q_attenuation);
 		glEnable(GL_LIGHT0 + i);
 	}




More information about the Scummvm-git-logs mailing list