1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 08:34:32 +02:00

#23 fix over-bright lighting

This commit is contained in:
XProger
2017-04-26 01:26:35 +03:00
parent 8c33378621
commit 5db4b54bd0
3 changed files with 4 additions and 3 deletions

View File

@@ -485,7 +485,7 @@ struct Controller {
if (light.intensity > 0x1FFF) continue;
vec3 dir = vec3(float(light.x), float(light.y), float(light.z)) - center;
float att = max(0.0f, 1.0f - dir.length2() / float(light.radius) / float(light.radius)) * (intensityf(light.intensity));
float att = max(0.0f, 1.0f - dir.length2() / float(light.radius) / float(light.radius)) * (1.0f - intensityf(light.intensity));
if (att > maxAtt) {
maxAtt = att;
@@ -502,7 +502,7 @@ struct Controller {
}
vec3 tpos = vec3(float(targetLight->x), float(targetLight->y), float(targetLight->z));
vec4 tcolor = vec4(vec3(intensityf(targetLight->intensity)), float(targetLight->radius));
vec4 tcolor = vec4(vec3(1.0f - intensityf(targetLight->intensity)), float(targetLight->radius));
if (lerp) {
float t = Core::deltaTime * 2.0f;

View File

@@ -357,7 +357,7 @@ namespace Debug {
for (int i = 0; i < level.roomsCount; i++)
for (int j = 0; j < level.rooms[i].lightsCount; j++) {
TR::Room::Light &l = level.rooms[i].lights[j];
float a = intensityf(l.intensity);
float a = 1.0f - intensityf(l.intensity);
vec3 p = vec3(l.x, l.y, l.z);
vec4 color = vec4(a, a, a, 1);

View File

@@ -174,6 +174,7 @@ struct Block : Controller {
updateEntity();
updateFloor(true);
}
updateLights();
}
};