17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-08 23:07:38 +01:00

Draw the cab probe with all the lights of the cab

This commit is contained in:
2026-10-29 20:05:03 +01:00
parent 8bd41f431d
commit 96100f1155
14 changed files with 143 additions and 89 deletions

View File

@@ -348,10 +348,10 @@ void vulkan14_renderer::render_cab_probe()
{
vehicle = nullptr;
}
// the brightest light of the cab lights the probe when it's a light of the frame
auto const *principal{(vehicle != nullptr) && (m_locallights.cab_lamp_vehicle() == vehicle) ? m_locallights.cab_principal() : nullptr};
auto const *lamp{principal != nullptr ? &principal->source : nullptr};
if (false == probe.update_wanted(vehicle, (vehicle != nullptr ? vehicle->mdKabina : nullptr), center, extent, lamp, m_framestamp))
// the lights of the cab light the probe when they're lights of the frame
std::vector<gfx::local_lights::cab_light> const nolights;
auto const &lights{(vehicle != nullptr) && (m_locallights.cab_lamp_vehicle() == vehicle) ? m_locallights.cab_lights() : nolights};
if (false == probe.update_wanted(vehicle, (vehicle != nullptr ? vehicle->mdKabina : nullptr), center, extent, lights, m_framestamp))
{
return;
}
@@ -361,9 +361,8 @@ void vulkan14_renderer::render_cab_probe()
return;
}
ctx.passes.begin_pass("cab probe");
// the light with its shadow map, when the map holds the shadows of the light where it is
auto const slot{principal != nullptr ? scene.lamps.cab_slot_of(vehicle, *principal) : -1};
probe.setup_drawing(scene_ubs, lamp, (principal != nullptr ? principal->local : glm::vec3{0.f}), (slot >= 0), (slot >= 0 ? scene.lamps.weights(static_cast<std::size_t>(slot)) : glm::vec4{0.f}));
// the lights with their shadow maps, where the maps hold their shadows
probe.setup_drawing(scene_ubs, lights, scene.lamps, vehicle);
// the sun coming in through the windows, as the shading of the last frame got it. the mask is read once it was copied
probe.setup_sun(scene_ubs, vehicle, -m_sunlight.direction, glm::vec3{light_data.lights[0].color} * light_data.lights[0].intensity, m_colorpass.pass_camera.position());
if (probe.mask_map() == nullptr)

View File

@@ -889,6 +889,7 @@ std::string binding_preamble(bool const Raytracing)
define("MAX_CASCADES", static_cast<unsigned int>(gl::MAX_CASCADES), "U");
define("MAX_PARAMS", static_cast<unsigned int>(gl::MAX_PARAMS), "U");
define("MAX_HEADLIGHT_SHADOWS", static_cast<unsigned int>(gl::MAX_HEADLIGHT_SHADOWS), "U");
define("MAX_CAB_PROBE_LAMPS", static_cast<unsigned int>(gl::MAX_CAB_PROBE_LAMPS), "U");
define("CLUSTER_GRID_X", gl::CLUSTER_GRID_X);
define("CLUSTER_GRID_Y", gl::CLUSTER_GRID_Y);
define("CLUSTER_GRID_Z", gl::CLUSTER_GRID_Z);