Cleanup comments and implement todo to use LOD0 only

#2299
This commit is contained in:
2024-03-04 20:27:11 +01:00
parent efd5561713
commit 32501101b1
3 changed files with 11 additions and 11 deletions
+5 -5
View File
@@ -85,7 +85,6 @@ namespace FlaxEditor.Gizmo
{
InitDrawing();
ModeChanged += ResetTranslationScale;
}
/// <summary>
@@ -564,13 +563,13 @@ namespace FlaxEditor.Gizmo
return; // ignore it if there is nothing under the mouse closestObject is only null if ray caster missed everything or Selection Count == 0
_vertexSnapObject = closestObject;
if (!closestObject.OnVertexSnap(ref ray.Ray, closestDistance, out _vertexSnapPoint))
{
//The OnVertexSnap is unimplemented or failed to get point return because there is nothing to do
// The OnVertexSnap is unimplemented or failed to get point return because there is nothing to do
_vertexSnapPoint = Vector3.Zero;
return;
}
// Transform back to the local space of the object to work when moving it
_vertexSnapPoint = closestObject.Transform.WorldToLocal(_vertexSnapPoint);
}
@@ -602,9 +601,9 @@ namespace FlaxEditor.Gizmo
var hit = Owner.SceneGraphRoot.RayCast(ref rayCast, out var distance, out var _);
if (hit != null)
{
if (hit.OnVertexSnap(ref rayCast.Ray, distance, out var pointSnapped)
if (hit.OnVertexSnap(ref rayCast.Ray, distance, out var pointSnapped)
//&& Vector3.Distance(point, pointSnapped) <= 25.0f
)
)
{
_vertexSnapObjectTo = hit;
_vertexSnapPointTo = hit.Transform.WorldToLocal(pointSnapped);
@@ -692,6 +691,7 @@ namespace FlaxEditor.Gizmo
protected virtual void OnDuplicate()
{
}
/// <inheritdoc />
public override void OnSelectionChanged(List<SceneGraphNode> newSelection)
{
@@ -23,13 +23,12 @@ namespace FlaxEditor.SceneGraph.Actors
: base(actor)
{
}
/// <inheritdoc />
public override bool OnVertexSnap(ref Ray ray, float hitDistance, out Vector3 result)
{
// Find the closest vertex to bounding box point (collision detection approximation)
result = ray.GetPoint(hitDistance);
var model = ((StaticModel)Actor).Model;
if (model && !model.WaitForLoaded())
@@ -39,7 +38,8 @@ namespace FlaxEditor.SceneGraph.Actors
_vertices = new();
var pointLocal = (Float3)Actor.Transform.WorldToLocal(result);
var minDistance = float.MaxValue;
foreach (var lod in model.LODs) //[ToDo] fix it [Nori_SC note] this is wrong it should get current lod level going it throw all lods will create ghost snaping points
var lodIndex = 0; // TODO: use LOD index based on the game view
var lod = model.LODs[lodIndex];
{
var hit = false;
foreach (var mesh in lod.Meshes)
+3 -3
View File
@@ -355,11 +355,11 @@ namespace FlaxEditor.SceneGraph
/// <summary>
/// Performs the vertex snapping for a given ray and hitDistance.
/// </summary>
/// <param name="ray">Raycasted ray</param>
/// <param name="hitDistance">Hit distance from ray to object bounding box</param>
/// <param name="ray">The ray to raycast.</param>
/// <param name="hitDistance">Hit distance from ray to object bounding box.</param>
/// <param name="result">The result point on the object mesh that is closest to the specified location.</param>
/// <returns>True if got a valid result value, otherwise false (eg. if missing data or not initialized).</returns>
public virtual bool OnVertexSnap(ref Ray ray,float hitDistance, out Vector3 result) // [NoriSC note] ray and hit Distance will be needed for a future use, in mesh types for proper collision detection
public virtual bool OnVertexSnap(ref Ray ray, float hitDistance, out Vector3 result)
{
result = Vector3.Zero;
return false;