[Scummvm-git-logs] scummvm master -> 231227625dc356ccce17dca524c6eb5dd16df500
aquadran
aquadran at gmail.com
Mon Oct 18 19:28:30 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:
231227625d STARK: Improve OpenGL ligthing
Commit: 231227625dc356ccce17dca524c6eb5dd16df500
https://github.com/scummvm/scummvm/commit/231227625dc356ccce17dca524c6eb5dd16df500
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2021-10-18T21:28:25+02:00
Commit Message:
STARK: Improve OpenGL ligthing
Changed paths:
engines/stark/gfx/opengl.cpp
engines/stark/gfx/openglactor.cpp
diff --git a/engines/stark/gfx/opengl.cpp b/engines/stark/gfx/opengl.cpp
index dd8f6d8778..a2e61c3a6e 100644
--- a/engines/stark/gfx/opengl.cpp
+++ b/engines/stark/gfx/opengl.cpp
@@ -120,6 +120,7 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
GLfloat lightDir[] = { 0.0f, 0.0f, -1.0f };
GLfloat cutoff = 180.0f;
GLfloat spotExp = 0.0f;
+ GLfloat c_attenuation = 1.0f;
GLfloat l_attenuation = 0.0f;
GLfloat q_attenuation = 0.0f;
@@ -135,7 +136,6 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
Math::Vector3d eyeDirection = viewMatrix.getRotation() * worldDirection;
eyeDirection.normalize();
- glDisable(GL_LIGHT0 + i);
switch (l->type) {
case LightEntry::kPoint:
lightColor[0] = (GLfloat)l->color.x();
@@ -164,16 +164,12 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
lightDir[0] = (GLfloat)eyeDirection.x();
lightDir[1] = (GLfloat)eyeDirection.y();
lightDir[2] = (GLfloat)eyeDirection.z();
- // FIXME
- l_attenuation = 0.0000001f;
- q_attenuation = 0.0000001f;
- //spotExp = 0.0f;
- //cutoff = (l->outerConeAngle.getDegrees() + l->innerConeAngle.getDegrees()) / 2.0f;
+ cutoff = (l->outerConeAngle.getDegrees() + l->innerConeAngle.getDegrees()) / 2.26f;
break;
case LightEntry::kAmbient:
- ambientColor[0] = (GLfloat)l->color.x();
- ambientColor[1] = (GLfloat)l->color.y();
- ambientColor[2] = (GLfloat)l->color.z();
+ lightColor[0] = (GLfloat)l->color.x();
+ lightColor[1] = (GLfloat)l->color.y();
+ lightColor[2] = (GLfloat)l->color.z();
break;
default:
break;
@@ -185,6 +181,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_CONSTANT_ATTENUATION, c_attenuation);
glLightf(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, l_attenuation);
glLightf(GL_LIGHT0 + i, GL_QUADRATIC_ATTENUATION, q_attenuation);
glEnable(GL_LIGHT0 + i);
diff --git a/engines/stark/gfx/openglactor.cpp b/engines/stark/gfx/openglactor.cpp
index 0d62f1d0e6..26d7ee11c5 100644
--- a/engines/stark/gfx/openglactor.cpp
+++ b/engines/stark/gfx/openglactor.cpp
@@ -97,7 +97,7 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
Common::Array<Material *> mats = _model->getMaterials();
const Common::Array<BoneNode *> &bones = _model->getBones();
- glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
for (Common::Array<Face *>::const_iterator face = faces.begin(); face != faces.end(); ++face) {
const Material *material = mats[(*face)->materialId];
More information about the Scummvm-git-logs
mailing list