Merge remote-tracking branch 'origin/master' into 1.1

# Conflicts:
#	Source/Engine/Navigation/NavMesh.cpp
#	Source/Engine/Navigation/NavMeshBuilder.cpp
This commit is contained in:
Wojtek Figat
2021-01-22 11:31:22 +01:00
178 changed files with 1163 additions and 864 deletions

BIN
Content/Shaders/BakeLightmap.flax (Stored with Git LFS)

Binary file not shown.

BIN
Content/Shaders/BitonicSort.flax (Stored with Git LFS)

Binary file not shown.

View File

@@ -262,9 +262,9 @@ namespace FlaxEditor.Content.Import
public int BaseLOD { get; set; } = 0;
/// <summary>
/// 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).
/// </summary>
[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;
/// <summary>

View File

@@ -146,7 +146,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;
}
}

View File

@@ -28,7 +28,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"));

View File

@@ -48,7 +48,7 @@ public:
/// <summary>
/// Gets the value indicating whenever platform requires AOT.
/// </summary>
/// <returns>True if platform uses AOT and needs C# assemblies to be be precompiled, otherwise false.</returns>
/// <returns>True if platform uses AOT and needs C# assemblies to be precompiled, otherwise false.</returns>
virtual bool UseAOT() const
{
return false;

View File

@@ -65,7 +65,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;
}
}

View File

@@ -43,7 +43,7 @@ public:
public:
/// <summary>
/// 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.
/// </summary>
static bool IsOldProjectOpened;

View File

@@ -222,7 +222,7 @@ namespace FlaxEditor.GUI
}
/// <summary>
/// Filters teh given value using the the <see cref="UseMode"/>.
/// Filters the given value using the <see cref="UseMode"/>.
/// </summary>
/// <param name="mode">The mode.</param>
/// <param name="value">The value to process.</param>

View File

@@ -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)
{

View File

@@ -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();

View File

@@ -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;
}

View File

@@ -120,7 +120,7 @@ namespace FlaxEditor.GUI
/// <summary>
/// Draws the column.
/// </summary>
/// <param name="rect">The the header area rectangle.</param>
/// <param name="rect">The header area rectangle.</param>
/// <param name="columnIndex">The zero-based index of the column.</param>
protected virtual void DrawColumn(ref Rectangle rect, int columnIndex)
{

View File

@@ -402,7 +402,7 @@ namespace FlaxEditor.GUI
}
/// <summary>
/// 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.
/// </summary>
/// <param name="point">The point.</param>
/// <param name="keyframesContentAreaBounds">The keyframes contents area bounds.</param>

View File

@@ -179,7 +179,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
}
/// <summary>
/// Evaluates the member value value at the specified time.
/// Evaluates the member value at the specified time.
/// </summary>
/// <param name="time">The time to evaluate the member at.</param>
/// <returns>The member value at provided time.</returns>

View File

@@ -7,7 +7,7 @@ using FlaxEngine;
namespace FlaxEditor.Gizmo
{
/// <summary>
/// Represents collection of Gizmo tools where one is active and in use.
/// Represents collection of gizmo tools where one is active and in use.
/// </summary>
/// <seealso cref="GizmoBase" />
[HideInEditor]

View File

@@ -45,7 +45,7 @@ namespace FlaxEditor.Gizmo
)
{
// Error
Platform.Fatal("Failed to load Transform Gizmo resources.");
Platform.Fatal("Failed to load transform gizmo resources.");
}
}

View File

@@ -104,7 +104,7 @@ namespace FlaxEditor.Gizmo
public Axis ActiveAxis => _activeAxis;
/// <summary>
/// Gets or sts the current gizmo mode.
/// Gets or sets the current gizmo mode.
/// </summary>
public Mode ActiveMode
{

View File

@@ -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;
}
}

View File

@@ -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();

View File

@@ -108,7 +108,7 @@ namespace FlaxEditor.Modules
/// <summary>
/// Removes a quick action by name.
/// </summary>
/// <param name="name">Thr action's name.</param>
/// <param name="name">The action's name.</param>
/// <returns>True when it succeed, false if there is no Quick Action with this name.</returns>
public bool RemoveQuickAction(string name)
{

View File

@@ -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)
{

View File

@@ -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)
{
@@ -971,7 +971,7 @@ namespace FlaxEditor.Modules
}
#region Window Events
private void OnEditorStateChanged()
{
for (int i = 0; i < Windows.Count; i++)

View File

@@ -41,7 +41,7 @@ namespace FlaxEditor.Options
private readonly Dictionary<string, CreateCustomSettingsDelegate> _customSettings = new Dictionary<string, CreateCustomSettingsDelegate>();
/// <summary>
/// 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.
/// </summary>
public IReadOnlyDictionary<string, CreateCustomSettingsDelegate> CustomSettings => _customSettings;

View File

@@ -80,7 +80,7 @@ namespace FlaxEditor.Progress
}
/// <summary>
/// Called when progress action gets updated (changed nfo text or progress value).
/// Called when progress action gets updated (changed info text or progress value).
/// </summary>
/// <param name="progress">The progress (normalized to range [0;1]).</param>
/// <param name="infoText">The information text.</param>

View File

@@ -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;
}

View File

@@ -49,7 +49,7 @@ public:
{
if (dwRejectType == SERVERCALL_RETRYLATER)
{
// Retry immediatey
// Retry immediately
return 99;
}

View File

@@ -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)

View File

@@ -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),
}
},
}

View File

@@ -1046,7 +1046,7 @@ namespace FlaxEditor.Surface.Archetypes
startPos += nrm;
endPos += nrm;
// Swap fo the other arrow
// Swap to the other arrow
if (!diff)
{
var tmp = startPos;

View File

@@ -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

View File

@@ -1177,7 +1177,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;
@@ -1564,7 +1564,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)

View File

@@ -32,7 +32,7 @@ namespace FlaxEditor.Surface.Archetypes
public Dictionary<Type, NodeElementArchetype[]> Prototypes = DefaultPrototypes;
/// <summary>
/// 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.
/// </summary>
public static readonly Dictionary<Type, NodeElementArchetype[]> DefaultPrototypes = new Dictionary<Type, NodeElementArchetype[]>
{

View File

@@ -107,7 +107,7 @@ namespace FlaxEditor.Surface
/// Validates the parameter drag operation.
/// </summary>
/// <param name="parameterName">Name of the parameter.</param>
/// <returns>Tre if can drag that parameter, otherwise false.</returns>
/// <returns>True if can drag that parameter, otherwise false.</returns>
protected virtual bool ValidateDragParameter(string parameterName)
{
return GetParameter(parameterName) != null;

View File

@@ -76,7 +76,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();

View File

@@ -21,6 +21,7 @@ namespace FlaxEditor.Tools.Foliage
private readonly Tabs _modes;
private readonly ContainerControl _noFoliagePanel;
private int _selectedFoliageTypeIndex = -1;
private Button _createNewFoliage;
/// <summary>
/// The editor instance.
@@ -99,6 +100,7 @@ namespace FlaxEditor.Tools.Foliage
public FoliageTab(SpriteHandle icon, Editor editor)
: base(string.Empty, icon)
{
Level.SceneLoaded += 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 += OnSceneUnloaded;
Level.SceneLoaded -= OnSceneLoaded;
}
private void OnSceneUnloaded(Scene arg1, Guid arg2)
{
_createNewFoliage.Enabled = false;
Level.SceneLoaded += OnSceneLoaded;
Level.SceneUnloaded -= OnSceneUnloaded;
}
private void OnSelected(Tab tab)
@@ -248,5 +267,16 @@ namespace FlaxEditor.Tools.Foliage
{
SelectedFoliageTypesChanged?.Invoke();
}
/// <inheritdoc />
public override void OnDestroy()
{
if (_createNewFoliage.Enabled)
Level.SceneUnloaded -= OnSceneUnloaded;
else
Level.SceneLoaded -= OnSceneLoaded;
base.OnDestroy();
}
}
}

View File

@@ -18,6 +18,7 @@ namespace FlaxEditor.Tools.Terrain
{
private readonly Tabs _modes;
private readonly ContainerControl _noTerrainPanel;
private readonly Button _createTerrainButton;
/// <summary>
/// The editor instance.
@@ -57,6 +58,7 @@ namespace FlaxEditor.Tools.Terrain
public CarveTab(SpriteHandle icon, Editor editor)
: base(string.Empty, icon)
{
Level.SceneLoaded += 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 += OnSceneUnloaded;
Level.SceneLoaded -= OnSceneLoaded;
}
private void OnSceneUnloaded(Scene arg1, Guid arg2)
{
_createTerrainButton.Enabled = false;
Level.SceneLoaded += OnSceneLoaded;
Level.SceneUnloaded -= OnSceneUnloaded;
}
private void OnSelected(Tab tab)
@@ -183,5 +202,16 @@ namespace FlaxEditor.Tools.Terrain
default: throw new IndexOutOfRangeException("Invalid carve tab mode.");
}
}
/// <inheritdoc />
public override void OnDestroy()
{
if (_createTerrainButton.Enabled)
Level.SceneUnloaded -= OnSceneUnloaded;
else
Level.SceneLoaded -= OnSceneLoaded;
base.OnDestroy();
}
}
}

View File

@@ -33,7 +33,7 @@ namespace FlaxEditor.Tools.Terrain.Paint
}
/// <summary>
/// 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.
/// </summary>
[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;

View File

@@ -33,7 +33,7 @@ namespace FlaxEditor.Tools.Terrain.Sculpt
}
/// <summary>
/// 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.
/// </summary>
[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;

View File

@@ -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"

View File

@@ -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;

View File

@@ -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"
@@ -247,7 +245,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++)

View File

@@ -251,7 +251,7 @@ namespace FlaxEditor.Utilities
var list = new List<MemberComparison>();
#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--)
{

View File

@@ -126,7 +126,7 @@ namespace FlaxEditor.Utilities
/// </summary>
/// <param name="oper1">The first operator.</param>
/// <param name="oper2">The second operator.</param>
/// <returns>The comparision result.</returns>
/// <returns>The comparison result.</returns>
private static bool CompareOperators(string oper1, string oper2)
{
var op1 = Operators[oper1];

View File

@@ -743,6 +743,7 @@ namespace FlaxEditor.Utilities
case VariantType.Array: return new ScriptType(typeof(object[]));
case VariantType.Dictionary: return new ScriptType(typeof(Dictionary<object, object>));
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.");
}
}
@@ -806,6 +807,7 @@ namespace FlaxEditor.Utilities
case VariantType.Array: return typeof(object[]);
case VariantType.Dictionary: return typeof(Dictionary<object, object>);
case VariantType.ManagedObject: return typeof(object);
case VariantType.Blob: return typeof(byte[]);
default: throw new ArgumentOutOfRangeException($"Unknown Variant Type {variantType} without typename.");
}
}

View File

@@ -24,7 +24,7 @@ namespace FlaxEditor.Viewport.Cameras
public bool IsAnimatingMove => _moveStartTime > Mathf.Epsilon;
/// <summary>
/// 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.
/// </summary>
public Vector3 TargetPoint = new Vector3(-200);

View File

@@ -528,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");
@@ -1193,6 +1205,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,

View File

@@ -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[]

View File

@@ -288,7 +288,7 @@ namespace FlaxEditor.Windows.Assets
public abstract class AssetEditorWindowBase<T> : AssetEditorWindow where T : Asset
{
/// <summary>
/// Flag set to true if window is is waiting for asset to be loaded (to send <see cref="OnAssetLoaded"/> or <see cref="OnAssetLoadFailed"/> events).
/// Flag set to true if window is waiting for asset to be loaded (to send <see cref="OnAssetLoaded"/> or <see cref="OnAssetLoadFailed"/> events).
/// </summary>
protected bool _isWaitingForLoaded;

View File

@@ -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;
}

View File

@@ -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

View File

@@ -110,6 +110,11 @@ 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"),
TEXT("Compiling Shaders (93,788)"),
TEXT("Hi There"),
};
SplashScreen::~SplashScreen()

View File

@@ -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;

View File

@@ -199,7 +199,7 @@ public:
/// Gets the current state of the audio playback (playing/paused/stopped).
/// </summary>
/// <returns>The value.</returns>
API_PROPERTY() FORCE_INLINE States GetState() const
API_PROPERTY() FORCE_INLINE AudioSource::States GetState() const
{
return _state;
}

View File

@@ -22,7 +22,7 @@ bool CSG::Mesh::Triangulate(RawData& data, Array<RawModelVertex>& cacheVB) const
Array<RawModelVertex> 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<int32, Dictionary<int32, Array<int32>>> polygonsPerBrush(64);
// Build index buffer
@@ -115,8 +115,8 @@ bool CSG::Mesh::Triangulate(RawData& data, Array<RawModelVertex>& 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<RawModelVertex>& cacheVB) const
}
else
{
tangent = newTangentUnormalized / length;
tangent = newTangentUnnormalized / length;
bitangent.Normalize();
}
@@ -217,12 +217,12 @@ bool CSG::Mesh::Triangulate(RawData& data, Array<RawModelVertex>& 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);
}
}

View File

@@ -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];

View File

@@ -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++)

View File

@@ -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();
}

View File

@@ -240,7 +240,7 @@ float IESLoader::ExtractInR16(Array<byte>& output)
float result = 0.0f;
for (uint32 i = 0; i < hAnglesCount; i++)
result += InterpolateBilinear(static_cast<float>(i), v);
*out++ = ConvertFloatToHalf(invMaxValue * result / (float)hAnglesCount);
*out++ = Float16Compressor::Compress(invMaxValue * result / (float)hAnglesCount);
}
}

View File

@@ -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');

View File

@@ -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--;
}
}
}

View File

@@ -8,7 +8,7 @@
/// <summary>
/// Integer axis aligned bounding box
/// </summary>
struct AABB
struct FLAXENGINE_API AABB
{
public:

View File

@@ -10,7 +10,7 @@
/// <summary>
/// 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.
/// </summary>
API_STRUCT(InBuild) struct BoundingFrustum
API_STRUCT(InBuild) struct FLAXENGINE_API BoundingFrustum
{
private:

View File

@@ -280,7 +280,7 @@ namespace FlaxEngine
/// </summary>
/// <param name="hexString">The hexadecimal string.</param>
/// <param name="value">Output value.</param>
/// <returns>True if value has benn parsed, otherwise false.</returns>
/// <returns>True if value has been parsed, otherwise false.</returns>
public static bool TryParseHex(string hexString, out Color value)
{
value = Black;

View File

@@ -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)
);
}

View File

@@ -11,8 +11,14 @@ typedef uint16 Half;
#define USE_SSE_HALF_CONVERSION 0
class Float16Compressor
/// <summary>
/// Utility for packing/unpacking floating point value from single precision (32 bit) to half precision (16 bit).
/// </summary>
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 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<Half>(_mm_cvtsi128_si32(V2));
__m128 value1 = _mm_set_ss(value);
__m128i value2 = _mm_cvtps_ph(value1, 0);
return static_cast<Half>(_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<int>(value));
__m128 V2 = _mm_cvtph_ps(V1);
return _mm_cvtss_f32(V2);
__m128i value1 = _mm_cvtsi32_si128(static_cast<int>(value));
__m128 value2 = _mm_cvtph_ps(value1);
return _mm_cvtss_f32(value2);
#else
Bits v;
v.ui = value;
@@ -95,20 +96,10 @@ public:
}
};
inline float ConvertHalfToFloat(const Half value)
{
return Float16Compressor::Decompress(value);
}
inline Half ConvertFloatToHalf(const float value)
{
return Float16Compressor::Compress(value);
}
/// <summary>
/// Defines a two component vector, using half precision floating point coordinates.
/// </summary>
struct Half2
struct FLAXENGINE_API Half2
{
public:
@@ -145,8 +136,8 @@ public:
/// <param name="y">Y component</param>
Half2(float x, float y)
{
X = ConvertFloatToHalf(x);
Y = ConvertFloatToHalf(y);
X = Float16Compressor::Compress(x);
Y = Float16Compressor::Compress(y);
}
/// <summary>
@@ -167,7 +158,7 @@ public:
/// <summary>
/// Defines a three component vector, using half precision floating point coordinates.
/// </summary>
struct Half3
struct FLAXENGINE_API Half3
{
public:
@@ -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);
@@ -216,7 +207,7 @@ public:
/// <summary>
/// Defines a four component vector, using half precision floating point coordinates.
/// </summary>
struct Half4
struct FLAXENGINE_API Half4
{
public:
@@ -255,31 +246,27 @@ 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);
explicit Half4(const Color& c);
explicit Half4(const Rectangle& rect);
public:
Vector2 ToVector2() const;
Vector3 ToVector3() const;
Vector4 ToVector4() const;
};

View File

@@ -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;
/// <summary>
/// Two-components vector (32 bit integer type).
/// </summary>
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:
/// <summary>
/// Empty constructor.
/// </summary>
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<Int2>
{
enum { Value = true };
};
DEFINE_DEFAULT_FORMATTING(Int2, "X:{0} Y:{1}", v.X, v.Y);

View File

@@ -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;
/// <summary>
/// Three-components vector (32 bit integer type).
/// </summary>
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:
/// <summary>
/// Empty constructor.
/// </summary>
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<Int3>
{
enum { Value = true };
};
DEFINE_DEFAULT_FORMATTING(Int3, "X:{0} Y:{1} Z:{2}", v.X, v.Y, v.Z);

View File

@@ -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;
/// <summary>
/// Four-components vector (32 bit integer type).
/// </summary>
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:
/// <summary>
/// Empty constructor.
/// </summary>
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:
/// <summary>
/// Returns average arithmetic of all the components
/// </summary>
/// <returns>Average arithmetic of all the components</returns>
float AverageArithmetic() const
{
return (X + Y + Z + W) * 0.25f;
}
/// <summary>
/// Gets sum of all vector components values
/// </summary>
/// <returns>Sum of X, Y, Z and W</returns>
int32 SumValues() const
{
return X + Y + Z + W;
}
/// <summary>
/// Returns minimum value of all the components
/// </summary>
/// <returns>Minimum value</returns>
int32 MinValue() const
{
return Math::Min(X, Y, Z, W);
}
/// <summary>
/// Returns maximum value of all the components
/// </summary>
/// <returns>Maximum value</returns>
int32 MaxValue() const
{
return Math::Max(X, Y, Z, W);
}
};
template<>
struct TIsPODType<Int4>
{
enum { Value = true };
};
DEFINE_DEFAULT_FORMATTING(Int4, "X:{0} Y:{1} Z:{2} W:{3}", v.X, v.Y, v.Z, v.W);

View File

@@ -36,6 +36,11 @@ namespace FlaxEngine
/// </summary>
public const float PiOverFour = (float)(Math.PI / 4);
/// <summary>
/// A value specifying the golden mean
/// </summary>
public const float GoldenRatio = 1.6180339887f;
/// <summary>
/// Returns the absolute value of f.
/// </summary>

View File

@@ -9,7 +9,7 @@
/// <summary>
/// Represents a 3x3 mathematical matrix.
/// </summary>
API_STRUCT(InBuild) struct Matrix3x3
API_STRUCT(InBuild) struct FLAXENGINE_API Matrix3x3
{
public:

View File

@@ -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:

View File

@@ -13,7 +13,7 @@ typedef Half Float16;
/// <summary>
/// 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].
/// </summary>
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;

View File

@@ -8,7 +8,7 @@
/// <summary>
/// Represents a plane in three dimensional space.
/// </summary>
API_STRUCT() struct Plane
API_STRUCT() struct FLAXENGINE_API Plane
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Plane);
public:

View File

@@ -11,7 +11,7 @@ struct Viewport;
/// <summary>
/// Represents a three dimensional line based on a point in space and a direction.
/// </summary>
API_STRUCT() struct Ray
API_STRUCT() struct FLAXENGINE_API Ray
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Ray);
public:

View File

@@ -10,7 +10,6 @@
API_STRUCT() struct FLAXENGINE_API Rectangle
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Rectangle);
public:
/// <summary>
/// The empty rectangle.

View File

@@ -11,10 +11,9 @@ struct Matrix;
/// <summary>
/// Describes transformation in a 3D space.
/// </summary>
API_STRUCT() struct Transform
API_STRUCT() struct FLAXENGINE_API Transform
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Transform);
public:
/// <summary>
/// The translation vector of the transform.

View File

@@ -8,7 +8,7 @@
/// <summary>
/// Represents a three dimensional triangle.
/// </summary>
struct Triangle
struct FLAXENGINE_API Triangle
{
public:

View File

@@ -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.");

View File

@@ -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.");

View File

@@ -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.");

View File

@@ -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;
/// <summary>
/// Two-components vector (32 bit integer type).
/// </summary>
API_STRUCT(InBuild) struct 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:
/// <summary>
/// Empty constructor.
/// </summary>
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);
}
};
/// <summary>
/// Three-components vector (32 bit integer type).
/// </summary>
API_STRUCT(InBuild) struct 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:
/// <summary>
/// Empty constructor.
/// </summary>
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);
}
};
/// <summary>
/// Four-components vector (32 bit integer type).
/// </summary>
API_STRUCT(InBuild) struct 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:
/// <summary>
/// Empty constructor.
/// </summary>
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:
/// <summary>
/// Returns average arithmetic of all the components
/// </summary>
/// <returns>Average arithmetic of all the components</returns>
float AverageArithmetic() const
{
return (X + Y + Z + W) * 0.25f;
}
/// <summary>
/// Gets sum of all vector components values
/// </summary>
/// <returns>Sum of X, Y, Z and W</returns>
int32 SumValues() const
{
return X + Y + Z + W;
}
/// <summary>
/// Returns minimum value of all the components
/// </summary>
/// <returns>Minimum value</returns>
int32 MinValue() const
{
return Math::Min(X, Y, Z, W);
}
/// <summary>
/// Returns maximum value of all the components
/// </summary>
/// <returns>Maximum value</returns>
int32 MaxValue() const
{
return Math::Max(X, Y, Z, W);
}
};
template<>
struct TIsPODType<Int2>
{
enum { Value = true };
};
template<>
struct TIsPODType<Int3>
{
enum { Value = true };
};
template<>
struct TIsPODType<Int4>
{
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"

View File

@@ -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:

View File

@@ -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)

View File

@@ -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);
}
}
}

View File

@@ -36,7 +36,7 @@ namespace Log
/// </summary>
/// <param name="additionalInfo">Additional information that help describe error</param>
Exception(const String& additionalInfo)
: Exception(TEXT("An exception has occured."), additionalInfo)
: Exception(TEXT("An exception has occurred."), additionalInfo)
{
}

View File

@@ -468,7 +468,7 @@ void Engine::OnExit()
LOG_FLUSH();
// Kill all reaming threads
// Kill all remaining threads
ThreadRegistry::KillEmAll();
// Cleanup

View File

@@ -985,7 +985,7 @@ API_ENUM() enum class TessellationMethod
enum class ShaderFlags : uint32
{
/// <summary>
/// The default set fo flags.
/// The default set for flags.
/// </summary>
Default = 0,

View File

@@ -215,7 +215,7 @@ public:
/// Gets a CPU pointer to the resource by mapping its contents. Denies the GPU access to that resource.
/// </summary>
/// <param name="mode">The map operation mode.</param>
/// <returns>The pointer ot the mapped CPU buffer with resource data or null if failed.</returns>
/// <returns>The pointer of the mapped CPU buffer with resource data or null if failed.</returns>
API_FUNCTION() virtual void* Map(GPUResourceMapMode mode) = 0;
/// <summary>

View File

@@ -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();
}

View File

@@ -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<int>(formatSupportFlags))
#define FORMAT_FEATURES_ARE_NOT_SUPPORTED(formatSupport, formatSupportFlags) ((formatSupport & (formatSupportFlags)) != static_cast<int>(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<int>(formatSupportFlags))
#define FORMAT_FEATURES_ARE_SUPPORTED(formatSupport, formatSupportFlags) ((formatSupport & (formatSupportFlags)) == static_cast<int>(formatSupportFlags))
/// <summary>
/// The features exposed for a particular format.

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -108,7 +108,7 @@ public:
/// <summary>
/// Gets the mask of render passes supported by this material.
/// </summary>
/// <returns>The drw passes supported by this material.</returns>
/// <returns>The draw passes supported by this material.</returns>
virtual DrawPass GetDrawModes() const
{
return DrawPass::None;

View File

@@ -435,7 +435,7 @@ namespace FlaxEngine
/// Downloads the third vertex buffer that contains mesh vertices data. To download data from GPU set <paramref name="forceGpu"/> to true and call this method from the thread other than main thread (see <see cref="Platform.IsInMainThread"/>).
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
/// <param name="forceGpu">If set to <c>true</c> 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.</param>
/// <returns>The gathered data or null if mesh has no vertex colors.</returns>

View File

@@ -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

View File

@@ -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"

View File

@@ -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;

View File

@@ -387,7 +387,7 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(ToneMappingSettings);
float WhiteTemperature = 6500.0f;
/// <summary>
/// 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`.
/// </summary>
API_FIELD(Attributes="DefaultValue(0.0f), Limit(-1, 1, 0.001f), EditorOrder(1), PostProcessSetting((int)ToneMappingSettingsOverride.WhiteTint)")
float WhiteTint = 0.0f;

View File

@@ -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!");
}

Some files were not shown because too many files have changed in this diff Show More