Update leenkx/Sources/leenkx/renderpath/Inc.hx

This commit is contained in:
Onek8 2025-05-22 02:57:45 +00:00
parent 58b9000305
commit ae72401657

View File

@ -31,10 +31,10 @@ class Inc {
static var m = iron.math.Mat4.identity();
static var voxel_ca1:kha.compute.ConstantLocation;
static var voxel_cb1:kha.compute.ConstantLocation;
static var voxel_cc1:kha.compute.ConstantLocation;
#if (rp_voxels == "Voxel GI")
static var voxel_td1:kha.compute.TextureUnit;
static var voxel_te1:kha.compute.TextureUnit;
static var voxel_cc1:kha.compute.ConstantLocation;
#else
#if lnx_voxelgi_shadows
static var voxel_te1:kha.compute.TextureUnit;
@ -152,9 +152,11 @@ class Inc {
for (atlas in ShadowMapAtlas.shadowMapAtlases) {
path.bindTarget(atlas.target, atlas.target);
}
#if rp_shadowmap_transparent
for (atlas in ShadowMapAtlas.shadowMapAtlasesTransparent) {
path.bindTarget(atlas.target, atlas.target);
}
#end
}
static function getShadowMapAtlas(atlas:ShadowMapAtlas, transparent: Bool):String {
@ -195,24 +197,30 @@ class Inc {
for (atlas in ShadowMapAtlas.shadowMapAtlases) {
atlas.rejectedLights = [];
}
#if rp_shadowmap_transparent
for (atlas in ShadowMapAtlas.shadowMapAtlasesTransparent) {
atlas.rejectedLights = [];
}
#end
#end
for (light in iron.Scene.active.lights) {
if (!light.lightInAtlas && !light.culledLight && light.visible && light.shadowMapScale > 0.0
&& light.data.raw.strength > 0.0 && light.data.raw.cast_shadow) {
ShadowMapAtlas.addLight(light, false);
}
#if rp_shadowmap_transparent
if (!light.lightInAtlasTransparent && !light.culledLight && light.visible && light.shadowMapScale > 0.0
&& light.data.raw.strength > 0.0 && light.data.raw.cast_shadow) {
ShadowMapAtlas.addLight(light, true);
}
#end
}
// update point light data before rendering
updatePointLightAtlasData(true);
updatePointLightAtlasData(false);
#if rp_shadowmap_transparent
updatePointLightAtlasData(true);
#end
for (atlas in ShadowMapAtlas.shadowMapAtlases) {
var tilesToRemove = [];
@ -290,6 +298,7 @@ class Inc {
path.endStream();
}
#if rp_shadowmap_transparent
for (atlas in ShadowMapAtlas.shadowMapAtlasesTransparent) {
var tilesToRemove = [];
#if lnx_shadowmap_atlas_lod
@ -384,8 +393,6 @@ class Inc {
tile.freeTile();
}
}
#if lnx_debug
endShadowsLogicProfile();
#end
#end
}
@ -490,6 +497,7 @@ class Inc {
else if (l.data.raw.type == "spot" || l.data.raw.type == "area") spotIndex++;
}
#if rp_shadowmap_transparent
pointIndex = 0;
spotIndex = 0;
for (l in iron.Scene.active.lights) {
@ -511,6 +519,7 @@ class Inc {
if (l.data.raw.type == "point") pointIndex++;
else if (l.data.raw.type == "spot" || l.data.raw.type == "area") spotIndex++;
}
#end
#end // rp_shadowmap
}
#end
@ -597,10 +606,14 @@ class Inc {
#end
#if (rp_voxels != "Off")
{
path.bindTarget("voxelsOut", "voxels");
path.bindTarget("voxelsSDF", "voxelsSDF");
}
path.bindTarget("voxelsOut", "voxels");
#if (rp_voxels == "Voxel GI" || lnx_voxelgi_shadows)
path.bindTarget("voxelsSDF", "voxelsSDF");
#end
#end
#if rp_ssrs
path.bindTarget("_main", "gbufferD");
#end
path.drawMeshes("translucent");
@ -811,6 +824,7 @@ class Inc {
#if (rp_voxels == "Voxel GI")
voxel_td1 = voxel_sh1.getTextureUnit("voxelsSampler");
voxel_te1 = voxel_sh1.getTextureUnit("SDF");
voxel_cc1 = voxel_sh1.getConstantLocation("envmapStrength");
#else
#if lnx_voxelgi_shadows
voxel_te1 = voxel_sh1.getTextureUnit("SDF");
@ -932,6 +946,7 @@ class Inc {
#if (rp_voxels == "Voxel GI")
kha.compute.Compute.setSampledTexture(voxel_td1, rts.get("voxelsOutB").image);
kha.compute.Compute.setTexture(voxel_te1, rts.get("voxelsSDF").image, kha.compute.Access.Write);
kha.compute.Compute.setFloat(voxel_cc1, iron.Scene.active.world == null ? 0.0 : iron.Scene.active.world.probe.raw.strength);
#else
#if lnx_voxelgi_shadows
kha.compute.Compute.setTexture(voxel_te1, rts.get("voxelsSDF").image, kha.compute.Access.Write);
@ -1221,8 +1236,6 @@ class Inc {
kha.compute.Compute.setSampledTexture(voxel_tf4, rts.get("gbuffer2").image);
#end
kha.compute.Compute.setSampledTexture(voxel_tf4, rts.get("gbuffer2").image);
var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10);
for (i in 0...Main.voxelgiClipmapCount) {
fa[i * 10] = clipmaps[i].voxelSize;