mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-15 01:24:35 +02:00
#23 fix over-bright lighting
This commit is contained in:
@@ -485,7 +485,7 @@ struct Controller {
|
|||||||
if (light.intensity > 0x1FFF) continue;
|
if (light.intensity > 0x1FFF) continue;
|
||||||
|
|
||||||
vec3 dir = vec3(float(light.x), float(light.y), float(light.z)) - center;
|
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) {
|
if (att > maxAtt) {
|
||||||
maxAtt = att;
|
maxAtt = att;
|
||||||
@@ -502,7 +502,7 @@ struct Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec3 tpos = vec3(float(targetLight->x), float(targetLight->y), float(targetLight->z));
|
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) {
|
if (lerp) {
|
||||||
float t = Core::deltaTime * 2.0f;
|
float t = Core::deltaTime * 2.0f;
|
||||||
|
@@ -357,7 +357,7 @@ namespace Debug {
|
|||||||
for (int i = 0; i < level.roomsCount; i++)
|
for (int i = 0; i < level.roomsCount; i++)
|
||||||
for (int j = 0; j < level.rooms[i].lightsCount; j++) {
|
for (int j = 0; j < level.rooms[i].lightsCount; j++) {
|
||||||
TR::Room::Light &l = level.rooms[i].lights[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);
|
vec3 p = vec3(l.x, l.y, l.z);
|
||||||
vec4 color = vec4(a, a, a, 1);
|
vec4 color = vec4(a, a, a, 1);
|
||||||
|
|
||||||
|
@@ -174,6 +174,7 @@ struct Block : Controller {
|
|||||||
updateEntity();
|
updateEntity();
|
||||||
updateFloor(true);
|
updateFloor(true);
|
||||||
}
|
}
|
||||||
|
updateLights();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user