[Scummvm-git-logs] scummvm master -> ec5a71e93f4a63bf92bc6be79b49673aeb305b91
aquadran
aquadran at gmail.com
Tue Oct 19 06:02:53 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:
ec5a71e93f STARK: Small cleanup in lighting code
Commit: ec5a71e93f4a63bf92bc6be79b49673aeb305b91
https://github.com/scummvm/scummvm/commit/ec5a71e93f4a63bf92bc6be79b49673aeb305b91
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2021-10-19T08:02:46+02:00
Commit Message:
STARK: Small cleanup in lighting code
Changed paths:
engines/stark/gfx/openglactor.cpp
engines/stark/gfx/openglprop.cpp
diff --git a/engines/stark/gfx/openglactor.cpp b/engines/stark/gfx/openglactor.cpp
index 75352e78ce..8db52bec28 100644
--- a/engines/stark/gfx/openglactor.cpp
+++ b/engines/stark/gfx/openglactor.cpp
@@ -194,6 +194,7 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
}
if (_gfx->computeLightsEnabled()) {
+ Math::Vector4d worldPosition = Math::Vector4d(0.0, 0.0, 0.0, 1.0);
static const uint maxLights = 10;
assert(lights.size() >= 1);
@@ -207,16 +208,12 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
for (uint li = 0; li < lights.size() - 1; li++) {
const LightEntry *l = lights[li + 1];
- Math::Vector4d worldPosition;
worldPosition.x() = l->position.x();
worldPosition.y() = l->position.y();
worldPosition.z() = l->position.z();
- worldPosition.w() = 1.0;
Math::Vector4d lightEyePosition = view * worldPosition;
-
- Math::Vector3d worldDirection = l->direction;
- Math::Vector3d lightEyeDirection = view.getRotation() * worldDirection;
+ Math::Vector3d lightEyeDirection = view.getRotation() * l->direction;
lightEyeDirection.normalize();
switch (l->type) {
diff --git a/engines/stark/gfx/openglprop.cpp b/engines/stark/gfx/openglprop.cpp
index cd4b2a7c56..8dac044404 100644
--- a/engines/stark/gfx/openglprop.cpp
+++ b/engines/stark/gfx/openglprop.cpp
@@ -122,6 +122,7 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
Math::Vector4d modelEyePosition = modelViewMatrix * Math::Vector4d(vertex.x, vertex.y, vertex.z, 1.0);
Math::Vector3d modelEyeNormal = normalMatrix.getRotation() * Math::Vector3d(vertex.nx, vertex.ny, vertex.nz);
modelEyeNormal.normalize();
+ Math::Vector4d worldPosition = Math::Vector4d(0.0, 0.0, 0.0, 1.0);
static const uint maxLights = 10;
@@ -136,16 +137,12 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
for (uint li = 0; li < lights.size() - 1; li++) {
const LightEntry *l = lights[li + 1];
- Math::Vector4d worldPosition;
worldPosition.x() = l->position.x();
worldPosition.y() = l->position.y();
worldPosition.z() = l->position.z();
- worldPosition.w() = 1.0;
Math::Vector4d lightEyePosition = view * worldPosition;
-
- Math::Vector3d worldDirection = l->direction;
- Math::Vector3d lightEyeDirection = view.getRotation() * worldDirection;
+ Math::Vector3d lightEyeDirection = view.getRotation() * l->direction;
lightEyeDirection.normalize();
switch (l->type) {
More information about the Scummvm-git-logs
mailing list