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