Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
use max_lights 24
Browse files Browse the repository at this point in the history
  • Loading branch information
e2002e committed Feb 14, 2024
1 parent 7528ba2 commit def7cd3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
15 changes: 14 additions & 1 deletion Sources/iron/RenderPath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import iron.object.MeshObject;
import iron.object.Uniforms;

class RenderPath {

public static var active: RenderPath;

public var frameScissor = false;
Expand Down Expand Up @@ -64,6 +65,19 @@ class RenderPath {
var depthBuffers: Array<{name: String, format: String}> = [];
var additionalTargets: Array<kha.Canvas>;

#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;
Expand Down Expand Up @@ -124,7 +138,6 @@ class RenderPath {
commands();

if (!isProbe) frame++;

}

public function setTarget(target: String, additional: Array<String> = null, viewportScale = 1.0) {
Expand Down
4 changes: 3 additions & 1 deletion Sources/iron/Scene.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import iron.data.TerrainStream;
import iron.data.SceneStream;
import iron.data.MeshBatch;
import iron.system.Time;

using StringTools;

class Scene {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/iron/data/ShaderData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Sources/iron/object/LightObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions Sources/iron/object/MeshObject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit def7cd3

Please sign in to comment.