diff --git a/Source/Tools/Flax.Build/Build/ProjectTarget.cs b/Source/Tools/Flax.Build/Build/ProjectTarget.cs
index 0640e30c7..b24b63807 100644
--- a/Source/Tools/Flax.Build/Build/ProjectTarget.cs
+++ b/Source/Tools/Flax.Build/Build/ProjectTarget.cs
@@ -80,9 +80,12 @@ namespace Flax.Build
options.ScriptingAPI.Defines.Add("USE_LARGE_WORLDS");
}
- // Add reverse-z definitions
- options.CompileEnv.PreprocessorDefinitions.Add("FLAX_REVERSE_Z");
- options.ScriptingAPI.Defines.Add("FLAX_REVERSE_Z");
+ if (!EngineConfiguration.WithTraditionalZ(options))
+ {
+ // Add reverse-z definitions
+ options.CompileEnv.PreprocessorDefinitions.Add("FLAX_REVERSE_Z");
+ options.ScriptingAPI.Defines.Add("FLAX_REVERSE_Z");
+ }
// Add include paths for this and all referenced projects sources
foreach (var project in Project.GetAllProjects())
diff --git a/Source/Tools/Flax.Build/Configuration.cs b/Source/Tools/Flax.Build/Configuration.cs
index 63d4aa5b3..30428559d 100644
--- a/Source/Tools/Flax.Build/Configuration.cs
+++ b/Source/Tools/Flax.Build/Configuration.cs
@@ -264,6 +264,12 @@ namespace Flax.Build
[CommandLine("useLargeWorlds", "1 to enable large worlds with 64-bit coordinates precision support in build (USE_LARGE_WORLDS=1)")]
public static bool UseLargeWorlds = false;
+ ///
+ /// 1 to use traditional z buffer, or reversed z will be adopted by default.
+ ///
+ [CommandLine("useLargeWorlds", "1 to use traditional z buffer, or reversed z will be adopted by default.")]
+ public static bool NoReverseZ = false;
+
///
/// True if managed C# scripting should be enabled, otherwise false. Engine without C# is partially supported and can be used when porting to a new platform before implementing C# runtime on it.
///
@@ -287,6 +293,12 @@ namespace Flax.Build
return UseLargeWorlds;
}
+ public static bool WithTraditionalZ(NativeCpp.BuildOptions options)
+ {
+ // Whether to use traditional z-buffer instead of reversed z
+ return NoReverseZ;
+ }
+
public static bool WithDotNet(NativeCpp.BuildOptions options)
{
return UseDotNet;