Refactor engine to support double-precision vectors
This commit is contained in:
@@ -149,7 +149,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
_floorModel = new StaticModel
|
||||
{
|
||||
Position = new Vector3(0, -25, 0),
|
||||
Scale = new Vector3(5, 0.5f, 5),
|
||||
Scale = new Float3(5, 0.5f, 5),
|
||||
Model = FlaxEngine.Content.LoadAsync<Model>(StringUtils.CombinePaths(Globals.EngineContentFolder, "Editor/Primitives/Cube.flax")),
|
||||
};
|
||||
}
|
||||
@@ -215,7 +215,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
{
|
||||
if (!ScaleToFit)
|
||||
{
|
||||
_previewModel.Scale = Vector3.One;
|
||||
_previewModel.Scale = Float3.One;
|
||||
_previewModel.Position = Vector3.Zero;
|
||||
return;
|
||||
}
|
||||
@@ -226,9 +226,9 @@ namespace FlaxEditor.Viewport.Previews
|
||||
{
|
||||
float targetSize = 50.0f;
|
||||
BoundingBox box = model.GetBox();
|
||||
float maxSize = Mathf.Max(0.001f, box.Size.MaxValue);
|
||||
float maxSize = Mathf.Max(0.001f, (float)box.Size.MaxValue);
|
||||
float scale = targetSize / maxSize;
|
||||
_previewModel.Scale = new Vector3(scale);
|
||||
_previewModel.Scale = new Float3(scale);
|
||||
_previewModel.Position = box.Center * (-0.5f * scale) + new Vector3(0, -10, 0);
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
float screenMultiple = 0.5f * Mathf.Max(projectionMatrix.M11, projectionMatrix.M22);
|
||||
var sphere = PreviewActor.Sphere;
|
||||
var viewOrigin = ViewPosition;
|
||||
float distSqr = Vector3.DistanceSquared(ref sphere.Center, ref viewOrigin);
|
||||
var distSqr = Vector3.DistanceSquared(ref sphere.Center, ref viewOrigin);
|
||||
var screenRadiusSquared = Mathf.Square(screenMultiple * sphere.Radius) / Mathf.Max(1.0f, distSqr);
|
||||
|
||||
// Check if model is being culled
|
||||
@@ -360,8 +360,8 @@ namespace FlaxEditor.Viewport.Previews
|
||||
text += string.Format("\nTriangles: {0:N0}\nVertices: {1:N0}", triangleCount, vertexCount);
|
||||
}
|
||||
var font = Style.Current.FontMedium;
|
||||
var pos = new Vector2(10, 50);
|
||||
Render2D.DrawText(font, text, new Rectangle(pos + Vector2.One, Size), Color.Black);
|
||||
var pos = new Float2(10, 50);
|
||||
Render2D.DrawText(font, text, new Rectangle(pos + Float2.One, Size), Color.Black);
|
||||
Render2D.DrawText(font, text, new Rectangle(pos, Size), Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user