Repe [T3DU] and Moises Jpelaez updates

This commit is contained in:
2026-05-12 23:54:06 -07:00
parent 6b404f9da6
commit 39091e8db3
147 changed files with 5539 additions and 1750 deletions

View File

@ -370,8 +370,6 @@ class LightObject extends Object {
}
#end // lnx_csm
#if lnx_clusters
// Centralize discarding conditions when iterating over lights
// Important to avoid issues later with "misaligned" data in uniforms (lightsArray, clusterData, LWVPSpotArray)
public inline static function discardLight(light: LightObject) {
@ -381,6 +379,8 @@ class LightObject extends Object {
public inline static function discardLightCulled(light: LightObject) {
return #if lnx_shadowmap_atlas light.culledLight || #end discardLight(light);
}
#if lnx_clusters
#if (lnx_shadowmap_atlas && lnx_shadowmap_atlas_lod)
// Arbitrary function to map from [0-16] to [1.0-0.0]
@ -422,7 +422,8 @@ class LightObject extends Object {
#if lnx_spot // Point lamps first
lights.sort(function(a, b): Int {
return a.data.raw.type >= b.data.raw.type ? 1 : -1;
if (a.data.raw.type == b.data.raw.type) return 0;
return a.data.raw.type > b.data.raw.type ? 1 : -1;
});
#end
@ -494,6 +495,13 @@ class LightObject extends Object {
continue;
}
#end
if (minX < 0) minX = 0;
if (maxX >= slicesX) maxX = slicesX - 1;
if (minY < 0) minY = 0;
if (maxY >= slicesY) maxY = slicesY - 1;
if (minZ < 0) minZ = 0;
if (maxZ >= slicesZ) maxZ = slicesZ - 1;
// Mark affected clusters
for (z in minZ...maxZ + 1) {
for (y in minY...maxY + 1) {