mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-29 02:17:28 +01:00
Cast shadows of scenery lamps from the scenery, nearby vehicles and the cab in the GL 4.6 renderer
This commit is contained in:
@@ -57,6 +57,7 @@ void gl::glsl_common_setup()
|
||||
"#define ATMOSPHERE_SKYVIEW_UNIT " + std::to_string(ATMOSPHERE_SKYVIEW_UNIT) + "\n" +
|
||||
"#define SKY_VIEW_TEX " + std::to_string(SKY_VIEW_TEX) + "\n" +
|
||||
"#define LOCAL_SHADOW_TEX " + std::to_string(LOCAL_SHADOW_TEX) + "\n" +
|
||||
"#define LOCAL_SHADOW_LAMPS_TEX " + std::to_string(LOCAL_SHADOW_LAMPS_TEX) + "\n" +
|
||||
R"STRING(
|
||||
const uint LIGHT_SPOT = 0U;
|
||||
const uint LIGHT_POINT = 1U;
|
||||
|
||||
5
gl/ubo.h
5
gl/ubo.h
@@ -60,6 +60,8 @@ namespace gl
|
||||
const size_t SKY_VIEW_TEX = MAX_TEXTURES + HELPER_TEXTURES + 0;
|
||||
// cube shadow maps of the lamps (cube map array, depth compared; opengl46_local_shadows). bound directly, like the one above
|
||||
const size_t LOCAL_SHADOW_TEX = MAX_TEXTURES + HELPER_TEXTURES + 1;
|
||||
// the same for the lamps of scenery models (a texture of its own: the maps have another size)
|
||||
const size_t LOCAL_SHADOW_LAMPS_TEX = MAX_TEXTURES + HELPER_TEXTURES + 2;
|
||||
|
||||
struct scene_ubs
|
||||
{
|
||||
@@ -141,7 +143,8 @@ namespace gl
|
||||
// HEADLIGHTS: view space to the space of the beam texture, and the weights of its channels.
|
||||
// SPOT and POINT (lamps): view space to the space of the cube shadow map of the lamp (origin at the lamp), and
|
||||
// x: layer of the cube map array the map is in, below 0 when the lamp has no shadows; y: near plane of the map;
|
||||
// z: size of a texel of the map one metre from the lamp; w: radius of the filter, in texels
|
||||
// z: size of a texel of the map one metre from the lamp; w: radius of the filter, in texels. the map is in the array of
|
||||
// the scenery lamps (LOCAL_SHADOW_LAMPS_TEX) when linear is 1, in the one of the cab lamp (LOCAL_SHADOW_TEX) otherwise
|
||||
glm::mat4 headlight_projection;
|
||||
glm::vec4 headlight_weights;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user