mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[vulkan] Check for ambient lights
Ambient lights are represented by a point at infinity and a zero direction vector (spherical lights have a non-zero direction vector but the cone angle is 360 degrees). This fixes what appeared to be mangled light renderers (it was actually just an ambient light being treated as a directional light (point at infinity, but non-zero direction vector).
This commit is contained in:
parent
8e7474f614
commit
b8070e0141
1 changed files with 4 additions and 3 deletions
|
@ -702,10 +702,12 @@ build_shadow_maps (lightingctx_t *lctx, vulkan_ctx_t *ctx)
|
|||
int layers = 1;
|
||||
int li = lightMap[i];
|
||||
__auto_type lr = &lctx->light_renderers.a[li];
|
||||
*lr = (light_renderer_t) {};
|
||||
|
||||
lr->mode = ST_NONE;
|
||||
if (!lights[li].position[3]) {
|
||||
lr->mode = ST_CASCADE;
|
||||
if (!VectorIsZero (lights[li].direction)) {
|
||||
lr->mode = ST_CASCADE;
|
||||
}
|
||||
} else {
|
||||
if (lights[li].direction[3] > -0.5) {
|
||||
lr->mode = ST_CUBE;
|
||||
|
@ -791,7 +793,6 @@ build_shadow_maps (lightingctx_t *lctx, vulkan_ctx_t *ctx)
|
|||
__auto_type lr = &lctx->light_renderers.a[li];
|
||||
|
||||
if (imageMap[li] == -1) {
|
||||
*lr = (light_renderer_t) {};
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue