17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 21:39:16 +01:00

Cast shadows of the cab lamp from the cab in the GL 4.6 renderer

This commit is contained in:
2026-10-16 02:43:27 +02:00
parent 4d3a401aae
commit 06d7b9e9f0
15 changed files with 568 additions and 8 deletions

View File

@@ -333,8 +333,10 @@ void opengl46_local_lights::gather_cab_lamp(gfx::geometrybank_manager const &Geo
auto const lamp{glm::vec3{bounds.center.x, std::max(bounds.center.y, bounds.center.y + bounds.extent.y - 0.25f), bounds.center.z}};
m_cablamp = light{};
m_cablamp.position = vehicle->GetWorldPosition(glm::dvec3{lamp});
m_cablampvehicle = vehicle;
m_cablamplocal = lamp;
m_cablamp.color = to_linear(vehicle->InteriorLight) * (level * Global.gfx_lights_cab_intensity);
// within the cab: with no shadows the lamp would light the track below and the body of the vehicle around it
// within the cab: without shadows (gfx.lights.shadows) the lamp would light the track below and the body of the vehicle around it
m_cablamp.range = std::clamp(glm::length(bounds.extent) * 1.25f, 2.5f, 8.f);
m_cablampon = (max_component(m_cablamp.color) > 0.f);
}