Add command line controls for reverse z

This commit is contained in:
ExMatics HydrogenC
2024-06-06 00:07:28 +08:00
parent b186d19faa
commit df8dc9173a
2 changed files with 18 additions and 3 deletions
@@ -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())
+12
View File
@@ -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;
/// <summary>
/// 1 to use traditional z buffer, or reversed z will be adopted by default.
/// </summary>
[CommandLine("useLargeWorlds", "1 to use traditional z buffer, or reversed z will be adopted by default.")]
public static bool NoReverseZ = false;
/// <summary>
/// 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.
/// </summary>
@@ -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;