Dynamic voxel alloc

This commit is contained in:
luboslenco 2019-03-14 10:55:15 +01:00
parent b802021435
commit 6b8fc76763
3 changed files with 28 additions and 28 deletions

View file

@ -37,6 +37,10 @@ class Inc {
static var spotIndex = 0;
static var lastFrame = -1;
#if ((rp_gi != "Off") && arm_config)
static var voxelsCreated = false;
#end
public static function init(_path:RenderPath) {
path = _path;
@ -214,7 +218,11 @@ class Inc {
}
path.resize();
}
// Init voxels
#if (rp_gi != "Off")
if (!voxelsCreated) initGI();
#end
#end // arm_config
}
// #if (rp_shadowmap && kha_webgl)
@ -292,6 +300,12 @@ class Inc {
#if (rp_gi != "Off")
public static function initGI(tname = "voxels") {
#if arm_config
var config = armory.data.Config.raw;
if (config.rp_gi != true || voxelsCreated) return;
voxelsCreated = true;
#end
var t = new RenderTargetRaw();
t.name = tname;
#if (rp_gi == "Voxel AO")
@ -311,6 +325,20 @@ class Inc {
t.is_image = true;
t.mipmaps = true;
path.createRenderTarget(t);
#if arm_voxelgi_temporal
{
var tB = new RenderTargetRaw();
tB.name = t.name + "B";
tB.format = t.format;
tB.width = t.width;
tB.height = t.height;
tB.depth = t.depth;
tB.is_image = t.is_image;
tB.mipmaps = t.mipmaps;
path.createRenderTarget(tB);
}
#end
}
#end

View file

@ -44,20 +44,6 @@ class RenderPathDeferred {
#if (rp_gi != "Off")
{
Inc.initGI();
#if arm_voxelgi_temporal
{
Inc.initGI("voxelsB");
}
#end
#if (rp_gi == "Voxel GI")
{
// Inc.initGI("voxelsOpac");
// Inc.initGI("voxelsNor");
// #if (rp_gi_bounces)
// Inc.initGI("voxelsBounce");
// #end
}
#end
#if (rp_gi == "Voxel AO")
path.loadShader("shader_datas/deferred_light/deferred_light_VoxelAOvar");
#end

View file

@ -121,20 +121,6 @@ class RenderPathForward {
#if (rp_gi != "Off")
{
Inc.initGI();
#if arm_voxelgi_temporal
{
Inc.initGI("voxelsB");
}
#end
#if (rp_gi == "Voxel GI")
{
// Inc.initGI("voxelsOpac");
// Inc.initGI("voxelsNor");
// #if (rp_gi_bounces)
// Inc.initGI("voxelsBounce");
// #end
}
#end
}
#end