Refactor engine to support double-precision vectors

This commit is contained in:
Wojtek Figat
2022-06-13 00:40:32 +02:00
parent f82e370392
commit a881c90b2e
744 changed files with 19062 additions and 12467 deletions

View File

@@ -111,7 +111,7 @@ namespace FlaxEditor.GUI.Dialogs
// Selector
_cSelector = new ColorSelectorWithSliders(180, 18)
{
Location = new Vector2(PickerMargin, PickerMargin),
Location = new Float2(PickerMargin, PickerMargin),
Parent = this
};
_cSelector.ColorChanged += x => SelectedColor = x;
@@ -166,7 +166,7 @@ namespace FlaxEditor.GUI.Dialogs
_cValue.ValueChanged += OnHSVChanged;
// Set valid dialog size based on UI content
_dialogSize = Size = new Vector2(_cRed.Right + PickerMargin, 300);
_dialogSize = Size = new Float2(_cRed.Right + PickerMargin, 300);
// Hex
const float hexTextBoxWidth = 80;

View File

@@ -84,11 +84,11 @@ namespace FlaxEditor.GUI.Dialogs
/// Updates the color selected by the mouse.
/// </summary>
/// <param name="location">The location.</param>
protected virtual void UpdateMouse(ref Vector2 location)
protected virtual void UpdateMouse(ref Float2 location)
{
if (_isMouseDownWheel)
{
Vector2 delta = location - _wheelRect.Center;
var delta = location - _wheelRect.Center;
float distance = delta.Length;
float degrees;
@@ -171,9 +171,9 @@ namespace FlaxEditor.GUI.Dialogs
Render2D.DrawSprite(_colorWheelSprite, _wheelRect.MakeExpanded(boxExpand), enabled ? Color.White : Color.Gray);
float hAngle = hsv.X * Mathf.DegreesToRadians;
float hRadius = hsv.Y * _wheelRect.Width * 0.5f;
Vector2 hsPos = new Vector2(hRadius * Mathf.Cos(hAngle), -hRadius * Mathf.Sin(hAngle));
var hsPos = new Float2(hRadius * Mathf.Cos(hAngle), -hRadius * Mathf.Sin(hAngle));
const float wheelBoxSize = 4.0f;
Render2D.DrawRectangle(new Rectangle(hsPos - (wheelBoxSize * 0.5f) + _wheelRect.Center, new Vector2(wheelBoxSize)), _isMouseDownWheel ? Color.Gray : Color.Black);
Render2D.DrawRectangle(new Rectangle(hsPos - (wheelBoxSize * 0.5f) + _wheelRect.Center, new Float2(wheelBoxSize)), _isMouseDownWheel ? Color.Gray : Color.Black);
}
/// <inheritdoc />
@@ -185,7 +185,7 @@ namespace FlaxEditor.GUI.Dialogs
}
/// <inheritdoc />
public override void OnMouseMove(Vector2 location)
public override void OnMouseMove(Float2 location)
{
UpdateMouse(ref location);
@@ -193,7 +193,7 @@ namespace FlaxEditor.GUI.Dialogs
}
/// <inheritdoc />
public override bool OnMouseDown(Vector2 location, MouseButton button)
public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _wheelRect.Contains(location))
{
@@ -211,7 +211,7 @@ namespace FlaxEditor.GUI.Dialogs
}
/// <inheritdoc />
public override bool OnMouseUp(Vector2 location, MouseButton button)
public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _isMouseDownWheel)
{
@@ -261,11 +261,11 @@ namespace FlaxEditor.GUI.Dialogs
const float slidersMargin = 8.0f;
_slider1Rect = new Rectangle(wheelSize + slidersMargin, 0, slidersThickness, wheelSize);
_slider2Rect = new Rectangle(_slider1Rect.Right + slidersMargin, _slider1Rect.Y, slidersThickness, _slider1Rect.Height);
Size = new Vector2(_slider2Rect.Right, wheelSize);
Size = new Float2(_slider2Rect.Right, wheelSize);
}
/// <inheritdoc />
protected override void UpdateMouse(ref Vector2 location)
protected override void UpdateMouse(ref Float2 location)
{
if (_isMouseDownSlider1)
{
@@ -327,7 +327,7 @@ namespace FlaxEditor.GUI.Dialogs
}
/// <inheritdoc />
public override bool OnMouseDown(Vector2 location, MouseButton button)
public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _slider1Rect.Contains(location))
{
@@ -346,7 +346,7 @@ namespace FlaxEditor.GUI.Dialogs
}
/// <inheritdoc />
public override bool OnMouseUp(Vector2 location, MouseButton button)
public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && (_isMouseDownSlider1 || _isMouseDownSlider2))
{

View File

@@ -32,7 +32,7 @@ namespace FlaxEditor.GUI.Dialogs
/// <summary>
/// The dialog size.
/// </summary>
protected Vector2 _dialogSize = new Vector2(300, 100);
protected Float2 _dialogSize = new Float2(300, 100);
/// <summary>
/// Gets the dialog result.