forked from LeenkxTeam/LNXSDK
Update
This commit is contained in:
@ -19,10 +19,6 @@ class Inc {
|
||||
#end
|
||||
#end
|
||||
|
||||
#if ((rp_voxels != 'Off') && lnx_config)
|
||||
static var voxelsCreated = false;
|
||||
#end
|
||||
|
||||
#if (rp_voxels != "Off")
|
||||
static var voxel_sh0:kha.compute.Shader = null;
|
||||
static var voxel_sh1:kha.compute.Shader = null;
|
||||
@ -636,7 +632,7 @@ class Inc {
|
||||
}
|
||||
// Init voxels
|
||||
#if (rp_voxels != 'Off')
|
||||
if (!voxelsCreated) initGI();
|
||||
initGI();
|
||||
#if (rp_voxels == "Voxel GI")
|
||||
initGI("voxelsLight");
|
||||
#end
|
||||
@ -744,12 +740,6 @@ class Inc {
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = tname;
|
||||
|
||||
#if lnx_config
|
||||
var config = leenkx.data.Config.raw;
|
||||
if (config.rp_voxels != true || voxelsCreated) return;
|
||||
voxelsCreated = true;
|
||||
#end
|
||||
|
||||
var res = iron.RenderPath.getVoxelRes();
|
||||
var resZ = iron.RenderPath.getVoxelResZ();
|
||||
|
||||
@ -761,48 +751,38 @@ class Inc {
|
||||
}
|
||||
else {
|
||||
if (t.name == "voxelsSDF" || t.name == "voxelsSDFtmp") {
|
||||
t.format = "R8";
|
||||
t.format = "R16";
|
||||
t.width = res;
|
||||
t.height = res * Main.voxelgiClipmapCount;
|
||||
t.depth = res;
|
||||
}
|
||||
else if (t.name == "voxelsLight") {
|
||||
t.format = "RGBA32";
|
||||
t.format = "R32UI";
|
||||
t.width = res;
|
||||
t.height = res * Main.voxelgiClipmapCount;
|
||||
t.depth = res * 3; // Store R, G, B in separate z-slices
|
||||
}
|
||||
else if (t.name == "voxelsOut" || t.name == "voxelsOutB") {
|
||||
#if (rp_voxels == "Voxel AO")
|
||||
t.format = "R8";
|
||||
#else
|
||||
t.format = "RGBA32";
|
||||
#end
|
||||
t.width = res * (6 + 16);
|
||||
t.height = res * Main.voxelgiClipmapCount;
|
||||
t.depth = res;
|
||||
}
|
||||
else {
|
||||
#if (rp_voxels == "Voxel AO")
|
||||
{
|
||||
if (t.name == "voxelsOut" || t.name == "voxelsOutB") {
|
||||
t.format = "R8";
|
||||
t.width = res * (6 + 16);
|
||||
t.height = res * Main.voxelgiClipmapCount;
|
||||
t.depth = res;
|
||||
}
|
||||
else {
|
||||
t.format = "R32UI";
|
||||
t.width = res * 6;
|
||||
t.height = res;
|
||||
t.depth = res * 2;
|
||||
}
|
||||
}
|
||||
t.format = "R32UI";
|
||||
t.width = res * 6;
|
||||
t.height = res;
|
||||
t.depth = res * 2;
|
||||
#else
|
||||
{
|
||||
if (t.name == "voxelsOut" || t.name == "voxelsOutB") {
|
||||
t.format = "RGBA32";
|
||||
t.width = res * (6 + 16);
|
||||
t.height = res * Main.voxelgiClipmapCount;
|
||||
t.depth = res;
|
||||
}
|
||||
else {
|
||||
t.format = "R32UI";
|
||||
t.width = res * 6;
|
||||
t.height = res;
|
||||
t.depth = res * 16;
|
||||
}
|
||||
}
|
||||
t.format = "R32UI";
|
||||
t.width = res * 6;
|
||||
t.height = res;
|
||||
t.depth = res * 16;
|
||||
#end
|
||||
}
|
||||
}
|
||||
@ -1063,6 +1043,20 @@ class Inc {
|
||||
var clipmaps = iron.RenderPath.clipmaps;
|
||||
var clipmap = clipmaps[iron.RenderPath.clipmapLevel];
|
||||
|
||||
// Ensure all required render targets exist
|
||||
if (rts.get("voxels") == null) initGI("voxels");
|
||||
if (rts.get("voxelsOut") == null) initGI("voxelsOut");
|
||||
if (rts.get("voxelsOutB") == null) initGI("voxelsOutB");
|
||||
#if (rp_voxels == "Voxel GI")
|
||||
if (rts.get("voxelsLight") == null) initGI("voxelsLight");
|
||||
if (rts.get("voxelsSDF") == null) initGI("voxelsSDF");
|
||||
#elseif lnx_voxelgi_shadows
|
||||
if (rts.get("voxelsSDF") == null) initGI("voxelsSDF");
|
||||
#end
|
||||
|
||||
// Check again after init
|
||||
if (rts.get("voxels") == null || rts.get("voxelsOutB") == null || rts.get("voxelsOut") == null) return;
|
||||
|
||||
kha.compute.Compute.setShader(voxel_sh1);
|
||||
|
||||
kha.compute.Compute.setTexture(voxel_ta1, rts.get("voxels").image, kha.compute.Access.Read);
|
||||
|
||||
Reference in New Issue
Block a user