From def7cd3c7ece7372778107a5188488c8be670b50 Mon Sep 17 00:00:00 2001 From: e2002e Date: Wed, 14 Feb 2024 21:39:11 +0100 Subject: [PATCH] use max_lights 24 --- Sources/iron/RenderPath.hx | 15 ++++++++++++++- Sources/iron/Scene.hx | 4 +++- Sources/iron/data/ShaderData.hx | 2 +- Sources/iron/object/LightObject.hx | 2 +- Sources/iron/object/MeshObject.hx | 4 ++++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Sources/iron/RenderPath.hx b/Sources/iron/RenderPath.hx index 93465720..3d3132c7 100644 --- a/Sources/iron/RenderPath.hx +++ b/Sources/iron/RenderPath.hx @@ -19,6 +19,7 @@ import iron.object.MeshObject; import iron.object.Uniforms; class RenderPath { + public static var active: RenderPath; public var frameScissor = false; @@ -64,6 +65,19 @@ class RenderPath { var depthBuffers: Array<{name: String, format: String}> = []; var additionalTargets: Array; + #if rp_voxels + public var voxelized = 0; + public var onVoxelize: Void->Bool = null; + public function voxelize() { // Returns true if scene should be voxelized + if (onVoxelize != null) return onVoxelize(); + #if arm_voxelgi_revox + return true; + #else + return ++voxelized > 2 ? false : true; + #end + } + #end + #if arm_debug public static var drawCalls = 0; public static var batchBuckets = 0; @@ -124,7 +138,6 @@ class RenderPath { commands(); if (!isProbe) frame++; - } public function setTarget(target: String, additional: Array = null, viewportScale = 1.0) { diff --git a/Sources/iron/Scene.hx b/Sources/iron/Scene.hx index 3f38132a..462de368 100644 --- a/Sources/iron/Scene.hx +++ b/Sources/iron/Scene.hx @@ -27,7 +27,6 @@ import iron.data.TerrainStream; import iron.data.SceneStream; import iron.data.MeshBatch; import iron.system.Time; - using StringTools; class Scene { @@ -214,6 +213,9 @@ class Scene { Data.getSceneRaw(sceneName, function(format: TSceneFormat) { Scene.create(format, function(o: Object) { if (done != null) done(o); + #if rp_voxels // Revoxelize + RenderPath.active.voxelized = 0; + #end #if (rp_background == "World") if (removeWorldShader != null) { diff --git a/Sources/iron/data/ShaderData.hx b/Sources/iron/data/ShaderData.hx index ac42101f..b5c66670 100644 --- a/Sources/iron/data/ShaderData.hx +++ b/Sources/iron/data/ShaderData.hx @@ -80,7 +80,7 @@ class ShaderContext { public function new(raw: TShaderContext, done: ShaderContext->Void, overrideContext: TShaderOverride = null) { this.raw = raw; - #if (rp_voxels == "Off") + #if (!rp_voxels) if (raw.name == "voxel") { done(this); return; diff --git a/Sources/iron/object/LightObject.hx b/Sources/iron/object/LightObject.hx index 2e66f2cf..b9c3a8b1 100644 --- a/Sources/iron/object/LightObject.hx +++ b/Sources/iron/object/LightObject.hx @@ -650,7 +650,7 @@ class LightObject extends Object { return 8; #elseif (rp_max_lights_cluster == 16) return 16; - #elseif (rp_max_lights == 24) + #elseif (rp_max_lights_cluster == 24) return 24; #elseif (rp_max_lights_cluster == 32) return 32; diff --git a/Sources/iron/object/MeshObject.hx b/Sources/iron/object/MeshObject.hx index 15f1ed26..089144fa 100644 --- a/Sources/iron/object/MeshObject.hx +++ b/Sources/iron/object/MeshObject.hx @@ -167,6 +167,10 @@ class MeshObject extends Object { if (skip_context == context) return setCulled(isShadow, true); if (force_context != null && force_context != context) return setCulled(isShadow, true); + #if (!arm_voxelgi_revox) // No revox - do not voxelize moving objects + if (context == "voxel" && raw != null && raw.mobile == true) return setCulled(isShadow, true); + #end + return setCulled(isShadow, false); }