Cleanup 3

This commit is contained in:
W2.Wizard
2021-02-21 11:09:04 +01:00
parent 92fafe877c
commit 20ba37e223
24 changed files with 181 additions and 119 deletions
@@ -32,7 +32,7 @@ namespace FlaxEditor.Content.Import
var result = 0;
for (int i = 0; i < _rootNode.ChildrenCount; i++)
{
if (_rootNode.Children[i].Tag is ImportFileEntry fileEntry)
if (_rootNode.Children[i].Tag is ImportFileEntry)
result++;
}
return result;
@@ -261,13 +261,17 @@ namespace FlaxEditor.CustomEditors.Editors
// Ensure to have valid drag helpers (uses lazy init)
if (_dragActors == null)
_dragActors = new DragActors(x => IsValid(TypeUtils.GetObjectType(x.Actor)));
if (_dragScripts == null)
_dragScripts = new DragScripts(x => IsValid(TypeUtils.GetObjectType(x)));
if (_dragHandlers == null)
{
_dragHandlers = new DragHandlers();
_dragHandlers.Add(_dragActors);
_dragHandlers.Add(_dragScripts);
_dragHandlers = new DragHandlers
{
_dragActors,
_dragScripts
};
}
_hasValidDragOver = _dragHandlers.OnDragEnter(data) != DragDropEffect.None;
@@ -68,7 +68,6 @@ namespace FlaxEditor.GUI.Timeline.Tracks
var e = (ParticleEmitterTrack)track;
Guid id = new Guid(stream.ReadBytes(16));
e.Asset = FlaxEngine.Content.LoadAsync<ParticleEmitter>(id);
var emitterIndex = stream.ReadInt32();
var m = e.TrackMedia;
m.StartFrame = stream.ReadInt32();
m.DurationFrames = stream.ReadInt32();
@@ -29,7 +29,6 @@ namespace FlaxEditor.Gizmo
private bool IntersectsRotateCircle(Vector3 normal, ref Ray ray, out float distance)
{
distance = float.MaxValue;
var plane = new Plane(Vector3.Zero, normal);
if (!plane.Intersects(ref ray, out distance))
@@ -393,7 +393,7 @@ namespace FlaxEditor.Surface.Archetypes
int count = 0;
if (ExtractNumber(ref filterText, out vec[count]))
{
count = count + 1;
count++;
while (count < 4)
{
if (ExtractComma(ref filterText) && ExtractNumber(ref filterText, out vec[count]))
+5 -2
View File
@@ -305,8 +305,11 @@ namespace FlaxEditor.Surface.Elements
if (HasAnyConnection)
{
// Remove all connections
var toUpdate = new List<Box>(1 + Connections.Count);
toUpdate.Add(this);
var toUpdate = new List<Box>(1 + Connections.Count)
{
this
};
for (int i = 0; i < Connections.Count; i++)
{
var targetBox = Connections[i];
+4 -3
View File
@@ -146,9 +146,10 @@ namespace FlaxEditor.Surface
for (int i = 0; i < entries; i++)
{
Entry e = new Entry();
e.TypeID = stream.ReadInt32();
Entry e = new Entry
{
TypeID = stream.ReadInt32()
};
stream.ReadInt64(); // don't use CreationTime
uint dataSize = stream.ReadUInt32();
@@ -76,9 +76,11 @@ namespace FlaxEditor.Surface.Undo
var iB = _input.Get(context);
var oB = _output.Get(context);
var toUpdate = new HashSet<Box>();
toUpdate.Add(iB);
toUpdate.Add(oB);
var toUpdate = new HashSet<Box>
{
iB,
oB
};
toUpdate.AddRange(iB.Connections);
toUpdate.AddRange(oB.Connections);
@@ -56,8 +56,10 @@ namespace FlaxEditor.Tools.Foliage
if (!_staticModel)
{
_staticModel = new StaticModel();
_staticModel.StaticFlags = StaticFlags.None;
_staticModel = new StaticModel
{
StaticFlags = StaticFlags.None
};
}
_staticModel.Model = model;
+5 -3
View File
@@ -179,9 +179,11 @@ namespace FlaxEditor.Tools.Foliage
private void OnCreateNewFoliageClicked()
{
// Create
var actor = new FlaxEngine.Foliage();
actor.StaticFlags = StaticFlags.FullyStatic;
actor.Name = "Foliage";
var actor = new FlaxEngine.Foliage
{
StaticFlags = StaticFlags.FullyStatic,
Name = "Foliage"
};
// Spawn
Editor.SceneEditing.Spawn(actor);
+2 -2
View File
@@ -84,7 +84,7 @@ namespace FlaxEditor.Utilities
while (bytes >= 1024 && order < MemorySizePostfixes.Length - 1)
{
order++;
bytes = bytes / 1024;
bytes /= 1024;
}
return string.Format("{0:0.##} {1}", bytes, MemorySizePostfixes[order]);
@@ -101,7 +101,7 @@ namespace FlaxEditor.Utilities
while (bytes >= 1024 && order < MemorySizePostfixes.Length - 1)
{
order++;
bytes = bytes / 1024;
bytes /= 1024;
}
return string.Format("{0:0.##} {1}", bytes, MemorySizePostfixes[order]);
+52 -27
View File
@@ -453,9 +453,11 @@ namespace FlaxEditor.Viewport
// Camera speed widget
var camSpeed = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
var camSpeedCM = new ContextMenu();
var camSpeedButton = new ViewportWidgetButton(_movementSpeed.ToString(), Editor.Instance.Icons.ArrowRightBorder16, camSpeedCM);
camSpeedButton.Tag = this;
camSpeedButton.TooltipText = "Camera speed scale";
var camSpeedButton = new ViewportWidgetButton(_movementSpeed.ToString(), Editor.Instance.Icons.ArrowRightBorder16, camSpeedCM)
{
Tag = this,
TooltipText = "Camera speed scale"
};
_speedWidget = camSpeedButton;
for (int i = 0; i < EditorViewportCameraSpeedValues.Length; i++)
{
@@ -471,9 +473,11 @@ namespace FlaxEditor.Viewport
// View mode widget
var viewMode = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperLeft);
ViewWidgetButtonMenu = new ContextMenu();
var viewModeButton = new ViewportWidgetButton("View", SpriteHandle.Invalid, ViewWidgetButtonMenu);
viewModeButton.TooltipText = "View properties";
viewModeButton.Parent = viewMode;
var viewModeButton = new ViewportWidgetButton("View", SpriteHandle.Invalid, ViewWidgetButtonMenu)
{
TooltipText = "View properties",
Parent = viewMode
};
viewMode.Parent = this;
// Show
@@ -524,8 +528,10 @@ namespace FlaxEditor.Viewport
// Orthographic
{
var ortho = ViewWidgetButtonMenu.AddButton("Orthographic");
var orthoValue = new CheckBox(90, 2, _isOrtho);
orthoValue.Parent = ortho;
var orthoValue = new CheckBox(90, 2, _isOrtho)
{
Parent = ortho
};
orthoValue.StateChanged += checkBox =>
{
if (checkBox.Checked != _isOrtho)
@@ -552,8 +558,11 @@ namespace FlaxEditor.Viewport
// Field of View
{
var fov = ViewWidgetButtonMenu.AddButton("Field Of View");
var fovValue = new FloatValueBox(1, 90, 2, 70.0f, 35.0f, 160.0f, 0.1f);
fovValue.Parent = fov;
var fovValue = new FloatValueBox(1, 90, 2, 70.0f, 35.0f, 160.0f, 0.1f)
{
Parent = fov
};
fovValue.ValueChanged += () => _fieldOfView = fovValue.Value;
ViewWidgetButtonMenu.VisibleChanged += control =>
{
@@ -565,8 +574,11 @@ namespace FlaxEditor.Viewport
// Ortho Scale
{
var orthoSize = ViewWidgetButtonMenu.AddButton("Ortho Scale");
var orthoSizeValue = new FloatValueBox(_orthoSize, 90, 2, 70.0f, 0.001f, 100000.0f, 0.01f);
orthoSizeValue.Parent = orthoSize;
var orthoSizeValue = new FloatValueBox(_orthoSize, 90, 2, 70.0f, 0.001f, 100000.0f, 0.01f)
{
Parent = orthoSize
};
orthoSizeValue.ValueChanged += () => _orthoSize = orthoSizeValue.Value;
ViewWidgetButtonMenu.VisibleChanged += control =>
{
@@ -578,8 +590,10 @@ namespace FlaxEditor.Viewport
// Near Plane
{
var nearPlane = ViewWidgetButtonMenu.AddButton("Near Plane");
var nearPlaneValue = new FloatValueBox(2.0f, 90, 2, 70.0f, 0.001f, 1000.0f);
nearPlaneValue.Parent = nearPlane;
var nearPlaneValue = new FloatValueBox(2.0f, 90, 2, 70.0f, 0.001f, 1000.0f)
{
Parent = nearPlane
};
nearPlaneValue.ValueChanged += () => _nearPlane = nearPlaneValue.Value;
ViewWidgetButtonMenu.VisibleChanged += control => nearPlaneValue.Value = _nearPlane;
}
@@ -587,8 +601,10 @@ namespace FlaxEditor.Viewport
// Far Plane
{
var farPlane = ViewWidgetButtonMenu.AddButton("Far Plane");
var farPlaneValue = new FloatValueBox(1000, 90, 2, 70.0f, 10.0f);
farPlaneValue.Parent = farPlane;
var farPlaneValue = new FloatValueBox(1000, 90, 2, 70.0f, 10.0f)
{
Parent = farPlane
};
farPlaneValue.ValueChanged += () => _farPlane = farPlaneValue.Value;
ViewWidgetButtonMenu.VisibleChanged += control => farPlaneValue.Value = _farPlane;
}
@@ -596,8 +612,10 @@ namespace FlaxEditor.Viewport
// Brightness
{
var brightness = ViewWidgetButtonMenu.AddButton("Brightness");
var brightnessValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.001f, 10.0f, 0.001f);
brightnessValue.Parent = brightness;
var brightnessValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.001f, 10.0f, 0.001f)
{
Parent = brightness
};
brightnessValue.ValueChanged += () => Brightness = brightnessValue.Value;
ViewWidgetButtonMenu.VisibleChanged += control => brightnessValue.Value = Brightness;
}
@@ -605,8 +623,10 @@ namespace FlaxEditor.Viewport
// Resolution
{
var resolution = ViewWidgetButtonMenu.AddButton("Resolution");
var resolutionValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.1f, 4.0f, 0.001f);
resolutionValue.Parent = resolution;
var resolutionValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.1f, 4.0f, 0.001f)
{
Parent = resolution
};
resolutionValue.ValueChanged += () => ResolutionScale = resolutionValue.Value;
ViewWidgetButtonMenu.VisibleChanged += control => resolutionValue.Value = ResolutionScale;
}
@@ -614,8 +634,11 @@ namespace FlaxEditor.Viewport
// Invert Panning
{
var invert = ViewWidgetButtonMenu.AddButton("Invert Panning");
var invertValue = new CheckBox(90, 2, _invertPanning);
invertValue.Parent = invert;
var invertValue = new CheckBox(90, 2, _invertPanning)
{
Parent = invert
};
invertValue.StateChanged += checkBox =>
{
if (checkBox.Checked != _invertPanning)
@@ -690,10 +713,12 @@ namespace FlaxEditor.Viewport
private void InitFpsCounter()
{
_fpsCounter = new FpsCounter(10, ViewportWidgetsContainer.WidgetsHeight + 14);
_fpsCounter.Visible = false;
_fpsCounter.Enabled = false;
_fpsCounter.Parent = this;
_fpsCounter = new FpsCounter(10, ViewportWidgetsContainer.WidgetsHeight + 14)
{
Visible = false,
Enabled = false,
Parent = this
};
}
#endregion
@@ -1085,7 +1110,7 @@ namespace FlaxEditor.Viewport
{
// Accelerate the delta
var currentDelta = mouseDelta;
mouseDelta = mouseDelta + _mouseDeltaRightLast * _mouseAccelerationScale;
mouseDelta += _mouseDeltaRightLast * _mouseAccelerationScale;
_mouseDeltaRightLast = currentDelta;
}
@@ -228,9 +228,13 @@ namespace FlaxEditor.Viewport
Parent = scaleSnappingWidget
};
enableScaleSnapping.Toggled += OnScaleSnappingToggle;
var scaleSnappingCM = new ContextMenu();
_scaleSnapping = new ViewportWidgetButton(TransformGizmo.ScaleSnapValue.ToString(), SpriteHandle.Invalid, scaleSnappingCM);
_scaleSnapping.TooltipText = "Scale snapping values";
_scaleSnapping = new ViewportWidgetButton(TransformGizmo.ScaleSnapValue.ToString(), SpriteHandle.Invalid, scaleSnappingCM)
{
TooltipText = "Scale snapping values"
};
for (int i = 0; i < EditorViewportScaleSnapValues.Length; i++)
{
var v = EditorViewportScaleSnapValues[i];
@@ -251,9 +255,13 @@ namespace FlaxEditor.Viewport
Parent = rotateSnappingWidget
};
enableRotateSnapping.Toggled += OnRotateSnappingToggle;
var rotateSnappingCM = new ContextMenu();
_rotateSnapping = new ViewportWidgetButton(TransformGizmo.RotationSnapValue.ToString(), SpriteHandle.Invalid, rotateSnappingCM);
_rotateSnapping.TooltipText = "Rotation snapping values";
_rotateSnapping = new ViewportWidgetButton(TransformGizmo.RotationSnapValue.ToString(), SpriteHandle.Invalid, rotateSnappingCM)
{
TooltipText = "Rotation snapping values"
};
for (int i = 0; i < EditorViewportRotateSnapValues.Length; i++)
{
var v = EditorViewportRotateSnapValues[i];
@@ -274,9 +282,13 @@ namespace FlaxEditor.Viewport
Parent = translateSnappingWidget
};
enableTranslateSnapping.Toggled += OnTranslateSnappingToggle;
var translateSnappingCM = new ContextMenu();
_translateSnapping = new ViewportWidgetButton(TransformGizmo.TranslationSnapValue.ToString(), SpriteHandle.Invalid, translateSnappingCM);
_translateSnapping.TooltipText = "Position snapping values";
_translateSnapping = new ViewportWidgetButton(TransformGizmo.TranslationSnapValue.ToString(), SpriteHandle.Invalid, translateSnappingCM)
{
TooltipText = "Position snapping values"
};
for (int i = 0; i < EditorViewportTranslateSnapValues.Length; i++)
{
var v = EditorViewportTranslateSnapValues[i];
@@ -368,15 +380,17 @@ namespace FlaxEditor.Viewport
return;
// Create actor
var actor = new Camera();
actor.StaticFlags = StaticFlags.None;
actor.Name = "Camera";
actor.Transform = ViewTransform;
actor.NearPlane = NearPlane;
actor.FarPlane = FarPlane;
actor.OrthographicScale = OrthographicScale;
actor.UsePerspective = !UseOrthographicProjection;
actor.FieldOfView = FieldOfView;
var actor = new Camera
{
StaticFlags = StaticFlags.None,
Name = "Camera",
Transform = ViewTransform,
NearPlane = NearPlane,
FarPlane = FarPlane,
OrthographicScale = OrthographicScale,
UsePerspective = !UseOrthographicProjection,
FieldOfView = FieldOfView
};
// Spawn
Editor.Instance.SceneEditing.Spawn(actor);
@@ -846,9 +860,11 @@ namespace FlaxEditor.Viewport
if (assetItem.IsOfType<ParticleSystem>())
{
var asset = FlaxEngine.Content.LoadAsync<ParticleSystem>(item.ID);
var actor = new ParticleEffect();
actor.Name = item.ShortName;
actor.ParticleSystem = asset;
var actor = new ParticleEffect
{
Name = item.ShortName,
ParticleSystem = asset
};
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
Editor.Instance.SceneEditing.Spawn(actor);
return;
@@ -856,9 +872,11 @@ namespace FlaxEditor.Viewport
if (assetItem.IsOfType<SceneAnimation>())
{
var asset = FlaxEngine.Content.LoadAsync<SceneAnimation>(item.ID);
var actor = new SceneAnimationPlayer();
actor.Name = item.ShortName;
actor.Animation = asset;
var actor = new SceneAnimationPlayer
{
Name = item.ShortName,
Animation = asset
};
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
Editor.Instance.SceneEditing.Spawn(actor);
return;
@@ -891,9 +909,11 @@ namespace FlaxEditor.Viewport
if (assetItem.IsOfType<SkinnedModel>())
{
var model = FlaxEngine.Content.LoadAsync<SkinnedModel>(item.ID);
var actor = new AnimatedModel();
actor.Name = item.ShortName;
actor.SkinnedModel = model;
var actor = new AnimatedModel
{
Name = item.ShortName,
SkinnedModel = model
};
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
Editor.Instance.SceneEditing.Spawn(actor);
return;
@@ -901,9 +921,11 @@ namespace FlaxEditor.Viewport
if (assetItem.IsOfType<Model>())
{
var model = FlaxEngine.Content.LoadAsync<Model>(item.ID);
var actor = new StaticModel();
actor.Name = item.ShortName;
actor.Model = model;
var actor = new StaticModel
{
Name = item.ShortName,
Model = model
};
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
Editor.Instance.SceneEditing.Spawn(actor);
return;
@@ -911,9 +933,11 @@ namespace FlaxEditor.Viewport
if (assetItem.IsOfType<AudioClip>())
{
var clip = FlaxEngine.Content.LoadAsync<AudioClip>(item.ID);
var actor = new AudioSource();
actor.Name = item.ShortName;
actor.Clip = clip;
var actor = new AudioSource
{
Name = item.ShortName,
Clip = clip
};
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
Editor.Instance.SceneEditing.Spawn(actor);
return;
+5 -5
View File
@@ -313,7 +313,7 @@ namespace FlaxEngine
if (time < start)
{
if (loop)
time = time + (Mathf.Floor(end - time) / length) * length;
time += (Mathf.Floor(end - time) / length) * length;
else
time = start;
}
@@ -322,7 +322,7 @@ namespace FlaxEngine
if (time > end)
{
if (loop)
time = time - Mathf.Floor((time - start) / length) * length;
time -= Mathf.Floor((time - start) / length) * length;
else
time = end;
}
@@ -420,7 +420,7 @@ namespace FlaxEngine
{
if (Keyframes.Length == 0)
{
result = new Keyframe(time, default(T));
result = new Keyframe(time, default);
return;
}
@@ -621,7 +621,7 @@ namespace FlaxEngine
{
Time = time;
Value = value;
TangentIn = TangentOut = default(T);
TangentIn = TangentOut = default;
}
/// <summary>
@@ -696,7 +696,7 @@ namespace FlaxEngine
{
if (Keyframes.Length == 0)
{
result = new Keyframe(time, default(T));
result = new Keyframe(time, default);
return;
}
@@ -307,7 +307,7 @@ namespace FlaxEngine.Collections
return true;
}
value = default(TValue);
value = default;
return false;
}
+1 -1
View File
@@ -553,7 +553,7 @@ namespace FlaxEngine
return true;
}
denominator = denominator * denominator;
denominator *= denominator;
//3x3 matrix for the first ray.
float m11 = ray2.Position.X - ray1.Position.X;
+2 -2
View File
@@ -782,9 +782,9 @@ namespace FlaxEngine
s = vv / v;
h = offset + (colorone - colortwo) / vv;
}
h = h / 6f;
h /= 6f;
if (h < 0f)
h = h + 1f;
h++;
}
}
+2 -2
View File
@@ -154,7 +154,7 @@ namespace FlaxEngine
{
float t = Repeat(target - current, 360f);
if (t > 180f)
t = t - 360f;
t -= 360f;
return t;
}
@@ -222,7 +222,7 @@ namespace FlaxEngine
{
float c = Repeat(b - a, 360f);
if (c > 180f)
c = c - 360f;
c -= 360f;
return a + c * Saturate(t);
}
+13 -13
View File
@@ -1205,7 +1205,7 @@ namespace FlaxEngine
while (true)
{
if ((exponent & 1) != 0)
identity = identity * temp;
identity *= temp;
exponent /= 2;
@@ -1517,14 +1517,14 @@ namespace FlaxEngine
//By separating the above algorithm into multiple lines, we actually increase accuracy.
result = value;
result.Row2 = result.Row2 - Vector4.Dot(result.Row1, result.Row2) / Vector4.Dot(result.Row1, result.Row1) * result.Row1;
result.Row2 -= Vector4.Dot(result.Row1, result.Row2) / Vector4.Dot(result.Row1, result.Row1) * result.Row1;
result.Row3 = result.Row3 - Vector4.Dot(result.Row1, result.Row3) / Vector4.Dot(result.Row1, result.Row1) * result.Row1;
result.Row3 = result.Row3 - Vector4.Dot(result.Row2, result.Row3) / Vector4.Dot(result.Row2, result.Row2) * result.Row2;
result.Row3 -= Vector4.Dot(result.Row1, result.Row3) / Vector4.Dot(result.Row1, result.Row1) * result.Row1;
result.Row3 -= Vector4.Dot(result.Row2, result.Row3) / Vector4.Dot(result.Row2, result.Row2) * result.Row2;
result.Row4 = result.Row4 - Vector4.Dot(result.Row1, result.Row4) / Vector4.Dot(result.Row1, result.Row1) * result.Row1;
result.Row4 = result.Row4 - Vector4.Dot(result.Row2, result.Row4) / Vector4.Dot(result.Row2, result.Row2) * result.Row2;
result.Row4 = result.Row4 - Vector4.Dot(result.Row3, result.Row4) / Vector4.Dot(result.Row3, result.Row3) * result.Row3;
result.Row4 -= Vector4.Dot(result.Row1, result.Row4) / Vector4.Dot(result.Row1, result.Row1) * result.Row1;
result.Row4 -= Vector4.Dot(result.Row2, result.Row4) / Vector4.Dot(result.Row2, result.Row2) * result.Row2;
result.Row4 -= Vector4.Dot(result.Row3, result.Row4) / Vector4.Dot(result.Row3, result.Row3) * result.Row3;
}
/// <summary>
@@ -1594,16 +1594,16 @@ namespace FlaxEngine
result.Row1 = Vector4.Normalize(result.Row1);
result.Row2 = result.Row2 - Vector4.Dot(result.Row1, result.Row2) * result.Row1;
result.Row2 -= Vector4.Dot(result.Row1, result.Row2) * result.Row1;
result.Row2 = Vector4.Normalize(result.Row2);
result.Row3 = result.Row3 - Vector4.Dot(result.Row1, result.Row3) * result.Row1;
result.Row3 = result.Row3 - Vector4.Dot(result.Row2, result.Row3) * result.Row2;
result.Row3 -= Vector4.Dot(result.Row1, result.Row3) * result.Row1;
result.Row3 -= Vector4.Dot(result.Row2, result.Row3) * result.Row2;
result.Row3 = Vector4.Normalize(result.Row3);
result.Row4 = result.Row4 - Vector4.Dot(result.Row1, result.Row4) * result.Row1;
result.Row4 = result.Row4 - Vector4.Dot(result.Row2, result.Row4) * result.Row2;
result.Row4 = result.Row4 - Vector4.Dot(result.Row3, result.Row4) * result.Row3;
result.Row4 -= Vector4.Dot(result.Row1, result.Row4) * result.Row1;
result.Row4 -= Vector4.Dot(result.Row2, result.Row4) * result.Row2;
result.Row4 -= Vector4.Dot(result.Row3, result.Row4) * result.Row3;
result.Row4 = Vector4.Normalize(result.Row4);
}
+7 -7
View File
@@ -901,7 +901,7 @@ namespace FlaxEngine
while (true)
{
if ((exponent & 1) != 0)
identity = identity * temp;
identity *= temp;
exponent /= 2;
@@ -1154,10 +1154,10 @@ namespace FlaxEngine
//By separating the above algorithm into multiple lines, we actually increase accuracy.
result = value;
result.Row2 = result.Row2 - (Vector3.Dot(result.Row1, result.Row2) / Vector3.Dot(result.Row1, result.Row1)) * result.Row1;
result.Row2 -= (Vector3.Dot(result.Row1, result.Row2) / Vector3.Dot(result.Row1, result.Row1)) * result.Row1;
result.Row3 = result.Row3 - (Vector3.Dot(result.Row1, result.Row3) / Vector3.Dot(result.Row1, result.Row1)) * result.Row1;
result.Row3 = result.Row3 - (Vector3.Dot(result.Row2, result.Row3) / Vector3.Dot(result.Row2, result.Row2)) * result.Row2;
result.Row3 -= (Vector3.Dot(result.Row1, result.Row3) / Vector3.Dot(result.Row1, result.Row1)) * result.Row1;
result.Row3 -= (Vector3.Dot(result.Row2, result.Row3) / Vector3.Dot(result.Row2, result.Row2)) * result.Row2;
}
/// <summary>
@@ -1215,11 +1215,11 @@ namespace FlaxEngine
result.Row1 = Vector3.Normalize(result.Row1);
result.Row2 = result.Row2 - Vector3.Dot(result.Row1, result.Row2) * result.Row1;
result.Row2 -= Vector3.Dot(result.Row1, result.Row2) * result.Row1;
result.Row2 = Vector3.Normalize(result.Row2);
result.Row3 = result.Row3 - Vector3.Dot(result.Row1, result.Row3) * result.Row1;
result.Row3 = result.Row3 - Vector3.Dot(result.Row2, result.Row3) * result.Row2;
result.Row3 -= Vector3.Dot(result.Row1, result.Row3) * result.Row1;
result.Row3 -= Vector3.Dot(result.Row2, result.Row3) * result.Row2;
result.Row3 = Vector3.Normalize(result.Row3);
}
+1 -1
View File
@@ -337,7 +337,7 @@ namespace FlaxEngine
X = -X * lengthSq;
Y = -Y * lengthSq;
Z = -Z * lengthSq;
W = W * lengthSq;
W *= lengthSq;
}
}
@@ -281,7 +281,7 @@ namespace FlaxEngine.GUI
Vector2 leftEdge = selection.StartIndex <= textBlock.Range.StartIndex ? textBlock.Bounds.UpperLeft : font.GetCharPosition(_text, selection.StartIndex);
Vector2 rightEdge = selection.EndIndex >= textBlock.Range.EndIndex ? textBlock.Bounds.UpperRight : font.GetCharPosition(_text, selection.EndIndex);
float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f);
alpha = alpha * alpha;
alpha *= alpha;
Color selectionColor = Color.White * alpha;
Rectangle selectionRect = new Rectangle(leftEdge.X, leftEdge.Y, rightEdge.X - leftEdge.X, font.Height);
textBlock.Style.BackgroundSelectedBrush.Draw(selectionRect, selectionColor);
+1 -1
View File
@@ -165,7 +165,7 @@ namespace FlaxEngine.GUI
// Draw selection background
float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f);
alpha = alpha * alpha;
alpha *= alpha;
Color selectionColor = SelectionColor * alpha;
//
int selectedLinesCount = 1 + Mathf.FloorToInt((rightEdge.Y - leftEdge.Y) / fontHeight);
+7 -6
View File
@@ -116,12 +116,13 @@ namespace FlaxEngine
var size = max - min;
// Calculate bounds
OrientedBoundingBox bounds = new OrientedBoundingBox();
bounds.Extents = new Vector3(size * 0.5f, Mathf.Epsilon);
Matrix world;
canvasRoot.Canvas.GetWorldMatrix(out world);
Matrix offset;
Matrix.Translation(min.X + size.X * 0.5f, min.Y + size.Y * 0.5f, 0, out offset);
OrientedBoundingBox bounds = new OrientedBoundingBox
{
Extents = new Vector3(size * 0.5f, Mathf.Epsilon)
};
canvasRoot.Canvas.GetWorldMatrix(out Matrix world);
Matrix.Translation(min.X + size.X * 0.5f, min.Y + size.Y * 0.5f, 0, out Matrix offset);
Matrix.Multiply(ref offset, ref world, out bounds.Transformation);
return bounds;
}