Revert some changes from #3389 that are not relevant for world units
This commit is contained in:
@@ -38,7 +38,7 @@ namespace FlaxEditor.CustomEditors.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Clamp(value, 0.05f, 0.95f);
|
value = Mathf.Clamp(value, 0.05f, 0.95f);
|
||||||
if (_splitterValue != value)
|
if (!Mathf.NearEqual(_splitterValue, value))
|
||||||
{
|
{
|
||||||
_splitterValue = value;
|
_splitterValue = value;
|
||||||
UpdateSplitRect();
|
UpdateSplitRect();
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ namespace FlaxEditor.GUI
|
|||||||
get => _fps;
|
get => _fps;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_fps.HasValue == value.HasValue && (!value.HasValue || _fps.Value == value.Value))
|
if (_fps.HasValue == value.HasValue && (!value.HasValue || Mathf.NearEqual(_fps.Value, value.Value)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_fps = value;
|
_fps = value;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace FlaxEditor.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Max(value, 1);
|
value = Mathf.Max(value, 1);
|
||||||
if (value != _headerHeight)
|
if (!Mathf.NearEqual(value, _headerHeight))
|
||||||
{
|
{
|
||||||
_headerHeight = value;
|
_headerHeight = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ namespace FlaxEditor.GUI
|
|||||||
get => _fps;
|
get => _fps;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_fps.HasValue == value.HasValue && (!value.HasValue || _fps.Value == value.Value))
|
if (_fps.HasValue == value.HasValue && (!value.HasValue || Mathf.NearEqual(_fps.Value, value.Value)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_fps = value;
|
_fps = value;
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ namespace FlaxEditor.GUI.Timeline
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Clamp(value, 0.1f, 1000.0f);
|
value = Mathf.Clamp(value, 0.1f, 1000.0f);
|
||||||
if (_framesPerSecond == value)
|
if (Mathf.NearEqual(_framesPerSecond, value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Undo?.AddAction(new EditFpsAction(this, _framesPerSecond, value));
|
Undo?.AddAction(new EditFpsAction(this, _framesPerSecond, value));
|
||||||
@@ -508,7 +508,7 @@ namespace FlaxEditor.GUI.Timeline
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Clamp(value, 0.00001f, 1000.0f);
|
value = Mathf.Clamp(value, 0.00001f, 1000.0f);
|
||||||
if (_zoom == value)
|
if (Mathf.NearEqual(_zoom, value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_zoom = value;
|
_zoom = value;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
|||||||
get => Preview.ViewOffset;
|
get => Preview.ViewOffset;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Preview.ViewOffset == value)
|
if (Mathf.NearEqual(Preview.ViewOffset, value))
|
||||||
return;
|
return;
|
||||||
Preview.ViewOffset = value;
|
Preview.ViewOffset = value;
|
||||||
Timeline?.MarkAsEdited();
|
Timeline?.MarkAsEdited();
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
get => _headerHeight;
|
get => _headerHeight;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_headerHeight != value)
|
if (!Mathf.NearEqual(_headerHeight, value))
|
||||||
{
|
{
|
||||||
_headerHeight = value;
|
_headerHeight = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace FlaxEditor.Tools.Foliage
|
|||||||
get => _type.CullDistance;
|
get => _type.CullDistance;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_type.CullDistance == value)
|
if (Mathf.NearEqual(_type.CullDistance, value))
|
||||||
return;
|
return;
|
||||||
_type.CullDistance = value;
|
_type.CullDistance = value;
|
||||||
Foliage.UpdateCullDistance();
|
Foliage.UpdateCullDistance();
|
||||||
@@ -120,7 +120,7 @@ namespace FlaxEditor.Tools.Foliage
|
|||||||
get => _type.CullDistanceRandomRange;
|
get => _type.CullDistanceRandomRange;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_type.CullDistanceRandomRange == value)
|
if (Mathf.NearEqual(_type.CullDistanceRandomRange, value))
|
||||||
return;
|
return;
|
||||||
_type.CullDistanceRandomRange = value;
|
_type.CullDistanceRandomRange = value;
|
||||||
Foliage.UpdateCullDistance();
|
Foliage.UpdateCullDistance();
|
||||||
@@ -174,7 +174,7 @@ namespace FlaxEditor.Tools.Foliage
|
|||||||
get => _type.DensityScalingScale;
|
get => _type.DensityScalingScale;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_type.DensityScalingScale == value)
|
if (Mathf.NearEqual(_type.DensityScalingScale, value))
|
||||||
return;
|
return;
|
||||||
_type.DensityScalingScale = value;
|
_type.DensityScalingScale = value;
|
||||||
Foliage.RebuildClusters();
|
Foliage.RebuildClusters();
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ namespace FlaxEditor.Viewport.Previews
|
|||||||
get => _mipLevel;
|
get => _mipLevel;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_mipLevel == value)
|
if (!Mathf.NearEqual(_mipLevel, value))
|
||||||
{
|
{
|
||||||
_mipLevel = value;
|
_mipLevel = value;
|
||||||
_previewMaterial.SetParameterValue("Mip", value);
|
_previewMaterial.SetParameterValue("Mip", value);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace FlaxEditor.Viewport.Previews
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Clamp(value, 0.1f, 100000000000.0f);
|
value = Mathf.Clamp(value, 0.1f, 100000000000.0f);
|
||||||
if (_playbackDuration == value)
|
if (Mathf.NearEqual(_playbackDuration, value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_playbackDuration = value;
|
_playbackDuration = value;
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ namespace FlaxEditor.Viewport.Previews
|
|||||||
get => _mipLevel;
|
get => _mipLevel;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_mipLevel != value)
|
if (!Mathf.NearEqual(_mipLevel, value))
|
||||||
{
|
{
|
||||||
_mipLevel = value;
|
_mipLevel = value;
|
||||||
_previewMaterial.SetParameterValue("Mip", value);
|
_previewMaterial.SetParameterValue("Mip", value);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
bool operator==(const StepCurveKeyframe& other) const
|
bool operator==(const StepCurveKeyframe& other) const
|
||||||
{
|
{
|
||||||
return Time == other.Time && Value == other.Value;
|
return Math::NearEqual(Time, other.Time) && Math::NearEqual(Value, other.Value);
|
||||||
}
|
}
|
||||||
} PACK_END();
|
} PACK_END();
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ public:
|
|||||||
|
|
||||||
bool operator==(const LinearCurveKeyframe& other) const
|
bool operator==(const LinearCurveKeyframe& other) const
|
||||||
{
|
{
|
||||||
return Time == other.Time && Value == other.Value;
|
return Math::NearEqual(Time, other.Time) && Math::NearEqual(Value, other.Value);
|
||||||
}
|
}
|
||||||
} PACK_END();
|
} PACK_END();
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ public:
|
|||||||
|
|
||||||
bool operator==(const HermiteCurveKeyframe& other) const
|
bool operator==(const HermiteCurveKeyframe& other) const
|
||||||
{
|
{
|
||||||
return Time == other.Time && Value == other.Value && TangentIn == other.TangentIn && TangentOut == other.TangentOut;
|
return Math::NearEqual(Time, other.Time) && Math::NearEqual(Value, other.Value) && Math::NearEqual(TangentIn, other.TangentIn) && Math::NearEqual(TangentOut, other.TangentOut);
|
||||||
}
|
}
|
||||||
} PACK_END();
|
} PACK_END();
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ public:
|
|||||||
|
|
||||||
bool operator==(const BezierCurveKeyframe& other) const
|
bool operator==(const BezierCurveKeyframe& other) const
|
||||||
{
|
{
|
||||||
return Time == other.Time && Value == other.Value && TangentIn == other.TangentIn && TangentOut == other.TangentOut;
|
return Math::NearEqual(Time, other.Time) && Math::NearEqual(Value, other.Value) && Math::NearEqual(TangentIn, other.TangentIn) && Math::NearEqual(TangentOut, other.TangentOut);
|
||||||
}
|
}
|
||||||
} PACK_END();
|
} PACK_END();
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ void AudioService::Update()
|
|||||||
// Mute audio if app has no user focus
|
// Mute audio if app has no user focus
|
||||||
masterVolume = 0.0f;
|
masterVolume = 0.0f;
|
||||||
}
|
}
|
||||||
if (Volume != masterVolume)
|
if (Math::NotNearEqual(Volume, masterVolume))
|
||||||
{
|
{
|
||||||
Volume = masterVolume;
|
Volume = masterVolume;
|
||||||
AudioBackend::SetVolume(masterVolume);
|
AudioBackend::SetVolume(masterVolume);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ AudioSource::AudioSource(const SpawnParams& params)
|
|||||||
void AudioSource::SetVolume(float value)
|
void AudioSource::SetVolume(float value)
|
||||||
{
|
{
|
||||||
value = Math::Saturate(value);
|
value = Math::Saturate(value);
|
||||||
if (_volume == value)
|
if (Math::NearEqual(_volume, value))
|
||||||
return;
|
return;
|
||||||
_volume = value;
|
_volume = value;
|
||||||
if (SourceID)
|
if (SourceID)
|
||||||
@@ -39,7 +39,7 @@ void AudioSource::SetVolume(float value)
|
|||||||
void AudioSource::SetPitch(float value)
|
void AudioSource::SetPitch(float value)
|
||||||
{
|
{
|
||||||
value = Math::Clamp(value, 0.5f, 2.0f);
|
value = Math::Clamp(value, 0.5f, 2.0f);
|
||||||
if (_pitch == value)
|
if (Math::NearEqual(_pitch, value))
|
||||||
return;
|
return;
|
||||||
_pitch = value;
|
_pitch = value;
|
||||||
if (SourceID)
|
if (SourceID)
|
||||||
@@ -49,7 +49,7 @@ void AudioSource::SetPitch(float value)
|
|||||||
void AudioSource::SetPan(float value)
|
void AudioSource::SetPan(float value)
|
||||||
{
|
{
|
||||||
value = Math::Clamp(value, -1.0f, 1.0f);
|
value = Math::Clamp(value, -1.0f, 1.0f);
|
||||||
if (_pan == value)
|
if (Math::NearEqual(_pan, value))
|
||||||
return;
|
return;
|
||||||
_pan = value;
|
_pan = value;
|
||||||
if (SourceID)
|
if (SourceID)
|
||||||
@@ -80,7 +80,7 @@ void AudioSource::SetStartTime(float value)
|
|||||||
void AudioSource::SetMinDistance(float value)
|
void AudioSource::SetMinDistance(float value)
|
||||||
{
|
{
|
||||||
value = Math::Max(0.0f, value);
|
value = Math::Max(0.0f, value);
|
||||||
if (_minDistance == value)
|
if (Math::NearEqual(_minDistance, value))
|
||||||
return;
|
return;
|
||||||
_minDistance = value;
|
_minDistance = value;
|
||||||
if (SourceID)
|
if (SourceID)
|
||||||
@@ -90,7 +90,7 @@ void AudioSource::SetMinDistance(float value)
|
|||||||
void AudioSource::SetAttenuation(float value)
|
void AudioSource::SetAttenuation(float value)
|
||||||
{
|
{
|
||||||
value = Math::Max(0.0f, value);
|
value = Math::Max(0.0f, value);
|
||||||
if (_attenuation == value)
|
if (Math::NearEqual(_attenuation, value))
|
||||||
return;
|
return;
|
||||||
_attenuation = value;
|
_attenuation = value;
|
||||||
if (SourceID)
|
if (SourceID)
|
||||||
@@ -100,7 +100,7 @@ void AudioSource::SetAttenuation(float value)
|
|||||||
void AudioSource::SetDopplerFactor(float value)
|
void AudioSource::SetDopplerFactor(float value)
|
||||||
{
|
{
|
||||||
value = Math::Max(0.0f, value);
|
value = Math::Max(0.0f, value);
|
||||||
if (_dopplerFactor == value)
|
if (Math::NearEqual(_dopplerFactor, value))
|
||||||
return;
|
return;
|
||||||
_dopplerFactor = value;
|
_dopplerFactor = value;
|
||||||
if (SourceID)
|
if (SourceID)
|
||||||
@@ -401,7 +401,7 @@ void AudioSource::Update()
|
|||||||
_startingToPlay = false;
|
_startingToPlay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UseStreaming() && GetTime() == 0.0f && _isActuallyPlayingSth && !_startingToPlay)
|
if (!UseStreaming() && Math::NearEqual(GetTime(), 0.0f) && _isActuallyPlayingSth && !_startingToPlay)
|
||||||
{
|
{
|
||||||
int32 queuedBuffers;
|
int32 queuedBuffers;
|
||||||
AudioBackend::Source::GetQueuedBuffersCount(SourceID, queuedBuffers);
|
AudioBackend::Source::GetQueuedBuffersCount(SourceID, queuedBuffers);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
ShaderGraphNode<>* AddValueNode(MaterialLayer* layer, const float& value, const float& defaultValue)
|
ShaderGraphNode<>* AddValueNode(MaterialLayer* layer, const float& value, const float& defaultValue)
|
||||||
{
|
{
|
||||||
if (value == defaultValue)
|
if (Math::NearEqual(value, defaultValue))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto& node = layer->Graph.Nodes.AddOne();
|
auto& node = layer->Graph.Nodes.AddOne();
|
||||||
node.ID = layer->Graph.Nodes.Count();
|
node.ID = layer->Graph.Nodes.Count();
|
||||||
|
|||||||
@@ -173,12 +173,12 @@ namespace FlaxEngine
|
|||||||
/// <returns><c>true</c> if the specified <see cref="Viewport"/> is equal to this instance; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if the specified <see cref="Viewport"/> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||||
public bool Equals(ref Viewport other)
|
public bool Equals(ref Viewport other)
|
||||||
{
|
{
|
||||||
return X == other.X &&
|
return Mathf.NearEqual(X, other.X) &&
|
||||||
Y == other.Y &&
|
Mathf.NearEqual(Y, other.Y) &&
|
||||||
Width == other.Width &&
|
Mathf.NearEqual(Width, other.Width) &&
|
||||||
Height == other.Height &&
|
Mathf.NearEqual(Height, other.Height) &&
|
||||||
MinDepth == other.MinDepth &&
|
Mathf.NearEqual(MinDepth, other.MinDepth) &&
|
||||||
MaxDepth == other.MaxDepth;
|
Mathf.NearEqual(MaxDepth, other.MaxDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1013,7 +1013,7 @@ bool UpdateFoliageDensityScaling(Actor* actor)
|
|||||||
void Foliage::SetGlobalDensityScale(float value)
|
void Foliage::SetGlobalDensityScale(float value)
|
||||||
{
|
{
|
||||||
value = Math::Saturate(value);
|
value = Math::Saturate(value);
|
||||||
if (value == GlobalDensityScale)
|
if (Math::NearEqual(value, GlobalDensityScale))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PROFILE_CPU();
|
PROFILE_CPU();
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ namespace FlaxEngine
|
|||||||
&& DecalBlendingMode == other.DecalBlendingMode
|
&& DecalBlendingMode == other.DecalBlendingMode
|
||||||
&& TransparentLightingMode == other.TransparentLightingMode
|
&& TransparentLightingMode == other.TransparentLightingMode
|
||||||
&& PostFxLocation == other.PostFxLocation
|
&& PostFxLocation == other.PostFxLocation
|
||||||
&& MaskThreshold == other.MaskThreshold
|
&& Mathf.NearEqual(MaskThreshold, other.MaskThreshold)
|
||||||
&& OpacityThreshold == other.OpacityThreshold
|
&& Mathf.NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||||
&& TessellationMode == other.TessellationMode
|
&& TessellationMode == other.TessellationMode
|
||||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ bool MaterialInfo8::operator==(const MaterialInfo8& other) const
|
|||||||
&& TransparentLighting == other.TransparentLighting
|
&& TransparentLighting == other.TransparentLighting
|
||||||
&& DecalBlendingMode == other.DecalBlendingMode
|
&& DecalBlendingMode == other.DecalBlendingMode
|
||||||
&& PostFxLocation == other.PostFxLocation
|
&& PostFxLocation == other.PostFxLocation
|
||||||
&& MaskThreshold == other.MaskThreshold
|
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||||
&& OpacityThreshold == other.OpacityThreshold
|
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||||
&& Flags == other.Flags
|
&& Flags == other.Flags
|
||||||
&& TessellationMode == other.TessellationMode
|
&& TessellationMode == other.TessellationMode
|
||||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||||
@@ -89,8 +89,8 @@ bool MaterialInfo9::operator==(const MaterialInfo9& other) const
|
|||||||
&& DecalBlendingMode == other.DecalBlendingMode
|
&& DecalBlendingMode == other.DecalBlendingMode
|
||||||
&& PostFxLocation == other.PostFxLocation
|
&& PostFxLocation == other.PostFxLocation
|
||||||
&& CullMode == other.CullMode
|
&& CullMode == other.CullMode
|
||||||
&& MaskThreshold == other.MaskThreshold
|
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||||
&& OpacityThreshold == other.OpacityThreshold
|
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||||
&& TessellationMode == other.TessellationMode
|
&& TessellationMode == other.TessellationMode
|
||||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||||
}
|
}
|
||||||
@@ -123,8 +123,8 @@ bool MaterialInfo::operator==(const MaterialInfo& other) const
|
|||||||
&& TransparentLightingMode == other.TransparentLightingMode
|
&& TransparentLightingMode == other.TransparentLightingMode
|
||||||
&& PostFxLocation == other.PostFxLocation
|
&& PostFxLocation == other.PostFxLocation
|
||||||
&& CullMode == other.CullMode
|
&& CullMode == other.CullMode
|
||||||
&& MaskThreshold == other.MaskThreshold
|
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||||
&& OpacityThreshold == other.OpacityThreshold
|
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||||
&& TessellationMode == other.TessellationMode
|
&& TessellationMode == other.TessellationMode
|
||||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ namespace FlaxEngine
|
|||||||
AddressU == other.AddressU &&
|
AddressU == other.AddressU &&
|
||||||
AddressV == other.AddressV &&
|
AddressV == other.AddressV &&
|
||||||
AddressW == other.AddressW &&
|
AddressW == other.AddressW &&
|
||||||
MipBias == other.MipBias &&
|
Mathf.NearEqual(MipBias, other.MipBias) &&
|
||||||
MinMipLevel == other.MinMipLevel &&
|
Mathf.NearEqual(MinMipLevel, other.MinMipLevel) &&
|
||||||
MaxMipLevel == other.MaxMipLevel &&
|
Mathf.NearEqual(MaxMipLevel, other.MaxMipLevel) &&
|
||||||
MaxAnisotropy == other.MaxAnisotropy &&
|
MaxAnisotropy == other.MaxAnisotropy &&
|
||||||
BorderColor == other.BorderColor &&
|
BorderColor == other.BorderColor &&
|
||||||
ComparisonFunction == other.ComparisonFunction;
|
ComparisonFunction == other.ComparisonFunction;
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(TextLayoutOptions);
|
|||||||
&& HorizontalAlignment == other.HorizontalAlignment
|
&& HorizontalAlignment == other.HorizontalAlignment
|
||||||
&& VerticalAlignment == other.VerticalAlignment
|
&& VerticalAlignment == other.VerticalAlignment
|
||||||
&& TextWrapping == other.TextWrapping
|
&& TextWrapping == other.TextWrapping
|
||||||
&& Scale == other.Scale
|
&& Math::NearEqual(Scale, other.Scale)
|
||||||
&& BaseLinesGapScale == other.BaseLinesGapScale;
|
&& Math::NearEqual(BaseLinesGapScale, other.BaseLinesGapScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE bool operator!=(const TextLayoutOptions& other) const
|
FORCE_INLINE bool operator!=(const TextLayoutOptions& other) const
|
||||||
|
|||||||
@@ -236,9 +236,9 @@ struct ShadowAtlasLight
|
|||||||
{
|
{
|
||||||
if (!Cache.StaticValid || !Cache.DynamicValid)
|
if (!Cache.StaticValid || !Cache.DynamicValid)
|
||||||
return;
|
return;
|
||||||
if (Cache.Distance != light.ShadowsDistance ||
|
if (!Math::NearEqual(Cache.Distance, light.ShadowsDistance) ||
|
||||||
Cache.ShadowsUpdateRate != light.ShadowsUpdateRate ||
|
!Math::NearEqual(Cache.ShadowsUpdateRate, light.ShadowsUpdateRate) ||
|
||||||
Cache.ShadowsUpdateRateAtDistance != light.ShadowsUpdateRateAtDistance ||
|
!Math::NearEqual(Cache.ShadowsUpdateRateAtDistance, light.ShadowsUpdateRateAtDistance) ||
|
||||||
Cache.ShadowFrame != light.ShadowFrame ||
|
Cache.ShadowFrame != light.ShadowFrame ||
|
||||||
Cache.ShadowsResolution != light.ShadowsResolution ||
|
Cache.ShadowsResolution != light.ShadowsResolution ||
|
||||||
Float3::Dot(Cache.Direction, light.Direction) < SHADOWS_ROTATION_ERROR)
|
Float3::Dot(Cache.Direction, light.Direction) < SHADOWS_ROTATION_ERROR)
|
||||||
@@ -250,7 +250,7 @@ struct ShadowAtlasLight
|
|||||||
{
|
{
|
||||||
// Sun
|
// Sun
|
||||||
if (!Float3::NearEqual(Cache.Position, view.Position, SHADOWS_POSITION_ERROR) ||
|
if (!Float3::NearEqual(Cache.Position, view.Position, SHADOWS_POSITION_ERROR) ||
|
||||||
Cache.CascadeSplits != CascadeSplits ||
|
!Float4::NearEqual(Cache.CascadeSplits, CascadeSplits) ||
|
||||||
Float3::Dot(Cache.ViewDirection, view.Direction) < SHADOWS_ROTATION_ERROR)
|
Float3::Dot(Cache.ViewDirection, view.Direction) < SHADOWS_ROTATION_ERROR)
|
||||||
{
|
{
|
||||||
// Invalidate
|
// Invalidate
|
||||||
@@ -262,12 +262,12 @@ struct ShadowAtlasLight
|
|||||||
// Local light
|
// Local light
|
||||||
const auto& localLight = (const RenderLocalLightData&)light;
|
const auto& localLight = (const RenderLocalLightData&)light;
|
||||||
if (!Float3::NearEqual(Cache.Position, light.Position, SHADOWS_POSITION_ERROR) ||
|
if (!Float3::NearEqual(Cache.Position, light.Position, SHADOWS_POSITION_ERROR) ||
|
||||||
Cache.Radius != localLight.Radius)
|
!Math::NearEqual(Cache.Radius, localLight.Radius))
|
||||||
{
|
{
|
||||||
// Invalidate
|
// Invalidate
|
||||||
Cache.StaticValid = false;
|
Cache.StaticValid = false;
|
||||||
}
|
}
|
||||||
if (light.IsSpotLight && Cache.OuterConeAngle != ((const RenderSpotLightData&)light).OuterConeAngle)
|
if (light.IsSpotLight && !Math::NearEqual(Cache.OuterConeAngle, ((const RenderSpotLightData&)light).OuterConeAngle))
|
||||||
{
|
{
|
||||||
// Invalidate
|
// Invalidate
|
||||||
Cache.StaticValid = false;
|
Cache.StaticValid = false;
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _scaleFactor;
|
get => _scaleFactor;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_scaleFactor == value)
|
if (Mathf.NearEqual(_scaleFactor, value))
|
||||||
return;
|
return;
|
||||||
_scaleFactor = value;
|
_scaleFactor = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -175,7 +175,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _physicalUnitSize;
|
get => _physicalUnitSize;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_physicalUnitSize == value)
|
if (Mathf.NearEqual(_physicalUnitSize, value))
|
||||||
return;
|
return;
|
||||||
_physicalUnitSize = value;
|
_physicalUnitSize = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -212,7 +212,7 @@ namespace FlaxEngine.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Float2.Max(value, Float2.One);
|
value = Float2.Max(value, Float2.One);
|
||||||
if (_resolutionMin == value)
|
if (Float2.NearEqual(ref _resolutionMin, ref value))
|
||||||
return;
|
return;
|
||||||
_resolutionMin = value;
|
_resolutionMin = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -231,7 +231,7 @@ namespace FlaxEngine.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Float2.Max(value, Float2.One);
|
value = Float2.Max(value, Float2.One);
|
||||||
if (_resolutionMax == value)
|
if (Float2.NearEqual(ref _resolutionMax, ref value))
|
||||||
return;
|
return;
|
||||||
_resolutionMax = value;
|
_resolutionMax = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace FlaxEngine.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Clamp(value, _minimum, _maximum);
|
value = Mathf.Clamp(value, _minimum, _maximum);
|
||||||
if (value != _value)
|
if (!Mathf.NearEqual(value, _value))
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
if (!UseSmoothing || _firstUpdate)
|
if (!UseSmoothing || _firstUpdate)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class Slider : ContainerControl
|
|||||||
value = Mathf.Clamp(value, Minimum, Maximum);
|
value = Mathf.Clamp(value, Minimum, Maximum);
|
||||||
if (WholeNumbers)
|
if (WholeNumbers)
|
||||||
value = Mathf.RoundToInt(value);
|
value = Mathf.RoundToInt(value);
|
||||||
if (value != _value)
|
if (!Mathf.NearEqual(value, _value))
|
||||||
{
|
{
|
||||||
_value = value;
|
_value = value;
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _bounds.Size.X;
|
get => _bounds.Size.X;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_bounds.Size.X == value)
|
if (Mathf.NearEqual(_bounds.Size.X, value))
|
||||||
return;
|
return;
|
||||||
var bounds = new Rectangle(_bounds.Location, value, _bounds.Size.Y);
|
var bounds = new Rectangle(_bounds.Location, value, _bounds.Size.Y);
|
||||||
if (_pivotRelativeSizing)
|
if (_pivotRelativeSizing)
|
||||||
@@ -210,7 +210,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _bounds.Size.Y;
|
get => _bounds.Size.Y;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_bounds.Size.Y == value)
|
if (Mathf.NearEqual(_bounds.Size.Y, value))
|
||||||
return;
|
return;
|
||||||
var bounds = new Rectangle(_bounds.Location, _bounds.Size.X, value);
|
var bounds = new Rectangle(_bounds.Location, _bounds.Size.X, value);
|
||||||
if (_pivotRelativeSizing)
|
if (_pivotRelativeSizing)
|
||||||
@@ -412,7 +412,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _rotation;
|
get => _rotation;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_rotation != value)
|
if (!Mathf.NearEqual(_rotation, value))
|
||||||
{
|
{
|
||||||
SetRotationInternal(value);
|
SetRotationInternal(value);
|
||||||
}
|
}
|
||||||
@@ -598,7 +598,8 @@ namespace FlaxEngine.GUI
|
|||||||
var anchorMin = AnchorPresetsData[i].Min;
|
var anchorMin = AnchorPresetsData[i].Min;
|
||||||
var anchorMax = AnchorPresetsData[i].Max;
|
var anchorMax = AnchorPresetsData[i].Max;
|
||||||
var bounds = _bounds;
|
var bounds = _bounds;
|
||||||
if (_anchorMin != anchorMin || _anchorMax != anchorMax)
|
if (!Float2.NearEqual(ref _anchorMin, ref anchorMin) ||
|
||||||
|
!Float2.NearEqual(ref _anchorMax, ref anchorMax))
|
||||||
{
|
{
|
||||||
// Disable scrolling for anchored controls (by default but can be manually restored)
|
// Disable scrolling for anchored controls (by default but can be manually restored)
|
||||||
if (!anchorMin.IsZero || !anchorMax.IsZero)
|
if (!anchorMin.IsZero || !anchorMax.IsZero)
|
||||||
|
|||||||
@@ -251,10 +251,10 @@ namespace FlaxEngine.GUI
|
|||||||
/// <returns><c>true</c> if the specified <see cref="Margin" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if the specified <see cref="Margin" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||||
public bool Equals(ref Margin other)
|
public bool Equals(ref Margin other)
|
||||||
{
|
{
|
||||||
return other.Left == Left &&
|
return Mathf.NearEqual(other.Left, Left) &&
|
||||||
other.Right == Right &&
|
Mathf.NearEqual(other.Right, Right) &&
|
||||||
other.Top == Top &&
|
Mathf.NearEqual(other.Top, Top) &&
|
||||||
other.Bottom == Bottom;
|
Mathf.NearEqual(other.Bottom, Bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _headerHeight;
|
get => _headerHeight;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_headerHeight != value)
|
if (!Mathf.NearEqual(_headerHeight, value))
|
||||||
{
|
{
|
||||||
_headerHeight = value;
|
_headerHeight = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _scrollBarsSize;
|
get => _scrollBarsSize;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_scrollBarsSize == value)
|
if (Mathf.NearEqual(_scrollBarsSize, value))
|
||||||
return;
|
return;
|
||||||
_scrollBarsSize = value;
|
_scrollBarsSize = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _margin.Left;
|
get => _margin.Left;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_margin.Left != value)
|
if (!Mathf.NearEqual(_margin.Left, value))
|
||||||
{
|
{
|
||||||
_margin.Left = value;
|
_margin.Left = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -61,7 +61,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _margin.Right;
|
get => _margin.Right;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_margin.Right != value)
|
if (!Mathf.NearEqual(_margin.Right, value))
|
||||||
{
|
{
|
||||||
_margin.Right = value;
|
_margin.Right = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -78,7 +78,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _margin.Top;
|
get => _margin.Top;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_margin.Top != value)
|
if (!Mathf.NearEqual(_margin.Top, value))
|
||||||
{
|
{
|
||||||
_margin.Top = value;
|
_margin.Top = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -95,7 +95,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _margin.Bottom;
|
get => _margin.Bottom;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_margin.Bottom != value)
|
if (!Mathf.NearEqual(_margin.Bottom, value))
|
||||||
{
|
{
|
||||||
_margin.Bottom = value;
|
_margin.Bottom = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -112,7 +112,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _spacing;
|
get => _spacing;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_spacing != value)
|
if (!Mathf.NearEqual(_spacing, value))
|
||||||
{
|
{
|
||||||
_spacing = value;
|
_spacing = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -129,7 +129,7 @@ namespace FlaxEngine.GUI
|
|||||||
get => _offset;
|
get => _offset;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_offset != value)
|
if (!Float2.NearEqual(ref _offset, ref value))
|
||||||
{
|
{
|
||||||
_offset = value;
|
_offset = value;
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace FlaxEngine.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Clamp(value, _minimum, _maximum);
|
value = Mathf.Clamp(value, _minimum, _maximum);
|
||||||
if (value != _targetValue)
|
if (!Mathf.NearEqual(value, _targetValue))
|
||||||
{
|
{
|
||||||
_targetValue = value;
|
_targetValue = value;
|
||||||
_startValue = _value;
|
_startValue = _value;
|
||||||
@@ -163,7 +163,7 @@ namespace FlaxEngine.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Clamp(value, _minimum, _maximum);
|
value = Mathf.Clamp(value, _minimum, _maximum);
|
||||||
if (value != _targetValue)
|
if (!Mathf.NearEqual(value, _targetValue))
|
||||||
{
|
{
|
||||||
_targetValue = value;
|
_targetValue = value;
|
||||||
_value = value;
|
_value = value;
|
||||||
@@ -237,7 +237,7 @@ namespace FlaxEngine.GUI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void FastScroll()
|
public void FastScroll()
|
||||||
{
|
{
|
||||||
if (_value != _targetValue)
|
if (!Mathf.NearEqual(_value, _targetValue))
|
||||||
{
|
{
|
||||||
_value = _targetValue = _startValue;
|
_value = _targetValue = _startValue;
|
||||||
_scrollAnimationProgress = 0f;
|
_scrollAnimationProgress = 0f;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace FlaxEngine.GUI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
value = Mathf.Saturate(value);
|
value = Mathf.Saturate(value);
|
||||||
if (_splitterValue != value)
|
if (!Mathf.NearEqual(_splitterValue, value))
|
||||||
{
|
{
|
||||||
// Set new value
|
// Set new value
|
||||||
_splitterValue = value;
|
_splitterValue = value;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void VideoPlayer::SetIsAudioSpatial(bool value)
|
|||||||
void VideoPlayer::SetAudioVolume(float value)
|
void VideoPlayer::SetAudioVolume(float value)
|
||||||
{
|
{
|
||||||
value = Math::Saturate(value);
|
value = Math::Saturate(value);
|
||||||
if (_volume == value)
|
if (Math::NearEqual(_volume, value))
|
||||||
return;
|
return;
|
||||||
_volume = value;
|
_volume = value;
|
||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
@@ -51,7 +51,7 @@ void VideoPlayer::SetAudioVolume(float value)
|
|||||||
void VideoPlayer::SetAudioPan(float value)
|
void VideoPlayer::SetAudioPan(float value)
|
||||||
{
|
{
|
||||||
value = Math::Clamp(value, -1.0f, 1.0f);
|
value = Math::Clamp(value, -1.0f, 1.0f);
|
||||||
if (_pan == value)
|
if (Math::NearEqual(_pan, value))
|
||||||
return;
|
return;
|
||||||
_pan = value;
|
_pan = value;
|
||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
@@ -60,7 +60,7 @@ void VideoPlayer::SetAudioPan(float value)
|
|||||||
void VideoPlayer::SetAudioMinDistance(float value)
|
void VideoPlayer::SetAudioMinDistance(float value)
|
||||||
{
|
{
|
||||||
value = Math::Max(0.0f, value);
|
value = Math::Max(0.0f, value);
|
||||||
if (_minDistance == value)
|
if (Math::NearEqual(_minDistance, value))
|
||||||
return;
|
return;
|
||||||
_minDistance = value;
|
_minDistance = value;
|
||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
@@ -69,7 +69,7 @@ void VideoPlayer::SetAudioMinDistance(float value)
|
|||||||
void VideoPlayer::SetAudioAttenuation(float value)
|
void VideoPlayer::SetAudioAttenuation(float value)
|
||||||
{
|
{
|
||||||
value = Math::Max(0.0f, value);
|
value = Math::Max(0.0f, value);
|
||||||
if (_attenuation == value)
|
if (Math::NearEqual(_attenuation, value))
|
||||||
return;
|
return;
|
||||||
_attenuation = value;
|
_attenuation = value;
|
||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user