From 0f2e579674f7de206596d5698be13cb537a1c2c0 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sat, 2 Jan 2021 12:51:32 +0100 Subject: [PATCH 01/46] Create BatteryInfo struct. --- Source/Engine/Platform/BatteryInfo.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Source/Engine/Platform/BatteryInfo.h diff --git a/Source/Engine/Platform/BatteryInfo.h b/Source/Engine/Platform/BatteryInfo.h new file mode 100644 index 000000000..c46bde59e --- /dev/null +++ b/Source/Engine/Platform/BatteryInfo.h @@ -0,0 +1,16 @@ +// Copyright (c) 2012-2020 Wojciech Figat. All rights reserved. + +#pragma once + +#include "Engine/Core/Types/BaseTypes.h" + +API_STRUCT() struct BatteryInfo +{ +DECLARE_SCRIPTING_TYPE_MINIMAL(BatteryInfo); + + API_FIELD() byte ACLineStatus; + + API_FIELD() byte BatteryLifePercent; + + API_FIELD() uint32 BatteryLifeTime; +}; From a4607385fd604e328c332e925d4ba0124743f4c5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sat, 2 Jan 2021 12:53:20 +0100 Subject: [PATCH 02/46] Adding GetBatteryInfo() to PlatformBase. --- Source/Engine/Platform/Base/PlatformBase.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h index f0a2baf43..86e760b3c 100644 --- a/Source/Engine/Platform/Base/PlatformBase.h +++ b/Source/Engine/Platform/Base/PlatformBase.h @@ -11,6 +11,7 @@ struct CPUInfo; struct MemoryStats; struct ProcessMemoryStats; struct CreateWindowSettings; +struct BatteryInfo; // ReSharper disable CppFunctionIsNotImplemented @@ -548,6 +549,11 @@ public: /// static void SetHighDpiAwarenessEnabled(bool enable); + /// + /// Gets the battery information. + /// + API_PROPERTY() static BatteryInfo GetBatteryInfo(); + /// /// Gets the screen DPI setting. /// From 624ab4b8dd9e527c06a0c6d455015d8bfc795065 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sat, 2 Jan 2021 12:54:16 +0100 Subject: [PATCH 03/46] Implementing GetBatteryInfo() to Win32Platform. --- Source/Engine/Platform/Win32/Win32Platform.cpp | 13 +++++++++++++ Source/Engine/Platform/Win32/Win32Platform.h | 1 + 2 files changed, 14 insertions(+) diff --git a/Source/Engine/Platform/Win32/Win32Platform.cpp b/Source/Engine/Platform/Win32/Win32Platform.cpp index 5bf724de2..317b6f232 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.cpp +++ b/Source/Engine/Platform/Win32/Win32Platform.cpp @@ -5,6 +5,7 @@ #include "Engine/Platform/Platform.h" #include "Engine/Platform/MemoryStats.h" #include "Engine/Platform/CPUInfo.h" +#include "Engine/Platform/BatteryInfo.h" #include "Engine/Core/Types/Guid.h" #include "Engine/Core/Types/String.h" #include "Engine/Core/Math/Math.h" @@ -15,6 +16,7 @@ #include #include #include +#include #pragma comment(lib, "Iphlpapi.lib") namespace @@ -308,6 +310,17 @@ bool Win32Platform::Is64BitPlatform() #endif } +BatteryInfo Win32Platform::GetBatteryInfo() +{ + BatteryInfo info; + SYSTEM_POWER_STATUS status; + GetSystemPowerStatus(&status); + info.ACLineStatus = status.ACLineStatus; + info.BatteryLifePercent = status.BatteryLifePercent; + info.BatteryLifeTime = status.BatteryLifeTime; + return info; +} + CPUInfo Win32Platform::GetCPUInfo() { return CpuInfo; diff --git a/Source/Engine/Platform/Win32/Win32Platform.h b/Source/Engine/Platform/Win32/Win32Platform.h index dd584cea9..c162c53e6 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.h +++ b/Source/Engine/Platform/Win32/Win32Platform.h @@ -43,6 +43,7 @@ public: _aligned_free(ptr); } static bool Is64BitPlatform(); + static BatteryInfo GetBatteryInfo(); static CPUInfo GetCPUInfo(); static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); From e9f72dbbbffbc6d12569a31bd9268ee81f15e10d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sat, 2 Jan 2021 13:15:15 +0100 Subject: [PATCH 04/46] Adding ACLineStatus enum. --- Source/Engine/Platform/BatteryInfo.h | 33 ++++++++++++++++++- .../Engine/Platform/Win32/Win32Platform.cpp | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Platform/BatteryInfo.h b/Source/Engine/Platform/BatteryInfo.h index c46bde59e..ba05d7992 100644 --- a/Source/Engine/Platform/BatteryInfo.h +++ b/Source/Engine/Platform/BatteryInfo.h @@ -4,13 +4,44 @@ #include "Engine/Core/Types/BaseTypes.h" +/// +/// Power supply status. +/// +API_ENUM() enum class ACLineStatus : byte +{ + /// + /// Power supply is not connected. + /// + Offline = 0, + /// + /// Power supply is connected. + /// + Online = 1, + /// + /// Unknown status. + /// + Unknown = 255 +}; + +/// +/// Contains information about power supply (Battery). +/// API_STRUCT() struct BatteryInfo { DECLARE_SCRIPTING_TYPE_MINIMAL(BatteryInfo); - API_FIELD() byte ACLineStatus; + /// + /// Power supply status. + /// + API_FIELD() ACLineStatus ACLineStatus; + /// + /// Battery percentage left. + /// API_FIELD() byte BatteryLifePercent; + /// + /// Remaining battery life time in second. + /// API_FIELD() uint32 BatteryLifeTime; }; diff --git a/Source/Engine/Platform/Win32/Win32Platform.cpp b/Source/Engine/Platform/Win32/Win32Platform.cpp index 317b6f232..ee73ffac2 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.cpp +++ b/Source/Engine/Platform/Win32/Win32Platform.cpp @@ -315,7 +315,7 @@ BatteryInfo Win32Platform::GetBatteryInfo() BatteryInfo info; SYSTEM_POWER_STATUS status; GetSystemPowerStatus(&status); - info.ACLineStatus = status.ACLineStatus; + info.ACLineStatus = (ACLineStatus)status.ACLineStatus; info.BatteryLifePercent = status.BatteryLifePercent; info.BatteryLifeTime = status.BatteryLifeTime; return info; From 3ed2e010fa1754bfeb8426d489384a6ed0d16f30 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sat, 2 Jan 2021 14:55:30 +0100 Subject: [PATCH 05/46] Bumping new file copyright to 2021. --- Source/Engine/Platform/BatteryInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Platform/BatteryInfo.h b/Source/Engine/Platform/BatteryInfo.h index ba05d7992..146f3f562 100644 --- a/Source/Engine/Platform/BatteryInfo.h +++ b/Source/Engine/Platform/BatteryInfo.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2020 Wojciech Figat. All rights reserved. +// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #pragma once From 21ec0f103eb2ce3fa4e7620a71c45e50786cd141 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sat, 2 Jan 2021 18:41:00 +0100 Subject: [PATCH 06/46] Implementing GetBatteryInfo() in PlatformBase. --- Source/Engine/Platform/Base/PlatformBase.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Engine/Platform/Base/PlatformBase.cpp b/Source/Engine/Platform/Base/PlatformBase.cpp index 2a0e23aea..d53ff8acc 100644 --- a/Source/Engine/Platform/Base/PlatformBase.cpp +++ b/Source/Engine/Platform/Base/PlatformBase.cpp @@ -19,6 +19,7 @@ #include "Engine/Engine/CommandLine.h" #include "Engine/Engine/Engine.h" #include "Engine/Utilities/StringConverter.h" +#include "Engine/Platform/BatteryInfo.h" #include // Check types sizes @@ -381,6 +382,11 @@ void PlatformBase::SetHighDpiAwarenessEnabled(bool enable) { } +BatteryInfo PlatformBase::GetBatteryInfo() +{ + return BatteryInfo(); +} + int32 PlatformBase::GetDpi() { return 96; From ed92489a6077f7e812375b3e1ed907e11990f5fb Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Mon, 4 Jan 2021 21:59:57 +0100 Subject: [PATCH 07/46] Fixing open file dialog. --- Source/Engine/Platform/Windows/WindowsFileSystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Platform/Windows/WindowsFileSystem.cpp b/Source/Engine/Platform/Windows/WindowsFileSystem.cpp index 0c0d9788c..6b6cd6bf0 100644 --- a/Source/Engine/Platform/Windows/WindowsFileSystem.cpp +++ b/Source/Engine/Platform/Windows/WindowsFileSystem.cpp @@ -231,7 +231,9 @@ bool WindowsFileSystem::ShowOpenFileDialog(Window* parentWindow, const StringVie while (*ptr) { filenames.Add(directory / ptr); - ptr += (lstrlenW(ptr) + 1); + ptr += lstrlenW(ptr); + if (multiSelect) + ptr++; } result = false; From f5ac18915a72cc7f08c8924188851eee07328a4b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Mon, 4 Jan 2021 22:44:40 +0100 Subject: [PATCH 08/46] Fixing open save dialog. --- Source/Engine/Platform/Windows/WindowsFileSystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Platform/Windows/WindowsFileSystem.cpp b/Source/Engine/Platform/Windows/WindowsFileSystem.cpp index 6b6cd6bf0..7c6b04fef 100644 --- a/Source/Engine/Platform/Windows/WindowsFileSystem.cpp +++ b/Source/Engine/Platform/Windows/WindowsFileSystem.cpp @@ -278,7 +278,9 @@ bool WindowsFileSystem::ShowSaveFileDialog(Window* parentWindow, const StringVie while (*ptr) { filenames.Add(directory / ptr); - ptr += (lstrlenW(ptr) + 1); + ptr += lstrlenW(ptr); + if (multiSelect) + ptr++; } result = false; From f7c17d96ce23ea8a3b1871a2b359ffdac4cc2a4f Mon Sep 17 00:00:00 2001 From: "W2.Wizard" Date: Tue, 5 Jan 2021 01:06:42 +0100 Subject: [PATCH 09/46] Fixed a typo --- Source/Shaders/Lighting.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Shaders/Lighting.hlsl b/Source/Shaders/Lighting.hlsl index 9838cca52..b5021b711 100644 --- a/Source/Shaders/Lighting.hlsl +++ b/Source/Shaders/Lighting.hlsl @@ -4,7 +4,7 @@ #define __LIGHTING__ #if !defined(USE_GBUFFER_CUSTOM_DATA) -#error "Canot calculate lighting without custom data in GBuffer. Define USE_GBUFFER_CUSTOM_DATA." +#error "Cannot calculate lighting without custom data in GBuffer. Define USE_GBUFFER_CUSTOM_DATA." #endif #include "./Flax/LightingCommon.hlsl" From 6ab300025b0cddd0db05bdfa3475ce247fc23a25 Mon Sep 17 00:00:00 2001 From: VNC <52937757+VNNCC@users.noreply.github.com> Date: Tue, 5 Jan 2021 02:13:15 +0100 Subject: [PATCH 10/46] Fixed a ton of typos --- .../Platform/Android/AndroidPlatformTools.cpp | 2 +- .../Cooker/Platform/UWP/UWPPlatformTools.cpp | 2 +- Source/Editor/Cooker/PlatformTools.h | 2 +- Source/Editor/Editor.h | 2 +- Source/Editor/GUI/CurveEditor.cs | 2 +- Source/Editor/GUI/Dialogs/Dialog.cs | 2 +- Source/Editor/GUI/Table.cs | 2 +- Source/Editor/GUI/Timeline/GUI/KeyframesEditor.cs | 2 +- Source/Editor/GUI/Timeline/Tracks/MemberTrack.cs | 2 +- Source/Editor/Modules/ContentFindingModule.cs | 2 +- Source/Editor/Options/OptionsModule.cs | 2 +- Source/Editor/Progress/ProgressHandler.cs | 2 +- Source/Editor/ProjectInfo.cpp | 4 ++-- .../VisualStudio/VisualStudioConnection.cpp | 2 +- .../Surface/Archetypes/Animation.StateMachine.cs | 2 +- Source/Editor/Surface/Archetypes/Function.cs | 4 ++-- Source/Editor/Surface/Archetypes/Parameters.cs | 2 +- Source/Editor/Surface/VisjectSurface.DragDrop.cs | 2 +- Source/Editor/Surface/VisualScriptSurface.cs | 2 +- Source/Editor/Tools/Terrain/Paint/Mode.cs | 2 +- Source/Editor/Tools/Terrain/Sculpt/Mode.cs | 2 +- Source/Editor/Tools/VertexPainting.cs | 2 +- Source/Editor/Utilities/EditorUtilities.cpp | 2 +- Source/Editor/Utilities/ObjectSnapshot.cs | 2 +- Source/Editor/Utilities/ShuntingYardParser.cs | 2 +- Source/Editor/Viewport/Cameras/FPSCamera.cs | 2 +- Source/Editor/Windows/Assets/AssetEditorWindow.cs | 2 +- Source/Engine/Core/Math/Color.cs | 2 +- Source/Engine/Graphics/Enums.h | 2 +- Source/Engine/Graphics/GPUBuffer.h | 2 +- Source/Engine/Graphics/GPUDevice.cpp | 2 +- Source/Engine/Graphics/GPUSwapChain.cpp | 2 +- Source/Engine/Graphics/Materials/IMaterial.h | 2 +- Source/Engine/Graphics/Mesh.cs | 2 +- Source/Engine/Graphics/Models/ModelData.Tool.cpp | 2 +- Source/Engine/Graphics/PostProcessSettings.h | 2 +- Source/Engine/Graphics/RenderTargetPool.cpp | 2 +- Source/Engine/Graphics/Shaders/GPUShader.h | 14 +++++++------- Source/Engine/Graphics/Textures/GPUTexture.h | 2 +- .../DirectX/DX11/GPUTimerQueryDX11.cpp | 2 +- .../GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp | 2 +- .../GraphicsDevice/Vulkan/RenderToolsVulkan.h | 6 +++--- Source/Engine/Input/Enums.h | 2 +- Source/Engine/Input/Mouse.h | 2 +- Source/Engine/Level/Actors/StaticModel.cpp | 2 +- Source/Engine/Level/Level.cpp | 4 ++-- Source/Engine/Level/Prefabs/Prefab.Apply.cpp | 2 +- Source/Engine/Navigation/NavMesh.cpp | 2 +- .../Engine/Particles/Graph/ParticleEmitterGraph.h | 2 +- Source/Engine/Physics/Colliders/Collider.h | 2 +- Source/Engine/Physics/CollisionCooking.cpp | 2 +- Source/Engine/Platform/Linux/LinuxPlatform.cpp | 2 +- Source/Engine/Renderer/AmbientOcclusionPass.h | 2 +- .../Attributes/Editor/EditorOrderAttribute.cs | 2 +- .../Scripting/Attributes/SerializeAttribute.cs | 2 +- .../Engine/Scripting/ManagedCLR/MAssembly.Mono.cpp | 2 +- Source/Engine/Scripting/ManagedCLR/MAssembly.h | 2 +- Source/Engine/Scripting/ManagedCLR/MClass.h | 2 +- Source/Engine/Scripting/ScriptingType.h | 4 ++-- Source/Engine/Serialization/JsonWriter.cpp | 2 +- Source/Engine/Serialization/Stream.h | 4 ++-- Source/Engine/Terrain/Terrain.cpp | 2 +- Source/Engine/Threading/ConcurrentBuffer.h | 2 +- Source/Engine/Threading/IRunnable.h | 2 +- Source/Engine/Threading/ThreadPool.cpp | 2 +- .../Engine/Tools/ModelTool/ModelTool.OpenFBX.cpp | 2 +- Source/Engine/Tools/ModelTool/ModelTool.cpp | 2 +- Source/Engine/UI/GUI/ContainerControl.cs | 2 +- Source/Engine/UI/GUI/Control.cs | 8 ++++---- Source/Engine/UI/GUI/Panels/UniformGridPanel.cs | 2 +- Source/Engine/UI/UICanvas.cs | 4 ++-- Source/Shaders/BakeLightmap.shader | 2 +- Source/Shaders/BitonicSort.shader | 2 +- 73 files changed, 90 insertions(+), 90 deletions(-) diff --git a/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp b/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp index bce6aa860..b4365b4bd 100644 --- a/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp +++ b/Source/Editor/Cooker/Platform/Android/AndroidPlatformTools.cpp @@ -141,7 +141,7 @@ bool AndroidPlatformTools::OnPostProcess(CookingData& data) const auto c = packageName[i]; if (c != '_' && c != '.' && !StringUtils::IsAlnum(c)) { - LOG(Error, "Android Package Name \'{0}\' contains invalid chaarcter. Only letters, numbers, dots and underscore characters are allowed.", packageName); + LOG(Error, "Android Package Name \'{0}\' contains invalid character. Only letters, numbers, dots and underscore characters are allowed.", packageName); return true; } } diff --git a/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp b/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp index f6c846fed..d9d2fe612 100644 --- a/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp +++ b/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp @@ -24,7 +24,7 @@ bool UWPPlatformTools::OnScriptsStepDone(CookingData& data) const String assembliesPath = data.OutputPath; if (FileSystem::CopyFile(assembliesPath / TEXT("Newtonsoft.Json.dll"), customBinPath)) { - data.Error(TEXT("Failed to copy deloy custom assembly.")); + data.Error(TEXT("Failed to copy deploy custom assembly.")); return true; } FileSystem::DeleteFile(assembliesPath / TEXT("Newtonsoft.Json.pdb")); diff --git a/Source/Editor/Cooker/PlatformTools.h b/Source/Editor/Cooker/PlatformTools.h index 28f6346ca..c98c008bc 100644 --- a/Source/Editor/Cooker/PlatformTools.h +++ b/Source/Editor/Cooker/PlatformTools.h @@ -48,7 +48,7 @@ public: /// /// Gets the value indicating whenever platform requires AOT. /// - /// True if platform uses AOT and needs C# assemblies to be be precompiled, otherwise false. + /// True if platform uses AOT and needs C# assemblies to be precompiled, otherwise false. virtual bool UseAOT() const { return false; diff --git a/Source/Editor/Editor.h b/Source/Editor/Editor.h index 761e4b059..8c56043d9 100644 --- a/Source/Editor/Editor.h +++ b/Source/Editor/Editor.h @@ -43,7 +43,7 @@ public: public: /// - /// The flag used to determine if a project was used with the older engine version last time it was opened. Some cached data should be regenerated to prevent version difference issues. The version number comparision is based on major and minor part of the version. Build number is ignored. + /// The flag used to determine if a project was used with the older engine version last time it was opened. Some cached data should be regenerated to prevent version difference issues. The version number comparison is based on major and minor part of the version. Build number is ignored. /// static bool IsOldProjectOpened; diff --git a/Source/Editor/GUI/CurveEditor.cs b/Source/Editor/GUI/CurveEditor.cs index 8840a7f06..cef9a9dec 100644 --- a/Source/Editor/GUI/CurveEditor.cs +++ b/Source/Editor/GUI/CurveEditor.cs @@ -221,7 +221,7 @@ namespace FlaxEditor.GUI } /// - /// Filters teh given value using the the . + /// Filters the given value using the . /// /// The mode. /// The value to process. diff --git a/Source/Editor/GUI/Dialogs/Dialog.cs b/Source/Editor/GUI/Dialogs/Dialog.cs index b8897b2e1..173dd9128 100644 --- a/Source/Editor/GUI/Dialogs/Dialog.cs +++ b/Source/Editor/GUI/Dialogs/Dialog.cs @@ -186,7 +186,7 @@ namespace FlaxEditor.GUI.Dialogs // Clean up _window = null; - // Check if any thead is blocked during ShowDialog, then wait for it + // Check if any thread is blocked during ShowDialog, then wait for it bool wait = true; while (wait) { diff --git a/Source/Editor/GUI/Table.cs b/Source/Editor/GUI/Table.cs index e070cba17..cca26cadc 100644 --- a/Source/Editor/GUI/Table.cs +++ b/Source/Editor/GUI/Table.cs @@ -120,7 +120,7 @@ namespace FlaxEditor.GUI /// /// Draws the column. /// - /// The the header area rectangle. + /// The header area rectangle. /// The zero-based index of the column. protected virtual void DrawColumn(ref Rectangle rect, int columnIndex) { diff --git a/Source/Editor/GUI/Timeline/GUI/KeyframesEditor.cs b/Source/Editor/GUI/Timeline/GUI/KeyframesEditor.cs index abd3e78a8..a12a71e21 100644 --- a/Source/Editor/GUI/Timeline/GUI/KeyframesEditor.cs +++ b/Source/Editor/GUI/Timeline/GUI/KeyframesEditor.cs @@ -401,7 +401,7 @@ namespace FlaxEditor.GUI } /// - /// Converts the input point from editor editor contents control space into the keyframes time/value coordinates. + /// Converts the input point from editor contents control space into the keyframes time/value coordinates. /// /// The point. /// The keyframes contents area bounds. diff --git a/Source/Editor/GUI/Timeline/Tracks/MemberTrack.cs b/Source/Editor/GUI/Timeline/Tracks/MemberTrack.cs index 57de46ee4..250fb73c3 100644 --- a/Source/Editor/GUI/Timeline/Tracks/MemberTrack.cs +++ b/Source/Editor/GUI/Timeline/Tracks/MemberTrack.cs @@ -179,7 +179,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks } /// - /// Evaluates the member value value at the specified time. + /// Evaluates the member value at the specified time. /// /// The time to evaluate the member at. /// The member value at provided time. diff --git a/Source/Editor/Modules/ContentFindingModule.cs b/Source/Editor/Modules/ContentFindingModule.cs index 88b5832af..9be15e0d1 100644 --- a/Source/Editor/Modules/ContentFindingModule.cs +++ b/Source/Editor/Modules/ContentFindingModule.cs @@ -108,7 +108,7 @@ namespace FlaxEditor.Modules /// /// Removes a quick action by name. /// - /// Thr action's name. + /// The action's name. /// True when it succeed, false if there is no Quick Action with this name. public bool RemoveQuickAction(string name) { diff --git a/Source/Editor/Options/OptionsModule.cs b/Source/Editor/Options/OptionsModule.cs index 7c0cd11da..3c501de85 100644 --- a/Source/Editor/Options/OptionsModule.cs +++ b/Source/Editor/Options/OptionsModule.cs @@ -41,7 +41,7 @@ namespace FlaxEditor.Options private readonly Dictionary _customSettings = new Dictionary(); /// - /// Gets the custom settings factories. Each entry defines the custom settings type identified by teh given key name. The value si a factory function that returns the default options fpr a given type. + /// Gets the custom settings factories. Each entry defines the custom settings type identified by the given key name. The value is a factory function that returns the default options for a given type. /// public IReadOnlyDictionary CustomSettings => _customSettings; diff --git a/Source/Editor/Progress/ProgressHandler.cs b/Source/Editor/Progress/ProgressHandler.cs index da2782d16..958612e51 100644 --- a/Source/Editor/Progress/ProgressHandler.cs +++ b/Source/Editor/Progress/ProgressHandler.cs @@ -79,7 +79,7 @@ namespace FlaxEditor.Progress } /// - /// Called when progress action gets updated (changed nfo text or progress value). + /// Called when progress action gets updated (changed info text or progress value). /// /// The progress (normalized to range [0;1]). /// The information text. diff --git a/Source/Editor/ProjectInfo.cpp b/Source/Editor/ProjectInfo.cpp index 0f916241e..47782ab9d 100644 --- a/Source/Editor/ProjectInfo.cpp +++ b/Source/Editor/ProjectInfo.cpp @@ -204,7 +204,7 @@ bool ProjectInfo::LoadProject(const String& projectPath) reference.Project = Load(referencePath); if (reference.Project == nullptr) { - LOG(Error, "Faield to load referenced project ({0}, from {1})", reference.Name, referencePath); + LOG(Error, "Failed to load referenced project ({0}, from {1})", reference.Name, referencePath); return true; } } @@ -277,7 +277,7 @@ bool ProjectInfo::LoadOldProject(const String& projectPath) flaxReference.Project = Load(Globals::StartupFolder / TEXT("Flax.flaxproj")); if (!flaxReference.Project) { - ShowProjectLoadError(TEXT("Failed to load Flax Engien project."), projectPath); + ShowProjectLoadError(TEXT("Failed to load Flax Engine project."), projectPath); return true; } diff --git a/Source/Editor/Scripting/CodeEditors/VisualStudio/VisualStudioConnection.cpp b/Source/Editor/Scripting/CodeEditors/VisualStudio/VisualStudioConnection.cpp index d73c5279a..54ba119f2 100644 --- a/Source/Editor/Scripting/CodeEditors/VisualStudio/VisualStudioConnection.cpp +++ b/Source/Editor/Scripting/CodeEditors/VisualStudio/VisualStudioConnection.cpp @@ -49,7 +49,7 @@ public: { if (dwRejectType == SERVERCALL_RETRYLATER) { - // Retry immediatey + // Retry immediately return 99; } diff --git a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs index 9f9e21f4f..63faacb6d 100644 --- a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs +++ b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs @@ -1046,7 +1046,7 @@ namespace FlaxEditor.Surface.Archetypes startPos += nrm; endPos += nrm; - // Swap fo the other arrow + // Swap for the other arrow if (!diff) { var tmp = startPos; diff --git a/Source/Editor/Surface/Archetypes/Function.cs b/Source/Editor/Surface/Archetypes/Function.cs index 7c4963072..14850a37d 100644 --- a/Source/Editor/Surface/Archetypes/Function.cs +++ b/Source/Editor/Surface/Archetypes/Function.cs @@ -1176,7 +1176,7 @@ namespace FlaxEditor.Surface.Archetypes [EditorOrder(0), Tooltip("The name of the parameter."), ExpandGroups] public string Name; - [EditorOrder(1), Tooltip("The type fo the parameter value.")] + [EditorOrder(1), Tooltip("The type for the parameter value.")] [TypeReference(typeof(object), nameof(IsTypeValid))] public ScriptType Type; @@ -1547,7 +1547,7 @@ namespace FlaxEditor.Surface.Archetypes // Check if return type has been changed if (_signature.ReturnType != prevReturnType) { - // Update all return nodes used by this function to match teh new type + // Update all return nodes used by this function to match the new type var usedNodes = DepthFirstTraversal(false); var hasAnyReturnNode = false; foreach (var node in usedNodes) diff --git a/Source/Editor/Surface/Archetypes/Parameters.cs b/Source/Editor/Surface/Archetypes/Parameters.cs index 43048d19d..5332b3475 100644 --- a/Source/Editor/Surface/Archetypes/Parameters.cs +++ b/Source/Editor/Surface/Archetypes/Parameters.cs @@ -32,7 +32,7 @@ namespace FlaxEditor.Surface.Archetypes public Dictionary Prototypes = DefaultPrototypes; /// - /// The default prototypes for thr node elements to use for the given parameter type. + /// The default prototypes for the node elements to use for the given parameter type. /// public static readonly Dictionary DefaultPrototypes = new Dictionary { diff --git a/Source/Editor/Surface/VisjectSurface.DragDrop.cs b/Source/Editor/Surface/VisjectSurface.DragDrop.cs index 323ef8510..422198f5b 100644 --- a/Source/Editor/Surface/VisjectSurface.DragDrop.cs +++ b/Source/Editor/Surface/VisjectSurface.DragDrop.cs @@ -107,7 +107,7 @@ namespace FlaxEditor.Surface /// Validates the parameter drag operation. /// /// Name of the parameter. - /// Tre if can drag that parameter, otherwise false. + /// True if can drag that parameter, otherwise false. protected virtual bool ValidateDragParameter(string parameterName) { return GetParameter(parameterName) != null; diff --git a/Source/Editor/Surface/VisualScriptSurface.cs b/Source/Editor/Surface/VisualScriptSurface.cs index ccabc8f2f..5a5a2e250 100644 --- a/Source/Editor/Surface/VisualScriptSurface.cs +++ b/Source/Editor/Surface/VisualScriptSurface.cs @@ -71,7 +71,7 @@ namespace FlaxEditor.Surface // Check if has cached groups if (_cache.Count != 0) { - // Check if context menu doesn;t have the recent cached groups + // Check if context menu doesn't have the recent cached groups if (!contextMenu.Groups.Any(g => g.Archetype.Tag is int asInt && asInt == _version)) { var groups = contextMenu.Groups.Where(g => g.Archetype.Tag is int).ToArray(); diff --git a/Source/Editor/Tools/Terrain/Paint/Mode.cs b/Source/Editor/Tools/Terrain/Paint/Mode.cs index 1a1373d05..e53071aa3 100644 --- a/Source/Editor/Tools/Terrain/Paint/Mode.cs +++ b/Source/Editor/Tools/Terrain/Paint/Mode.cs @@ -33,7 +33,7 @@ namespace FlaxEditor.Tools.Terrain.Paint } /// - /// The tool strength (normalized to range 0-1). Defines the intensity of the paint operation to make it stronger or mre subtle. + /// The tool strength (normalized to range 0-1). Defines the intensity of the paint operation to make it stronger or more subtle. /// [EditorOrder(0), Limit(0, 10, 0.01f), Tooltip("The tool strength (normalized to range 0-1). Defines the intensity of the paint operation to make it stronger or more subtle.")] public float Strength = 1.0f; diff --git a/Source/Editor/Tools/Terrain/Sculpt/Mode.cs b/Source/Editor/Tools/Terrain/Sculpt/Mode.cs index 14fbe0175..eb32b3934 100644 --- a/Source/Editor/Tools/Terrain/Sculpt/Mode.cs +++ b/Source/Editor/Tools/Terrain/Sculpt/Mode.cs @@ -33,7 +33,7 @@ namespace FlaxEditor.Tools.Terrain.Sculpt } /// - /// The tool strength (normalized to range 0-1). Defines the intensity of the sculpt operation to make it stronger or mre subtle. + /// The tool strength (normalized to range 0-1). Defines the intensity of the sculpt operation to make it stronger or more subtle. /// [EditorOrder(0), Limit(0, 6, 0.01f), Tooltip("The tool strength (normalized to range 0-1). Defines the intensity of the sculpt operation to make it stronger or more subtle.")] public float Strength = 1.2f; diff --git a/Source/Editor/Tools/VertexPainting.cs b/Source/Editor/Tools/VertexPainting.cs index c130370e7..29d9daedc 100644 --- a/Source/Editor/Tools/VertexPainting.cs +++ b/Source/Editor/Tools/VertexPainting.cs @@ -49,7 +49,7 @@ namespace FlaxEditor.Tools set => Tab._gizmoMode.BrushStrength = value; } - [EditorOrder(20), EditorDisplay("Brush"), Limit(0.0f, 1.0f, 0.01f), Tooltip("The falloff parameter fo the brush. Adjusts the paint strength for the vertices that are far from the brush center. Use lower values to make painting smoother and softer.")] + [EditorOrder(20), EditorDisplay("Brush"), Limit(0.0f, 1.0f, 0.01f), Tooltip("The falloff parameter for the brush. Adjusts the paint strength for the vertices that are far from the brush center. Use lower values to make painting smoother and softer.")] public float BrushFalloff { get => Tab._gizmoMode.BrushFalloff; diff --git a/Source/Editor/Utilities/EditorUtilities.cpp b/Source/Editor/Utilities/EditorUtilities.cpp index 1571c39d1..d7136a5c8 100644 --- a/Source/Editor/Utilities/EditorUtilities.cpp +++ b/Source/Editor/Utilities/EditorUtilities.cpp @@ -247,7 +247,7 @@ void UpdateIconData(uint8* iconData, const TextureData* icon) iconTexSize = Math::RoundUpToPowerOf2(width); } - // Try to pick a proper mip (requrie the same size) + // Try to pick a proper mip (require the same size) const TextureMipData* srcPixels = nullptr; int32 mipLevels = icon->GetMipLevels(); for (int32 mipIndex = 0; mipIndex < mipLevels; mipIndex++) diff --git a/Source/Editor/Utilities/ObjectSnapshot.cs b/Source/Editor/Utilities/ObjectSnapshot.cs index a64ddf306..8f29d1145 100644 --- a/Source/Editor/Utilities/ObjectSnapshot.cs +++ b/Source/Editor/Utilities/ObjectSnapshot.cs @@ -251,7 +251,7 @@ namespace FlaxEditor.Utilities var list = new List(); #if DEBUG_OBJECT_SNAPSHOT_COMPARISION - Debug.Logger.LogHandler.LogWrite(LogType.Warning, "-------------- Comparision --------------"); + Debug.Logger.LogHandler.LogWrite(LogType.Warning, "-------------- Comparison --------------"); #endif for (int i = _members.Count - 1; i >= 0; i--) { diff --git a/Source/Editor/Utilities/ShuntingYardParser.cs b/Source/Editor/Utilities/ShuntingYardParser.cs index dfd83b1f8..100c5c3d7 100644 --- a/Source/Editor/Utilities/ShuntingYardParser.cs +++ b/Source/Editor/Utilities/ShuntingYardParser.cs @@ -126,7 +126,7 @@ namespace FlaxEditor.Utilities /// /// The first operator. /// The second operator. - /// The comparision result. + /// The comparison result. private static bool CompareOperators(string oper1, string oper2) { var op1 = Operators[oper1]; diff --git a/Source/Editor/Viewport/Cameras/FPSCamera.cs b/Source/Editor/Viewport/Cameras/FPSCamera.cs index c9e65d6e4..8ed219449 100644 --- a/Source/Editor/Viewport/Cameras/FPSCamera.cs +++ b/Source/Editor/Viewport/Cameras/FPSCamera.cs @@ -24,7 +24,7 @@ namespace FlaxEditor.Viewport.Cameras public bool IsAnimatingMove => _moveStartTime > Mathf.Epsilon; /// - /// The target point location. It's used to orbit around it whe user clicks Alt+LMB. + /// The target point location. It's used to orbit around it when user clicks Alt+LMB. /// public Vector3 TargetPoint = new Vector3(-200); diff --git a/Source/Editor/Windows/Assets/AssetEditorWindow.cs b/Source/Editor/Windows/Assets/AssetEditorWindow.cs index 756adbe05..92c697b88 100644 --- a/Source/Editor/Windows/Assets/AssetEditorWindow.cs +++ b/Source/Editor/Windows/Assets/AssetEditorWindow.cs @@ -288,7 +288,7 @@ namespace FlaxEditor.Windows.Assets public abstract class AssetEditorWindowBase : AssetEditorWindow where T : Asset { /// - /// Flag set to true if window is is waiting for asset to be loaded (to send or events). + /// Flag set to true if window is waiting for asset to be loaded (to send or events). /// protected bool _isWaitingForLoaded; diff --git a/Source/Engine/Core/Math/Color.cs b/Source/Engine/Core/Math/Color.cs index 5aee4c428..a865bde15 100644 --- a/Source/Engine/Core/Math/Color.cs +++ b/Source/Engine/Core/Math/Color.cs @@ -280,7 +280,7 @@ namespace FlaxEngine /// /// The hexadecimal string. /// Output value. - /// True if value has benn parsed, otherwise false. + /// True if value has been parsed, otherwise false. public static bool TryParseHex(string hexString, out Color value) { value = Black; diff --git a/Source/Engine/Graphics/Enums.h b/Source/Engine/Graphics/Enums.h index 20836b300..8aa88756a 100644 --- a/Source/Engine/Graphics/Enums.h +++ b/Source/Engine/Graphics/Enums.h @@ -985,7 +985,7 @@ API_ENUM() enum class TessellationMethod enum class ShaderFlags : uint32 { /// - /// The default set fo flags. + /// The default set for flags. /// Default = 0, diff --git a/Source/Engine/Graphics/GPUBuffer.h b/Source/Engine/Graphics/GPUBuffer.h index 84611419e..97be261a4 100644 --- a/Source/Engine/Graphics/GPUBuffer.h +++ b/Source/Engine/Graphics/GPUBuffer.h @@ -215,7 +215,7 @@ public: /// Gets a CPU pointer to the resource by mapping its contents. Denies the GPU access to that resource. /// /// The map operation mode. - /// The pointer ot the mapped CPU buffer with resource data or null if failed. + /// The pointer of the mapped CPU buffer with resource data or null if failed. API_FUNCTION() virtual void* Map(GPUResourceMapMode mode) = 0; /// diff --git a/Source/Engine/Graphics/GPUDevice.cpp b/Source/Engine/Graphics/GPUDevice.cpp index a5195ff50..47ec6d3a6 100644 --- a/Source/Engine/Graphics/GPUDevice.cpp +++ b/Source/Engine/Graphics/GPUDevice.cpp @@ -239,7 +239,7 @@ void GPUDevice::preDispose() SAFE_DELETE_GPU_RESOURCE(_res->FullscreenTriangleVB); // Release GPU resources memory and unlink from device - // Note: after that noe GPU resources should be used/created, only deleted + // Note: after that no GPU resources should be used/created, only deleted Resources.OnDeviceDispose(); } diff --git a/Source/Engine/Graphics/GPUSwapChain.cpp b/Source/Engine/Graphics/GPUSwapChain.cpp index 347fa6e46..68b1486ad 100644 --- a/Source/Engine/Graphics/GPUSwapChain.cpp +++ b/Source/Engine/Graphics/GPUSwapChain.cpp @@ -39,7 +39,7 @@ Task* GPUSwapChain::DownloadDataAsync(TextureData& result) { if (_downloadTask) { - LOG(Warning, "Can download window backuffer data ony once at the time."); + LOG(Warning, "Can download window backuffer data only once at the time."); return nullptr; } diff --git a/Source/Engine/Graphics/Materials/IMaterial.h b/Source/Engine/Graphics/Materials/IMaterial.h index 8d5590354..09796c04b 100644 --- a/Source/Engine/Graphics/Materials/IMaterial.h +++ b/Source/Engine/Graphics/Materials/IMaterial.h @@ -108,7 +108,7 @@ public: /// /// Gets the mask of render passes supported by this material. /// - /// The drw passes supported by this material. + /// The draw passes supported by this material. virtual DrawPass GetDrawModes() const { return DrawPass::None; diff --git a/Source/Engine/Graphics/Mesh.cs b/Source/Engine/Graphics/Mesh.cs index f639bff8f..22579eb07 100644 --- a/Source/Engine/Graphics/Mesh.cs +++ b/Source/Engine/Graphics/Mesh.cs @@ -435,7 +435,7 @@ namespace FlaxEngine /// Downloads the third vertex buffer that contains mesh vertices data. To download data from GPU set to true and call this method from the thread other than main thread (see ). /// /// - /// If mesh has no vertex colors (stored in vertex buffer 2) the the returned value is null. + /// If mesh has no vertex colors (stored in vertex buffer 2) the returned value is null. /// /// If set to true the data will be downloaded from the GPU, otherwise it can be loaded from the drive (source asset file) or from memory (if cached). Downloading mesh from GPU requires this call to be made from the other thread than main thread. Virtual assets are always downloaded from GPU memory due to lack of dedicated storage container for the asset data. /// The gathered data or null if mesh has no vertex colors. diff --git a/Source/Engine/Graphics/Models/ModelData.Tool.cpp b/Source/Engine/Graphics/Models/ModelData.Tool.cpp index ee1b219dd..ee0fcb348 100644 --- a/Source/Engine/Graphics/Models/ModelData.Tool.cpp +++ b/Source/Engine/Graphics/Models/ModelData.Tool.cpp @@ -791,7 +791,7 @@ void MeshData::ImproveCacheLocality() Allocator::Free(piCandidates); const auto endTime = Platform::GetTimeSeconds(); - LOG(Info, "Cache relevant optimzie for {0} vertices and {1} indices. Average output ACMR is {2}. Time: {3}s", vertexCount, indexCount, (float)iCacheMisses / indexCount / 3, Utilities::RoundTo2DecimalPlaces(endTime - startTime)); + LOG(Info, "Cache relevant optimize for {0} vertices and {1} indices. Average output ACMR is {2}. Time: {3}s", vertexCount, indexCount, (float)iCacheMisses / indexCount / 3, Utilities::RoundTo2DecimalPlaces(endTime - startTime)); } float MeshData::CalculateTrianglesArea() const diff --git a/Source/Engine/Graphics/PostProcessSettings.h b/Source/Engine/Graphics/PostProcessSettings.h index 4279cfc9b..400deb3c1 100644 --- a/Source/Engine/Graphics/PostProcessSettings.h +++ b/Source/Engine/Graphics/PostProcessSettings.h @@ -387,7 +387,7 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(ToneMappingSettings); float WhiteTemperature = 6500.0f; /// - /// Adjusts the white balance temperature tint for the scene by adjusting the cyan and magenta color ranges. Ideally, this setting should be used once you've adjusted the white balance temporature to get accurate colors. Under some light temperatures, the colors may appear to be more yellow or blue. This can be used to balance the resulting color to look more natural. The default value is `0`. + /// Adjusts the white balance temperature tint for the scene by adjusting the cyan and magenta color ranges. Ideally, this setting should be used once you've adjusted the white balance temperature to get accurate colors. Under some light temperatures, the colors may appear to be more yellow or blue. This can be used to balance the resulting color to look more natural. The default value is `0`. /// API_FIELD(Attributes="DefaultValue(0.0f), Limit(-1, 1, 0.001f), EditorOrder(1), PostProcessSetting((int)ToneMappingSettingsOverride.WhiteTint)") float WhiteTint = 0.0f; diff --git a/Source/Engine/Graphics/RenderTargetPool.cpp b/Source/Engine/Graphics/RenderTargetPool.cpp index 109ff8de9..a9db0283d 100644 --- a/Source/Engine/Graphics/RenderTargetPool.cpp +++ b/Source/Engine/Graphics/RenderTargetPool.cpp @@ -108,5 +108,5 @@ void RenderTargetPool::Release(GPUTexture* rt) } } - LOG(Error, "Trying to release temporary render target which has not been registred in service!"); + LOG(Error, "Trying to release temporary render target which has not been registered in service!"); } diff --git a/Source/Engine/Graphics/Shaders/GPUShader.h b/Source/Engine/Graphics/Shaders/GPUShader.h index 79b165396..76c8df546 100644 --- a/Source/Engine/Graphics/Shaders/GPUShader.h +++ b/Source/Engine/Graphics/Shaders/GPUShader.h @@ -97,7 +97,7 @@ public: /// /// Gets the vertex shader. /// - /// Thr shader program name. + /// The shader program name. /// The shader permutation index. /// The shader object. API_FUNCTION() FORCE_INLINE GPUShaderProgramVS* GetVS(const StringAnsiView& name, int32 permutationIndex = 0) const @@ -108,7 +108,7 @@ public: /// /// Gets the hull shader. /// - /// Thr shader program name. + /// The shader program name. /// The shader permutation index. /// The shader object. API_FUNCTION() FORCE_INLINE GPUShaderProgramHS* GetHS(const StringAnsiView& name, int32 permutationIndex = 0) const @@ -119,7 +119,7 @@ public: /// /// Gets domain shader. /// - /// Thr shader program name. + /// The shader program name. /// The shader permutation index. /// The shader object. API_FUNCTION() FORCE_INLINE GPUShaderProgramDS* GetDS(const StringAnsiView& name, int32 permutationIndex = 0) const @@ -130,7 +130,7 @@ public: /// /// Gets the geometry shader. /// - /// Thr shader program name. + /// The shader program name. /// The shader permutation index. /// The shader object. API_FUNCTION() FORCE_INLINE GPUShaderProgramGS* GetGS(const StringAnsiView& name, int32 permutationIndex = 0) const @@ -141,7 +141,7 @@ public: /// /// Gets the pixel shader. /// - /// Thr shader program name. + /// The shader program name. /// The shader permutation index. /// The shader object. API_FUNCTION() FORCE_INLINE GPUShaderProgramPS* GetPS(const StringAnsiView& name, int32 permutationIndex = 0) const @@ -152,7 +152,7 @@ public: /// /// Gets the compute shader. /// - /// Thr shader program name. + /// The shader program name. /// The shader permutation index. /// The shader object. API_FUNCTION() FORCE_INLINE GPUShaderProgramCS* GetCS(const StringAnsiView& name, int32 permutationIndex = 0) const @@ -176,7 +176,7 @@ public: /// /// Determines whether the specified shader program is in the shader. /// - /// Thr shader program name. + /// The shader program name. /// The shader permutation index. /// true if the shader is valid; otherwise, false. FORCE_INLINE bool HasShader(const StringAnsiView& name, int32 permutationIndex = 0) const diff --git a/Source/Engine/Graphics/Textures/GPUTexture.h b/Source/Engine/Graphics/Textures/GPUTexture.h index d0ae27e7f..8b5385f9e 100644 --- a/Source/Engine/Graphics/Textures/GPUTexture.h +++ b/Source/Engine/Graphics/Textures/GPUTexture.h @@ -483,7 +483,7 @@ public: /// /// Creates new staging readback texture with the same dimensions and properties as a source texture (but without a data transferred; warning: caller must delete object). /// - /// Thr staging readback texture. + /// The staging readback texture. GPUTexture* ToStagingReadback() const; /// diff --git a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTimerQueryDX11.cpp b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTimerQueryDX11.cpp index 63cd9bcb4..5df4a45a5 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTimerQueryDX11.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUTimerQueryDX11.cpp @@ -118,7 +118,7 @@ float GPUTimerQueryDX11::GetResult() if (!SingleShotLog) { SingleShotLog = true; - LOG(Warning, "Unrealiable GPU timer query detected."); + LOG(Warning, "Unreliable GPU timer query detected."); } #endif } diff --git a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp index 29d417834..096a0ec11 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp @@ -391,7 +391,7 @@ bool GPUDeviceDX12::Init() { // Descriptor tables D3D12_DESCRIPTOR_RANGE r[2]; - // TODO: separate ranges for pixel/vertex visiblity and one shared for all? + // TODO: separate ranges for pixel/vertex visibility and one shared for all? { D3D12_DESCRIPTOR_RANGE& range = r[0]; range.RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV; diff --git a/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.h b/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.h index b18ae9c1b..cf9b7e9cf 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.h +++ b/Source/Engine/GraphicsDevice/Vulkan/RenderToolsVulkan.h @@ -232,10 +232,10 @@ public: } /// - /// Converts Flax comparision function to the Vulkan comparision operation. + /// Converts Flax comparison function to the Vulkan comparison operation. /// - /// The Flax comparision function. - /// The Vulkan comparision operation. + /// The Flax comparison function. + /// The Vulkan comparison operation. static FORCE_INLINE VkCompareOp ToVulkanCompareOp(const ComparisonFunc value) { return ComparisonFuncToVkCompareOp[(int32)value]; diff --git a/Source/Engine/Input/Enums.h b/Source/Engine/Input/Enums.h index 764a17922..e397dd3c2 100644 --- a/Source/Engine/Input/Enums.h +++ b/Source/Engine/Input/Enums.h @@ -8,7 +8,7 @@ #define MAX_GAMEPADS 8 /// -/// Hardware mouse cursor behaviour. +/// Hardware mouse cursor behavior. /// API_ENUM() enum class CursorLockMode { diff --git a/Source/Engine/Input/Mouse.h b/Source/Engine/Input/Mouse.h index 15fa17e6d..94875ea3a 100644 --- a/Source/Engine/Input/Mouse.h +++ b/Source/Engine/Input/Mouse.h @@ -124,7 +124,7 @@ public: virtual void SetMousePosition(const Vector2& newPosition) = 0; /// - /// Called when mouse cursor gets moved by the application. Invalidates the previous cached mouse position to prevent mouse jitter when locking the cursor programatically. + /// Called when mouse cursor gets moved by the application. Invalidates the previous cached mouse position to prevent mouse jitter when locking the cursor programmatically. /// /// The new mouse position. void OnMouseMoved(const Vector2& newPosition) diff --git a/Source/Engine/Level/Actors/StaticModel.cpp b/Source/Engine/Level/Actors/StaticModel.cpp index cba13a601..a884c9707 100644 --- a/Source/Engine/Level/Actors/StaticModel.cpp +++ b/Source/Engine/Level/Actors/StaticModel.cpp @@ -98,7 +98,7 @@ void StaticModel::SetVertexColor(int32 lodIndex, int32 meshIndex, int32 vertexIn { if (!Model || Model->WaitForLoaded()) { - LOG(Warning, "Cannot set vertex color if model is missing or faied to load."); + LOG(Warning, "Cannot set vertex color if model is missing or failed to load."); return; } diff --git a/Source/Engine/Level/Level.cpp b/Source/Engine/Level/Level.cpp index 18d9d4a52..04918f24b 100644 --- a/Source/Engine/Level/Level.cpp +++ b/Source/Engine/Level/Level.cpp @@ -961,7 +961,7 @@ bool Level::loadScene(rapidjson_flax::Value& data, int32 engineBuild, bool autoI } // Synchronize prefab instances (prefab may have new objects added or some removed so deserialized instances need to synchronize with it) - // TODO: resave and force sync scenes durign game cooking so this step could be skipped in game + // TODO: resave and force sync scenes during game cooking so this step could be skipped in game Scripting::ObjectsLookupIdMapping.Set(&modifier.Value->IdsMapping); SceneObjectsFactory::SynchronizePrefabInstances(*sceneObjects.Value, actorToRemovedObjectsData, modifier.Value); Scripting::ObjectsLookupIdMapping.Set(nullptr); @@ -973,7 +973,7 @@ bool Level::loadScene(rapidjson_flax::Value& data, int32 engineBuild, bool autoI if (obj && obj->GetParent() == nullptr) { sceneObjects->At(i) = nullptr; - LOG(Warning, "Scene object {0} {1} has missing parent objct after scene load. Removing it.", obj->GetID(), obj->ToString()); + LOG(Warning, "Scene object {0} {1} has missing parent object after scene load. Removing it.", obj->GetID(), obj->ToString()); obj->DeleteObject(); } } diff --git a/Source/Engine/Level/Prefabs/Prefab.Apply.cpp b/Source/Engine/Level/Prefabs/Prefab.Apply.cpp index 84bd17962..4305046e0 100644 --- a/Source/Engine/Level/Prefabs/Prefab.Apply.cpp +++ b/Source/Engine/Level/Prefabs/Prefab.Apply.cpp @@ -509,7 +509,7 @@ bool FindCyclicReferences(Actor* actor, const Guid& prefabRootId) bool Prefab::ApplyAll(Actor* targetActor) { - // TODO: use more cached dictionaries and other collections containers to prevent memory allocations during apply (optimize fo apply 10 times per second the same prefab on many changes in editor) + // TODO: use more cached dictionaries and other collections containers to prevent memory allocations during apply (optimize for apply 10 times per second the same prefab on many changes in editor) PROFILE_CPU(); const auto startTime = DateTime::NowUTC(); diff --git a/Source/Engine/Navigation/NavMesh.cpp b/Source/Engine/Navigation/NavMesh.cpp index 406aada30..d0bdba81f 100644 --- a/Source/Engine/Navigation/NavMesh.cpp +++ b/Source/Engine/Navigation/NavMesh.cpp @@ -79,7 +79,7 @@ void NavMesh::EnsureCapacity(int32 tilesToAddCount) // Ensure to have size assigned ASSERT(_tileSize != 0); - // Fre previous data (if any) + // Free previous data (if any) if (_navMesh) { dtFreeNavMesh(_navMesh); diff --git a/Source/Engine/Particles/Graph/ParticleEmitterGraph.h b/Source/Engine/Particles/Graph/ParticleEmitterGraph.h index 0f92d5f22..76af84011 100644 --- a/Source/Engine/Particles/Graph/ParticleEmitterGraph.h +++ b/Source/Engine/Particles/Graph/ParticleEmitterGraph.h @@ -103,7 +103,7 @@ protected: public: /// - /// The Particle Emitter Graph data version number. Used to sync the Particle Emitter Graph data with the instances state. Handles graph reloads to enure data is valid. + /// The Particle Emitter Graph data version number. Used to sync the Particle Emitter Graph data with the instances state. Handles graph reloads to ensure data is valid. /// uint32 Version = 0; diff --git a/Source/Engine/Physics/Colliders/Collider.h b/Source/Engine/Physics/Colliders/Collider.h index 8c6eeb59a..c836a7886 100644 --- a/Source/Engine/Physics/Colliders/Collider.h +++ b/Source/Engine/Physics/Colliders/Collider.h @@ -175,7 +175,7 @@ public: } /// - /// Attaches collider to the the specified rigid body. + /// Attaches collider to the specified rigid body. /// /// The rigid body. void Attach(RigidBody* rigidBody); diff --git a/Source/Engine/Physics/CollisionCooking.cpp b/Source/Engine/Physics/CollisionCooking.cpp index ea0f2f442..070f49936 100644 --- a/Source/Engine/Physics/CollisionCooking.cpp +++ b/Source/Engine/Physics/CollisionCooking.cpp @@ -13,7 +13,7 @@ #define ENSURE_CAN_COOK \ if (Physics::GetCooking() == nullptr) \ { \ - LOG(Warning, "Physics collisions cooking is disabled at runtime. Enable Physics Settigns option SupportCookingAtRuntime to use terrain generation at runtime."); \ + LOG(Warning, "Physics collisions cooking is disabled at runtime. Enable Physics Settings option SupportCookingAtRuntime to use terrain generation at runtime."); \ return true; \ } diff --git a/Source/Engine/Platform/Linux/LinuxPlatform.cpp b/Source/Engine/Platform/Linux/LinuxPlatform.cpp index f070c05f1..a68e40f72 100644 --- a/Source/Engine/Platform/Linux/LinuxPlatform.cpp +++ b/Source/Engine/Platform/Linux/LinuxPlatform.cpp @@ -346,7 +346,7 @@ static int X11_MessageBoxCreateWindow(MessageBoxData* data) { windowdata = data->Parent; windowdataWin = (X11::Window)windowdata->GetNativePtr(); - // TODO: place popup on the the screen that parent window is + // TODO: place popup on the screen that parent window is data->screen = X11_DefaultScreen(display); } else diff --git a/Source/Engine/Renderer/AmbientOcclusionPass.h b/Source/Engine/Renderer/AmbientOcclusionPass.h index 81d64a0e4..bfaf4bc19 100644 --- a/Source/Engine/Renderer/AmbientOcclusionPass.h +++ b/Source/Engine/Renderer/AmbientOcclusionPass.h @@ -60,7 +60,7 @@ private: float ShadowMultiplier; // [0.0, 5.0] Effect strength linear multiplier float ShadowPower; // [0.5, 5.0] Effect strength pow modifier float HorizonAngleThreshold; // [0.0, 0.2] Limits self-shadowing (makes the sampling area less of a hemisphere, more of a spherical cone, to avoid self-shadowing and various artifacts due to low tessellation and depth buffer imprecision, etc.) - float FadeOutFrom; // [0.0, ~ ] Distance to start start fading out the effect. + float FadeOutFrom; // [0.0, ~ ] Distance to start fading out the effect. float FadeOutTo; // [0.0, ~ ] Distance at which the effect is faded out. int QualityLevel; // [ 0, ] Effect quality; 0 - low, 1 - medium, 2 - high, 3 - very high; each quality level is roughly 2x more costly than the previous, except the q3 which is variable but, in general, above q2. int BlurPassCount; // [ 0, 6] Number of edge-sensitive smart blur passes to apply. Quality 0 is an exception with only one 'dumb' blur pass used. diff --git a/Source/Engine/Scripting/Attributes/Editor/EditorOrderAttribute.cs b/Source/Engine/Scripting/Attributes/Editor/EditorOrderAttribute.cs index 506666def..5b783b514 100644 --- a/Source/Engine/Scripting/Attributes/Editor/EditorOrderAttribute.cs +++ b/Source/Engine/Scripting/Attributes/Editor/EditorOrderAttribute.cs @@ -27,7 +27,7 @@ namespace FlaxEngine /// /// Current order is resolved runtime, and can change if custom editor class has changed. /// - /// The order order. + /// The order. public EditorOrderAttribute(int order) { Order = order; diff --git a/Source/Engine/Scripting/Attributes/SerializeAttribute.cs b/Source/Engine/Scripting/Attributes/SerializeAttribute.cs index 3cda97473..d120756ea 100644 --- a/Source/Engine/Scripting/Attributes/SerializeAttribute.cs +++ b/Source/Engine/Scripting/Attributes/SerializeAttribute.cs @@ -5,7 +5,7 @@ using System; namespace FlaxEngine { /// - /// Indicates that a field or a property of a serializable class should be be serialized. This class cannot be inherited. + /// Indicates that a field or a property of a serializable class should be serialized. This class cannot be inherited. /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public sealed class SerializeAttribute : Attribute diff --git a/Source/Engine/Scripting/ManagedCLR/MAssembly.Mono.cpp b/Source/Engine/Scripting/ManagedCLR/MAssembly.Mono.cpp index 50a8b689e..e24b71eff 100644 --- a/Source/Engine/Scripting/ManagedCLR/MAssembly.Mono.cpp +++ b/Source/Engine/Scripting/ManagedCLR/MAssembly.Mono.cpp @@ -303,7 +303,7 @@ bool MAssembly::LoadWithImage(const String& assemblyPath) const auto assembly = mono_assembly_load_from_full(assemblyImage, name.Substring(0, name.Length() - 3).Get(), &status, false); if (status != MONO_IMAGE_OK || assembly == nullptr) { - // Close image if error occured + // Close image if error occurred mono_image_close(assemblyImage); Log::CLRInnerException(TEXT("Mono assembly image is corrupted at ") + assemblyPath); diff --git a/Source/Engine/Scripting/ManagedCLR/MAssembly.h b/Source/Engine/Scripting/ManagedCLR/MAssembly.h index ff8d5e8db..17cb8b624 100644 --- a/Source/Engine/Scripting/ManagedCLR/MAssembly.h +++ b/Source/Engine/Scripting/ManagedCLR/MAssembly.h @@ -234,7 +234,7 @@ public: #endif /// - /// Gets the classes lookup cache. Performs ful initialization if not cached. The result cache contains all classes from the assembly. + /// Gets the classes lookup cache. Performs full initialization if not cached. The result cache contains all classes from the assembly. /// /// The cache. const ClassesDictionary& GetClasses() const; diff --git a/Source/Engine/Scripting/ManagedCLR/MClass.h b/Source/Engine/Scripting/ManagedCLR/MClass.h index bfa813fb4..a8d083d7b 100644 --- a/Source/Engine/Scripting/ManagedCLR/MClass.h +++ b/Source/Engine/Scripting/ManagedCLR/MClass.h @@ -193,7 +193,7 @@ public: /// /// Returns an object referencing a method with the specified name and number of parameters. /// - /// If the the type contains more than one method of the given name and parameters count the returned value can be non-deterministic (one of the matching methods). + /// If the type contains more than one method of the given name and parameters count the returned value can be non-deterministic (one of the matching methods). /// The method name. /// The method parameters count. /// The method or null if failed to get it. diff --git a/Source/Engine/Scripting/ScriptingType.h b/Source/Engine/Scripting/ScriptingType.h index 40ca2ed10..942edcd1a 100644 --- a/Source/Engine/Scripting/ScriptingType.h +++ b/Source/Engine/Scripting/ScriptingType.h @@ -190,7 +190,7 @@ struct FLAXENGINE_API ScriptingType SetupScriptObjectVTableHandler SetupScriptObjectVTable; /// - /// The default instance of the scripting type. Used by serialization system for comparision to save only modified properties of the object. + /// The default instance of the scripting type. Used by serialization system for comparison to save only modified properties of the object. /// mutable ScriptingObject* DefaultInstance; } Class; @@ -255,7 +255,7 @@ struct FLAXENGINE_API ScriptingType } /// - /// Gets the default instance of the scripting type. Used by serialization system for comparision to save only modified properties of the object. + /// Gets the default instance of the scripting type. Used by serialization system for comparison to save only modified properties of the object. /// ScriptingObject* GetDefaultInstance() const; diff --git a/Source/Engine/Serialization/JsonWriter.cpp b/Source/Engine/Serialization/JsonWriter.cpp index d3f04a684..de90b49b4 100644 --- a/Source/Engine/Serialization/JsonWriter.cpp +++ b/Source/Engine/Serialization/JsonWriter.cpp @@ -195,7 +195,7 @@ void JsonWriter::SceneObject(::SceneObject* obj) auto prefab = Content::Load(obj->GetPrefabID()); if (prefab) { - // Request the prefab to be deserialized to the default instance (used for comparision to generate a diff) + // Request the prefab to be deserialized to the default instance (used for comparison to generate a diff) prefab->GetDefaultInstance(); // Get prefab object instance from the prefab diff --git a/Source/Engine/Serialization/Stream.h b/Source/Engine/Serialization/Stream.h index de7911fb4..d988a24df 100644 --- a/Source/Engine/Serialization/Stream.h +++ b/Source/Engine/Serialization/Stream.h @@ -37,9 +37,9 @@ public: public: /// - /// Returns true if error occured during reading/writing to the stream + /// Returns true if error occurred during reading/writing to the stream /// - /// True if error occured during reading/writing to the stream + /// True if error occurred during reading/writing to the stream virtual bool HasError() const { return _hasError; diff --git a/Source/Engine/Terrain/Terrain.cpp b/Source/Engine/Terrain/Terrain.cpp index d15dd4cfa..38d1865bb 100644 --- a/Source/Engine/Terrain/Terrain.cpp +++ b/Source/Engine/Terrain/Terrain.cpp @@ -489,7 +489,7 @@ void Terrain::RemovePatch(const Int2& patchCoord) const auto patch = GetPatch(patchCoord); if (patch == nullptr) { - LOG(Warning, "Cannot remvoe patch at {0}x{1}. It does not exist.", patchCoord.X, patchCoord.Y); + LOG(Warning, "Cannot remove patch at {0}x{1}. It does not exist.", patchCoord.X, patchCoord.Y); return; } diff --git a/Source/Engine/Threading/ConcurrentBuffer.h b/Source/Engine/Threading/ConcurrentBuffer.h index 99159e206..99ebe5e86 100644 --- a/Source/Engine/Threading/ConcurrentBuffer.h +++ b/Source/Engine/Threading/ConcurrentBuffer.h @@ -382,7 +382,7 @@ public: /// Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection. /// /// The item. - /// The zero-based index of the first occurrence of itm within the entire collection, if found; otherwise, INVALID_INDEX. + /// The zero-based index of the first occurrence of item within the entire collection, if found; otherwise, INVALID_INDEX. int32 IndexOf(const T& item) const { for (int32 i = 0; i < _count; i++) diff --git a/Source/Engine/Threading/IRunnable.h b/Source/Engine/Threading/IRunnable.h index 7dc42f73a..83a2af305 100644 --- a/Source/Engine/Threading/IRunnable.h +++ b/Source/Engine/Threading/IRunnable.h @@ -41,7 +41,7 @@ public: } // Called when thread ends work (via Kill or normally) - // @param wasKilled True if thead has been killed + // @param wasKilled True if thread has been killed virtual void AfterWork(bool wasKilled) { } diff --git a/Source/Engine/Threading/ThreadPool.cpp b/Source/Engine/Threading/ThreadPool.cpp index 56d6f6289..ffd80d655 100644 --- a/Source/Engine/Threading/ThreadPool.cpp +++ b/Source/Engine/Threading/ThreadPool.cpp @@ -52,7 +52,7 @@ bool ThreadPoolService::Init() // Create tread auto runnable = New(true); runnable->OnWork.Bind(ThreadPool::ThreadProc); - auto thread = Thread::Create(runnable, String::Format(TEXT("Therad Pool {0}"), i)); + auto thread = Thread::Create(runnable, String::Format(TEXT("Thread Pool {0}"), i)); if (thread == nullptr) { LOG(Error, "Failed to spawn {0} thread in the Thread Pool", i + 1); diff --git a/Source/Engine/Tools/ModelTool/ModelTool.OpenFBX.cpp b/Source/Engine/Tools/ModelTool/ModelTool.OpenFBX.cpp index 4c2876125..757dfa6ea 100644 --- a/Source/Engine/Tools/ModelTool/ModelTool.OpenFBX.cpp +++ b/Source/Engine/Tools/ModelTool/ModelTool.OpenFBX.cpp @@ -744,7 +744,7 @@ bool ProcessMesh(OpenFbxImporterData& data, const ofbx::Mesh* aMesh, MeshData& m auto length = delta.Length(); if (length > ZeroTolerance) delta /= length;*/ - auto delta = Vector3::Zero; // TODO: blend shape normals deltas fix when importing from ofbx + auto delta = Vector3::Zero; // TODO: blend shape normals deltas fix when importing from fbx blendShapeData.Vertices[i].NormalDelta = delta; } } diff --git a/Source/Engine/Tools/ModelTool/ModelTool.cpp b/Source/Engine/Tools/ModelTool/ModelTool.cpp index 3d6c74482..35cb3860b 100644 --- a/Source/Engine/Tools/ModelTool/ModelTool.cpp +++ b/Source/Engine/Tools/ModelTool/ModelTool.cpp @@ -1131,7 +1131,7 @@ bool ModelTool::ImportModel(const String& path, ModelData& meshData, Options opt dstLod.Meshes.RemoveAt(i--); } - LOG(Info, "Generated LOD{0}: triangles: {1} ({2}% of base LOD), verteces: {3} ({4}% of base LOD)", + LOG(Info, "Generated LOD{0}: triangles: {1} ({2}% of base LOD), verticies: {3} ({4}% of base LOD)", lodIndex, lodTriangleCount, (int32)(lodTriangleCount * 100 / baseLodTriangleCount), lodVertexCount, (int32)(lodVertexCount * 100 / baseLodVertexCount)); diff --git a/Source/Engine/UI/GUI/ContainerControl.cs b/Source/Engine/UI/GUI/ContainerControl.cs index 44f8c782a..fed4335c0 100644 --- a/Source/Engine/UI/GUI/ContainerControl.cs +++ b/Source/Engine/UI/GUI/ContainerControl.cs @@ -469,7 +469,7 @@ namespace FlaxEngine.GUI } /// - /// Checks if given point in thi container control space intersects with the child control content. + /// Checks if given point in this container control space intersects with the child control content. /// Also calculates result location in child control space which can be used to feed control with event at that point. /// /// The child control to check. diff --git a/Source/Engine/UI/GUI/Control.cs b/Source/Engine/UI/GUI/Control.cs index 74041610c..1c4eda965 100644 --- a/Source/Engine/UI/GUI/Control.cs +++ b/Source/Engine/UI/GUI/Control.cs @@ -1211,7 +1211,7 @@ namespace FlaxEngine.GUI } /// - /// Action fred when parent control gets changed. + /// Action fired when parent control gets changed. /// protected virtual void OnParentChangedInternal() { @@ -1252,9 +1252,9 @@ namespace FlaxEngine.GUI } /// - /// Helper utility function to sets the update callback to the root. Does nothing if value has not been modified. Handles if control ahs no root or parent. + /// Helper utility function to sets the update callback to the root. Does nothing if value has not been modified. Handles if control has no root or parent. /// - /// The cached update callback delegate (field in teh custom control implementation). + /// The cached update callback delegate (field in the custom control implementation). /// The value to assign. protected void SetUpdate(ref UpdateDelegate onUpdate, UpdateDelegate value) { @@ -1268,7 +1268,7 @@ namespace FlaxEngine.GUI } /// - /// Action fred when parent control gets resized (also when control gets non-null parent). + /// Action fired when parent control gets resized (also when control gets non-null parent). /// public virtual void OnParentResized() { diff --git a/Source/Engine/UI/GUI/Panels/UniformGridPanel.cs b/Source/Engine/UI/GUI/Panels/UniformGridPanel.cs index 089907901..62c6a9744 100644 --- a/Source/Engine/UI/GUI/Panels/UniformGridPanel.cs +++ b/Source/Engine/UI/GUI/Panels/UniformGridPanel.cs @@ -14,7 +14,7 @@ namespace FlaxEngine.GUI /// /// Gets or sets the padding given to each slot. /// - [EditorOrder(0), Tooltip("The padding margin appied to each item slot.")] + [EditorOrder(0), Tooltip("The padding margin applied to each item slot.")] public Margin SlotPadding { get => _slotPadding; diff --git a/Source/Engine/UI/UICanvas.cs b/Source/Engine/UI/UICanvas.cs index 9ccbef214..f07910975 100644 --- a/Source/Engine/UI/UICanvas.cs +++ b/Source/Engine/UI/UICanvas.cs @@ -186,14 +186,14 @@ namespace FlaxEngine public CanvasRootControl GUI => _guiRoot; /// - /// Delegate schema for the callback used to perform custom canvas intersection test. Can be used to implement a canvas tha has a holes or non-rectangular shape. + /// Delegate schema for the callback used to perform custom canvas intersection test. Can be used to implement a canvas that has a holes or non-rectangular shape. /// /// The location of the point to test in coordinates of the canvas root control (see ). /// True if canvas was hit, otherwise false. public delegate bool TestCanvasIntersectionDelegate(ref Vector2 location); /// - /// The callback used to perform custom canvas intersection test. Can be used to implement a canvas tha has a holes or non-rectangular shape. + /// The callback used to perform custom canvas intersection test. Can be used to implement a canvas that has a holes or non-rectangular shape. /// [HideInEditor] public TestCanvasIntersectionDelegate TestCanvasIntersection; diff --git a/Source/Shaders/BakeLightmap.shader b/Source/Shaders/BakeLightmap.shader index 4f206469e..14f99b4f4 100644 --- a/Source/Shaders/BakeLightmap.shader +++ b/Source/Shaders/BakeLightmap.shader @@ -328,7 +328,7 @@ void CS_BlurEmpty(uint3 GroupID : SV_GroupID, uint3 GroupThreadID : SV_GroupThre const int2 location = int2(GroupID.x, GroupID.y); const uint texelAdress = (location.y * AtlasSize + location.x) * NUM_SH_TARGETS; - // TODO: use more therads to sample lightmap and final therad make it blur + // TODO: use more threads to sample lightmap and final therad make it blur // Simple box filter (using only valid samples) const int blurRadius = 2; diff --git a/Source/Shaders/BitonicSort.shader b/Source/Shaders/BitonicSort.shader index b75f553b1..8a53802d0 100644 --- a/Source/Shaders/BitonicSort.shader +++ b/Source/Shaders/BitonicSort.shader @@ -32,7 +32,7 @@ uint InsertOneBit(uint value, uint oneBitMask) // Determines if two sort keys should be swapped in the list. KeySign is // either 1 or -1. Multiplication with the KeySign will either invert the sign -// (effectively a negation) or leave the value alone. When the the KeySign is +// (effectively a negation) or leave the value alone. When the KeySign is // 1, we are sorting descending, so when A < B, they should swap. For an // ascending sort, -A < -B should swap. bool ShouldSwap(Item a, Item b) From 4d8cc9aef7d220c3992494dea552fa239b915f31 Mon Sep 17 00:00:00 2001 From: "W2.Wizard" Date: Tue, 5 Jan 2021 02:14:21 +0100 Subject: [PATCH 11/46] Fixed additional typos Went through the source with VNNCC to correct as many found typos as possible Co-Authored-By: VNC <52937757+VNNCC@users.noreply.github.com> --- .../Editor/Modules/ContentImportingModule.cs | 2 +- Source/Engine/CSG/CSGMesh.Triangulate.cpp | 16 ++++++++-------- Source/Engine/CSG/CSGMesh.cpp | 8 ++++---- Source/Engine/Debug/Exception.h | 2 +- .../Graph/CPU/ParticleEmitterGraph.CPU.h | 2 +- .../Engine/Particles/ParticlesSimulation.cpp | 2 +- Source/Engine/Render2D/Font.cpp | 2 +- Source/Engine/Render2D/FontManager.cpp | 2 +- Source/Engine/Serialization/Stream.h | 4 ++-- Source/Engine/Streaming/StreamingManager.cpp | 2 +- .../Tools/MaterialGenerator/MaterialLayer.cpp | 2 +- .../Tools/ModelTool/ModelTool.Assimp.cpp | 2 +- .../Engine/Tools/TextureTool/TextureTool.cpp | 4 ++-- Source/Engine/UI/GUI/Common/Dropdown.cs | 2 +- Source/Engine/UI/GUI/ContainerControl.cs | 2 +- Source/Engine/UI/GUI/Panels/SplitPanel.cs | 16 ++++++++-------- Source/Engine/UI/GUI/WindowRootControl.cs | 8 ++++---- Source/Engine/Utilities/StateMachine.h | 2 +- .../Build/Plugins/VisualScriptingPlugin.cs | 2 +- Source/Tools/Flax.Build/Build/Target.cs | 2 +- Source/Tools/Flax.Stats/CodeFrameNode.cs | 18 +++++++++--------- Source/Tools/Flax.Stats/Tools.cs | 4 ++-- 22 files changed, 53 insertions(+), 53 deletions(-) diff --git a/Source/Editor/Modules/ContentImportingModule.cs b/Source/Editor/Modules/ContentImportingModule.cs index 03f434b9c..0c934f130 100644 --- a/Source/Editor/Modules/ContentImportingModule.cs +++ b/Source/Editor/Modules/ContentImportingModule.cs @@ -410,7 +410,7 @@ namespace FlaxEditor.Modules { if (request.Settings != null && entry.TryOverrideSettings(request.Settings)) { - // Use overriden settings + // Use overridden settings } else if (!request.SkipSettingsDialog) { diff --git a/Source/Engine/CSG/CSGMesh.Triangulate.cpp b/Source/Engine/CSG/CSGMesh.Triangulate.cpp index bb814653b..8a64f4042 100644 --- a/Source/Engine/CSG/CSGMesh.Triangulate.cpp +++ b/Source/Engine/CSG/CSGMesh.Triangulate.cpp @@ -22,7 +22,7 @@ bool CSG::Mesh::Triangulate(RawData& data, Array& cacheVB) const Array surfaceCacheVB(32); // Cache submeshes by material to lay them down - // key- brush index, value- direcotry for surafecs (key: surface index, value: list with start vertex per triangle) + // key- brush index, value- direcotry for surfaces (key: surface index, value: list with start vertex per triangle) Dictionary>> polygonsPerBrush(64); // Build index buffer @@ -115,8 +115,8 @@ bool CSG::Mesh::Triangulate(RawData& data, Array& cacheVB) const tangent.Normalize(); // Gram-Schmidt orthogonalize - Vector3 newTangentUnormalized = tangent - normal * Vector3::Dot(normal, tangent); - const float length = newTangentUnormalized.Length(); + Vector3 newTangentUnnormalized = tangent - normal * Vector3::Dot(normal, tangent); + const float length = newTangentUnnormalized.Length(); // Workaround to handle degenerated case if (Math::IsZero(length)) @@ -129,7 +129,7 @@ bool CSG::Mesh::Triangulate(RawData& data, Array& cacheVB) const } else { - tangent = newTangentUnormalized / length; + tangent = newTangentUnnormalized / length; bitangent.Normalize(); } @@ -217,12 +217,12 @@ bool CSG::Mesh::Triangulate(RawData& data, Array& cacheVB) const auto& vertex = cacheVB[triangleStartVertex + k]; Vector3 projected = Vector3::Project(vertex.Position, 0, 0, 1000, 1000, 0, 1, vp); - Vector2 projectecXY = Vector2(projected); + Vector2 projectedXY = Vector2(projected); - min = Vector2::Min(projectecXY, min); - max = Vector2::Max(projectecXY, max); + min = Vector2::Min(projectedXY, min); + max = Vector2::Max(projectedXY, max); - pointsCache.Add(projectecXY); + pointsCache.Add(projectedXY); } } diff --git a/Source/Engine/CSG/CSGMesh.cpp b/Source/Engine/CSG/CSGMesh.cpp index cc4897d3a..9a885a35d 100644 --- a/Source/Engine/CSG/CSGMesh.cpp +++ b/Source/Engine/CSG/CSGMesh.cpp @@ -38,7 +38,7 @@ void CSG::Mesh::PerformOperation(Mesh* other) { case Mode::Additive: { - // Check if both meshes do not intesect + // Check if both meshes do not intersect if (AABB::IsOutside(_bounds, other->GetBounds())) // TODO: test every sub bounds not whole _bounds { // Add vertices to the mesh without any additional calculations @@ -57,7 +57,7 @@ void CSG::Mesh::PerformOperation(Mesh* other) case Mode::Subtractive: { - // Check if both meshes do not intesect + // Check if both meshes do not intersect if (AABB::IsOutside(_bounds, other->GetBounds())) // TODO: test every sub bounds not whole _bounds { // Do nothing @@ -141,7 +141,7 @@ void CSG::Mesh::intersect(const Mesh* other, PolygonOperation insideOp, PolygonO // insideOp - operation for polygons being inside the other brush // outsideOp - operation for polygons being outside the other brush - // Prevent from redudant action + // Prevent from redundant action if (insideOp == Keep && outsideOp == Keep) return; @@ -180,7 +180,7 @@ void CSG::Mesh::intersectSubMesh(const Mesh* other, int32 subMeshIndex, PolygonO int32 startBrushSurface = brushMeta.StartSurfaceIndex; int32 endBrushSurface = startBrushSurface + brushMeta.SurfacesCount; - // Check every polygon (itereate fron end since we can ass new polygons and we don't want to process them) + // Check every polygon (iterate from end since we can ass new polygons and we don't want to process them) for (int32 i = _polygons.Count() - 1; i >= 0; i--) { auto& polygon = _polygons[i]; diff --git a/Source/Engine/Debug/Exception.h b/Source/Engine/Debug/Exception.h index 481c78589..5bef7aa55 100644 --- a/Source/Engine/Debug/Exception.h +++ b/Source/Engine/Debug/Exception.h @@ -36,7 +36,7 @@ namespace Log /// /// Additional information that help describe error Exception(const String& additionalInfo) - : Exception(TEXT("An exception has occured."), additionalInfo) + : Exception(TEXT("An exception has occurred."), additionalInfo) { } diff --git a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h index a93c50ec2..cc1b5b6b2 100644 --- a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h +++ b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h @@ -100,7 +100,7 @@ public: public: /// - /// Determinates whenever this emitter uses lights rendering. + /// Determinate whenever this emitter uses lights rendering. /// /// True if emitter uses lights rendering, otherwise false. FORCE_INLINE bool UsesLightRendering() const diff --git a/Source/Engine/Particles/ParticlesSimulation.cpp b/Source/Engine/Particles/ParticlesSimulation.cpp index bbba833ff..0b6e3691d 100644 --- a/Source/Engine/Particles/ParticlesSimulation.cpp +++ b/Source/Engine/Particles/ParticlesSimulation.cpp @@ -115,7 +115,7 @@ int32 ParticleSystemInstance::GetParticlesCount() const const auto desc = GPUBufferDescription::Buffer(Emitters.Count() * sizeof(uint32), GPUBufferFlags::None, PixelFormat::Unknown, nullptr, sizeof(uint32), GPUResourceUsage::StagingReadback); if (GPUParticlesCountReadback->Init(desc)) { - LOG(Error, "Failed to create GPU particles coun readback buffer."); + LOG(Error, "Failed to create GPU particles count readback buffer."); } } diff --git a/Source/Engine/Render2D/Font.cpp b/Source/Engine/Render2D/Font.cpp index c9dd7b55c..209989d4f 100644 --- a/Source/Engine/Render2D/Font.cpp +++ b/Source/Engine/Render2D/Font.cpp @@ -33,7 +33,7 @@ Font::~Font() void Font::GetCharacter(Char c, FontCharacterEntry& result) { - // Try get character or cache it if cannot find + // Try to get the character or cache it if cannot be found if (!_characters.TryGet(c, result)) { // This thread race condition may happen in editor but in game we usually do all stuff with fonts on main thread (chars caching) diff --git a/Source/Engine/Render2D/FontManager.cpp b/Source/Engine/Render2D/FontManager.cpp index f05cd7280..ec7a61257 100644 --- a/Source/Engine/Render2D/FontManager.cpp +++ b/Source/Engine/Render2D/FontManager.cpp @@ -214,7 +214,7 @@ bool FontManager::AddNewEntry(Font* font, Char c, FontCharacterEntry& entry) return false; } - // Copy glyph data after rasterize (row by row) + // Copy glyph data after rasterization (row by row) for (int32 row = 0; row < glyphHeight; row++) { Platform::MemoryCopy(&GlyphImageData[row * glyphWidth], &bitmap->buffer[row * bitmap->pitch], glyphWidth); diff --git a/Source/Engine/Serialization/Stream.h b/Source/Engine/Serialization/Stream.h index de7911fb4..d988a24df 100644 --- a/Source/Engine/Serialization/Stream.h +++ b/Source/Engine/Serialization/Stream.h @@ -37,9 +37,9 @@ public: public: /// - /// Returns true if error occured during reading/writing to the stream + /// Returns true if error occurred during reading/writing to the stream /// - /// True if error occured during reading/writing to the stream + /// True if error occurred during reading/writing to the stream virtual bool HasError() const { return _hasError; diff --git a/Source/Engine/Streaming/StreamingManager.cpp b/Source/Engine/Streaming/StreamingManager.cpp index d82a3b5ab..3b557e85f 100644 --- a/Source/Engine/Streaming/StreamingManager.cpp +++ b/Source/Engine/Streaming/StreamingManager.cpp @@ -92,7 +92,7 @@ void UpdateResource(StreamableResource* resource, DateTime now) } } - // Calculate residency level to stream in (resources may want to incease/decrease it's quality in steps rather than at once) + // Calculate residency level to stream in (resources may want to increase/decrease it's quality in steps rather than at once) int32 requestedResidency = handler->CalculateRequestedResidency(resource, targetResidency); // Create streaming task (resource type specific) diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialLayer.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialLayer.cpp index c7f940574..41679a6a3 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialLayer.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialLayer.cpp @@ -64,7 +64,7 @@ void MaterialLayer::Prepare() Guid MaterialLayer::GetMappedParamId(const Guid& id) { - // TODO: test ParamIdsMappings using Dictionary. will performance change? mamybe we don't wont to allocate too much memory + // TODO: test ParamIdsMappings using Dictionary. will performance change? maybe we don't wont to allocate too much memory for (int32 i = 0; i < ParamIdsMappings.Count(); i++) { diff --git a/Source/Engine/Tools/ModelTool/ModelTool.Assimp.cpp b/Source/Engine/Tools/ModelTool/ModelTool.Assimp.cpp index fef8d7f3c..50914ea2e 100644 --- a/Source/Engine/Tools/ModelTool/ModelTool.Assimp.cpp +++ b/Source/Engine/Tools/ModelTool/ModelTool.Assimp.cpp @@ -355,7 +355,7 @@ bool ProcessMesh(AssimpImporterData& data, const aiMesh* aMesh, MeshData& mesh, mesh.BlendIndices.SetAll(Int4::Zero); mesh.BlendWeights.SetAll(Vector4::Zero); - // Build skinning clusters and fill controls points data stutcture + // Build skinning clusters and fill controls points data structure for (unsigned boneId = 0; boneId < aMesh->mNumBones; boneId++) { const auto aBone = aMesh->mBones[boneId]; diff --git a/Source/Engine/Tools/TextureTool/TextureTool.cpp b/Source/Engine/Tools/TextureTool/TextureTool.cpp index a8af48764..97e4df253 100644 --- a/Source/Engine/Tools/TextureTool/TextureTool.cpp +++ b/Source/Engine/Tools/TextureTool/TextureTool.cpp @@ -316,7 +316,7 @@ bool TextureTool::Convert(TextureData& dst, const TextureData& src, const PixelF } if (src.Format == dstFormat) { - LOG(Warning, "Soure data and destination format are the same. Cannot perform conversion."); + LOG(Warning, "Source data and destination format are the same. Cannot perform conversion."); return true; } if (src.Depth != 1) @@ -343,7 +343,7 @@ bool TextureTool::Resize(TextureData& dst, const TextureData& src, int32 dstWidt } if (src.Width == dstWidth && src.Height == dstHeight) { - LOG(Warning, "Soure data and destination dimensions are the same. Cannot perform resizing."); + LOG(Warning, "Source data and destination dimensions are the same. Cannot perform resizing."); return true; } if (src.Depth != 1) diff --git a/Source/Engine/UI/GUI/Common/Dropdown.cs b/Source/Engine/UI/GUI/Common/Dropdown.cs index e78300e1a..917e51f6e 100644 --- a/Source/Engine/UI/GUI/Common/Dropdown.cs +++ b/Source/Engine/UI/GUI/Common/Dropdown.cs @@ -26,7 +26,7 @@ namespace FlaxEngine.GUI public Action ItemClicked; /// - /// Occurs when popup losts focus. + /// Occurs when popup lost focus. /// public Action LostFocus; diff --git a/Source/Engine/UI/GUI/ContainerControl.cs b/Source/Engine/UI/GUI/ContainerControl.cs index 44f8c782a..0fecef9ef 100644 --- a/Source/Engine/UI/GUI/ContainerControl.cs +++ b/Source/Engine/UI/GUI/ContainerControl.cs @@ -636,7 +636,7 @@ namespace FlaxEngine.GUI } /// - /// Draws the children. Can be overriden to provide some customizations. Draw is performed with applied clipping mask for the client area. + /// Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area. /// protected virtual void DrawChildren() { diff --git a/Source/Engine/UI/GUI/Panels/SplitPanel.cs b/Source/Engine/UI/GUI/Panels/SplitPanel.cs index 733e0b3a1..04160db25 100644 --- a/Source/Engine/UI/GUI/Panels/SplitPanel.cs +++ b/Source/Engine/UI/GUI/Panels/SplitPanel.cs @@ -12,12 +12,12 @@ namespace FlaxEngine.GUI /// /// The splitter size (in pixels). /// - public const int SpliterSize = 4; + public const int SplitterSize = 4; /// /// The splitter half size (in pixels). /// - private const int SpliterSizeHalf = SpliterSize / 2; + private const int SplitterSizeHalf = SplitterSize / 2; private Orientation _orientation; private float _splitterValue; @@ -105,12 +105,12 @@ namespace FlaxEngine.GUI if (_orientation == Orientation.Horizontal) { var split = Mathf.RoundToInt(_splitterValue * Width); - _splitterRect = new Rectangle(Mathf.Clamp(split - SpliterSizeHalf, 0.0f, Width), 0, SpliterSize, Height); + _splitterRect = new Rectangle(Mathf.Clamp(split - SplitterSizeHalf, 0.0f, Width), 0, SplitterSize, Height); } else { var split = Mathf.RoundToInt(_splitterValue * Height); - _splitterRect = new Rectangle(0, Mathf.Clamp(split - SpliterSizeHalf, 0.0f, Height), Width, SpliterSize); + _splitterRect = new Rectangle(0, Mathf.Clamp(split - SplitterSizeHalf, 0.0f, Height), Width, SplitterSize); } } @@ -226,14 +226,14 @@ namespace FlaxEngine.GUI if (_orientation == Orientation.Horizontal) { var split = Mathf.RoundToInt(_splitterValue * Width); - Panel1.Bounds = new Rectangle(0, 0, split - SpliterSizeHalf, Height); - Panel2.Bounds = new Rectangle(split + SpliterSizeHalf, 0, Width - split - SpliterSizeHalf, Height); + Panel1.Bounds = new Rectangle(0, 0, split - SplitterSizeHalf, Height); + Panel2.Bounds = new Rectangle(split + SplitterSizeHalf, 0, Width - split - SplitterSizeHalf, Height); } else { var split = Mathf.RoundToInt(_splitterValue * Height); - Panel1.Bounds = new Rectangle(0, 0, Width, split - SpliterSizeHalf); - Panel2.Bounds = new Rectangle(0, split + SpliterSizeHalf, Width, Height - split - SpliterSizeHalf); + Panel1.Bounds = new Rectangle(0, 0, Width, split - SplitterSizeHalf); + Panel2.Bounds = new Rectangle(0, split + SplitterSizeHalf, Width, Height - split - SplitterSizeHalf); } } } diff --git a/Source/Engine/UI/GUI/WindowRootControl.cs b/Source/Engine/UI/GUI/WindowRootControl.cs index 03a994aa6..23330ffae 100644 --- a/Source/Engine/UI/GUI/WindowRootControl.cs +++ b/Source/Engine/UI/GUI/WindowRootControl.cs @@ -262,14 +262,14 @@ namespace FlaxEngine.GUI return false; // Change focused control - Control prevous = _focusedControl; + Control previous = _focusedControl; _focusedControl = c; // Fire events - if (prevous != null) + if (previous != null) { - prevous.OnLostFocus(); - Assert.IsFalse(prevous.IsFocused); + previous.OnLostFocus(); + Assert.IsFalse(previous.IsFocused); } if (_focusedControl != null) { diff --git a/Source/Engine/Utilities/StateMachine.h b/Source/Engine/Utilities/StateMachine.h index 292a67978..38e69a06b 100644 --- a/Source/Engine/Utilities/StateMachine.h +++ b/Source/Engine/Utilities/StateMachine.h @@ -50,7 +50,7 @@ public: /// /// Checks if can exit from that state /// - /// Next state to ener after exit from the current state + /// Next state to enter after exit from the current state /// True if can exit from that state, otherwise false virtual bool CanExit(State* nextState) const { diff --git a/Source/Tools/Flax.Build/Build/Plugins/VisualScriptingPlugin.cs b/Source/Tools/Flax.Build/Build/Plugins/VisualScriptingPlugin.cs index 8ebe13518..ecfd97d88 100644 --- a/Source/Tools/Flax.Build/Build/Plugins/VisualScriptingPlugin.cs +++ b/Source/Tools/Flax.Build/Build/Plugins/VisualScriptingPlugin.cs @@ -22,7 +22,7 @@ namespace Flax.Build.Plugins private void OnGenerateCppScriptWrapperFunction(Builder.BuildData buildData, ClassInfo classInfo, FunctionInfo functionInfo, int scriptVTableSize, int scriptVTableIndex, StringBuilder contents) { - // Generate C++ wrapper function to invoke Visual Script instead of overriden native function (with support for base method callback) + // Generate C++ wrapper function to invoke Visual Script instead of overridden native function (with support for base method callback) BindingsGenerator.CppIncludeFiles.Add("Engine/Content/Assets/VisualScript.h"); diff --git a/Source/Tools/Flax.Build/Build/Target.cs b/Source/Tools/Flax.Build/Build/Target.cs index b7a6b2fbe..ebf1d36c9 100644 --- a/Source/Tools/Flax.Build/Build/Target.cs +++ b/Source/Tools/Flax.Build/Build/Target.cs @@ -225,7 +225,7 @@ namespace Flax.Build } /// - /// Setups the target building environment (native C++). Allows to modify compiler and linker options. Options applied here are used by all modules included into this target (can be overriden per module). + /// Setups the target building environment (native C++). Allows to modify compiler and linker options. Options applied here are used by all modules included into this target (can be overridden per module). /// /// The build options. public virtual void SetupTargetEnvironment(BuildOptions options) diff --git a/Source/Tools/Flax.Stats/CodeFrameNode.cs b/Source/Tools/Flax.Stats/CodeFrameNode.cs index 25d326ff4..e42bdcfef 100644 --- a/Source/Tools/Flax.Stats/CodeFrameNode.cs +++ b/Source/Tools/Flax.Stats/CodeFrameNode.cs @@ -75,14 +75,14 @@ namespace Flax.Stats /// /// Gets total amount of memory used by that node and all child nodes /// - public long TotaSizeOnDisk + public long TotalSizeOnDisk { get { long result = SizeOnDisk; for (int i = 0; i < Children.Length; i++) { - result += Children[i].TotaSizeOnDisk; + result += Children[i].TotalSizeOnDisk; } return result; } @@ -153,15 +153,15 @@ namespace Flax.Stats /// /// Gets total amount of lines of code per language /// - /// Language + /// Language /// Result amount of lines - public long GetTotalLinesOfCode(Languages languge) + public long GetTotalLinesOfCode(Languages language) { long result = 0; - result += LinesOfCode[(int)languge]; + result += LinesOfCode[(int)language]; for (int i = 0; i < Children.Length; i++) { - result += Children[i].GetTotalLinesOfCode(languge); + result += Children[i].GetTotalLinesOfCode(language); } return result; } @@ -270,9 +270,9 @@ namespace Flax.Stats public void CleanupDirectories() { - var chld = Children.ToList(); - chld.RemoveAll(e => ignoredFolders.Contains(e.ShortName.ToLower())); - Children = chld.ToArray(); + var child = Children.ToList(); + child.RemoveAll(e => ignoredFolders.Contains(e.ShortName.ToLower())); + Children = child.ToArray(); foreach (var a in Children) { diff --git a/Source/Tools/Flax.Stats/Tools.cs b/Source/Tools/Flax.Stats/Tools.cs index d947ae758..1e3ba1f74 100644 --- a/Source/Tools/Flax.Stats/Tools.cs +++ b/Source/Tools/Flax.Stats/Tools.cs @@ -103,7 +103,7 @@ namespace Flax.Stats } /// - /// Write string in UTF-8 encoding to the stream and ofset data + /// Write string in UTF-8 encoding to the stream and offset data /// /// File stream /// Data to write @@ -292,7 +292,7 @@ namespace Flax.Stats } /// - /// Write arry of Guids to the stream + /// Write array of Guids to the stream /// /// File stream /// Value to write From 6da5c704b12592d9bfbd5fe699b1d1e49f3cf43d Mon Sep 17 00:00:00 2001 From: VNC <52937757+VNNCC@users.noreply.github.com> Date: Wed, 6 Jan 2021 01:03:19 +0100 Subject: [PATCH 12/46] Change 'for' to 'to' --- Source/Editor/Surface/Archetypes/Animation.StateMachine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs index 63faacb6d..2faa9feef 100644 --- a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs +++ b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs @@ -1046,7 +1046,7 @@ namespace FlaxEditor.Surface.Archetypes startPos += nrm; endPos += nrm; - // Swap for the other arrow + // Swap to the other arrow if (!diff) { var tmp = startPos; From 6f727aa48355ad117bddafbff72e2c1a200bae82 Mon Sep 17 00:00:00 2001 From: "W2.Wizard" Date: Wed, 6 Jan 2021 22:20:16 +0100 Subject: [PATCH 13/46] Corrected additional typos --- Source/Editor/Gizmo/GizmosCollection.cs | 2 +- Source/Editor/Gizmo/TransformGizmoBase.Draw.cs | 2 +- Source/Editor/Gizmo/TransformGizmoBase.Settings.cs | 2 +- Source/Editor/Gizmo/TransformGizmoBase.cs | 4 ++-- Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Editor/Gizmo/GizmosCollection.cs b/Source/Editor/Gizmo/GizmosCollection.cs index a246aeeb0..5530a41a3 100644 --- a/Source/Editor/Gizmo/GizmosCollection.cs +++ b/Source/Editor/Gizmo/GizmosCollection.cs @@ -7,7 +7,7 @@ using FlaxEngine; namespace FlaxEditor.Gizmo { /// - /// Represents collection of Gizmo tools where one is active and in use. + /// Represents collection of gizmo tools where one is active and in use. /// /// [HideInEditor] diff --git a/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs b/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs index 8f871c635..0a11ecd77 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.Draw.cs @@ -45,7 +45,7 @@ namespace FlaxEditor.Gizmo ) { // Error - Platform.Fatal("Failed to load Transform Gizmo resources."); + Platform.Fatal("Failed to load transform gizmo resources."); } } diff --git a/Source/Editor/Gizmo/TransformGizmoBase.Settings.cs b/Source/Editor/Gizmo/TransformGizmoBase.Settings.cs index 786e001e6..2955fe6d7 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.Settings.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.Settings.cs @@ -104,7 +104,7 @@ namespace FlaxEditor.Gizmo public Axis ActiveAxis => _activeAxis; /// - /// Gets or sts the current gizmo mode. + /// Gets or sets the current gizmo mode. /// public Mode ActiveMode { diff --git a/Source/Editor/Gizmo/TransformGizmoBase.cs b/Source/Editor/Gizmo/TransformGizmoBase.cs index 87dcb6fa8..93dbeddaa 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.cs @@ -151,7 +151,7 @@ namespace FlaxEditor.Gizmo // Set positions of the gizmo UpdateGizmoPosition(); - // Scale Gizmo to fit on-screen + // Scale gizmo to fit on-screen Vector3 vLength = Owner.ViewPosition - Position; float gizmoSize = Editor.Instance.Options.Options.Visual.GizmoSize; _screenScale = vLength.Length / GizmoScaleFactor * gizmoSize; @@ -318,7 +318,7 @@ namespace FlaxEditor.Gizmo } else if (_activeMode == Mode.Scale) { - // Apply Scale + // Apply scale _scaleDelta = delta; } } diff --git a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h index cc1b5b6b2..42aca7dbb 100644 --- a/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h +++ b/Source/Engine/Particles/Graph/CPU/ParticleEmitterGraph.CPU.h @@ -100,7 +100,7 @@ public: public: /// - /// Determinate whenever this emitter uses lights rendering. + /// Determines whenever this emitter uses lights rendering. /// /// True if emitter uses lights rendering, otherwise false. FORCE_INLINE bool UsesLightRendering() const From 6deb64e587751d0e9fc5ce056fb98aadc98070fd Mon Sep 17 00:00:00 2001 From: VNC <52937757+VNNCC@users.noreply.github.com> Date: Thu, 7 Jan 2021 00:02:04 +0100 Subject: [PATCH 14/46] Fix to disable terrain and foliage buttons if no scene is present This will fix the issues described in #99. --- Source/Editor/Tools/Foliage/FoliageTab.cs | 23 +++++++++++++++++-- Source/Editor/Tools/Terrain/CarveTab.cs | 28 ++++++++++++++++++++--- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Source/Editor/Tools/Foliage/FoliageTab.cs b/Source/Editor/Tools/Foliage/FoliageTab.cs index 9dbb17e88..bbad9018b 100644 --- a/Source/Editor/Tools/Foliage/FoliageTab.cs +++ b/Source/Editor/Tools/Foliage/FoliageTab.cs @@ -21,6 +21,7 @@ namespace FlaxEditor.Tools.Foliage private readonly Tabs _modes; private readonly ContainerControl _noFoliagePanel; private int _selectedFoliageTypeIndex = -1; + private Button _createNewFoliage; /// /// The editor instance. @@ -99,6 +100,7 @@ namespace FlaxEditor.Tools.Foliage public FoliageTab(SpriteHandle icon, Editor editor) : base(string.Empty, icon) { + Level.SceneLoaded += this.OnSceneLoaded; Editor = editor; Editor.SceneEditing.SelectionChanged += OnSelectionChanged; @@ -135,14 +137,31 @@ namespace FlaxEditor.Tools.Foliage Offsets = Margin.Zero, Parent = _noFoliagePanel }; - var noFoliageButton = new Button + _createNewFoliage = new Button { Text = "Create new foliage", AnchorPreset = AnchorPresets.MiddleCenter, Offsets = new Margin(-60, 120, -12, 24), Parent = _noFoliagePanel, + Enabled = false }; - noFoliageButton.Clicked += OnCreateNewFoliageClicked; + _createNewFoliage.Clicked += OnCreateNewFoliageClicked; + } + + private void OnSceneLoaded(Scene arg1, Guid arg2) + { + _createNewFoliage.Enabled = true; + + Level.SceneUnloaded += this.OnSceneUnloaded; + Level.SceneLoaded -= OnSceneLoaded; + } + + private void OnSceneUnloaded(Scene arg1, Guid arg2) + { + _createNewFoliage.Enabled = false; + + Level.SceneLoaded += OnSceneLoaded; + Level.SceneUnloaded -= this.OnSceneUnloaded; } private void OnSelected(Tab tab) diff --git a/Source/Editor/Tools/Terrain/CarveTab.cs b/Source/Editor/Tools/Terrain/CarveTab.cs index a3a65c52a..c8029c82a 100644 --- a/Source/Editor/Tools/Terrain/CarveTab.cs +++ b/Source/Editor/Tools/Terrain/CarveTab.cs @@ -18,6 +18,7 @@ namespace FlaxEditor.Tools.Terrain { private readonly Tabs _modes; private readonly ContainerControl _noTerrainPanel; + private readonly Button _createTerrainButton; /// /// The editor instance. @@ -57,6 +58,7 @@ namespace FlaxEditor.Tools.Terrain public CarveTab(SpriteHandle icon, Editor editor) : base(string.Empty, icon) { + Level.SceneLoaded += this.OnSceneLoaded; Editor = editor; Editor.SceneEditing.SelectionChanged += OnSelectionChanged; @@ -93,14 +95,31 @@ namespace FlaxEditor.Tools.Terrain Offsets = Margin.Zero, Parent = _noTerrainPanel }; - var noTerrainButton = new Button + _createTerrainButton = new Button { Text = "Create new terrain", AnchorPreset = AnchorPresets.MiddleCenter, Offsets = new Margin(-60, 120, -12, 24), - Parent = _noTerrainPanel + Parent = _noTerrainPanel, + Enabled = false }; - noTerrainButton.Clicked += OnCreateNewTerrainClicked; + _createTerrainButton.Clicked += OnCreateNewTerrainClicked; + } + + private void OnSceneLoaded(Scene arg1, Guid arg2) + { + _createTerrainButton.Enabled = true; + + Level.SceneUnloaded += this.OnSceneUnloaded; + Level.SceneLoaded -= OnSceneLoaded; + } + + private void OnSceneUnloaded(Scene arg1, Guid arg2) + { + _createTerrainButton.Enabled = false; + + Level.SceneLoaded += OnSceneLoaded; + Level.SceneUnloaded -= this.OnSceneUnloaded; } private void OnSelected(Tab tab) @@ -117,6 +136,9 @@ namespace FlaxEditor.Tools.Terrain private void OnCreateNewTerrainClicked() { + if (!Level.IsAnySceneLoaded) + return; + Editor.UI.CreateTerrain(); } From 2252cd73f98b2b1dac6ea895aad640a970ec63d8 Mon Sep 17 00:00:00 2001 From: VNC <52937757+VNNCC@users.noreply.github.com> Date: Thu, 7 Jan 2021 00:06:43 +0100 Subject: [PATCH 15/46] Removed unnecessary check --- Source/Editor/Tools/Terrain/CarveTab.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/Editor/Tools/Terrain/CarveTab.cs b/Source/Editor/Tools/Terrain/CarveTab.cs index c8029c82a..37ce82c1f 100644 --- a/Source/Editor/Tools/Terrain/CarveTab.cs +++ b/Source/Editor/Tools/Terrain/CarveTab.cs @@ -136,9 +136,6 @@ namespace FlaxEditor.Tools.Terrain private void OnCreateNewTerrainClicked() { - if (!Level.IsAnySceneLoaded) - return; - Editor.UI.CreateTerrain(); } From 0d0340e11adaa39aea34083e7ff535474d905f96 Mon Sep 17 00:00:00 2001 From: "W2.Wizard" Date: Fri, 8 Jan 2021 12:06:17 +0100 Subject: [PATCH 16/46] Added golden ratio value --- Source/Engine/Core/Math/Mathf.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Engine/Core/Math/Mathf.cs b/Source/Engine/Core/Math/Mathf.cs index 7286573bf..8240b02cc 100644 --- a/Source/Engine/Core/Math/Mathf.cs +++ b/Source/Engine/Core/Math/Mathf.cs @@ -36,6 +36,11 @@ namespace FlaxEngine /// public const float PiOverFour = (float)(Math.PI / 4); + /// + /// A value specifying the golden mean + /// + public const float GoldenRatio = 1.61803f; + /// /// Returns the absolute value of f. /// From 2d2d45f56848ed34c75cb2d2eae76241cb4e5b41 Mon Sep 17 00:00:00 2001 From: "W2.Wizard" Date: Fri, 8 Jan 2021 23:14:09 +0100 Subject: [PATCH 17/46] Increased precision by 5 digits --- Source/Engine/Core/Math/Mathf.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Core/Math/Mathf.cs b/Source/Engine/Core/Math/Mathf.cs index 8240b02cc..529bd6ab0 100644 --- a/Source/Engine/Core/Math/Mathf.cs +++ b/Source/Engine/Core/Math/Mathf.cs @@ -39,7 +39,7 @@ namespace FlaxEngine /// /// A value specifying the golden mean /// - public const float GoldenRatio = 1.61803f; + public const float GoldenRatio = 1.6180339887f; /// /// Returns the absolute value of f. From cd5db384a47ee29602baa1d29c08cbf03115134c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sat, 9 Jan 2021 19:40:06 +0100 Subject: [PATCH 18/46] Adding Camera Orientation to editor view menu. --- Source/Editor/Viewport/EditorViewport.cs | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs index 02696f743..99cb8cb92 100644 --- a/Source/Editor/Viewport/EditorViewport.cs +++ b/Source/Editor/Viewport/EditorViewport.cs @@ -510,6 +510,17 @@ namespace FlaxEditor.Viewport debugView.VisibleChanged += WidgetViewModeShowHide; } + // Camera Orientation + { + var cameraView = ViewWidgetButtonMenu.AddChildMenu("Camera Orientation").ContextMenu; + for (int i = 0; i < EditorViewportCameraOrientationValues.Length; i++) + { + var co = EditorViewportCameraOrientationValues[i]; + var button = cameraView.AddButton(co.Name); + button.Tag = co.Orientation; + } + cameraView.ButtonClicked += button => ViewOrientation = Quaternion.Euler((Vector3)button.Tag); + } ViewWidgetButtonMenu.AddSeparator(); // Orthographic @@ -1193,6 +1204,28 @@ namespace FlaxEditor.Viewport base.OnDestroy(); } + private struct CameraOrientation + { + public readonly string Name; + public readonly Vector3 Orientation; + + public CameraOrientation(string name, Vector3 orientation) + { + Name = name; + Orientation = orientation; + } + } + + private readonly CameraOrientation[] EditorViewportCameraOrientationValues = + { + new CameraOrientation("Front", new Vector3(0,0,0)), + new CameraOrientation("Back", new Vector3(0,180,0)), + new CameraOrientation("Left", new Vector3(0,90,0)), + new CameraOrientation("Right", new Vector3(0,-90,0)), + new CameraOrientation("Top", new Vector3(-90,0,0)), + new CameraOrientation("Bottom", new Vector3(90,0,0)) + }; + private readonly float[] EditorViewportCameraSpeedValues = { 0.1f, From 01e904e7021982958314b72f915c8c365bda863a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sun, 10 Jan 2021 00:17:47 +0100 Subject: [PATCH 19/46] Fixing Windows position (on startup) being always on the top left corner. --- Source/Editor/Modules/WindowsModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Modules/WindowsModule.cs b/Source/Editor/Modules/WindowsModule.cs index 9b80b664c..0a19e7380 100644 --- a/Source/Editor/Modules/WindowsModule.cs +++ b/Source/Editor/Modules/WindowsModule.cs @@ -276,8 +276,8 @@ namespace FlaxEditor.Modules // Get metadata int version = int.Parse(root.Attributes["Version"].Value, CultureInfo.InvariantCulture); var virtualDesktopBounds = Platform.VirtualDesktopBounds; - var virtualDesktopSafeLeftCorner = virtualDesktopBounds.Location + new Vector2(0, 23); // 23 is a window strip size - var virtualDesktopSafeRightCorner = virtualDesktopBounds.BottomRight - new Vector2(50, 50); // apply some safe area + var virtualDesktopSafeLeftCorner = virtualDesktopBounds.Location; + var virtualDesktopSafeRightCorner = virtualDesktopBounds.BottomRight; switch (version) { From f0f18631240e6b2a12dc9fa1f843534f3fb9c711 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 11 Jan 2021 14:58:46 +0100 Subject: [PATCH 20/46] Fix code style and move Camera Orientation widget below --- Source/Editor/Viewport/EditorViewport.cs | 39 ++++++++++++------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs index 99cb8cb92..0b810e891 100644 --- a/Source/Editor/Viewport/EditorViewport.cs +++ b/Source/Editor/Viewport/EditorViewport.cs @@ -510,17 +510,6 @@ namespace FlaxEditor.Viewport debugView.VisibleChanged += WidgetViewModeShowHide; } - // Camera Orientation - { - var cameraView = ViewWidgetButtonMenu.AddChildMenu("Camera Orientation").ContextMenu; - for (int i = 0; i < EditorViewportCameraOrientationValues.Length; i++) - { - var co = EditorViewportCameraOrientationValues[i]; - var button = cameraView.AddButton(co.Name); - button.Tag = co.Orientation; - } - cameraView.ButtonClicked += button => ViewOrientation = Quaternion.Euler((Vector3)button.Tag); - } ViewWidgetButtonMenu.AddSeparator(); // Orthographic @@ -539,6 +528,18 @@ namespace FlaxEditor.Viewport ViewWidgetButtonMenu.VisibleChanged += control => orthoValue.Checked = _isOrtho; } + // Cara Orientation + { + var cameraView = ViewWidgetButtonMenu.AddChildMenu("Orientation").ContextMenu; + for (int i = 0; i < EditorViewportCameraOrientationValues.Length; i++) + { + var co = EditorViewportCameraOrientationValues[i]; + var button = cameraView.AddButton(co.Name); + button.Tag = co.Orientation; + } + cameraView.ButtonClicked += button => ViewOrientation = Quaternion.Euler((Vector3)button.Tag); + } + // Field of View { var fov = ViewWidgetButtonMenu.AddButton("Field Of View"); @@ -1215,17 +1216,17 @@ namespace FlaxEditor.Viewport Orientation = orientation; } } - + private readonly CameraOrientation[] EditorViewportCameraOrientationValues = { - new CameraOrientation("Front", new Vector3(0,0,0)), - new CameraOrientation("Back", new Vector3(0,180,0)), - new CameraOrientation("Left", new Vector3(0,90,0)), - new CameraOrientation("Right", new Vector3(0,-90,0)), - new CameraOrientation("Top", new Vector3(-90,0,0)), - new CameraOrientation("Bottom", new Vector3(90,0,0)) + new CameraOrientation("Front", new Vector3(0, 0, 0)), + new CameraOrientation("Back", new Vector3(0, 180, 0)), + new CameraOrientation("Left", new Vector3(0, 90, 0)), + new CameraOrientation("Right", new Vector3(0, -90, 0)), + new CameraOrientation("Top", new Vector3(-90, 0, 0)), + new CameraOrientation("Bottom", new Vector3(90, 0, 0)) }; - + private readonly float[] EditorViewportCameraSpeedValues = { 0.1f, From 1ca31224e2dfb28038671e8e8bbe95e9737f976a Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 11 Jan 2021 15:03:23 +0100 Subject: [PATCH 21/46] Fix code style --- Source/Editor/Modules/WindowsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Modules/WindowsModule.cs b/Source/Editor/Modules/WindowsModule.cs index 0a19e7380..a8058b9d8 100644 --- a/Source/Editor/Modules/WindowsModule.cs +++ b/Source/Editor/Modules/WindowsModule.cs @@ -971,7 +971,7 @@ namespace FlaxEditor.Modules } #region Window Events - + private void OnEditorStateChanged() { for (int i = 0; i < Windows.Count; i++) From a664e277724e942046d58dbb8f86d844fc97b41c Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 11 Jan 2021 15:13:47 +0100 Subject: [PATCH 22/46] Add missing event unregister for foliage/terrain tabs --- Source/Editor/Tools/Foliage/FoliageTab.cs | 17 ++++++++++++++--- Source/Editor/Tools/Terrain/CarveTab.cs | 19 +++++++++++++++---- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Source/Editor/Tools/Foliage/FoliageTab.cs b/Source/Editor/Tools/Foliage/FoliageTab.cs index bbad9018b..fe4120035 100644 --- a/Source/Editor/Tools/Foliage/FoliageTab.cs +++ b/Source/Editor/Tools/Foliage/FoliageTab.cs @@ -100,7 +100,7 @@ namespace FlaxEditor.Tools.Foliage public FoliageTab(SpriteHandle icon, Editor editor) : base(string.Empty, icon) { - Level.SceneLoaded += this.OnSceneLoaded; + Level.SceneLoaded += OnSceneLoaded; Editor = editor; Editor.SceneEditing.SelectionChanged += OnSelectionChanged; @@ -152,7 +152,7 @@ namespace FlaxEditor.Tools.Foliage { _createNewFoliage.Enabled = true; - Level.SceneUnloaded += this.OnSceneUnloaded; + Level.SceneUnloaded += OnSceneUnloaded; Level.SceneLoaded -= OnSceneLoaded; } @@ -161,7 +161,7 @@ namespace FlaxEditor.Tools.Foliage _createNewFoliage.Enabled = false; Level.SceneLoaded += OnSceneLoaded; - Level.SceneUnloaded -= this.OnSceneUnloaded; + Level.SceneUnloaded -= OnSceneUnloaded; } private void OnSelected(Tab tab) @@ -267,5 +267,16 @@ namespace FlaxEditor.Tools.Foliage { SelectedFoliageTypesChanged?.Invoke(); } + + /// + public override void OnDestroy() + { + if (_createNewFoliage.Enabled) + Level.SceneUnloaded -= OnSceneUnloaded; + else + Level.SceneLoaded -= OnSceneLoaded; + + base.OnDestroy(); + } } } diff --git a/Source/Editor/Tools/Terrain/CarveTab.cs b/Source/Editor/Tools/Terrain/CarveTab.cs index 37ce82c1f..e7b880414 100644 --- a/Source/Editor/Tools/Terrain/CarveTab.cs +++ b/Source/Editor/Tools/Terrain/CarveTab.cs @@ -58,7 +58,7 @@ namespace FlaxEditor.Tools.Terrain public CarveTab(SpriteHandle icon, Editor editor) : base(string.Empty, icon) { - Level.SceneLoaded += this.OnSceneLoaded; + Level.SceneLoaded += OnSceneLoaded; Editor = editor; Editor.SceneEditing.SelectionChanged += OnSelectionChanged; @@ -105,12 +105,12 @@ namespace FlaxEditor.Tools.Terrain }; _createTerrainButton.Clicked += OnCreateNewTerrainClicked; } - + private void OnSceneLoaded(Scene arg1, Guid arg2) { _createTerrainButton.Enabled = true; - Level.SceneUnloaded += this.OnSceneUnloaded; + Level.SceneUnloaded += OnSceneUnloaded; Level.SceneLoaded -= OnSceneLoaded; } @@ -119,7 +119,7 @@ namespace FlaxEditor.Tools.Terrain _createTerrainButton.Enabled = false; Level.SceneLoaded += OnSceneLoaded; - Level.SceneUnloaded -= this.OnSceneUnloaded; + Level.SceneUnloaded -= OnSceneUnloaded; } private void OnSelected(Tab tab) @@ -202,5 +202,16 @@ namespace FlaxEditor.Tools.Terrain default: throw new IndexOutOfRangeException("Invalid carve tab mode."); } } + + /// + public override void OnDestroy() + { + if (_createTerrainButton.Enabled) + Level.SceneUnloaded -= OnSceneUnloaded; + else + Level.SceneLoaded -= OnSceneLoaded; + + base.OnDestroy(); + } } } From b446790438120368328609105c3c586b4a1977c3 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 11 Jan 2021 15:38:22 +0100 Subject: [PATCH 23/46] Update shaders --- Content/Shaders/BakeLightmap.flax | 2 +- Content/Shaders/BitonicSort.flax | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Content/Shaders/BakeLightmap.flax b/Content/Shaders/BakeLightmap.flax index 6e813205f..fac992469 100644 --- a/Content/Shaders/BakeLightmap.flax +++ b/Content/Shaders/BakeLightmap.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17295767d488dc2b64a1794ceda8b4d68f20dd2c5f1a8fdbe6f7940a070f9724 +oid sha256:cc4b141137661d995ff571191150c5997fa6f6576572b5c2281c395a12772d7c size 16095 diff --git a/Content/Shaders/BitonicSort.flax b/Content/Shaders/BitonicSort.flax index c8a9e901c..d5964fca9 100644 --- a/Content/Shaders/BitonicSort.flax +++ b/Content/Shaders/BitonicSort.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8371a1f4e0631e69f6dc6dbb8e11c8618351a7083293078270d60599f739e9f -size 6725 +oid sha256:df704c63770ee2b641f000726a3ec93c189685ffa149e484e961c9dba522baaf +size 6721 From 6252c111b42cb6564b207d25f22b296dbb574f8c Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 11 Jan 2021 16:38:12 +0100 Subject: [PATCH 24/46] Tweak BatteryInfo --- Source/Engine/Audio/AudioSource.h | 2 +- Source/Engine/Platform/BatteryInfo.h | 58 ++++++++++--------- .../Engine/Platform/Win32/Win32Platform.cpp | 10 +++- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Source/Engine/Audio/AudioSource.h b/Source/Engine/Audio/AudioSource.h index ac15b5a4b..2b5b7e9d8 100644 --- a/Source/Engine/Audio/AudioSource.h +++ b/Source/Engine/Audio/AudioSource.h @@ -199,7 +199,7 @@ public: /// Gets the current state of the audio playback (playing/paused/stopped). /// /// The value. - API_PROPERTY() FORCE_INLINE States GetState() const + API_PROPERTY() FORCE_INLINE AudioSource::States GetState() const { return _state; } diff --git a/Source/Engine/Platform/BatteryInfo.h b/Source/Engine/Platform/BatteryInfo.h index 146f3f562..2ed6b5cac 100644 --- a/Source/Engine/Platform/BatteryInfo.h +++ b/Source/Engine/Platform/BatteryInfo.h @@ -5,43 +5,45 @@ #include "Engine/Core/Types/BaseTypes.h" /// -/// Power supply status. -/// -API_ENUM() enum class ACLineStatus : byte -{ - /// - /// Power supply is not connected. - /// - Offline = 0, - /// - /// Power supply is connected. - /// - Online = 1, - /// - /// Unknown status. - /// - Unknown = 255 -}; - -/// -/// Contains information about power supply (Battery). +/// Contains information about power supply (battery). /// API_STRUCT() struct BatteryInfo { DECLARE_SCRIPTING_TYPE_MINIMAL(BatteryInfo); - /// - /// Power supply status. - /// - API_FIELD() ACLineStatus ACLineStatus; + /// + /// Power supply status. + /// + API_ENUM() enum class States + { + /// + /// Unknown status. + /// + Unknown, + + /// + /// Power supply is connected and battery is charging. + /// + BatteryCharging, + + /// + /// Device is running on a battery. + /// + BatteryDischarging, + + /// + /// Device is connected to the stable power supply (AC). + /// + Connected, + }; /// - /// Battery percentage left. + /// Power supply state. /// - API_FIELD() byte BatteryLifePercent; + API_FIELD() BatteryInfo::States State = BatteryInfo::States::Unknown; /// - /// Remaining battery life time in second. + /// Battery percentage left (normalized to 0-1 range). /// - API_FIELD() uint32 BatteryLifeTime; + API_FIELD() float BatteryLifePercent = 1.0f; }; diff --git a/Source/Engine/Platform/Win32/Win32Platform.cpp b/Source/Engine/Platform/Win32/Win32Platform.cpp index 5e2aa4598..129ff4249 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.cpp +++ b/Source/Engine/Platform/Win32/Win32Platform.cpp @@ -315,9 +315,13 @@ BatteryInfo Win32Platform::GetBatteryInfo() BatteryInfo info; SYSTEM_POWER_STATUS status; GetSystemPowerStatus(&status); - info.ACLineStatus = (ACLineStatus)status.ACLineStatus; - info.BatteryLifePercent = status.BatteryLifePercent; - info.BatteryLifeTime = status.BatteryLifeTime; + info.BatteryLifePercent = (float)status.BatteryLifePercent / 255.0f; + if (status.BatteryFlag & 8) + info.State = BatteryInfo::States::BatteryCharging; + else if (status.BatteryFlag & 1 || status.BatteryFlag & 2 || status.BatteryFlag & 4) + info.State = BatteryInfo::States::BatteryDischarging; + else if (status.ACLineStatus == 1 || status.BatteryFlag & 128) + info.State = BatteryInfo::States::Connected; return info; } From 5679d86683ecd6de16b0d97717d1e953ab49d41e Mon Sep 17 00:00:00 2001 From: stefnotch Date: Tue, 12 Jan 2021 12:04:30 +0100 Subject: [PATCH 25/46] Fix tracking mouse offset on high DPI screens --- Source/Engine/UI/GUI/WindowRootControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/UI/GUI/WindowRootControl.cs b/Source/Engine/UI/GUI/WindowRootControl.cs index 23330ffae..02c996b68 100644 --- a/Source/Engine/UI/GUI/WindowRootControl.cs +++ b/Source/Engine/UI/GUI/WindowRootControl.cs @@ -151,7 +151,7 @@ namespace FlaxEngine.GUI } /// - public override Vector2 TrackingMouseOffset => _window.TrackingMouseOffset; + public override Vector2 TrackingMouseOffset => _window.TrackingMouseOffset / _window._dpiScale; /// public override WindowRootControl RootWindow => this; From fd268f4e154b60d5e0d0be6759f344bf562eaa93 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 12 Jan 2021 19:00:54 +0100 Subject: [PATCH 26/46] Add missing FLAXENGINE_API expose macro to engine math types --- Source/Engine/Core/Math/AABB.h | 2 +- Source/Engine/Core/Math/BoundingFrustum.h | 2 +- Source/Engine/Core/Math/Half.h | 12 ++++-------- Source/Engine/Core/Math/Matrix3x3.h | 2 +- Source/Engine/Core/Math/OrientedBoundingBox.h | 2 +- Source/Engine/Core/Math/Packed.h | 8 ++++---- Source/Engine/Core/Math/Plane.h | 2 +- Source/Engine/Core/Math/Ray.h | 2 +- Source/Engine/Core/Math/Rectangle.h | 1 - Source/Engine/Core/Math/Transform.h | 3 +-- Source/Engine/Core/Math/Triangle.h | 2 +- Source/Engine/Core/Math/VectorInt.h | 6 +++--- Source/Engine/Core/Math/Viewport.h | 2 +- 13 files changed, 20 insertions(+), 26 deletions(-) diff --git a/Source/Engine/Core/Math/AABB.h b/Source/Engine/Core/Math/AABB.h index 39e8a5bf6..5853d6597 100644 --- a/Source/Engine/Core/Math/AABB.h +++ b/Source/Engine/Core/Math/AABB.h @@ -8,7 +8,7 @@ /// /// Integer axis aligned bounding box /// -struct AABB +struct FLAXENGINE_API AABB { public: diff --git a/Source/Engine/Core/Math/BoundingFrustum.h b/Source/Engine/Core/Math/BoundingFrustum.h index b8b16c412..9052521fc 100644 --- a/Source/Engine/Core/Math/BoundingFrustum.h +++ b/Source/Engine/Core/Math/BoundingFrustum.h @@ -10,7 +10,7 @@ /// /// Defines a frustum which can be used in frustum culling, zoom to Extents (zoom to fit) operations, (matrix, frustum, camera) interchange, and many kind of intersection testing. /// -API_STRUCT(InBuild) struct BoundingFrustum +API_STRUCT(InBuild) struct FLAXENGINE_API BoundingFrustum { private: diff --git a/Source/Engine/Core/Math/Half.h b/Source/Engine/Core/Math/Half.h index 19059ad0c..7b86fd7a7 100644 --- a/Source/Engine/Core/Math/Half.h +++ b/Source/Engine/Core/Math/Half.h @@ -11,7 +11,7 @@ typedef uint16 Half; #define USE_SSE_HALF_CONVERSION 0 -class Float16Compressor +class FLAXENGINE_API Float16Compressor { union Bits { @@ -108,7 +108,7 @@ inline Half ConvertFloatToHalf(const float value) /// /// Defines a two component vector, using half precision floating point coordinates. /// -struct Half2 +struct FLAXENGINE_API Half2 { public: @@ -167,7 +167,7 @@ public: /// /// Defines a three component vector, using half precision floating point coordinates. /// -struct Half3 +struct FLAXENGINE_API Half3 { public: @@ -216,7 +216,7 @@ public: /// /// Defines a four component vector, using half precision floating point coordinates. /// -struct Half4 +struct FLAXENGINE_API Half4 { public: @@ -270,16 +270,12 @@ public: } explicit Half4(const Vector4& v); - explicit Half4(const Color& c); - explicit Half4(const Rectangle& rect); public: Vector2 ToVector2() const; - Vector3 ToVector3() const; - Vector4 ToVector4() const; }; diff --git a/Source/Engine/Core/Math/Matrix3x3.h b/Source/Engine/Core/Math/Matrix3x3.h index 3cf690259..b28be5437 100644 --- a/Source/Engine/Core/Math/Matrix3x3.h +++ b/Source/Engine/Core/Math/Matrix3x3.h @@ -9,7 +9,7 @@ /// /// Represents a 3x3 mathematical matrix. /// -API_STRUCT(InBuild) struct Matrix3x3 +API_STRUCT(InBuild) struct FLAXENGINE_API Matrix3x3 { public: diff --git a/Source/Engine/Core/Math/OrientedBoundingBox.h b/Source/Engine/Core/Math/OrientedBoundingBox.h index 03256633d..d19108f84 100644 --- a/Source/Engine/Core/Math/OrientedBoundingBox.h +++ b/Source/Engine/Core/Math/OrientedBoundingBox.h @@ -8,7 +8,7 @@ #include "CollisionsHelper.h" // Oriented Bounding Box (OBB) is a rectangular block, much like an AABB (Bounding Box) but with an arbitrary orientation in 3D space. -API_STRUCT(InBuild) struct OrientedBoundingBox +API_STRUCT(InBuild) struct FLAXENGINE_API OrientedBoundingBox { public: diff --git a/Source/Engine/Core/Math/Packed.h b/Source/Engine/Core/Math/Packed.h index ec666bf61..4f41dac9c 100644 --- a/Source/Engine/Core/Math/Packed.h +++ b/Source/Engine/Core/Math/Packed.h @@ -13,7 +13,7 @@ typedef Half Float16; /// /// Packed vector, layout: R:10 bytes, G:10 bytes, B:10 bytes, A:2 bytes, all values are stored as floats in range [0;1]. /// -struct Float1010102 +struct FLAXENGINE_API Float1010102 { union { @@ -64,7 +64,7 @@ public: }; // The 3D vector is packed into 32 bits with 11/11/10 bits per floating-point component. -struct FloatR11G11B10 +struct FLAXENGINE_API FloatR11G11B10 { union { @@ -118,7 +118,7 @@ public: Vector3 ToVector3() const; }; -struct RG16UNorm +struct FLAXENGINE_API RG16UNorm { uint16 X, Y; @@ -131,7 +131,7 @@ struct RG16UNorm Vector2 ToVector2() const; }; -struct RGBA16UNorm +struct FLAXENGINE_API RGBA16UNorm { uint16 X, Y, Z, W; diff --git a/Source/Engine/Core/Math/Plane.h b/Source/Engine/Core/Math/Plane.h index 2ca34258f..2fbe7438c 100644 --- a/Source/Engine/Core/Math/Plane.h +++ b/Source/Engine/Core/Math/Plane.h @@ -8,7 +8,7 @@ /// /// Represents a plane in three dimensional space. /// -API_STRUCT() struct Plane +API_STRUCT() struct FLAXENGINE_API Plane { DECLARE_SCRIPTING_TYPE_MINIMAL(Plane); public: diff --git a/Source/Engine/Core/Math/Ray.h b/Source/Engine/Core/Math/Ray.h index 56d06a21e..f125cba97 100644 --- a/Source/Engine/Core/Math/Ray.h +++ b/Source/Engine/Core/Math/Ray.h @@ -11,7 +11,7 @@ struct Viewport; /// /// Represents a three dimensional line based on a point in space and a direction. /// -API_STRUCT() struct Ray +API_STRUCT() struct FLAXENGINE_API Ray { DECLARE_SCRIPTING_TYPE_MINIMAL(Ray); public: diff --git a/Source/Engine/Core/Math/Rectangle.h b/Source/Engine/Core/Math/Rectangle.h index 305ae70e1..f2dcbd20a 100644 --- a/Source/Engine/Core/Math/Rectangle.h +++ b/Source/Engine/Core/Math/Rectangle.h @@ -10,7 +10,6 @@ API_STRUCT() struct FLAXENGINE_API Rectangle { DECLARE_SCRIPTING_TYPE_MINIMAL(Rectangle); -public: /// /// The empty rectangle. diff --git a/Source/Engine/Core/Math/Transform.h b/Source/Engine/Core/Math/Transform.h index 3b8cf71b7..ed19efeae 100644 --- a/Source/Engine/Core/Math/Transform.h +++ b/Source/Engine/Core/Math/Transform.h @@ -11,10 +11,9 @@ struct Matrix; /// /// Describes transformation in a 3D space. /// -API_STRUCT() struct Transform +API_STRUCT() struct FLAXENGINE_API Transform { DECLARE_SCRIPTING_TYPE_MINIMAL(Transform); -public: /// /// The translation vector of the transform. diff --git a/Source/Engine/Core/Math/Triangle.h b/Source/Engine/Core/Math/Triangle.h index 03f91ece3..b0f7ea09d 100644 --- a/Source/Engine/Core/Math/Triangle.h +++ b/Source/Engine/Core/Math/Triangle.h @@ -8,7 +8,7 @@ /// /// Represents a three dimensional triangle. /// -struct Triangle +struct FLAXENGINE_API Triangle { public: diff --git a/Source/Engine/Core/Math/VectorInt.h b/Source/Engine/Core/Math/VectorInt.h index 80804c39a..9b5eeb866 100644 --- a/Source/Engine/Core/Math/VectorInt.h +++ b/Source/Engine/Core/Math/VectorInt.h @@ -13,7 +13,7 @@ struct Vector4; /// /// Two-components vector (32 bit integer type). /// -API_STRUCT(InBuild) struct Int2 +API_STRUCT(InBuild) struct FLAXENGINE_API Int2 { public: @@ -273,7 +273,7 @@ public: /// /// Three-components vector (32 bit integer type). /// -API_STRUCT(InBuild) struct Int3 +API_STRUCT(InBuild) struct FLAXENGINE_API Int3 { public: @@ -382,7 +382,7 @@ public: /// /// Four-components vector (32 bit integer type). /// -API_STRUCT(InBuild) struct Int4 +API_STRUCT(InBuild) struct FLAXENGINE_API Int4 { public: diff --git a/Source/Engine/Core/Math/Viewport.h b/Source/Engine/Core/Math/Viewport.h index 0b5871f2e..e30d085d3 100644 --- a/Source/Engine/Core/Math/Viewport.h +++ b/Source/Engine/Core/Math/Viewport.h @@ -10,7 +10,7 @@ struct Matrix; struct Rectangle; // Describes the viewport dimensions. -API_STRUCT(InBuild) struct Viewport +API_STRUCT(InBuild) struct FLAXENGINE_API Viewport { public: From 89f25516fc318b225dad491ed83b7507a9a66f38 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 12 Jan 2021 19:05:17 +0100 Subject: [PATCH 27/46] Add inline for float16 compression and add code reference note --- Source/Engine/Content/Utilities/IESLoader.cpp | 2 +- .../Engine/ContentExporters/ExportModel.cpp | 4 +- Source/Engine/Core/Math/Half.cpp | 62 +++++++++---------- Source/Engine/Core/Math/Half.h | 57 +++++++---------- .../Engine/Tools/TextureTool/TextureTool.cpp | 4 +- 5 files changed, 60 insertions(+), 69 deletions(-) diff --git a/Source/Engine/Content/Utilities/IESLoader.cpp b/Source/Engine/Content/Utilities/IESLoader.cpp index 0ef7c320a..271ab3d5e 100644 --- a/Source/Engine/Content/Utilities/IESLoader.cpp +++ b/Source/Engine/Content/Utilities/IESLoader.cpp @@ -240,7 +240,7 @@ float IESLoader::ExtractInR16(Array& output) float result = 0.0f; for (uint32 i = 0; i < hAnglesCount; i++) result += InterpolateBilinear(static_cast(i), v); - *out++ = ConvertFloatToHalf(invMaxValue * result / (float)hAnglesCount); + *out++ = Float16Compressor::Compress(invMaxValue * result / (float)hAnglesCount); } } diff --git a/Source/Engine/ContentExporters/ExportModel.cpp b/Source/Engine/ContentExporters/ExportModel.cpp index efc13419b..7fdd011f9 100644 --- a/Source/Engine/ContentExporters/ExportModel.cpp +++ b/Source/Engine/ContentExporters/ExportModel.cpp @@ -76,7 +76,7 @@ ExportAssetResult AssetExporters::ExportModel(ExportAssetContext& context) for (uint32 i = 0; i < vertices; i++) { auto v = vb1[i].TexCoord; - output->WriteTextFormatted("vt {0} {1}\n", ConvertHalfToFloat(v.X), ConvertHalfToFloat(v.Y)); + output->WriteTextFormatted("vt {0} {1}\n", Float16Compressor::Decompress(v.X), Float16Compressor::Decompress(v.Y)); } output->WriteChar('\n'); @@ -181,7 +181,7 @@ ExportAssetResult AssetExporters::ExportSkinnedModel(ExportAssetContext& context for (uint32 i = 0; i < vertices; i++) { auto v = vb0[i].TexCoord; - output->WriteTextFormatted("vt {0} {1}\n", ConvertHalfToFloat(v.X), ConvertHalfToFloat(v.Y)); + output->WriteTextFormatted("vt {0} {1}\n", Float16Compressor::Decompress(v.X), Float16Compressor::Decompress(v.Y)); } output->WriteChar('\n'); diff --git a/Source/Engine/Core/Math/Half.cpp b/Source/Engine/Core/Math/Half.cpp index 47bf66802..0de29c030 100644 --- a/Source/Engine/Core/Math/Half.cpp +++ b/Source/Engine/Core/Math/Half.cpp @@ -18,81 +18,81 @@ Half4 Half4::Zero(0, 0, 0, 0); Half2::Half2(const Vector2& v) { - X = ConvertFloatToHalf(v.X); - Y = ConvertFloatToHalf(v.Y); + X = Float16Compressor::Compress(v.X); + Y = Float16Compressor::Compress(v.Y); } Vector2 Half2::ToVector2() const { return Vector2( - ConvertHalfToFloat(X), - ConvertHalfToFloat(Y) + Float16Compressor::Decompress(X), + Float16Compressor::Decompress(Y) ); } Half3::Half3(const Vector3& v) { - X = ConvertFloatToHalf(v.X); - Y = ConvertFloatToHalf(v.Y); - Z = ConvertFloatToHalf(v.Z); + X = Float16Compressor::Compress(v.X); + Y = Float16Compressor::Compress(v.Y); + Z = Float16Compressor::Compress(v.Z); } Vector3 Half3::ToVector3() const { return Vector3( - ConvertHalfToFloat(X), - ConvertHalfToFloat(Y), - ConvertHalfToFloat(Z) + Float16Compressor::Decompress(X), + Float16Compressor::Decompress(Y), + Float16Compressor::Decompress(Z) ); } Half4::Half4(const Vector4& v) { - X = ConvertFloatToHalf(v.X); - Y = ConvertFloatToHalf(v.Y); - Z = ConvertFloatToHalf(v.Z); - W = ConvertFloatToHalf(v.W); + X = Float16Compressor::Compress(v.X); + Y = Float16Compressor::Compress(v.Y); + Z = Float16Compressor::Compress(v.Z); + W = Float16Compressor::Compress(v.W); } Half4::Half4(const Color& c) { - X = ConvertFloatToHalf(c.R); - Y = ConvertFloatToHalf(c.G); - Z = ConvertFloatToHalf(c.B); - W = ConvertFloatToHalf(c.A); + X = Float16Compressor::Compress(c.R); + Y = Float16Compressor::Compress(c.G); + Z = Float16Compressor::Compress(c.B); + W = Float16Compressor::Compress(c.A); } Half4::Half4(const Rectangle& rect) { - X = ConvertFloatToHalf(rect.Location.X); - Y = ConvertFloatToHalf(rect.Location.Y); - Z = ConvertFloatToHalf(rect.Size.X); - W = ConvertFloatToHalf(rect.Size.Y); + X = Float16Compressor::Compress(rect.Location.X); + Y = Float16Compressor::Compress(rect.Location.Y); + Z = Float16Compressor::Compress(rect.Size.X); + W = Float16Compressor::Compress(rect.Size.Y); } Vector2 Half4::ToVector2() const { return Vector2( - ConvertHalfToFloat(X), - ConvertHalfToFloat(Y) + Float16Compressor::Decompress(X), + Float16Compressor::Decompress(Y) ); } Vector3 Half4::ToVector3() const { return Vector3( - ConvertHalfToFloat(X), - ConvertHalfToFloat(Y), - ConvertHalfToFloat(Z) + Float16Compressor::Decompress(X), + Float16Compressor::Decompress(Y), + Float16Compressor::Decompress(Z) ); } Vector4 Half4::ToVector4() const { return Vector4( - ConvertHalfToFloat(X), - ConvertHalfToFloat(Y), - ConvertHalfToFloat(Z), - ConvertHalfToFloat(W) + Float16Compressor::Decompress(X), + Float16Compressor::Decompress(Y), + Float16Compressor::Decompress(Z), + Float16Compressor::Decompress(W) ); } diff --git a/Source/Engine/Core/Math/Half.h b/Source/Engine/Core/Math/Half.h index 7b86fd7a7..e0773b1d4 100644 --- a/Source/Engine/Core/Math/Half.h +++ b/Source/Engine/Core/Math/Half.h @@ -11,8 +11,14 @@ typedef uint16 Half; #define USE_SSE_HALF_CONVERSION 0 +/// +/// Utility for packing/unpacking floating point value from single precision (32 bit) to half precision (16 bit). +/// class FLAXENGINE_API Float16Compressor { + // Reference: + // http://www.cs.cmu.edu/~jinlianw/third_party/float16_compressor.hpp + union Bits { float f; @@ -22,24 +28,19 @@ class FLAXENGINE_API Float16Compressor static const int shift = 13; static const int shiftSign = 16; - static const int32 infN = 0x7F800000; // flt32 infinity static const int32 maxN = 0x477FE000; // max flt16 normal as a flt32 static const int32 minN = 0x38800000; // min flt16 normal as a flt32 static const int32 signN = 0x80000000; // flt32 sign bit - static const int32 infC = infN >> shift; static const int32 nanN = (infC + 1) << shift; // minimum flt16 nan as a flt32 static const int32 maxC = maxN >> shift; static const int32 minC = minN >> shift; static const int32 signC = signN >> shiftSign; // flt16 sign bit - static const int32 mulN = 0x52000000; // (1 << 23) / minN static const int32 mulC = 0x33800000; // minN / (1 << (23 - shift)) - static const int32 subC = 0x003FF; // max flt32 subnormal down shifted static const int32 norC = 0x00400; // min flt32 normal down shifted - static const int32 maxD = infC - maxC - 1; static const int32 minD = minC - subC - 1; @@ -48,9 +49,9 @@ public: static Half Compress(const float value) { #if USE_SSE_HALF_CONVERSION - __m128 V1 = _mm_set_ss(value); - __m128i V2 = _mm_cvtps_ph(V1, 0); - return static_cast(_mm_cvtsi128_si32(V2)); + __m128 value1 = _mm_set_ss(value); + __m128i value2 = _mm_cvtps_ph(value1, 0); + return static_cast(_mm_cvtsi128_si32(value2)); #else Bits v, s; v.f = value; @@ -72,9 +73,9 @@ public: static float Decompress(const Half value) { #if USE_SSE_HALF_CONVERSION - __m128i V1 = _mm_cvtsi32_si128(static_cast(value)); - __m128 V2 = _mm_cvtph_ps(V1); - return _mm_cvtss_f32(V2); + __m128i value1 = _mm_cvtsi32_si128(static_cast(value)); + __m128 value2 = _mm_cvtph_ps(value1); + return _mm_cvtss_f32(value2); #else Bits v; v.ui = value; @@ -95,16 +96,6 @@ public: } }; -inline float ConvertHalfToFloat(const Half value) -{ - return Float16Compressor::Decompress(value); -} - -inline Half ConvertFloatToHalf(const float value) -{ - return Float16Compressor::Compress(value); -} - /// /// Defines a two component vector, using half precision floating point coordinates. /// @@ -145,8 +136,8 @@ public: /// Y component Half2(float x, float y) { - X = ConvertFloatToHalf(x); - Y = ConvertFloatToHalf(y); + X = Float16Compressor::Compress(x); + Y = Float16Compressor::Compress(y); } /// @@ -201,9 +192,9 @@ public: Half3(const float x, const float y, const float z) { - X = ConvertFloatToHalf(x); - Y = ConvertFloatToHalf(y); - Z = ConvertFloatToHalf(z); + X = Float16Compressor::Compress(x); + Y = Float16Compressor::Compress(y); + Z = Float16Compressor::Compress(z); } Half3(const Vector3& v); @@ -255,18 +246,18 @@ public: Half4(const float x, const float y, const float z) { - X = ConvertFloatToHalf(x); - Y = ConvertFloatToHalf(y); - Z = ConvertFloatToHalf(z); + X = Float16Compressor::Compress(x); + Y = Float16Compressor::Compress(y); + Z = Float16Compressor::Compress(z); W = 0; } Half4(const float x, const float y, const float z, const float w) { - X = ConvertFloatToHalf(x); - Y = ConvertFloatToHalf(y); - Z = ConvertFloatToHalf(z); - W = ConvertFloatToHalf(w); + X = Float16Compressor::Compress(x); + Y = Float16Compressor::Compress(y); + Z = Float16Compressor::Compress(z); + W = Float16Compressor::Compress(w); } explicit Half4(const Vector4& v); diff --git a/Source/Engine/Tools/TextureTool/TextureTool.cpp b/Source/Engine/Tools/TextureTool/TextureTool.cpp index 97e4df253..e6502bb6f 100644 --- a/Source/Engine/Tools/TextureTool/TextureTool.cpp +++ b/Source/Engine/Tools/TextureTool/TextureTool.cpp @@ -489,11 +489,11 @@ TextureTool::PixelFormatSampler PixelFormatSamplers[] = sizeof(Half), [](const void* ptr) { - return Color(ConvertHalfToFloat(*(Half*)ptr), 0, 0, 1); + return Color(Float16Compressor::Decompress(*(Half*)ptr), 0, 0, 1); }, [](const void* ptr, const Color& color) { - *(Half*)ptr = ConvertFloatToHalf(color.R); + *(Half*)ptr = Float16Compressor::Compress(color.R); }, }, { From d7696c4765cbc7b61195cdfaa9551ddfc25176c8 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 12 Jan 2021 19:09:22 +0100 Subject: [PATCH 28/46] Split VectorInt into separate files for Int2, Int3 and Int4 --- Source/Engine/Core/Math/Int2.h | 279 +++++++++++++++ Source/Engine/Core/Math/Int3.h | 128 +++++++ Source/Engine/Core/Math/Int4.h | 134 +++++++ Source/Engine/Core/Math/VectorInt.h | 518 +--------------------------- 4 files changed, 544 insertions(+), 515 deletions(-) create mode 100644 Source/Engine/Core/Math/Int2.h create mode 100644 Source/Engine/Core/Math/Int3.h create mode 100644 Source/Engine/Core/Math/Int4.h diff --git a/Source/Engine/Core/Math/Int2.h b/Source/Engine/Core/Math/Int2.h new file mode 100644 index 000000000..a6038d1b0 --- /dev/null +++ b/Source/Engine/Core/Math/Int2.h @@ -0,0 +1,279 @@ +// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. + +#pragma once + +#include "Math.h" +#include "Engine/Core/Formatting.h" +#include "Engine/Core/Templates.h" + +struct Vector2; +struct Vector3; +struct Vector4; + +/// +/// Two-components vector (32 bit integer type). +/// +API_STRUCT(InBuild) struct FLAXENGINE_API Int2 +{ +public: + + union + { + struct + { + // X component + int32 X; + + // Y component + int32 Y; + }; + + // Raw values + int32 Raw[2]; + }; + +public: + + // Vector with all components equal 0 + static const Int2 Zero; + + // Vector with all components equal 1 + static const Int2 One; + +public: + + /// + /// Empty constructor. + /// + Int2() + { + } + + // Init + // @param xy Value to assign to the all components + Int2(int32 xy) + : X(xy) + , Y(xy) + { + } + + // Init + // @param x X component value + // @param y Y component value + Int2(int32 x, int32 y) + : X(x) + , Y(y) + { + } + + // Init + // @param v Vector to use X and Y components + explicit Int2(const Vector2& v); + +public: + + String ToString() const; + +public: + + // Arithmetic operators with Int2 + + Int2 operator+(const Int2& b) const + { + return Add(*this, b); + } + + Int2 operator-(const Int2& b) const + { + return Subtract(*this, b); + } + + Int2 operator*(const Int2& b) const + { + return Multiply(*this, b); + } + + Int2 operator/(const Int2& b) const + { + return Divide(*this, b); + } + + Int2 operator-() const + { + return Int2(-X, -Y); + } + + // op= operators with Int2 + + Int2& operator+=(const Int2& b) + { + *this = Add(*this, b); + return *this; + } + + Int2& operator-=(const Int2& b) + { + *this = Subtract(*this, b); + return *this; + } + + Int2& operator*=(const Int2& b) + { + *this = Multiply(*this, b); + return *this; + } + + Int2& operator/=(const Int2& b) + { + *this = Divide(*this, b); + return *this; + } + + // Arithmetic operators with int32 + + Int2 operator+(int32 b) const + { + return Add(*this, b); + } + + Int2 operator-(int32 b) const + { + return Subtract(*this, b); + } + + Int2 operator*(int32 b) const + { + return Multiply(*this, b); + } + + Int2 operator/(int32 b) const + { + return Divide(*this, b); + } + + // op= operators with int32 + + Int2& operator+=(int32 b) + { + *this = Add(*this, b); + return *this; + } + + Int2& operator-=(int32 b) + { + *this = Subtract(*this, b); + return *this; + } + + Int2& operator*=(int32 b) + { + *this = Multiply(*this, b); + return *this; + } + + Int2& operator/=(int32 b) + { + *this = Divide(*this, b); + return *this; + } + + // Comparison operators + + bool operator==(const Int2& b) const + { + return X == b.X && Y == b.Y; + } + + bool operator!=(const Int2& b) const + { + return X != b.X || Y != b.Y; + } + + bool operator>(const Int2& b) const + { + return X > b.X && Y > b.Y; + } + + bool operator>=(const Int2& b) const + { + return X >= b.X && Y >= b.Y; + } + + bool operator<(const Int2& b) const + { + return X < b.X && Y < b.Y; + } + + bool operator<=(const Int2& b) const + { + return X <= b.X && Y <= b.Y; + } + +public: + + static void Add(const Int2& a, const Int2& b, Int2* result) + { + result->X = a.X + b.X; + result->Y = a.Y + b.Y; + } + + static Int2 Add(const Int2& a, const Int2& b) + { + Int2 result; + Add(a, b, &result); + return result; + } + + static void Subtract(const Int2& a, const Int2& b, Int2* result) + { + result->X = a.X - b.X; + result->Y = a.Y - b.Y; + } + + static Int2 Subtract(const Int2& a, const Int2& b) + { + Int2 result; + Subtract(a, b, &result); + return result; + } + + static Int2 Multiply(const Int2& a, const Int2& b) + { + return Int2(a.X * b.X, a.Y * b.Y); + } + + static Int2 Multiply(const Int2& a, int32 b) + { + return Int2(a.X * b, a.Y * b); + } + + static Int2 Divide(const Int2& a, const Int2& b) + { + return Int2(a.X / b.X, a.Y / b.Y); + } + + static Int2 Divide(const Int2& a, int32 b) + { + return Int2(a.X / b, a.Y / b); + } + + // Creates vector from minimum components of two vectors + static Int2 Min(const Int2& a, const Int2& b) + { + return Int2(a.X < b.X ? a.X : b.X, a.Y < b.Y ? a.Y : b.Y); + } + + // Creates vector from maximum components of two vectors + static Int2 Max(const Int2& a, const Int2& b) + { + return Int2(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y); + } +}; + +template<> +struct TIsPODType +{ + enum { Value = true }; +}; + +DEFINE_DEFAULT_FORMATTING(Int2, "X:{0} Y:{1}", v.X, v.Y); diff --git a/Source/Engine/Core/Math/Int3.h b/Source/Engine/Core/Math/Int3.h new file mode 100644 index 000000000..6886acc6b --- /dev/null +++ b/Source/Engine/Core/Math/Int3.h @@ -0,0 +1,128 @@ +// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. + +#pragma once + +#include "Math.h" +#include "Engine/Core/Formatting.h" +#include "Engine/Core/Templates.h" + +struct Vector2; +struct Vector3; +struct Vector4; + +/// +/// Three-components vector (32 bit integer type). +/// +API_STRUCT(InBuild) struct FLAXENGINE_API Int3 +{ +public: + + union + { + struct + { + // X component + int32 X; + + // Y component + int32 Y; + + // Y component + int32 Z; + }; + + // Raw values + int32 Raw[3]; + }; + +public: + + // Vector with all components equal 0 + static const Int3 Zero; + + // Vector with all components equal 1 + static const Int3 One; + +public: + + /// + /// Empty constructor. + /// + Int3() + { + } + + // Init + // @param xy Value to assign to the all components + Int3(int32 xyz) + : X(xyz) + , Y(xyz) + , Z(xyz) + { + } + + // Init + // @param x X component value + // @param y Y component value + // @param z Z component value + Int3(int32 x, int32 y, int32 z) + : X(x) + , Y(y) + , Z(z) + { + } + + // Init + // @param v Vector to use X, Y and Z components + explicit Int3(const Vector3& v); + +public: + + String ToString() const; + +public: + + // Returns a vector containing the largest components of the specified vectors + // @param a The first source vector + // @param b The second source vector + // @param result When the method completes, contains an new vector composed of the largest components of the source vectors + static Int3 Max(const Int3& a, const Int3& b) + { + return Int3(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y, a.Z > b.Z ? a.Z : b.Z); + } + + // Returns a vector containing the smallest components of the specified vectors + // @param a The first source vector + // @param b The second source vector + // @param result When the method completes, contains an new vector composed of the smallest components of the source vectors + static Int3 Min(const Int3& a, const Int3& b) + { + return Int3(a.X < b.X ? a.X : b.X, a.Y < b.Y ? a.Y : b.Y, a.Z < b.Z ? a.Z : b.Z); + } + + // Returns a vector containing the largest components of the specified vectors + // @param a The first source vector + // @param b The second source vector + // @param result When the method completes, contains an new vector composed of the largest components of the source vectors + static void Max(const Int3& a, const Int3& b, Int3* result) + { + *result = Int3(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y, a.Z > b.Z ? a.Z : b.Z); + } + + // Returns a vector containing the smallest components of the specified vectors + // @param a The first source vector + // @param b The second source vector + // @param result When the method completes, contains an new vector composed of the smallest components of the source vectors + static void Min(const Int3& a, const Int3& b, Int3* result) + { + *result = Int3(a.X < b.X ? a.X : b.X, a.Y < b.Y ? a.Y : b.Y, a.Z < b.Z ? a.Z : b.Z); + } +}; + +template<> +struct TIsPODType +{ + enum { Value = true }; +}; + +DEFINE_DEFAULT_FORMATTING(Int3, "X:{0} Y:{1} Z:{2}", v.X, v.Y, v.Z); diff --git a/Source/Engine/Core/Math/Int4.h b/Source/Engine/Core/Math/Int4.h new file mode 100644 index 000000000..c8e9eebd8 --- /dev/null +++ b/Source/Engine/Core/Math/Int4.h @@ -0,0 +1,134 @@ +// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. + +#pragma once + +#include "Math.h" +#include "Engine/Core/Formatting.h" +#include "Engine/Core/Templates.h" + +struct Vector2; +struct Vector3; +struct Vector4; + +/// +/// Four-components vector (32 bit integer type). +/// +API_STRUCT(InBuild) struct FLAXENGINE_API Int4 +{ +public: + + union + { + struct + { + // X component + int32 X; + + // Y component + int32 Y; + + // Z component + int32 Z; + + // W component + int32 W; + }; + + // Raw values + int32 Raw[4]; + }; + +public: + + // Vector with all components equal 0 + static const Int4 Zero; + + // Vector with all components equal 1 + static const Int4 One; + +public: + + /// + /// Empty constructor. + /// + Int4() + { + } + + // Init + // @param xy Value to assign to the all components + Int4(int32 xyzw) + : X(xyzw) + , Y(xyzw) + , Z(xyzw) + , W(xyzw) + { + } + + // Init + // @param x X component value + // @param y Y component value + // @param z Z component value + // @param w W component value + Int4(int32 x, int32 y, int32 z, int32 w) + : X(x) + , Y(y) + , Z(z) + , W(w) + { + } + + // Init + // @param v Vector to use X, Y, Z and W components + explicit Int4(const Vector4& v); + +public: + + String ToString() const; + +public: + + /// + /// Returns average arithmetic of all the components + /// + /// Average arithmetic of all the components + float AverageArithmetic() const + { + return (X + Y + Z + W) * 0.25f; + } + + /// + /// Gets sum of all vector components values + /// + /// Sum of X, Y, Z and W + int32 SumValues() const + { + return X + Y + Z + W; + } + + /// + /// Returns minimum value of all the components + /// + /// Minimum value + int32 MinValue() const + { + return Math::Min(X, Y, Z, W); + } + + /// + /// Returns maximum value of all the components + /// + /// Maximum value + int32 MaxValue() const + { + return Math::Max(X, Y, Z, W); + } +}; + +template<> +struct TIsPODType +{ + enum { Value = true }; +}; + +DEFINE_DEFAULT_FORMATTING(Int4, "X:{0} Y:{1} Z:{2} W:{3}", v.X, v.Y, v.Z, v.W); diff --git a/Source/Engine/Core/Math/VectorInt.h b/Source/Engine/Core/Math/VectorInt.h index 9b5eeb866..d9611d615 100644 --- a/Source/Engine/Core/Math/VectorInt.h +++ b/Source/Engine/Core/Math/VectorInt.h @@ -2,518 +2,6 @@ #pragma once -#include "Math.h" -#include "Engine/Core/Formatting.h" -#include "Engine/Core/Templates.h" - -struct Vector2; -struct Vector3; -struct Vector4; - -/// -/// Two-components vector (32 bit integer type). -/// -API_STRUCT(InBuild) struct FLAXENGINE_API Int2 -{ -public: - - union - { - struct - { - // X component - int32 X; - - // Y component - int32 Y; - }; - - // Raw values - int32 Raw[2]; - }; - -public: - - // Vector with all components equal 0 - static const Int2 Zero; - - // Vector with all components equal 1 - static const Int2 One; - -public: - - /// - /// Empty constructor. - /// - Int2() - { - } - - // Init - // @param xy Value to assign to the all components - Int2(int32 xy) - : X(xy) - , Y(xy) - { - } - - // Init - // @param x X component value - // @param y Y component value - Int2(int32 x, int32 y) - : X(x) - , Y(y) - { - } - - // Init - // @param v Vector to use X and Y components - explicit Int2(const Vector2& v); - -public: - - String ToString() const; - -public: - - // Arithmetic operators with Int2 - - Int2 operator+(const Int2& b) const - { - return Add(*this, b); - } - - Int2 operator-(const Int2& b) const - { - return Subtract(*this, b); - } - - Int2 operator*(const Int2& b) const - { - return Multiply(*this, b); - } - - Int2 operator/(const Int2& b) const - { - return Divide(*this, b); - } - - Int2 operator-() const - { - return Int2(-X, -Y); - } - - // op= operators with Int2 - - Int2& operator+=(const Int2& b) - { - *this = Add(*this, b); - return *this; - } - - Int2& operator-=(const Int2& b) - { - *this = Subtract(*this, b); - return *this; - } - - Int2& operator*=(const Int2& b) - { - *this = Multiply(*this, b); - return *this; - } - - Int2& operator/=(const Int2& b) - { - *this = Divide(*this, b); - return *this; - } - - // Arithmetic operators with int32 - - Int2 operator+(int32 b) const - { - return Add(*this, b); - } - - Int2 operator-(int32 b) const - { - return Subtract(*this, b); - } - - Int2 operator*(int32 b) const - { - return Multiply(*this, b); - } - - Int2 operator/(int32 b) const - { - return Divide(*this, b); - } - - // op= operators with int32 - - Int2& operator+=(int32 b) - { - *this = Add(*this, b); - return *this; - } - - Int2& operator-=(int32 b) - { - *this = Subtract(*this, b); - return *this; - } - - Int2& operator*=(int32 b) - { - *this = Multiply(*this, b); - return *this; - } - - Int2& operator/=(int32 b) - { - *this = Divide(*this, b); - return *this; - } - - // Comparison operators - - bool operator==(const Int2& b) const - { - return X == b.X && Y == b.Y; - } - - bool operator!=(const Int2& b) const - { - return X != b.X || Y != b.Y; - } - - bool operator>(const Int2& b) const - { - return X > b.X && Y > b.Y; - } - - bool operator>=(const Int2& b) const - { - return X >= b.X && Y >= b.Y; - } - - bool operator<(const Int2& b) const - { - return X < b.X && Y < b.Y; - } - - bool operator<=(const Int2& b) const - { - return X <= b.X && Y <= b.Y; - } - -public: - - static void Add(const Int2& a, const Int2& b, Int2* result) - { - result->X = a.X + b.X; - result->Y = a.Y + b.Y; - } - - static Int2 Add(const Int2& a, const Int2& b) - { - Int2 result; - Add(a, b, &result); - return result; - } - - static void Subtract(const Int2& a, const Int2& b, Int2* result) - { - result->X = a.X - b.X; - result->Y = a.Y - b.Y; - } - - static Int2 Subtract(const Int2& a, const Int2& b) - { - Int2 result; - Subtract(a, b, &result); - return result; - } - - static Int2 Multiply(const Int2& a, const Int2& b) - { - return Int2(a.X * b.X, a.Y * b.Y); - } - - static Int2 Multiply(const Int2& a, int32 b) - { - return Int2(a.X * b, a.Y * b); - } - - static Int2 Divide(const Int2& a, const Int2& b) - { - return Int2(a.X / b.X, a.Y / b.Y); - } - - static Int2 Divide(const Int2& a, int32 b) - { - return Int2(a.X / b, a.Y / b); - } - - // Creates vector from minimum components of two vectors - static Int2 Min(const Int2& a, const Int2& b) - { - return Int2(a.X < b.X ? a.X : b.X, a.Y < b.Y ? a.Y : b.Y); - } - - // Creates vector from maximum components of two vectors - static Int2 Max(const Int2& a, const Int2& b) - { - return Int2(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y); - } -}; - -/// -/// Three-components vector (32 bit integer type). -/// -API_STRUCT(InBuild) struct FLAXENGINE_API Int3 -{ -public: - - union - { - struct - { - // X component - int32 X; - - // Y component - int32 Y; - - // Y component - int32 Z; - }; - - // Raw values - int32 Raw[3]; - }; - -public: - - // Vector with all components equal 0 - static const Int3 Zero; - - // Vector with all components equal 1 - static const Int3 One; - -public: - - /// - /// Empty constructor. - /// - Int3() - { - } - - // Init - // @param xy Value to assign to the all components - Int3(int32 xyz) - : X(xyz) - , Y(xyz) - , Z(xyz) - { - } - - // Init - // @param x X component value - // @param y Y component value - // @param z Z component value - Int3(int32 x, int32 y, int32 z) - : X(x) - , Y(y) - , Z(z) - { - } - - // Init - // @param v Vector to use X, Y and Z components - explicit Int3(const Vector3& v); - -public: - - String ToString() const; - -public: - - // Returns a vector containing the largest components of the specified vectors - // @param a The first source vector - // @param b The second source vector - // @param result When the method completes, contains an new vector composed of the largest components of the source vectors - static Int3 Max(const Int3& a, const Int3& b) - { - return Int3(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y, a.Z > b.Z ? a.Z : b.Z); - } - - // Returns a vector containing the smallest components of the specified vectors - // @param a The first source vector - // @param b The second source vector - // @param result When the method completes, contains an new vector composed of the smallest components of the source vectors - static Int3 Min(const Int3& a, const Int3& b) - { - return Int3(a.X < b.X ? a.X : b.X, a.Y < b.Y ? a.Y : b.Y, a.Z < b.Z ? a.Z : b.Z); - } - - // Returns a vector containing the largest components of the specified vectors - // @param a The first source vector - // @param b The second source vector - // @param result When the method completes, contains an new vector composed of the largest components of the source vectors - static void Max(const Int3& a, const Int3& b, Int3* result) - { - *result = Int3(a.X > b.X ? a.X : b.X, a.Y > b.Y ? a.Y : b.Y, a.Z > b.Z ? a.Z : b.Z); - } - - // Returns a vector containing the smallest components of the specified vectors - // @param a The first source vector - // @param b The second source vector - // @param result When the method completes, contains an new vector composed of the smallest components of the source vectors - static void Min(const Int3& a, const Int3& b, Int3* result) - { - *result = Int3(a.X < b.X ? a.X : b.X, a.Y < b.Y ? a.Y : b.Y, a.Z < b.Z ? a.Z : b.Z); - } -}; - -/// -/// Four-components vector (32 bit integer type). -/// -API_STRUCT(InBuild) struct FLAXENGINE_API Int4 -{ -public: - - union - { - struct - { - // X component - int32 X; - - // Y component - int32 Y; - - // Z component - int32 Z; - - // W component - int32 W; - }; - - // Raw values - int32 Raw[4]; - }; - -public: - - // Vector with all components equal 0 - static const Int4 Zero; - - // Vector with all components equal 1 - static const Int4 One; - -public: - - /// - /// Empty constructor. - /// - Int4() - { - } - - // Init - // @param xy Value to assign to the all components - Int4(int32 xyzw) - : X(xyzw) - , Y(xyzw) - , Z(xyzw) - , W(xyzw) - { - } - - // Init - // @param x X component value - // @param y Y component value - // @param z Z component value - // @param w W component value - Int4(int32 x, int32 y, int32 z, int32 w) - : X(x) - , Y(y) - , Z(z) - , W(w) - { - } - - // Init - // @param v Vector to use X, Y, Z and W components - explicit Int4(const Vector4& v); - -public: - - String ToString() const; - -public: - - /// - /// Returns average arithmetic of all the components - /// - /// Average arithmetic of all the components - float AverageArithmetic() const - { - return (X + Y + Z + W) * 0.25f; - } - - /// - /// Gets sum of all vector components values - /// - /// Sum of X, Y, Z and W - int32 SumValues() const - { - return X + Y + Z + W; - } - - /// - /// Returns minimum value of all the components - /// - /// Minimum value - int32 MinValue() const - { - return Math::Min(X, Y, Z, W); - } - - /// - /// Returns maximum value of all the components - /// - /// Maximum value - int32 MaxValue() const - { - return Math::Max(X, Y, Z, W); - } -}; - -template<> -struct TIsPODType -{ - enum { Value = true }; -}; - -template<> -struct TIsPODType -{ - enum { Value = true }; -}; - -template<> -struct TIsPODType -{ - enum { Value = true }; -}; - -DEFINE_DEFAULT_FORMATTING(Int2, "X:{0} Y:{1}", v.X, v.Y); - -DEFINE_DEFAULT_FORMATTING(Int3, "X:{0} Y:{1} Z:{2}", v.X, v.Y, v.Z); - -DEFINE_DEFAULT_FORMATTING(Int4, "X:{0} Y:{1} Z:{2} W:{3}", v.X, v.Y, v.Z, v.W); +#include "Int2.h" +#include "Int3.h" +#include "Int4.h" From 259c419c360f09e8d9dff6d94205c72c39256bd2 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 12 Jan 2021 19:09:42 +0100 Subject: [PATCH 29/46] Fix crash when resizing existing MaterialSlots collection for model --- Source/Engine/Content/Assets/ModelBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Content/Assets/ModelBase.h b/Source/Engine/Content/Assets/ModelBase.h index ebf05570d..89805f3c0 100644 --- a/Source/Engine/Content/Assets/ModelBase.h +++ b/Source/Engine/Content/Assets/ModelBase.h @@ -53,7 +53,7 @@ public: ScopeLock lock(Locker); const int32 prevCount = MaterialSlots.Count(); - MaterialSlots.Resize(slotsCount); + MaterialSlots.Resize(slotsCount, false); // Initialize slot names for (int32 i = prevCount; i < slotsCount; i++) From a3fa8ff9f0e4ddd636b6369c19961b07affd51d9 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 12 Jan 2021 19:17:08 +0100 Subject: [PATCH 30/46] Optimize some includes --- Source/Editor/Tools/Terrain/TerrainTools.cpp | 2 +- Source/Editor/Utilities/EditorUtilities.cpp | 2 -- Source/Engine/Core/Math/Vector2.cpp | 2 +- Source/Engine/Core/Math/Vector3.cpp | 2 +- Source/Engine/Core/Math/Vector4.cpp | 2 +- Source/Engine/Graphics/Models/ModelData.h | 2 +- Source/Engine/Graphics/Models/Types.h | 2 +- Source/Engine/Navigation/NavMeshBuilder.cpp | 2 +- Source/Engine/Platform/Linux/LinuxWindow.cpp | 2 +- Source/Engine/Renderer/EyeAdaptationPass.cpp | 1 + Source/Engine/Terrain/TerrainPatch.cpp | 1 - Source/Engine/Terrain/TerrainPatch.h | 2 +- Source/Engine/Tools/TextureTool/TextureTool.cpp | 2 +- 13 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Source/Editor/Tools/Terrain/TerrainTools.cpp b/Source/Editor/Tools/Terrain/TerrainTools.cpp index 6bf4f8fd4..e89b5e3e9 100644 --- a/Source/Editor/Tools/Terrain/TerrainTools.cpp +++ b/Source/Editor/Tools/Terrain/TerrainTools.cpp @@ -2,7 +2,7 @@ #include "TerrainTools.h" #include "Engine/Core/Cache.h" -#include "Engine/Core/Math/VectorInt.h" +#include "Engine/Core/Math/Int2.h" #include "Engine/Core/Math/Color32.h" #include "Engine/Core/Collections/CollectionPoolCache.h" #include "Engine/Terrain/TerrainPatch.h" diff --git a/Source/Editor/Utilities/EditorUtilities.cpp b/Source/Editor/Utilities/EditorUtilities.cpp index d7136a5c8..fc266ec13 100644 --- a/Source/Editor/Utilities/EditorUtilities.cpp +++ b/Source/Editor/Utilities/EditorUtilities.cpp @@ -6,10 +6,8 @@ #include "Engine/Core/Log.h" #include "Engine/Graphics/Textures/TextureData.h" #include "Engine/Graphics/PixelFormatExtensions.h" -#include "Engine/Serialization/FileReadStream.h" #include "Engine/Tools/TextureTool/TextureTool.h" #include "Engine/Core/Math/Color32.h" -#include "Engine/Core/Math/VectorInt.h" #include "Engine/Core/Config/GameSettings.h" #include "Engine/Content/Content.h" #include "Engine/Content/AssetReference.h" diff --git a/Source/Engine/Core/Math/Vector2.cpp b/Source/Engine/Core/Math/Vector2.cpp index 6a0468033..c23e79d19 100644 --- a/Source/Engine/Core/Math/Vector2.cpp +++ b/Source/Engine/Core/Math/Vector2.cpp @@ -4,8 +4,8 @@ #include "Vector3.h" #include "Vector4.h" #include "Color.h" +#include "Int2.h" #include "../Types/String.h" -#include "VectorInt.h" static_assert(sizeof(Vector2) == 8, "Invalid Vector2 type size."); diff --git a/Source/Engine/Core/Math/Vector3.cpp b/Source/Engine/Core/Math/Vector3.cpp index e3ff349ba..f66bbcbbd 100644 --- a/Source/Engine/Core/Math/Vector3.cpp +++ b/Source/Engine/Core/Math/Vector3.cpp @@ -6,7 +6,7 @@ #include "Color.h" #include "Quaternion.h" #include "Matrix.h" -#include "VectorInt.h" +#include "Int3.h" #include "../Types/String.h" static_assert(sizeof(Vector3) == 12, "Invalid Vector3 type size."); diff --git a/Source/Engine/Core/Math/Vector4.cpp b/Source/Engine/Core/Math/Vector4.cpp index 3caaab985..34fa27aac 100644 --- a/Source/Engine/Core/Math/Vector4.cpp +++ b/Source/Engine/Core/Math/Vector4.cpp @@ -6,7 +6,7 @@ #include "Color.h" #include "Matrix.h" #include "Rectangle.h" -#include "VectorInt.h" +#include "Int4.h" #include "../Types/String.h" static_assert(sizeof(Vector4) == 16, "Invalid Vector4 type size."); diff --git a/Source/Engine/Graphics/Models/ModelData.h b/Source/Engine/Graphics/Models/ModelData.h index 1e4b59d0a..a3bb47fcc 100644 --- a/Source/Engine/Graphics/Models/ModelData.h +++ b/Source/Engine/Graphics/Models/ModelData.h @@ -5,7 +5,7 @@ #include "Engine/Core/Common.h" #include "Engine/Core/Math/BoundingSphere.h" #include "Engine/Core/Math/BoundingBox.h" -#include "Engine/Core/Math/VectorInt.h" +#include "Engine/Core/Math/Int4.h" #include "Engine/Serialization/Stream.h" #include "Engine/Graphics/Enums.h" #include "Types.h" diff --git a/Source/Engine/Graphics/Models/Types.h b/Source/Engine/Graphics/Models/Types.h index 248988243..9a95b8815 100644 --- a/Source/Engine/Graphics/Models/Types.h +++ b/Source/Engine/Graphics/Models/Types.h @@ -9,7 +9,7 @@ #include "Engine/Core/Math/Vector4.h" #include "Engine/Core/Math/Color.h" #include "Engine/Core/Math/Color32.h" -#include "Engine/Core/Math/VectorInt.h" +#include "Engine/Core/Math/Int4.h" class Model; class SkinnedModel; diff --git a/Source/Engine/Navigation/NavMeshBuilder.cpp b/Source/Engine/Navigation/NavMeshBuilder.cpp index b8e9a7544..2220d2cb6 100644 --- a/Source/Engine/Navigation/NavMeshBuilder.cpp +++ b/Source/Engine/Navigation/NavMeshBuilder.cpp @@ -4,7 +4,6 @@ #include "NavMeshBuilder.h" #include "Engine/Core/Math/BoundingBox.h" -#include "Engine/Core/Math/VectorInt.h" #include "Engine/Physics/Colliders/BoxCollider.h" #include "Engine/Physics/Colliders/MeshCollider.h" #include "Engine/Threading/ThreadPoolTask.h" @@ -15,6 +14,7 @@ #include "Engine/Level/Level.h" #include "Engine/Level/SceneQuery.h" #include "Engine/Core/Log.h" +#include "Engine/Core/Math/Int3.h" #include "NavigationScene.h" #include "NavigationSettings.h" #include "NavMeshBoundsVolume.h" diff --git a/Source/Engine/Platform/Linux/LinuxWindow.cpp b/Source/Engine/Platform/Linux/LinuxWindow.cpp index 0ed5341ec..768df66bd 100644 --- a/Source/Engine/Platform/Linux/LinuxWindow.cpp +++ b/Source/Engine/Platform/Linux/LinuxWindow.cpp @@ -10,7 +10,7 @@ #include "Engine/Core/Log.h" #include "Engine/Core/Math/Math.h" #include "Engine/Core/Math/Color32.h" -#include "Engine/Core/Math/VectorInt.h" +#include "Engine/Core/Math/Int2.h" #include "Engine/Core/Collections/Array.h" #include "Engine/Core/Collections/Dictionary.h" #include "Engine/Utilities/StringConverter.h" diff --git a/Source/Engine/Renderer/EyeAdaptationPass.cpp b/Source/Engine/Renderer/EyeAdaptationPass.cpp index 754c1489f..a85e0a72b 100644 --- a/Source/Engine/Renderer/EyeAdaptationPass.cpp +++ b/Source/Engine/Renderer/EyeAdaptationPass.cpp @@ -2,6 +2,7 @@ #include "EyeAdaptationPass.h" #include "RenderList.h" +#include "Engine/Core/Math/Int2.h" #include "Engine/Content/Assets/Shader.h" #include "Engine/Content/Content.h" #include "Engine/Graphics/PostProcessBase.h" diff --git a/Source/Engine/Terrain/TerrainPatch.cpp b/Source/Engine/Terrain/TerrainPatch.cpp index d0050d455..791e93c7f 100644 --- a/Source/Engine/Terrain/TerrainPatch.cpp +++ b/Source/Engine/Terrain/TerrainPatch.cpp @@ -5,7 +5,6 @@ #include "Engine/Serialization/Serialization.h" #include "Engine/Graphics/RenderView.h" #include "Engine/Core/Math/Color32.h" -#include "Engine/Core/Math/VectorInt.h" #include "Engine/Profiler/ProfilerCPU.h" #include "Engine/Physics/Utilities.h" #include "Engine/Physics/Physics.h" diff --git a/Source/Engine/Terrain/TerrainPatch.h b/Source/Engine/Terrain/TerrainPatch.h index fcd97f4ec..b09848d61 100644 --- a/Source/Engine/Terrain/TerrainPatch.h +++ b/Source/Engine/Terrain/TerrainPatch.h @@ -5,7 +5,7 @@ #include "Terrain.h" #include "TerrainChunk.h" #include "Engine/Core/Math/Color32.h" -#include "Engine/Core/Math/VectorInt.h" +#include "Engine/Core/Math/Int2.h" #include "Engine/Physics/Types.h" #include "Engine/Level/Scene/Lightmap.h" #include "Engine/Content/Assets/RawDataAsset.h" diff --git a/Source/Engine/Tools/TextureTool/TextureTool.cpp b/Source/Engine/Tools/TextureTool/TextureTool.cpp index e6502bb6f..67e4d7679 100644 --- a/Source/Engine/Tools/TextureTool/TextureTool.cpp +++ b/Source/Engine/Tools/TextureTool/TextureTool.cpp @@ -7,7 +7,7 @@ #include "Engine/Core/Types/DateTime.h" #include "Engine/Core/Math/Packed.h" #include "Engine/Core/Math/Color32.h" -#include "Engine/Core/Math/VectorInt.h" +#include "Engine/Core/Math/Int2.h" #include "Engine/Platform/FileSystem.h" #include "Engine/Serialization/JsonWriter.h" #include "Engine/Serialization/JsonTools.h" From 932de300e4a03959f210185e6319acd0e88265b0 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 12 Jan 2021 23:07:20 +0100 Subject: [PATCH 31/46] Fix missing focus for SliderControl --- Source/Editor/GUI/Input/SliderControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/GUI/Input/SliderControl.cs b/Source/Editor/GUI/Input/SliderControl.cs index 90288cfd0..77e8a5da8 100644 --- a/Source/Editor/GUI/Input/SliderControl.cs +++ b/Source/Editor/GUI/Input/SliderControl.cs @@ -168,6 +168,7 @@ namespace FlaxEditor.GUI.Input { if (button == MouseButton.Left) { + Focus(); float mousePosition = location.X; if (_thumbRect.Contains(ref location)) @@ -208,7 +209,6 @@ namespace FlaxEditor.GUI.Input { if (button == MouseButton.Left && _isSliding) { - // End sliding EndSliding(); return true; } From fd6158e1a9aabbf444273a06c9a7d05fef68ecd6 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 12 Jan 2021 23:36:50 +0100 Subject: [PATCH 32/46] Fix loading `VariantType.Blob` --- Source/Editor/Utilities/Utils.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 5f1636239..ac34d9e45 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -742,6 +742,7 @@ namespace FlaxEditor.Utilities case VariantType.Array: return new ScriptType(typeof(object[])); case VariantType.Dictionary: return new ScriptType(typeof(Dictionary)); case VariantType.ManagedObject: return new ScriptType(typeof(object)); + case VariantType.Blob: return new ScriptType(typeof(byte[])); default: throw new ArgumentOutOfRangeException($"Unknown Variant Type {variantType} without typename."); } } @@ -805,6 +806,7 @@ namespace FlaxEditor.Utilities case VariantType.Array: return typeof(object[]); case VariantType.Dictionary: return typeof(Dictionary); case VariantType.ManagedObject: return typeof(object); + case VariantType.Blob: return typeof(byte[]); default: throw new ArgumentOutOfRangeException($"Unknown Variant Type {variantType} without typename."); } } From 9e3c413c918367cf44a1072ce727d487375b6b18 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 13 Jan 2021 00:22:52 +0100 Subject: [PATCH 33/46] Fix crash when using Byte, Int16 or UInt16 as VS parameters --- Source/Engine/Core/Types/Variant.cpp | 25 ++++++++++++++++++++++++- Source/Engine/Serialization/Stream.cpp | 18 +++++++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Source/Engine/Core/Types/Variant.cpp b/Source/Engine/Core/Types/Variant.cpp index 62c791875..db71c2f77 100644 --- a/Source/Engine/Core/Types/Variant.cpp +++ b/Source/Engine/Core/Types/Variant.cpp @@ -2612,7 +2612,8 @@ Variant Variant::Lerp(const Variant& a, const Variant& b, float alpha) void Variant::AllocStructure() { - const ScriptingTypeHandle typeHandle = Scripting::FindScriptingType(StringAnsiView(Type.TypeName)); + const StringAnsiView typeName(Type.TypeName); + const ScriptingTypeHandle typeHandle = Scripting::FindScriptingType(typeName); if (typeHandle) { const ScriptingType& type = typeHandle.GetType(); @@ -2620,8 +2621,26 @@ void Variant::AllocStructure() AsBlob.Data = Allocator::Allocate(AsBlob.Length); type.Struct.Ctor(AsBlob.Data); } + else if (typeName == "System.Byte") + { + // Hack for byte + AsBlob.Length = 1; + AsBlob.Data = Allocator::Allocate(AsBlob.Length); + *((byte*)AsBlob.Data) = 0; + } + else if (typeName == "System.Int16" || typeName == "System.UInt16") + { + // Hack for 16bit int + AsBlob.Length = 2; + AsBlob.Data = Allocator::Allocate(AsBlob.Length); + *((int16*)AsBlob.Data) = 0; + } else { + if (typeName.Length() != 0) + { + LOG(Warning, "Missing scripting type \'{0}\'", String(typeName.Get())); + } AsBlob.Data = nullptr; AsBlob.Length = 0; } @@ -2637,6 +2656,10 @@ void Variant::CopyStructure(void* src) auto& type = typeHandle.GetType(); type.Struct.Copy(AsBlob.Data, src); } + else + { + Platform::MemoryCopy(AsBlob.Data, src, AsBlob.Length); + } } } diff --git a/Source/Engine/Serialization/Stream.cpp b/Source/Engine/Serialization/Stream.cpp index e10ae9fd6..2d3ef8b30 100644 --- a/Source/Engine/Serialization/Stream.cpp +++ b/Source/Engine/Serialization/Stream.cpp @@ -4,8 +4,9 @@ #include "WriteStream.h" #include "Engine/Core/Types/CommonValue.h" #include "Engine/Core/Types/Variant.h" -#include "Engine/Content/Asset.h" #include "Engine/Core/Collections/Dictionary.h" +#include "Engine/Content/Asset.h" +#include "Engine/Debug/DebugLog.h" #include "Engine/Scripting/ScriptingObject.h" #include "Engine/Scripting/ScriptingObjectReference.h" @@ -330,8 +331,19 @@ void ReadStream::ReadVariant(Variant* data) { int32 length; ReadInt32(&length); - ASSERT(data->AsBlob.Length == length); - ReadBytes(data->AsBlob.Data, length); + if (data->AsBlob.Length == length) + { + ReadBytes(data->AsBlob.Data, length); + } + else + { + LOG(Error, "Invalid Variant {2} data length {0}. Expected {1} bytes from stream.", data->AsBlob.Length, length, data->Type.ToString()); + + // Skip those bytes + void* ptr = Allocator::Allocate(length); + ReadBytes(ptr, length); + Allocator::Free(ptr); + } break; } case VariantType::Blob: From b76d5d34ea7d54f1e0614d90eb21e62e47671385 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 14 Jan 2021 21:21:08 +0100 Subject: [PATCH 34/46] Fix lambda --- .../GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp | 34 +++++++++---------- .../GraphicsDevice/Vulkan/GPUDeviceVulkan.h | 4 +++ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp index 33df0db47..ea9e6a990 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp @@ -1363,23 +1363,7 @@ PixelFormat GPUDeviceVulkan::GetClosestSupportedPixelFormat(PixelFormat format, if (flags & GPUTextureFlags::UnorderedAccess) wantedFeatureFlags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT; - // Check actual device for format support - const auto isSupported = [&](VkFormat vkFormat) - { - VkFormatProperties props; - vkGetPhysicalDeviceFormatProperties(Adapter->Gpu, vkFormat, &props); - const VkFormatFeatureFlags featureFlags = optimalTiling ? props.optimalTilingFeatures : props.linearTilingFeatures; - if ((featureFlags & wantedFeatureFlags) != wantedFeatureFlags) - return false; - - //VkImageFormatProperties imageProps; - //vkGetPhysicalDeviceImageFormatProperties(Adapter->Gpu, vkFormat, , &imageProps); - - return true; - }; - - VkFormat vkFormat = RenderToolsVulkan::ToVulkanFormat(format); - if (!isSupported(vkFormat)) + if (!IsVkFormatSupported(RenderToolsVulkan::ToVulkanFormat(format), wantedFeatureFlags, optimalTiling)) { // Special case for depth-stencil formats if (flags & GPUTextureFlags::DepthStencil) @@ -1389,7 +1373,7 @@ PixelFormat GPUDeviceVulkan::GetClosestSupportedPixelFormat(PixelFormat format, // Spec guarantees at least one depth-only, and one depth-stencil format to be supported if (hasStencil) { - if (isSupported(VK_FORMAT_D32_SFLOAT_S8_UINT)) + if (IsVkFormatSupported(VK_FORMAT_D32_SFLOAT_S8_UINT, wantedFeatureFlags, optimalTiling)) format = PixelFormat::D32_Float; else format = PixelFormat::D24_UNorm_S8_UInt; @@ -1493,6 +1477,20 @@ bool GPUDeviceVulkan::SaveValidationCache() #endif +bool GPUDeviceVulkan::IsVkFormatSupported(VkFormat vkFormat, VkFormatFeatureFlags wantedFeatureFlags, bool optimalTiling) const +{ + VkFormatProperties props; + vkGetPhysicalDeviceFormatProperties(Adapter->Gpu, vkFormat, &props); + const VkFormatFeatureFlags featureFlags = optimalTiling ? props.optimalTilingFeatures : props.linearTilingFeatures; + if ((featureFlags & wantedFeatureFlags) != wantedFeatureFlags) + return false; + + //VkImageFormatProperties imageProps; + //vkGetPhysicalDeviceImageFormatProperties(Adapter->Gpu, vkFormat, , &imageProps); + + return true; +} + GPUContext* GPUDeviceVulkan::GetMainContext() { return reinterpret_cast(MainContext); diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.h b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.h index 9bab15dda..ba972932b 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.h +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.h @@ -720,6 +720,10 @@ public: #endif +private: + + bool IsVkFormatSupported(VkFormat vkFormat, VkFormatFeatureFlags wantedFeatureFlags, bool optimalTiling) const; + public: // [GPUDevice] From f80f7cdd33dbb010efa1454b5cc3ce67f652e040 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 14 Jan 2021 22:23:22 +0100 Subject: [PATCH 35/46] Fix crash on Android if GPU doesn't support linear sampling of the shadow map --- Source/Engine/Graphics/GPULimits.h | 4 +- Source/Engine/Renderer/MotionBlurPass.cpp | 6 +-- Source/Engine/Renderer/ShadowsPass.cpp | 57 +++++++++++++++-------- Source/Engine/Renderer/ShadowsPass.h | 1 + 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/Source/Engine/Graphics/GPULimits.h b/Source/Engine/Graphics/GPULimits.h index 485f5d866..b50714fcd 100644 --- a/Source/Engine/Graphics/GPULimits.h +++ b/Source/Engine/Graphics/GPULimits.h @@ -174,10 +174,10 @@ API_ENUM(Attributes="Flags") enum class FormatSupport : int32 DECLARE_ENUM_OPERATORS(FormatSupport); // Helper macro to check if given format does not support a given set of feature flags -#define FORMAT_FEATURES_ARE_NOT_SUPPORTED(formatSupport, formatSupportFlags) ((formatSupport & formatSupportFlags) != static_cast(formatSupportFlags)) +#define FORMAT_FEATURES_ARE_NOT_SUPPORTED(formatSupport, formatSupportFlags) ((formatSupport & (formatSupportFlags)) != static_cast(formatSupportFlags)) // Helper macro to check if given format does support a given set of feature flags -#define FORMAT_FEATURES_ARE_SUPPORTED(formatSupport, formatSupportFlags) ((formatSupport & formatSupportFlags) == static_cast(formatSupportFlags)) +#define FORMAT_FEATURES_ARE_SUPPORTED(formatSupport, formatSupportFlags) ((formatSupport & (formatSupportFlags)) == static_cast(formatSupportFlags)) /// /// The features exposed for a particular format. diff --git a/Source/Engine/Renderer/MotionBlurPass.cpp b/Source/Engine/Renderer/MotionBlurPass.cpp index f25d14c51..609712e1f 100644 --- a/Source/Engine/Renderer/MotionBlurPass.cpp +++ b/Source/Engine/Renderer/MotionBlurPass.cpp @@ -57,11 +57,11 @@ bool MotionBlurPass::Init() // Prepare formats for the buffers auto format = MOTION_VECTORS_PIXEL_FORMAT; - if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(format).Support, (FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D))) + if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(format).Support, FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D)) { - if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(PixelFormat::R32G32_Float).Support, (FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D))) + if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(PixelFormat::R32G32_Float).Support, FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D)) format = PixelFormat::R32G32_Float; - else if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(PixelFormat::R16G16B16A16_Float).Support, (FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D))) + else if (FORMAT_FEATURES_ARE_NOT_SUPPORTED(GPUDevice::Instance->GetFormatFeatures(PixelFormat::R16G16B16A16_Float).Support, FormatSupport::RenderTarget | FormatSupport::ShaderSample | FormatSupport::Texture2D)) format = PixelFormat::R16G16B16A16_Float; else format = PixelFormat::R32G32B32A32_Float; diff --git a/Source/Engine/Renderer/ShadowsPass.cpp b/Source/Engine/Renderer/ShadowsPass.cpp index 5ec9d6446..11812a45c 100644 --- a/Source/Engine/Renderer/ShadowsPass.cpp +++ b/Source/Engine/Renderer/ShadowsPass.cpp @@ -6,6 +6,7 @@ #include "Engine/Graphics/Graphics.h" #include "Engine/Graphics/RenderBuffers.h" #include "Engine/Content/Content.h" +#include "Engine/Graphics/PixelFormatExtensions.h" #if USE_EDITOR #include "Engine/Renderer/Lightmaps.h" #endif @@ -77,6 +78,19 @@ bool ShadowsPass::Init() _shader.Get()->OnReloading.Bind(this); #endif + // If GPU doesn't support linear sampling for the shadow map then fallback to the single sample on lowest quality + const auto formatTexture = PixelFormatExtensions::FindShaderResourceFormat(SHADOW_MAPS_FORMAT, false); + const auto formatFeaturesDepth = GPUDevice::Instance->GetFormatFeatures(SHADOW_MAPS_FORMAT); + const auto formatFeaturesTexture = GPUDevice::Instance->GetFormatFeatures(formatTexture); + _supportsShadows = FORMAT_FEATURES_ARE_SUPPORTED(formatFeaturesDepth.Support, FormatSupport::DepthStencil | FormatSupport::Texture2D) + && FORMAT_FEATURES_ARE_SUPPORTED(formatFeaturesTexture.Support, FormatSupport::ShaderSample | FormatSupport::ShaderSampleComparison); + if (!_supportsShadows) + { + LOG(Warning, "GPU doesn't support shadows rendering"); + LOG(Warning, "Format: {0} features support: {1}", (int32)SHADOW_MAPS_FORMAT, (uint32)formatFeaturesDepth.Support); + LOG(Warning, "Format: {0} features support: {1}", (int32)formatTexture, (uint32)formatFeaturesTexture.Support); + } + return false; } @@ -130,24 +144,27 @@ void ShadowsPass::updateShadowMapSize() // Select new size _currentShadowMapsQuality = Graphics::ShadowMapsQuality; - switch (_currentShadowMapsQuality) + if (_supportsShadows) { - case Quality::Ultra: - newSizeCSM = 2048; - newSizeCube = 1024; - break; - case Quality::High: - newSizeCSM = 1024; - newSizeCube = 1024; - break; - case Quality::Medium: - newSizeCSM = 1024; - newSizeCube = 512; - break; - case Quality::Low: - newSizeCSM = 512; - newSizeCube = 256; - break; + switch (_currentShadowMapsQuality) + { + case Quality::Ultra: + newSizeCSM = 2048; + newSizeCube = 1024; + break; + case Quality::High: + newSizeCSM = 1024; + newSizeCube = 1024; + break; + case Quality::Medium: + newSizeCSM = 1024; + newSizeCube = 512; + break; + case Quality::Low: + newSizeCSM = 512; + newSizeCube = 256; + break; + } } // Check if size will change @@ -194,7 +211,7 @@ bool ShadowsPass::CanRenderShadow(RenderContext& renderContext, const RendererPo const float fadeDistance = Math::Max(light.ShadowsFadeDistance, 0.1f); const float fade = 1 - Math::Saturate((dstLightToView - light.Radius - light.ShadowsDistance + fadeDistance) / fadeDistance); - return fade > ZeroTolerance; + return fade > ZeroTolerance && _supportsShadows; } bool ShadowsPass::CanRenderShadow(RenderContext& renderContext, const RendererSpotLightData& light) @@ -206,12 +223,12 @@ bool ShadowsPass::CanRenderShadow(RenderContext& renderContext, const RendererSp const float fadeDistance = Math::Max(light.ShadowsFadeDistance, 0.1f); const float fade = 1 - Math::Saturate((dstLightToView - light.Radius - light.ShadowsDistance + fadeDistance) / fadeDistance); - return fade > ZeroTolerance; + return fade > ZeroTolerance && _supportsShadows; } bool ShadowsPass::CanRenderShadow(RenderContext& renderContext, const RendererDirectionalLightData& light) { - return true; + return _supportsShadows; } void ShadowsPass::Prepare(RenderContext& renderContext, GPUContext* context) diff --git a/Source/Engine/Renderer/ShadowsPass.h b/Source/Engine/Renderer/ShadowsPass.h index 8deef8258..3d3190670 100644 --- a/Source/Engine/Renderer/ShadowsPass.h +++ b/Source/Engine/Renderer/ShadowsPass.h @@ -25,6 +25,7 @@ private: GPUPipelineStatePermutationsPs(Quality::MAX) * 2 * 2> _psShadowDir; GPUPipelineStatePermutationsPs(Quality::MAX) * 2> _psShadowPoint; GPUPipelineStatePermutationsPs(Quality::MAX) * 2> _psShadowSpot; + bool _supportsShadows; // Shadow maps stuff int32 _shadowMapsSizeCSM; From 8fd0af3f394a3f472b9857e34d370be34a4e612f Mon Sep 17 00:00:00 2001 From: "W2.Wizard" Date: Sun, 17 Jan 2021 10:18:30 +0100 Subject: [PATCH 36/46] Fixed Typos and padding --- Source/Editor/Content/Import/ModelImportEntry.cs | 4 ++-- Source/Editor/GUI/Docking/MasterDockPanel.cs | 2 +- Source/Editor/History/HistoryStack.cs | 2 +- Source/Editor/Scripting/ScriptsBuilder.cpp | 2 +- Source/Editor/Windows/AboutDialog.cs | 2 +- Source/Editor/Windows/Assets/SceneAnimationWindow.cs | 2 +- Source/Editor/Windows/GameWindow.cs | 4 ++-- Source/Engine/Content/Loading/ContentLoadingManager.cpp | 2 +- Source/Engine/Core/Log.cpp | 8 ++++---- Source/Engine/Core/ObjectsRemovalService.cpp | 2 +- Source/Engine/Engine/Engine.cpp | 2 +- .../Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp | 2 +- .../Engine/GraphicsDevice/DirectX/IncludeDirectXHeaders.h | 2 +- Source/Engine/GraphicsDevice/Vulkan/CmdBufferVulkan.cpp | 2 +- Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp | 2 +- Source/Engine/Particles/ParticleManager.cpp | 2 +- Source/Engine/Platform/Base/WindowsManager.cpp | 2 +- Source/Engine/Render2D/FontAsset.cpp | 2 +- Source/Engine/Utilities/RectPack.h | 2 +- 19 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Source/Editor/Content/Import/ModelImportEntry.cs b/Source/Editor/Content/Import/ModelImportEntry.cs index e7cbe96ea..37525e6d3 100644 --- a/Source/Editor/Content/Import/ModelImportEntry.cs +++ b/Source/Editor/Content/Import/ModelImportEntry.cs @@ -262,9 +262,9 @@ namespace FlaxEditor.Content.Import public int BaseLOD { get; set; } = 0; /// - /// The amount of LODs to include in the model (all reaming ones starting from Base LOD will be generated). + /// The amount of LODs to include in the model (all remaining ones starting from Base LOD will be generated). /// - [EditorOrder(1120), DefaultValue(4), Limit(1, Model.MaxLODs), EditorDisplay("Level Of Detail", "LOD Count"), Tooltip("The amount of LODs to include in the model (all reaming ones starting from Base LOD will be generated).")] + [EditorOrder(1120), DefaultValue(4), Limit(1, Model.MaxLODs), EditorDisplay("Level Of Detail", "LOD Count"), Tooltip("The amount of LODs to include in the model (all remaining ones starting from Base LOD will be generated).")] public int LODCount { get; set; } = 4; /// diff --git a/Source/Editor/GUI/Docking/MasterDockPanel.cs b/Source/Editor/GUI/Docking/MasterDockPanel.cs index f7acdbed4..a560de195 100644 --- a/Source/Editor/GUI/Docking/MasterDockPanel.cs +++ b/Source/Editor/GUI/Docking/MasterDockPanel.cs @@ -64,7 +64,7 @@ namespace FlaxEditor.GUI.Docking for (int i = 0; i < childPanels.Length; i++) childPanels[i].Dispose(); - // Delete reaming controls (except tabs proxy) + // Delete remaining controls (except tabs proxy) if (TabsProxy != null) TabsProxy.Parent = null; DisposeChildren(); diff --git a/Source/Editor/History/HistoryStack.cs b/Source/Editor/History/HistoryStack.cs index c7a63efc4..e2d828ce9 100644 --- a/Source/Editor/History/HistoryStack.cs +++ b/Source/Editor/History/HistoryStack.cs @@ -74,7 +74,7 @@ namespace FlaxEditor.History _reverseActions.PushBack(reverse[i]); } - // Cleanup reaming actions + // Cleanup remaining actions for (int i = _historyActionsLimit; i < history.Length; i++) { history[i].Dispose(); diff --git a/Source/Editor/Scripting/ScriptsBuilder.cpp b/Source/Editor/Scripting/ScriptsBuilder.cpp index 7d581fa8a..7cced3e36 100644 --- a/Source/Editor/Scripting/ScriptsBuilder.cpp +++ b/Source/Editor/Scripting/ScriptsBuilder.cpp @@ -567,7 +567,7 @@ bool ScriptsBuilderService::Init() LOG(Warning, "Missing EditorTarget property in opened project, using deducted target name {0}", Editor::Project->EditorTarget); } - // Remove any reaming files from previous Editor run hot-reloads + // Remove any remaining files from previous Editor run hot-reloads const Char *target, *platform, *architecture, *configuration; ScriptsBuilder::GetBinariesConfiguration(target, platform, architecture, configuration); if (target) diff --git a/Source/Editor/Windows/AboutDialog.cs b/Source/Editor/Windows/AboutDialog.cs index 03e60f43c..bb320fb87 100644 --- a/Source/Editor/Windows/AboutDialog.cs +++ b/Source/Editor/Windows/AboutDialog.cs @@ -115,7 +115,7 @@ namespace FlaxEditor.Windows { var thirdPartyPanel = new Panel(ScrollBars.Vertical) { - Bounds = new Rectangle(0, topParentControl.Bottom + 4, Width, Height - topParentControl.Bottom - 24), + Bounds = new Rectangle(4, topParentControl.Bottom + 4, Width - 8, Height - topParentControl.Bottom - 24), Parent = this }; var thirdPartyEntries = new[] diff --git a/Source/Editor/Windows/Assets/SceneAnimationWindow.cs b/Source/Editor/Windows/Assets/SceneAnimationWindow.cs index cbed724bc..95421585d 100644 --- a/Source/Editor/Windows/Assets/SceneAnimationWindow.cs +++ b/Source/Editor/Windows/Assets/SceneAnimationWindow.cs @@ -490,7 +490,7 @@ namespace FlaxEditor.Windows.Assets } if (_player.IsStopped || _player.Time >= _options.EndTime) { - // End rendering but perform reaming copies of the staging textures so all data is captured (from GPU to CPU) + // End rendering but perform remaining copies of the staging textures so all data is captured (from GPU to CPU) _state = States.Staging; break; } diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs index a29869825..35bc91bbe 100644 --- a/Source/Editor/Windows/GameWindow.cs +++ b/Source/Editor/Windows/GameWindow.cs @@ -222,7 +222,7 @@ namespace FlaxEditor.Windows private void PlayingStateOnSceneDuplicating() { - // Remove reaming GUI controls so loaded scene can add own GUI + // Remove remaining GUI controls so loaded scene can add own GUI //_guiRoot.DisposeChildren(); // Show GUI @@ -231,7 +231,7 @@ namespace FlaxEditor.Windows private void PlayingStateOnSceneRestored() { - // Remove reaming GUI controls so loaded scene can add own GUI + // Remove remaining GUI controls so loaded scene can add own GUI //_guiRoot.DisposeChildren(); // Hide GUI diff --git a/Source/Engine/Content/Loading/ContentLoadingManager.cpp b/Source/Engine/Content/Loading/ContentLoadingManager.cpp index ac2dd8257..6e6ff7a65 100644 --- a/Source/Engine/Content/Loading/ContentLoadingManager.cpp +++ b/Source/Engine/Content/Loading/ContentLoadingManager.cpp @@ -208,7 +208,7 @@ void ContentLoadingManagerService::Dispose() MainThread = nullptr; ThisThread = nullptr; - // Cancel all reaming tasks (no chance to execute them) + // Cancel all remaining tasks (no chance to execute them) Tasks.CancelAll(); } diff --git a/Source/Engine/Core/Log.cpp b/Source/Engine/Core/Log.cpp index 2213672c9..cb73a79e1 100644 --- a/Source/Engine/Core/Log.cpp +++ b/Source/Engine/Core/Log.cpp @@ -51,18 +51,18 @@ bool Log::Logger::Init() { // Check if there are any files to delete const int32 maxLogFiles = 20; - int32 reaming = oldLogs.Count() - maxLogFiles + 1; - if (reaming > 0) + int32 remaining = oldLogs.Count() - maxLogFiles + 1; + if (remaining > 0) { Sorting::QuickSort(oldLogs.Get(), oldLogs.Count()); // Delete the oldest logs int32 i = 0; - while (reaming > 0) + while (remaining > 0) { FileSystem::DeleteFile(oldLogs[i++]); filesDeleted++; - reaming--; + remaining--; } } } diff --git a/Source/Engine/Core/ObjectsRemovalService.cpp b/Source/Engine/Core/ObjectsRemovalService.cpp index a36265646..f9d26f808 100644 --- a/Source/Engine/Core/ObjectsRemovalService.cpp +++ b/Source/Engine/Core/ObjectsRemovalService.cpp @@ -193,7 +193,7 @@ void ObjectsRemovalServiceService::Dispose() // Collect new objects ObjectsRemovalService::Flush(); - // Delete all reaming objects + // Delete all remaining objects { ScopeLock lock(PoolLocker); for (auto i = Pool.Begin(); i.IsNotEnd(); ++i) diff --git a/Source/Engine/Engine/Engine.cpp b/Source/Engine/Engine/Engine.cpp index ebf268957..140f1b4a0 100644 --- a/Source/Engine/Engine/Engine.cpp +++ b/Source/Engine/Engine/Engine.cpp @@ -463,7 +463,7 @@ void Engine::OnExit() LOG_FLUSH(); - // Kill all reaming threads + // Kill all remaining threads ThreadRegistry::KillEmAll(); // Cleanup diff --git a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp index ce36a7347..4d1bd3e17 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUContextDX12.cpp @@ -216,7 +216,7 @@ uint64 GPUContextDX12::Execute(bool waitForCompletion) ASSERT(_currentAllocator != nullptr); auto queue = _device->GetCommandQueue(); - // Flush reaming and buffered commands + // Flush remaining and buffered commands FlushState(); _currentState = nullptr; diff --git a/Source/Engine/GraphicsDevice/DirectX/IncludeDirectXHeaders.h b/Source/Engine/GraphicsDevice/DirectX/IncludeDirectXHeaders.h index 8351deb71..ea621c22a 100644 --- a/Source/Engine/GraphicsDevice/DirectX/IncludeDirectXHeaders.h +++ b/Source/Engine/GraphicsDevice/DirectX/IncludeDirectXHeaders.h @@ -8,7 +8,7 @@ #include "Engine/Platform/Win32/IncludeWindowsHeaders.h" #include "Engine/Platform/Windows/ComPtr.h" -// Helper define to dispose the COM object with reaming references counter checking +// Helper define to dispose the COM object with remaining references counter checking #define DX_SAFE_RELEASE_CHECK(x, refs) if(x) { auto res = (x)->Release(); (x) = nullptr; CHECK(res == refs); } #endif diff --git a/Source/Engine/GraphicsDevice/Vulkan/CmdBufferVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/CmdBufferVulkan.cpp index c327fd32a..f9a39574c 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/CmdBufferVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/CmdBufferVulkan.cpp @@ -44,7 +44,7 @@ void CmdBufferVulkan::End() ASSERT(IsOutsideRenderPass()); #if GPU_ALLOW_PROFILE_EVENTS - // End reaming events + // End remaining events while (_eventsBegin--) vkCmdEndDebugUtilsLabelEXT(GetHandle()); #endif diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp index ea8fa6502..e8f770831 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp @@ -1155,7 +1155,7 @@ void GPUContextVulkan::FlushState() void GPUContextVulkan::Flush() { - // Flush reaming and buffered commands + // Flush remaining and buffered commands FlushState(); _currentState = nullptr; diff --git a/Source/Engine/Particles/ParticleManager.cpp b/Source/Engine/Particles/ParticleManager.cpp index 0e5640545..40cebd892 100644 --- a/Source/Engine/Particles/ParticleManager.cpp +++ b/Source/Engine/Particles/ParticleManager.cpp @@ -1172,7 +1172,7 @@ void ParticleManagerService::Update() // Update bounds after first system update updateBounds = true; } - // TODO: if using fixed timestep quantize the dt and accumulate reaming part for the next update? + // TODO: if using fixed timestep quantize the dt and accumulate remaining part for the next update? if (dt <= 1.0f / 240.0f) continue; dt *= effect->SimulationSpeed; diff --git a/Source/Engine/Platform/Base/WindowsManager.cpp b/Source/Engine/Platform/Base/WindowsManager.cpp index b49cbd058..75082c4f9 100644 --- a/Source/Engine/Platform/Base/WindowsManager.cpp +++ b/Source/Engine/Platform/Base/WindowsManager.cpp @@ -77,7 +77,7 @@ void WindowsManagerService::Update() void WindowsManagerService::Dispose() { - // Close reaming windows + // Close remaining windows WindowsManager::WindowsLocker.Lock(); auto windows = WindowsManager::Windows; for (auto& win : windows) diff --git a/Source/Engine/Render2D/FontAsset.cpp b/Source/Engine/Render2D/FontAsset.cpp index cf2571e4a..8b14b1cfc 100644 --- a/Source/Engine/Render2D/FontAsset.cpp +++ b/Source/Engine/Render2D/FontAsset.cpp @@ -55,7 +55,7 @@ void FontAsset::unload(bool isReloading) // Ensure to cleanup child font objects if (_fonts.HasItems()) { - LOG(Warning, "Font asset {0} is unloading but has {1} reaming font objects created", ToString(), _fonts.Count()); + LOG(Warning, "Font asset {0} is unloading but has {1} remaining font objects created", ToString(), _fonts.Count()); for (auto font : _fonts) { font->_asset = nullptr; diff --git a/Source/Engine/Utilities/RectPack.h b/Source/Engine/Utilities/RectPack.h index f020b0481..a8ffb0b7e 100644 --- a/Source/Engine/Utilities/RectPack.h +++ b/Source/Engine/Utilities/RectPack.h @@ -25,7 +25,7 @@ struct RectPack SizeType Width; SizeType Height; - // The reaming space amount inside this slot (updated on every insertion, initial it equal to width*height). + // The remaining space amount inside this slot (updated on every insertion, initial it equal to width*height). SizeType SpaceLeft; // True, if slot has been allocated, otherwise it's free. From edb103f8e729092a777a0bdb4d85556374629ebe Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sun, 17 Jan 2021 12:13:48 +0100 Subject: [PATCH 37/46] Fix NearEqual (GPU Particle) missing implementation. --- Source/Engine/Visject/ShaderGraph.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Visject/ShaderGraph.cpp b/Source/Engine/Visject/ShaderGraph.cpp index 61c609307..c7db3b41b 100644 --- a/Source/Engine/Visject/ShaderGraph.cpp +++ b/Source/Engine/Visject/ShaderGraph.cpp @@ -380,6 +380,15 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value) Value v2 = tryGetValue(node->GetBox(1), Value::Zero); value = writeFunction2(node, v1, v2, TEXT("atan2")); break; + } + // Near Equal + case 42: + { + Value v1 = tryGetValue(node->GetBox(0), Value::Zero); + Value v2 = tryGetValue(node->GetBox(1), Value::Zero).Cast(v1.Type); + Value epsilon = tryGetValue(node->GetBox(2), 2, Value::Zero); + value = writeLocal(ValueType::Bool, String::Format(TEXT("(distance({0},{1}) < {2})"), v1.Value, v2.Value, epsilon.Value), node); + break; } // Degrees case 43: @@ -911,7 +920,7 @@ void ShaderGenerator::ProcessGroupComparisons(Box* box, Node* node, Value& value const Value condition = tryGetValue(node->GetBox(0), Value::False).AsBool(); const Value onTrue = tryGetValue(node->GetBox(2), 1, Value::Zero); const Value onFalse = tryGetValue(node->GetBox(1), 0, Value::Zero).Cast(onTrue.Type); - value = writeLocal(onTrue.Type, String::Format(TEXT("({0}) ? ({1}) : ({2})"), condition.Value, onTrue.Value, onFalse.Value), node); + value = writeLocal(onTrue.Type, String::Format(TEXT("{0} ? {1} : {2}"), condition.Value, onTrue.Value, onFalse.Value), node); break; } } From 50f87c8bfb972fac830c5e5f5cef94009c997cf8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Sun, 17 Jan 2021 12:36:53 +0100 Subject: [PATCH 38/46] Remove unused (). --- Source/Engine/Visject/ShaderGraph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Visject/ShaderGraph.cpp b/Source/Engine/Visject/ShaderGraph.cpp index c7db3b41b..7b3c51f3e 100644 --- a/Source/Engine/Visject/ShaderGraph.cpp +++ b/Source/Engine/Visject/ShaderGraph.cpp @@ -387,7 +387,7 @@ void ShaderGenerator::ProcessGroupMath(Box* box, Node* node, Value& value) Value v1 = tryGetValue(node->GetBox(0), Value::Zero); Value v2 = tryGetValue(node->GetBox(1), Value::Zero).Cast(v1.Type); Value epsilon = tryGetValue(node->GetBox(2), 2, Value::Zero); - value = writeLocal(ValueType::Bool, String::Format(TEXT("(distance({0},{1}) < {2})"), v1.Value, v2.Value, epsilon.Value), node); + value = writeLocal(ValueType::Bool, String::Format(TEXT("distance({0},{1}) < {2}"), v1.Value, v2.Value, epsilon.Value), node); break; } // Degrees From c4e6d013c11210c157b5931e71c1c72b98c123eb Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 18 Jan 2021 22:47:31 +0100 Subject: [PATCH 39/46] Add more splash screen quotes --- Source/Editor/Windows/SplashScreen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Editor/Windows/SplashScreen.cpp b/Source/Editor/Windows/SplashScreen.cpp index 98578950f..1e4ff0af0 100644 --- a/Source/Editor/Windows/SplashScreen.cpp +++ b/Source/Editor/Windows/SplashScreen.cpp @@ -110,6 +110,9 @@ const Char* SplashScreenQuotes[] = TEXT("You have my bow.\nAnd my axe!"), TEXT("To the bridge of Khazad-dum."), TEXT("One ring to rule them all.\nOne ring to find them."), + TEXT("Ladies and gentelman, we got him"), + TEXT("Cyberpunk of game engines"), + TEXT("That's what she said"), }; SplashScreen::~SplashScreen() From bd7a681700160a43915b35e24dc6396eb0402aec Mon Sep 17 00:00:00 2001 From: stefnotch Date: Tue, 19 Jan 2021 21:08:26 +0100 Subject: [PATCH 40/46] Add more descriptive error message --- Source/Editor/Cooker/Steps/ValidateStep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Cooker/Steps/ValidateStep.cpp b/Source/Editor/Cooker/Steps/ValidateStep.cpp index 219301544..fdebca0a7 100644 --- a/Source/Editor/Cooker/Steps/ValidateStep.cpp +++ b/Source/Editor/Cooker/Steps/ValidateStep.cpp @@ -60,7 +60,7 @@ bool ValidateStep::Perform(CookingData& data) AssetInfo info; if (!Content::GetAssetInfo(GameSettings::FirstScene, info)) { - data.Error(TEXT("Missing first scene.")); + data.Error(TEXT("Missing first scene. Set it in the game settings.")); return true; } } From 0a0c856a64c110dd203203a9058ebf69ffae8070 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 19 Jan 2021 21:10:45 +0100 Subject: [PATCH 41/46] Add more splash screen quotes --- Source/Editor/Windows/SplashScreen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Editor/Windows/SplashScreen.cpp b/Source/Editor/Windows/SplashScreen.cpp index 1e4ff0af0..b05c73761 100644 --- a/Source/Editor/Windows/SplashScreen.cpp +++ b/Source/Editor/Windows/SplashScreen.cpp @@ -113,6 +113,8 @@ const Char* SplashScreenQuotes[] = TEXT("Ladies and gentelman, we got him"), TEXT("Cyberpunk of game engines"), TEXT("That's what she said"), + TEXT("Compiling Shaders (93,788)"), + TEXT("Hi There"), }; SplashScreen::~SplashScreen() From 75d197cb847065ae5e2ec4ad6240de1836a1197f Mon Sep 17 00:00:00 2001 From: intolerantape Date: Tue, 19 Jan 2021 23:02:33 -0800 Subject: [PATCH 42/46] Spelling fixes. --- Source/Editor/Surface/AnimGraphSurface.cs | 4 ++-- Source/Editor/Surface/Archetypes/Animation.cs | 4 ++-- Source/Engine/Animations/Graph/AnimGroup.Animation.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Editor/Surface/AnimGraphSurface.cs b/Source/Editor/Surface/AnimGraphSurface.cs index 8621ed257..abffc4432 100644 --- a/Source/Editor/Surface/AnimGraphSurface.cs +++ b/Source/Editor/Surface/AnimGraphSurface.cs @@ -65,8 +65,8 @@ namespace FlaxEditor.Surface NodeElementArchetype.Factory.Output(0, "Length", typeof(float), 0), NodeElementArchetype.Factory.Output(1, "Time", typeof(float), 1), NodeElementArchetype.Factory.Output(2, "Normalized Time", typeof(float), 2), - NodeElementArchetype.Factory.Output(3, "Reaming Time", typeof(float), 3), - NodeElementArchetype.Factory.Output(4, "Reaming Normalized Time", typeof(float), 4), + NodeElementArchetype.Factory.Output(3, "Remaining Time", typeof(float), 3), + NodeElementArchetype.Factory.Output(4, "Remaining Normalized Time", typeof(float), 4), } }, } diff --git a/Source/Editor/Surface/Archetypes/Animation.cs b/Source/Editor/Surface/Archetypes/Animation.cs index b27fb9bd6..2ec196e13 100644 --- a/Source/Editor/Surface/Archetypes/Animation.cs +++ b/Source/Editor/Surface/Archetypes/Animation.cs @@ -764,8 +764,8 @@ namespace FlaxEditor.Surface.Archetypes NodeElementArchetype.Factory.Output(0, "Length", typeof(float), 0), NodeElementArchetype.Factory.Output(1, "Time", typeof(float), 1), NodeElementArchetype.Factory.Output(2, "Normalized Time", typeof(float), 2), - NodeElementArchetype.Factory.Output(3, "Reaming Time", typeof(float), 3), - NodeElementArchetype.Factory.Output(4, "Reaming Normalized Time", typeof(float), 4), + NodeElementArchetype.Factory.Output(3, "Remaining Time", typeof(float), 3), + NodeElementArchetype.Factory.Output(4, "Remaining Normalized Time", typeof(float), 4), } }, new NodeArchetype diff --git a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp index 8f43506d2..1a26318a1 100644 --- a/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp +++ b/Source/Engine/Animations/Graph/AnimGroup.Animation.cpp @@ -1489,11 +1489,11 @@ void AnimGraphExecutor::ProcessGroupAnimation(Box* boxBase, Node* nodeBase, Valu case 2: value = transitionsData.Position / transitionsData.Length; break; - // Reaming Time + // Remaining Time case 3: value = transitionsData.Length - transitionsData.Position; break; - // Reaming Normalized Time + // Remaining Normalized Time case 4: value = 1.0f - (transitionsData.Position / transitionsData.Length); break; From ea489fbf2a57f9bb8f8489f04cdcb6d85bd72509 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 20 Jan 2021 13:11:45 +0100 Subject: [PATCH 43/46] Fix crash in motion blur tile size calculation --- Source/Engine/Renderer/MotionBlurPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Renderer/MotionBlurPass.cpp b/Source/Engine/Renderer/MotionBlurPass.cpp index 609712e1f..46b2ccd8f 100644 --- a/Source/Engine/Renderer/MotionBlurPass.cpp +++ b/Source/Engine/Renderer/MotionBlurPass.cpp @@ -285,7 +285,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP PROFILE_GPU_CPU("Motion Blur"); // Setup shader inputs - const int32 maxBlurSize = (int32)((float)motionVectorsHeight * 0.05f); + const int32 maxBlurSize = Math::Max((int32)((float)motionVectorsHeight * 0.05f), 1); const int32 tileSize = Math::AlignUp(maxBlurSize, 8); const float timeScale = renderContext.Task->View.IsOfflinePass ? 1.0f : 1.0f / Time::Draw.UnscaledDeltaTime.GetTotalSeconds() / 60.0f; // 60fps as a reference Data data; From ef5e98efaa7fc3552ba43efaf3046dcc4b10cfe8 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 20 Jan 2021 13:12:11 +0100 Subject: [PATCH 44/46] Fix assertion during engine shutdown after crash during rendering --- Source/Engine/Graphics/Graphics.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Engine/Graphics/Graphics.cpp b/Source/Engine/Graphics/Graphics.cpp index 21b506ef1..69170dca0 100644 --- a/Source/Engine/Graphics/Graphics.cpp +++ b/Source/Engine/Graphics/Graphics.cpp @@ -49,6 +49,9 @@ GraphicsService GraphicsServiceInstance; void Graphics::DisposeDevice() { + // Clean any danging pointer to last task (might stay if engine is disposing after crash) + GPUDevice::Instance->CurrentTask = nullptr; + if (GPUDevice::Instance) { GPUDevice::Instance->Dispose(); From 8dce3c0fb76b7dc35abe9fd8cdc81605cb315d2e Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 20 Jan 2021 13:38:42 +0100 Subject: [PATCH 45/46] Fix missing animated model parameter error --- Source/Engine/Level/Actors/AnimatedModel.cpp | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Source/Engine/Level/Actors/AnimatedModel.cpp b/Source/Engine/Level/Actors/AnimatedModel.cpp index cf3e71f13..3d6450716 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.cpp +++ b/Source/Engine/Level/Actors/AnimatedModel.cpp @@ -146,8 +146,32 @@ void AnimatedModel::GetNodeTransformation(const StringView& nodeName, Matrix& no GetNodeTransformation(SkinnedModel ? SkinnedModel->FindNode(nodeName) : -1, nodeTransformation, worldSpace); } +#define CHECK_ANIM_GRAPH_PARAM_ACCESS() \ + if (!AnimationGraph) \ + { \ + LOG(Warning, "Missing animation graph for animated model '{0}'", ToString()); \ + return; \ + } \ + if (AnimationGraph->WaitForLoaded()) \ + { \ + LOG(Warning, "Failed to load animation graph for animated model '{0}'", ToString()); \ + return; \ + } +#define CHECK_ANIM_GRAPH_PARAM_ACCESS_RESULT(result) \ + if (!AnimationGraph) \ + { \ + LOG(Warning, "Missing animation graph for animated model '{0}'", ToString()); \ + return result; \ + } \ + if (AnimationGraph->WaitForLoaded()) \ + { \ + LOG(Warning, "Failed to load animation graph for animated model '{0}'", ToString()); \ + return result; \ + } + AnimGraphParameter* AnimatedModel::GetParameter(const StringView& name) { + CHECK_ANIM_GRAPH_PARAM_ACCESS_RESULT(nullptr); for (auto& param : GraphInstance.Parameters) { if (param.Name == name) @@ -159,6 +183,7 @@ AnimGraphParameter* AnimatedModel::GetParameter(const StringView& name) Variant AnimatedModel::GetParameterValue(const StringView& name) { + CHECK_ANIM_GRAPH_PARAM_ACCESS_RESULT(Variant::Null); for (auto& param : GraphInstance.Parameters) { if (param.Name == name) @@ -170,6 +195,7 @@ Variant AnimatedModel::GetParameterValue(const StringView& name) void AnimatedModel::SetParameterValue(const StringView& name, const Variant& value) { + CHECK_ANIM_GRAPH_PARAM_ACCESS(); for (auto& param : GraphInstance.Parameters) { if (param.Name == name) @@ -183,6 +209,7 @@ void AnimatedModel::SetParameterValue(const StringView& name, const Variant& val Variant AnimatedModel::GetParameterValue(const Guid& id) { + CHECK_ANIM_GRAPH_PARAM_ACCESS_RESULT(Variant::Null); for (auto& param : GraphInstance.Parameters) { if (param.Identifier == id) @@ -194,6 +221,7 @@ Variant AnimatedModel::GetParameterValue(const Guid& id) void AnimatedModel::SetParameterValue(const Guid& id, const Variant& value) { + CHECK_ANIM_GRAPH_PARAM_ACCESS(); for (auto& param : GraphInstance.Parameters) { if (param.Identifier == id) From 8680aba8971e06248a60e937d0013e312178b2e2 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 20 Jan 2021 13:45:49 +0100 Subject: [PATCH 46/46] Fix missing public empty constructor for UICanvas --- Source/Engine/UI/UICanvas.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Engine/UI/UICanvas.cs b/Source/Engine/UI/UICanvas.cs index f07910975..e0b6425de 100644 --- a/Source/Engine/UI/UICanvas.cs +++ b/Source/Engine/UI/UICanvas.cs @@ -228,7 +228,10 @@ namespace FlaxEngine } } - private UICanvas() + /// + /// Initializes a new instance of the class. + /// + public UICanvas() { _guiRoot = new CanvasRootControl(this); _guiRoot.IsLayoutLocked = false;