Merge remote-tracking branch 'origin/master' into 1.2
This commit is contained in:
@@ -70,7 +70,7 @@ namespace AnimationUtils
|
||||
FORCE_INLINE void GetTangent<Quaternion>(const Quaternion& a, const Quaternion& b, float length, Quaternion& result)
|
||||
{
|
||||
const float oneThird = 1.0f / 3.0f;
|
||||
Quaternion::Slerp(a, b, length * oneThird, result);
|
||||
Quaternion::Slerp(a, b, oneThird, result);
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -79,7 +79,7 @@ namespace AnimationUtils
|
||||
const float oneThird = 1.0f / 3.0f;
|
||||
const float oneThirdLength = length * oneThird;
|
||||
result.Translation = a.Translation + b.Translation * oneThirdLength;
|
||||
Quaternion::Slerp(a.Orientation, b.Orientation, oneThirdLength, result.Orientation);
|
||||
Quaternion::Slerp(a.Orientation, b.Orientation, oneThird, result.Orientation);
|
||||
result.Scale = a.Scale + (b.Scale - a.Scale) * oneThirdLength;
|
||||
}
|
||||
|
||||
|
||||
@@ -408,16 +408,20 @@ Asset* Content::LoadAsync(const StringView& path, MClass* type)
|
||||
|
||||
Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& type)
|
||||
{
|
||||
// Ensure path is in a valid format
|
||||
String pathNorm(path);
|
||||
FileSystem::NormalizePath(pathNorm);
|
||||
|
||||
#if USE_EDITOR
|
||||
if (!FileSystem::FileExists(path))
|
||||
if (!FileSystem::FileExists(pathNorm))
|
||||
{
|
||||
LOG(Error, "Missing file \'{0}\'", path);
|
||||
LOG(Error, "Missing file \'{0}\'", pathNorm);
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
AssetInfo assetInfo;
|
||||
if (GetAssetInfo(path, assetInfo))
|
||||
if (GetAssetInfo(pathNorm, assetInfo))
|
||||
{
|
||||
return LoadAsync(assetInfo.ID, type);
|
||||
}
|
||||
|
||||
@@ -194,13 +194,13 @@ void FlaxStorage::AddRef()
|
||||
|
||||
void FlaxStorage::RemoveRef()
|
||||
{
|
||||
ASSERT(_refCount > 0);
|
||||
|
||||
_refCount--;
|
||||
|
||||
if (_refCount == 0)
|
||||
if (_refCount > 0)
|
||||
{
|
||||
_lastRefLostTime = DateTime::NowUTC();
|
||||
_refCount--;
|
||||
if (_refCount == 0)
|
||||
{
|
||||
_lastRefLostTime = DateTime::NowUTC();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1566,7 +1566,7 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
|
||||
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and z-axis.
|
||||
/// </summary>
|
||||
/// <param name="scale">Scaling factor for all three axes.</param>
|
||||
/// <returns>The created scaling Matrix3x3.</returns>
|
||||
@@ -1577,7 +1577,7 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and y-axis.
|
||||
/// Creates a Matrix3x3 that scales along the x-axis, y-axis, and z-axis.
|
||||
/// </summary>
|
||||
/// <param name="x">Scaling factor that is applied along the x-axis.</param>
|
||||
/// <param name="y">Scaling factor that is applied along the y-axis.</param>
|
||||
@@ -1605,9 +1605,9 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Matrix3x3 that uniformly scales along all three axis.
|
||||
/// Creates a Matrix3x3 that uniformly scales along all three axes.
|
||||
/// </summary>
|
||||
/// <param name="scale">The uniform scale that is applied along all axis.</param>
|
||||
/// <param name="scale">The uniform scale that is applied along all axes.</param>
|
||||
/// <param name="result">When the method completes, contains the created scaling Matrix3x3.</param>
|
||||
public static void Scaling(float scale, out Matrix3x3 result)
|
||||
{
|
||||
@@ -1616,9 +1616,9 @@ namespace FlaxEngine
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Matrix3x3 that uniformly scales along all three axis.
|
||||
/// Creates a Matrix3x3 that uniformly scales along all three axes.
|
||||
/// </summary>
|
||||
/// <param name="scale">The uniform scale that is applied along all axis.</param>
|
||||
/// <param name="scale">The uniform scale that is applied along all axes.</param>
|
||||
/// <returns>The created scaling Matrix3x3.</returns>
|
||||
public static Matrix3x3 Scaling(float scale)
|
||||
{
|
||||
|
||||
@@ -189,10 +189,10 @@ public:
|
||||
*height = bounds.Height;
|
||||
}
|
||||
|
||||
void GetDpi(float* dpi) override
|
||||
void GetDpi(int* dpi) override
|
||||
{
|
||||
auto currentDisplayInformation = Windows::Graphics::Display::DisplayInformation::GetForCurrentView();
|
||||
*dpi = currentDisplayInformation->LogicalDpi;
|
||||
*dpi = (int)currentDisplayInformation->LogicalDpi;
|
||||
}
|
||||
|
||||
void GetTitle(wchar_t* buffer, int bufferLength) override
|
||||
|
||||
@@ -370,18 +370,9 @@ void NavMeshRuntime::EnsureCapacity(int32 tilesToAddCount)
|
||||
PROFILE_CPU_NAMED("NavMeshRuntime.EnsureCapacity");
|
||||
|
||||
// Navmesh tiles capacity growing rule
|
||||
int32 newCapacity = 0;
|
||||
if (capacity)
|
||||
{
|
||||
while (newCapacity < newTilesCount)
|
||||
{
|
||||
newCapacity = Math::RoundUpToPowerOf2(newCapacity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newCapacity = 32;
|
||||
}
|
||||
int32 newCapacity = capacity ? capacity : 32;
|
||||
while (newCapacity < newTilesCount)
|
||||
newCapacity = Math::RoundUpToPowerOf2(newCapacity);
|
||||
|
||||
LOG(Info, "Resizing navmesh {2} from {0} to {1} tiles capacity", capacity, newCapacity, Properties.Name);
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
virtual void SetMousePosition(float x, float y) = 0;
|
||||
virtual void GetMousePosition(float* x, float* y) = 0;
|
||||
virtual void GetBounds(float* x, float* y, float* width, float* height) = 0;
|
||||
virtual void GetDpi(float* dpi) = 0;
|
||||
virtual void GetDpi(int* dpi) = 0;
|
||||
virtual void GetTitle(wchar_t* buffer, int bufferLength) = 0;
|
||||
virtual void SetTitle(const wchar_t* title) = 0;
|
||||
virtual int GetGamepadsCount() = 0;
|
||||
|
||||
@@ -320,7 +320,7 @@ void* Win32Platform::AllocatePages(uint64 numPages, uint64 pageSize)
|
||||
const uint64 numBytes = numPages * pageSize;
|
||||
|
||||
// Use VirtualAlloc to allocate page-aligned memory
|
||||
return VirtualAlloc(nullptr, numBytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
return VirtualAlloc(nullptr, (SIZE_T)numBytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
}
|
||||
|
||||
void Win32Platform::FreePages(void* ptr)
|
||||
|
||||
@@ -87,8 +87,8 @@ bool ShadowsPass::Init()
|
||||
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);
|
||||
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;
|
||||
|
||||
@@ -298,6 +298,8 @@ void VolumetricFogPass::RenderRadialLight(RenderContext& renderContext, GPUConte
|
||||
context->SetViewportAndScissors(_cache.Data.GridSize.X, _cache.Data.GridSize.Y);
|
||||
|
||||
// Setup data
|
||||
perLight.SliceToDepth.X = _cache.Data.GridSize.Z;
|
||||
perLight.SliceToDepth.Y = _cache.Data.VolumetricFogMaxDistance;
|
||||
perLight.MinZ = volumeZBoundsMin;
|
||||
perLight.LocalLightScatteringIntensity = light.VolumetricScatteringIntensity;
|
||||
perLight.ViewSpaceBoundingSphere = Vector4(viewSpaceLightBoundsOrigin, bounds.Radius);
|
||||
@@ -355,6 +357,8 @@ void VolumetricFogPass::RenderRadialLight(RenderContext& renderContext, GPUConte
|
||||
bool withShadow = false;
|
||||
|
||||
// Setup data
|
||||
perLight.SliceToDepth.X = cache.Data.GridSize.Z;
|
||||
perLight.SliceToDepth.Y = cache.Data.VolumetricFogMaxDistance;
|
||||
perLight.MinZ = volumeZBoundsMin;
|
||||
perLight.LocalLightScatteringIntensity = light.VolumetricScatteringIntensity;
|
||||
perLight.ViewSpaceBoundingSphere = Vector4(viewSpaceLightBoundsOrigin, bounds.Radius);
|
||||
|
||||
@@ -812,6 +812,19 @@ namespace FlaxEngine.GUI
|
||||
return spaceLoc;
|
||||
}
|
||||
|
||||
private int FindPrevLineBegin()
|
||||
{
|
||||
int caretPos = CaretPosition;
|
||||
if (caretPos - 2 < 0)
|
||||
return 0;
|
||||
int newLineLoc = _text.LastIndexOf('\n', caretPos - 2);
|
||||
if (newLineLoc == -1)
|
||||
newLineLoc = 0;
|
||||
else
|
||||
newLineLoc++;
|
||||
return newLineLoc;
|
||||
}
|
||||
|
||||
private int FindLineDownChar(int index)
|
||||
{
|
||||
if (!IsMultiline)
|
||||
@@ -1181,7 +1194,6 @@ namespace FlaxEngine.GUI
|
||||
return true;
|
||||
}
|
||||
case KeyboardKeys.Return:
|
||||
{
|
||||
if (IsMultiline)
|
||||
{
|
||||
// Insert new line
|
||||
@@ -1192,15 +1204,22 @@ namespace FlaxEngine.GUI
|
||||
// End editing
|
||||
Defocus();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
case KeyboardKeys.Home:
|
||||
{
|
||||
// Move caret to the first character
|
||||
SetSelection(0);
|
||||
if (shiftDown)
|
||||
{
|
||||
// Select text from the current cursor point back to the beginning of the line
|
||||
if (_selectionStart != -1)
|
||||
{
|
||||
SetSelection(FindPrevLineBegin(), _selectionStart);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Move caret to the first character
|
||||
SetSelection(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case KeyboardKeys.End:
|
||||
{
|
||||
// Move caret after last character
|
||||
|
||||
@@ -558,6 +558,7 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
SetBounds(ref bounds);
|
||||
}
|
||||
_parent?.PerformLayout();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,28 +35,39 @@ namespace FlaxEngine.GUI
|
||||
/// <inheritdoc />
|
||||
protected override void PerformLayoutAfterChildren()
|
||||
{
|
||||
// Sort controls from left to right
|
||||
float x = _margin.Left;
|
||||
// Sort controls horizontally
|
||||
float left = _margin.Left;
|
||||
float right = _margin.Right;
|
||||
float h = Height - _margin.Height;
|
||||
bool hasAnyItem = false;
|
||||
bool hasAnyLeft = false, hasAnyRight = false;
|
||||
for (int i = 0; i < _children.Count; i++)
|
||||
{
|
||||
Control c = _children[i];
|
||||
if (c.Visible && Mathf.IsZero(c.AnchorMax.X))
|
||||
if (c.Visible)
|
||||
{
|
||||
var w = c.Width;
|
||||
c.Bounds = new Rectangle(x + _offset.X, _margin.Top + _offset.Y, w, h);
|
||||
x = c.Right + _spacing;
|
||||
hasAnyItem = true;
|
||||
if (Mathf.IsZero(c.AnchorMin.X) && Mathf.IsZero(c.AnchorMax.X))
|
||||
{
|
||||
c.Bounds = new Rectangle(left + _offset.X, _margin.Top + _offset.Y, w, h);
|
||||
left = c.Right + _spacing;
|
||||
hasAnyLeft = true;
|
||||
}
|
||||
else if (Mathf.IsOne(c.AnchorMin.X) && Mathf.IsOne(c.AnchorMax.X))
|
||||
{
|
||||
right += w + _spacing;
|
||||
c.Bounds = new Rectangle(Width - right + _offset.X, _margin.Top + _offset.Y, w, h);
|
||||
hasAnyRight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasAnyItem)
|
||||
x -= _spacing;
|
||||
x += _margin.Right;
|
||||
if (hasAnyLeft)
|
||||
left -= _spacing;
|
||||
if (hasAnyRight)
|
||||
right -= _spacing;
|
||||
|
||||
// Update size
|
||||
if (_autoSize)
|
||||
Width = x;
|
||||
Width = left + right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,28 +35,39 @@ namespace FlaxEngine.GUI
|
||||
/// <inheritdoc />
|
||||
protected override void PerformLayoutAfterChildren()
|
||||
{
|
||||
// Sort controls from top to bottom
|
||||
float y = _margin.Top;
|
||||
// Sort controls vertically
|
||||
float top = _margin.Top;
|
||||
float bottom = _margin.Bottom;
|
||||
float w = Width - _margin.Width;
|
||||
bool hasAnyItem = false;
|
||||
bool hasAnyTop = false, hasAnyBottom = false;
|
||||
for (int i = 0; i < _children.Count; i++)
|
||||
{
|
||||
Control c = _children[i];
|
||||
if (c.Visible && Mathf.IsZero(c.AnchorMax.Y))
|
||||
if (c.Visible)
|
||||
{
|
||||
var h = c.Height;
|
||||
c.Bounds = new Rectangle(_margin.Left + _offset.X, y + _offset.Y, w, h);
|
||||
y = c.Bottom + _spacing;
|
||||
hasAnyItem = true;
|
||||
if (Mathf.IsZero(c.AnchorMin.Y) && Mathf.IsZero(c.AnchorMax.Y))
|
||||
{
|
||||
c.Bounds = new Rectangle(_margin.Left + _offset.X, top + _offset.Y, w, h);
|
||||
top = c.Bottom + _spacing;
|
||||
hasAnyTop = true;
|
||||
}
|
||||
else if (Mathf.IsOne(c.AnchorMin.Y) && Mathf.IsOne(c.AnchorMax.Y))
|
||||
{
|
||||
bottom += h + _spacing;
|
||||
c.Bounds = new Rectangle(_margin.Left + _offset.X, Height - bottom + _offset.Y, w, h);
|
||||
hasAnyBottom = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasAnyItem)
|
||||
y -= _spacing;
|
||||
y += _margin.Bottom;
|
||||
if (hasAnyTop)
|
||||
top -= _spacing;
|
||||
if (hasAnyBottom)
|
||||
bottom -= _spacing;
|
||||
|
||||
// Update size
|
||||
if (_autoSize)
|
||||
Height = y;
|
||||
Height = top + bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user