Merge remote-tracking branch 'origin/1.5' into dotnet7
# Conflicts: # Content/Shaders/GI/DDGI.flax # Content/Shaders/TAA.flax
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -29,6 +29,7 @@ enum class IconTypes
|
||||
DirectionalLight,
|
||||
EnvironmentProbe,
|
||||
Skybox,
|
||||
SkyLight,
|
||||
AudioListener,
|
||||
AudioSource,
|
||||
Decal,
|
||||
@@ -155,6 +156,7 @@ bool ViewportIconsRendererService::Init()
|
||||
INIT(DirectionalLight, "Editor/Icons/DirectionalLight");
|
||||
INIT(EnvironmentProbe, "Editor/Icons/EnvironmentProbe");
|
||||
INIT(Skybox, "Editor/Icons/Skybox");
|
||||
INIT(SkyLight, "Editor/Icons/SkyLight");
|
||||
INIT(AudioListener, "Editor/Icons/AudioListener");
|
||||
INIT(AudioSource, "Editor/Icons/AudioSource");
|
||||
INIT(Decal, "Editor/Icons/Decal");
|
||||
@@ -173,7 +175,7 @@ bool ViewportIconsRendererService::Init()
|
||||
MAP_TYPE(SceneAnimationPlayer, SceneAnimationPlayer);
|
||||
MAP_TYPE(ExponentialHeightFog, Skybox);
|
||||
MAP_TYPE(Sky, Skybox);
|
||||
MAP_TYPE(SkyLight, PointLight);
|
||||
MAP_TYPE(SkyLight, SkyLight);
|
||||
MAP_TYPE(SpotLight, PointLight);
|
||||
#undef MAP_TYPE
|
||||
|
||||
|
||||
@@ -198,6 +198,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
// Preview LOD
|
||||
{
|
||||
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
|
||||
previewLOD.CloseMenuOnClick = false;
|
||||
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f)
|
||||
{
|
||||
Parent = previewLOD
|
||||
|
||||
@@ -62,6 +62,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
// Preview LOD
|
||||
{
|
||||
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
|
||||
previewLOD.CloseMenuOnClick = false;
|
||||
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f)
|
||||
{
|
||||
Parent = previewLOD
|
||||
|
||||
@@ -201,6 +201,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
// Preview LOD
|
||||
{
|
||||
var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD");
|
||||
previewLOD.CloseMenuOnClick = false;
|
||||
var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f)
|
||||
{
|
||||
Parent = previewLOD
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
if (useWidgets)
|
||||
{
|
||||
var playbackDuration = ViewWidgetButtonMenu.AddButton("Duration");
|
||||
playbackDuration.CloseMenuOnClick = false;
|
||||
var playbackDurationValue = new FloatValueBox(_playbackDuration, 90, 2, 70.0f, 0.1f, 1000000.0f, 0.1f)
|
||||
{
|
||||
Parent = playbackDuration
|
||||
|
||||
@@ -204,6 +204,7 @@ namespace FlaxEditor.Windows
|
||||
showFileExtensionsButton.AutoCheck = true;
|
||||
|
||||
var viewScale = menu.AddButton("View Scale");
|
||||
viewScale.CloseMenuOnClick = false;
|
||||
var scaleValue = new FloatValueBox(1, 75, 2, 50.0f, 0.3f, 3.0f, 0.01f)
|
||||
{
|
||||
Parent = viewScale
|
||||
|
||||
@@ -353,6 +353,7 @@ namespace FlaxEditor.Windows
|
||||
// Viewport Brightness
|
||||
{
|
||||
var brightness = menu.AddButton("Viewport Brightness");
|
||||
brightness.CloseMenuOnClick = false;
|
||||
var brightnessValue = new FloatValueBox(_viewport.Brightness, 140, 2, 50.0f, 0.001f, 10.0f, 0.001f)
|
||||
{
|
||||
Parent = brightness
|
||||
@@ -363,6 +364,7 @@ namespace FlaxEditor.Windows
|
||||
// Viewport Resolution
|
||||
{
|
||||
var resolution = menu.AddButton("Viewport Resolution");
|
||||
resolution.CloseMenuOnClick = false;
|
||||
var resolutionValue = new FloatValueBox(_viewport.ResolutionScale, 140, 2, 50.0f, 0.1f, 4.0f, 0.001f)
|
||||
{
|
||||
Parent = resolution
|
||||
@@ -381,6 +383,7 @@ namespace FlaxEditor.Windows
|
||||
// Show GUI
|
||||
{
|
||||
var button = menu.AddButton("Show GUI");
|
||||
button.CloseMenuOnClick = false;
|
||||
var checkbox = new CheckBox(140, 2, ShowGUI) { Parent = button };
|
||||
checkbox.StateChanged += x => ShowGUI = x.Checked;
|
||||
}
|
||||
@@ -388,6 +391,7 @@ namespace FlaxEditor.Windows
|
||||
// Show Debug Draw
|
||||
{
|
||||
var button = menu.AddButton("Show Debug Draw");
|
||||
button.CloseMenuOnClick = false;
|
||||
var checkbox = new CheckBox(140, 2, ShowDebugDraw) { Parent = button };
|
||||
checkbox.StateChanged += x => ShowDebugDraw = x.Checked;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ Asset::LoadResult Material::load()
|
||||
FlaxChunk* materialParamsChunk;
|
||||
|
||||
// Wait for the GPU Device to be ready (eg. case when loading material before GPU init)
|
||||
#define IS_GPU_NOT_READY() (GPUDevice::Instance == nullptr || GPUDevice::Instance->GetState() != GPUDevice::DeviceState::Ready || GPUDevice::Instance->QuadShader == nullptr)
|
||||
#define IS_GPU_NOT_READY() (GPUDevice::Instance == nullptr || GPUDevice::Instance->GetState() != GPUDevice::DeviceState::Ready)
|
||||
if (!IsInMainThread() && IS_GPU_NOT_READY())
|
||||
{
|
||||
int32 timeout = 1000;
|
||||
|
||||
@@ -22,11 +22,10 @@ namespace ObjectsRemovalServiceImpl
|
||||
|
||||
using namespace ObjectsRemovalServiceImpl;
|
||||
|
||||
class ObjectsRemovalServiceService : public EngineService
|
||||
class ObjectsRemoval : public EngineService
|
||||
{
|
||||
public:
|
||||
|
||||
ObjectsRemovalServiceService()
|
||||
ObjectsRemoval()
|
||||
: EngineService(TEXT("Objects Removal Service"), -1000)
|
||||
{
|
||||
}
|
||||
@@ -36,7 +35,7 @@ public:
|
||||
void Dispose() override;
|
||||
};
|
||||
|
||||
ObjectsRemovalServiceService ObjectsRemovalServiceServiceInstance;
|
||||
ObjectsRemoval ObjectsRemovalInstance;
|
||||
|
||||
bool ObjectsRemovalService::IsInPool(Object* obj)
|
||||
{
|
||||
@@ -63,7 +62,6 @@ bool ObjectsRemovalService::HasNewItemsForFlush()
|
||||
NewItemsLocker.Lock();
|
||||
const bool result = NewItemsPool.HasItems();
|
||||
NewItemsLocker.Unlock();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -95,6 +93,8 @@ void ObjectsRemovalService::Add(Object* obj, float timeToLive, bool useGameTime)
|
||||
|
||||
void ObjectsRemovalService::Flush(float dt, float gameDelta)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
|
||||
// Add new items
|
||||
{
|
||||
ScopeLock lock(NewItemsLocker);
|
||||
@@ -173,14 +173,14 @@ void ObjectsRemovalService::Flush(float dt, float gameDelta)
|
||||
}
|
||||
}
|
||||
|
||||
bool ObjectsRemovalServiceService::Init()
|
||||
bool ObjectsRemoval::Init()
|
||||
{
|
||||
LastUpdate = DateTime::NowUTC();
|
||||
LastUpdateGameTime = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ObjectsRemovalServiceService::LateUpdate()
|
||||
void ObjectsRemoval::LateUpdate()
|
||||
{
|
||||
PROFILE_CPU();
|
||||
|
||||
@@ -194,7 +194,7 @@ void ObjectsRemovalServiceService::LateUpdate()
|
||||
LastUpdate = now;
|
||||
}
|
||||
|
||||
void ObjectsRemovalServiceService::Dispose()
|
||||
void ObjectsRemoval::Dispose()
|
||||
{
|
||||
// Collect new objects
|
||||
ObjectsRemovalService::Flush();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class FLAXENGINE_API ObjectsRemovalService
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether object has been registered in the pool for the removing.
|
||||
/// </summary>
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace FlaxEngine
|
||||
{
|
||||
if (type.IsAbstract)
|
||||
return null;
|
||||
|
||||
|
||||
var result = (Actor)New(type);
|
||||
result.SetParent(this, false, false);
|
||||
return result;
|
||||
@@ -180,7 +180,7 @@ namespace FlaxEngine
|
||||
{
|
||||
if (typeof(T).IsAbstract)
|
||||
return null;
|
||||
|
||||
|
||||
result = New<T>();
|
||||
result.SetParent(this, false, false);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ namespace FlaxEngine
|
||||
{
|
||||
if (type.IsAbstract)
|
||||
return null;
|
||||
|
||||
|
||||
var script = (Script)New(type);
|
||||
script.Parent = this;
|
||||
return script;
|
||||
@@ -211,7 +211,7 @@ namespace FlaxEngine
|
||||
{
|
||||
if (typeof(T).IsAbstract)
|
||||
return null;
|
||||
|
||||
|
||||
var script = New<T>();
|
||||
script.Parent = this;
|
||||
return script;
|
||||
|
||||
@@ -320,7 +320,7 @@ GPUSampler* Streaming::GetTextureGroupSampler(int32 index)
|
||||
{
|
||||
FallbackSampler = GPUSampler::New();
|
||||
#if GPU_ENABLE_RESOURCE_NAMING
|
||||
sampler->SetName(TEXT("FallbackSampler"));
|
||||
FallbackSampler->SetName(TEXT("FallbackSampler"));
|
||||
#endif
|
||||
FallbackSampler->Init(GPUSamplerDescription::New(GPUSamplerFilter::Trilinear));
|
||||
}
|
||||
|
||||
40
Source/Engine/Tests/TestScripting.cpp
Normal file
40
Source/Engine/Tests/TestScripting.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
|
||||
|
||||
#include "TestScripting.h"
|
||||
#include "Engine/Scripting/Scripting.h"
|
||||
#include <ThirdParty/catch2/catch.hpp>
|
||||
|
||||
TestClassNative::TestClassNative(const SpawnParams& params)
|
||||
: ScriptingObject(params)
|
||||
{
|
||||
}
|
||||
|
||||
TEST_CASE("Scripting")
|
||||
{
|
||||
SECTION("Test Class")
|
||||
{
|
||||
// Test native class
|
||||
ScriptingTypeHandle type = Scripting::FindScriptingType("FlaxEngine.TestClassNative");
|
||||
CHECK(type == TestClassNative::TypeInitializer);
|
||||
ScriptingObject* object = Scripting::NewObject(type.GetType().ManagedClass);
|
||||
CHECK(object);
|
||||
CHECK(object->Is<TestClassNative>());
|
||||
TestClassNative* testClass = (TestClassNative*)object;
|
||||
CHECK(testClass->SimpleField == 1);
|
||||
int32 methodResult = testClass->Test(TEXT("123"));
|
||||
CHECK(methodResult == 3);
|
||||
|
||||
// Test managed class
|
||||
type = Scripting::FindScriptingType("FlaxEngine.TestClassManaged");
|
||||
CHECK(type);
|
||||
object = Scripting::NewObject(type.GetType().ManagedClass);
|
||||
CHECK(object);
|
||||
CHECK(object->Is<TestClassNative>());
|
||||
testClass = (TestClassNative*)object;
|
||||
MObject* managed = testClass->GetOrCreateManagedInstance(); // Ensure to create C# object and run it's ctor
|
||||
CHECK(managed);
|
||||
CHECK(testClass->SimpleField == 2);
|
||||
methodResult = testClass->Test(TEXT("123"));
|
||||
CHECK(methodResult == 6);
|
||||
}
|
||||
}
|
||||
23
Source/Engine/Tests/TestScripting.cs
Normal file
23
Source/Engine/Tests/TestScripting.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
|
||||
|
||||
#if FLAX_TESTS
|
||||
namespace FlaxEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// Test class.
|
||||
/// </summary>
|
||||
public class TestClassManaged : TestClassNative
|
||||
{
|
||||
TestClassManaged()
|
||||
{
|
||||
SimpleField = 2;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int Test(string str)
|
||||
{
|
||||
return str.Length + base.Test(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
23
Source/Engine/Tests/TestScripting.h
Normal file
23
Source/Engine/Tests/TestScripting.h
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Core/ISerializable.h"
|
||||
#include "Engine/Scripting/ScriptingObject.h"
|
||||
|
||||
// Test class.
|
||||
API_CLASS() class TestClassNative : public ScriptingObject, public ISerializable
|
||||
{
|
||||
API_AUTO_SERIALIZATION();
|
||||
DECLARE_SCRIPTING_TYPE(TestClassNative);
|
||||
|
||||
public:
|
||||
// Test value
|
||||
API_FIELD() int32 SimpleField = 1;
|
||||
|
||||
// Test virtual method
|
||||
API_FUNCTION() virtual int32 Test(const String& str)
|
||||
{
|
||||
return str.Length();
|
||||
}
|
||||
};
|
||||
@@ -45,6 +45,8 @@ public class FlaxTestsTarget : FlaxEditor
|
||||
{
|
||||
base.SetupTargetEnvironment(options);
|
||||
|
||||
options.ScriptingAPI.Defines.Add("FLAX_TESTS");
|
||||
|
||||
// Produce console program
|
||||
options.LinkEnv.LinkAsConsoleProgram = true;
|
||||
}
|
||||
|
||||
@@ -1360,7 +1360,8 @@ namespace Flax.Build.Bindings
|
||||
thunkCall += GenerateCppWrapperNativeToBox(buildData, parameterInfo.Type, classInfo, parameterInfo.Name);
|
||||
}
|
||||
|
||||
if (functionInfo.ReturnType.IsVoid)
|
||||
var returnType = functionInfo.ReturnType;
|
||||
if (returnType.IsVoid)
|
||||
{
|
||||
contents.AppendLine($" typedef void (*Thunk)(void* instance{thunkParams}, MonoObject** exception);");
|
||||
contents.AppendLine(" const auto thunk = (Thunk)method->GetThunk();");
|
||||
@@ -1378,18 +1379,30 @@ namespace Flax.Build.Bindings
|
||||
contents.AppendLine(" if (exception)");
|
||||
contents.AppendLine(" DebugLog::LogException(exception);");
|
||||
|
||||
if (!functionInfo.ReturnType.IsVoid)
|
||||
if (!returnType.IsVoid)
|
||||
{
|
||||
if (functionInfo.ReturnType.IsRef)
|
||||
if (returnType.IsRef)
|
||||
throw new NotSupportedException($"Passing return value by reference is not supported for virtual API methods. Used on method '{functionInfo}'.");
|
||||
|
||||
switch (functionInfo.ReturnType.Type)
|
||||
switch (returnType.Type)
|
||||
{
|
||||
case "bool":
|
||||
contents.AppendLine($" return __result != 0;");
|
||||
contents.AppendLine(" return __result != 0;");
|
||||
break;
|
||||
case "int8":
|
||||
case "int16":
|
||||
case "int32":
|
||||
case "int64":
|
||||
contents.AppendLine($" return ({returnType.Type})(intptr)__result;");
|
||||
break;
|
||||
case "uint8":
|
||||
case "uint16":
|
||||
case "uint32":
|
||||
case "uint64":
|
||||
contents.AppendLine($" return ({returnType.Type})(uintptr)__result;");
|
||||
break;
|
||||
default:
|
||||
contents.AppendLine($" return MUtils::Unbox<{functionInfo.ReturnType}>(__result);");
|
||||
contents.AppendLine($" return MUtils::Unbox<{returnType}>(__result);");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Flax.Build.Platforms
|
||||
}
|
||||
|
||||
// Visual Studio 2017+ supported only
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019);
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019 || x.Version == VisualStudioVersion.VisualStudio2022);
|
||||
if (visualStudio == null)
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
|
||||
@@ -43,9 +43,7 @@ namespace Flax.Build.Platforms
|
||||
if (!toolsets.ContainsKey(WindowsPlatformToolset.v141) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v142) &&
|
||||
!toolsets.ContainsKey(WindowsPlatformToolset.v143))
|
||||
{
|
||||
_hasRequiredSDKsInstalled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Flax.Build.Platforms
|
||||
public UWPToolchain(UWPPlatform platform, TargetArchitecture architecture, WindowsPlatformToolset toolsetVer = WindowsPlatformToolset.Latest, WindowsPlatformSDK sdkVer = WindowsPlatformSDK.Latest)
|
||||
: base(platform, architecture, toolsetVer, sdkVer)
|
||||
{
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019);
|
||||
var visualStudio = VisualStudioInstance.GetInstances().FirstOrDefault(x => x.Version == VisualStudioVersion.VisualStudio2017 || x.Version == VisualStudioVersion.VisualStudio2019 || x.Version == VisualStudioVersion.VisualStudio2022);
|
||||
if (visualStudio == null)
|
||||
throw new Exception("Missing Visual Studio 2017 or newer. It's required to build for UWP.");
|
||||
_usingDirs.Add(Path.Combine(visualStudio.Path, "VC", "vcpackages"));
|
||||
@@ -45,6 +45,14 @@ namespace Flax.Build.Platforms
|
||||
_usingDirs.Add(Path.Combine(sdk10, "UnionMetadata", sdk10Ver));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void LogInfo()
|
||||
{
|
||||
base.LogInfo();
|
||||
|
||||
Log.Error("UWP (Windows Store) platform has been deprecated and soon will be removed!");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void SetupCompileCppFilesArgs(TaskGraph graph, BuildOptions options, List<string> args)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user