17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 00:50:29 +01:00

Add the optional Radius, ShadeSelf, CastShadows and SoftFalloff of FreeSpotLight and make FalloffAngle 360 a point light

This commit is contained in:
2026-10-28 16:18:03 +01:00
parent 413cebed9c
commit c4e23932bf
25 changed files with 327 additions and 72 deletions

View File

@@ -153,6 +153,16 @@ void opengl46_local_shadows::init()
glClearTexImage(m_emptyheadlights, 0, GL_DEPTH_COMPONENT, GL_FLOAT, &farthest);
}
void opengl46_local_shadows::set_near(float const Near)
{
glProgramUniform1f(*m_program, NEAR_LOCATION, Near);
glProgramUniform1f(*m_alpha_program, NEAR_LOCATION, Near);
if (m_multidraw_program)
glProgramUniform1f(*m_multidraw_program, NEAR_LOCATION, Near);
if (m_alpha_multidraw_program)
glProgramUniform1f(*m_alpha_multidraw_program, NEAR_LOCATION, Near);
}
void opengl46_local_shadows::set_layer(int const Layer)
{
glProgramUniform1i(*m_program, LAYER_LOCATION, Layer);
@@ -229,6 +239,7 @@ void opengl46_local_shadows::gpu_begin_cab()
{
m_timer.begin();
set_layer(CAB_SLOT * 6);
set_near(SHADOW_NEAR);
setup_drawing(m_framebuffer, m_size);
float const farthest{0.f};
glClearNamedFramebufferfv(m_framebuffer, GL_DEPTH, 0, &farthest);
@@ -254,6 +265,8 @@ void opengl46_local_shadows::gpu_begin_lamp(int const Scenerycube, int const Wor
glClearTexSubImage(m_lampstexture, 0, 0, 0, Scenerycube * 6, m_lampssize, m_lampssize, 6, GL_DEPTH_COMPONENT, GL_FLOAT, &farthest);
}
set_layer((Vehicles ? Workingcube : Scenerycube) * 6);
// the near plane of the lamp, which the shading reads the map with (lamp_weights())
set_near(m_lampnear);
setup_drawing(m_lampsframebuffer, m_lampssize);
}