@@ -263,6 +263,12 @@ namespace FlaxEditor.SceneGraph
|
|||||||
return _actor.IntersectsItself(ray.Ray, out distance, out normal);
|
return _actor.IntersectsItself(ray.Ray, out distance, out normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void GetEditorSphere(out BoundingSphere sphere)
|
||||||
|
{
|
||||||
|
Editor.GetActorEditorSphere(_actor, out sphere);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDebugDraw(ViewportDebugDrawData data)
|
public override void OnDebugDraw(ViewportDebugDrawData data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -309,6 +309,20 @@ namespace FlaxEditor.SceneGraph
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the object bounding sphere (including child actors).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sphere">The bounding sphere.</param>
|
||||||
|
public virtual void GetEditorSphere(out BoundingSphere sphere)
|
||||||
|
{
|
||||||
|
sphere = new BoundingSphere(Transform.Translation, 15.0f);
|
||||||
|
for (int i = 0; i < ChildNodes.Count; i++)
|
||||||
|
{
|
||||||
|
ChildNodes[i].GetEditorSphere(out var childSphere);
|
||||||
|
BoundingSphere.Merge(ref sphere, ref childSphere, out sphere);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when selected nodes should draw debug shapes using <see cref="DebugDraw"/> interface.
|
/// Called when selected nodes should draw debug shapes using <see cref="DebugDraw"/> interface.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -103,45 +103,43 @@ namespace FlaxEditor.Viewport.Cameras
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Moves the viewport to visualize selected actors.
|
/// Moves the viewport to visualize selected actors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="actors">The actors to show.</param>
|
/// <param name="selection">The actors to show.</param>
|
||||||
public void ShowActors(List<SceneGraphNode> actors)
|
public void ShowActors(List<SceneGraphNode> selection)
|
||||||
{
|
{
|
||||||
if (actors.Count == 0)
|
if (selection.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BoundingSphere mergesSphere = BoundingSphere.Empty;
|
BoundingSphere mergesSphere = BoundingSphere.Empty;
|
||||||
for (int i = 0; i < actors.Count; i++)
|
for (int i = 0; i < selection.Count; i++)
|
||||||
{
|
{
|
||||||
if (actors[i] is ActorNode actor)
|
selection[i].GetEditorSphere(out var sphere);
|
||||||
{
|
BoundingSphere.Merge(ref mergesSphere, ref sphere, out mergesSphere);
|
||||||
Editor.GetActorEditorSphere(actor.Actor, out BoundingSphere sphere);
|
|
||||||
BoundingSphere.Merge(ref mergesSphere, ref sphere, out mergesSphere);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mergesSphere == BoundingSphere.Empty)
|
||||||
|
return;
|
||||||
ShowSphere(ref mergesSphere);
|
ShowSphere(ref mergesSphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Moves the viewport to visualize selected actors.
|
/// Moves the viewport to visualize selected actors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="actors">The actors to show.</param>
|
/// <param name="selection">The actors to show.</param>
|
||||||
/// <param name="orientation">The used orientation.</param>
|
/// <param name="orientation">The used orientation.</param>
|
||||||
public void ShowActors(List<SceneGraphNode> actors, ref Quaternion orientation)
|
public void ShowActors(List<SceneGraphNode> selection, ref Quaternion orientation)
|
||||||
{
|
{
|
||||||
if (actors.Count == 0)
|
if (selection.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BoundingSphere mergesSphere = BoundingSphere.Empty;
|
BoundingSphere mergesSphere = BoundingSphere.Empty;
|
||||||
for (int i = 0; i < actors.Count; i++)
|
for (int i = 0; i < selection.Count; i++)
|
||||||
{
|
{
|
||||||
if (actors[i] is ActorNode actor)
|
selection[i].GetEditorSphere(out var sphere);
|
||||||
{
|
BoundingSphere.Merge(ref mergesSphere, ref sphere, out mergesSphere);
|
||||||
Editor.GetActorEditorSphere(actor.Actor, out BoundingSphere sphere);
|
|
||||||
BoundingSphere.Merge(ref mergesSphere, ref sphere, out mergesSphere);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mergesSphere == BoundingSphere.Empty)
|
||||||
|
return;
|
||||||
ShowSphere(ref mergesSphere, ref orientation);
|
ShowSphere(ref mergesSphere, ref orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1139,20 +1139,28 @@ BoundingBox Actor::GetBoxWithChildren() const
|
|||||||
|
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
|
|
||||||
|
BoundingBox Actor::GetEditorBox() const
|
||||||
|
{
|
||||||
|
return GetBox();
|
||||||
|
}
|
||||||
|
|
||||||
BoundingBox Actor::GetEditorBoxChildren() const
|
BoundingBox Actor::GetEditorBoxChildren() const
|
||||||
{
|
{
|
||||||
BoundingBox result = GetEditorBox();
|
BoundingBox result = GetEditorBox();
|
||||||
|
|
||||||
for (int32 i = 0; i < Children.Count(); i++)
|
for (int32 i = 0; i < Children.Count(); i++)
|
||||||
{
|
{
|
||||||
BoundingBox::Merge(result, Children[i]->GetEditorBoxChildren(), result);
|
BoundingBox::Merge(result, Children[i]->GetEditorBoxChildren(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool Actor::HasContentLoaded() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Actor::UnregisterObjectHierarchy()
|
void Actor::UnregisterObjectHierarchy()
|
||||||
{
|
{
|
||||||
if (IsRegistered())
|
if (IsRegistered())
|
||||||
@@ -1170,6 +1178,10 @@ void Actor::UnregisterObjectHierarchy()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actor::Draw(RenderContext& renderContext)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Actor::DrawGeneric(RenderContext& renderContext)
|
void Actor::DrawGeneric(RenderContext& renderContext)
|
||||||
{
|
{
|
||||||
// Generic drawing uses only GBuffer Fill Pass and simple frustum culling (see SceneRendering for more optimized drawing)
|
// Generic drawing uses only GBuffer Fill Pass and simple frustum culling (see SceneRendering for more optimized drawing)
|
||||||
|
|||||||
@@ -629,10 +629,7 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets actor bounding box (single actor, no children included) for editor tools.
|
/// Gets actor bounding box (single actor, no children included) for editor tools.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
API_PROPERTY() virtual BoundingBox GetEditorBox() const
|
API_PROPERTY() virtual BoundingBox GetEditorBox() const;
|
||||||
{
|
|
||||||
return GetBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets actor bounding box of the actor including all child actors for editor tools.
|
/// Gets actor bounding box of the actor including all child actors for editor tools.
|
||||||
@@ -644,10 +641,7 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if actor has loaded content.
|
/// Returns true if actor has loaded content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
API_PROPERTY() virtual bool HasContentLoaded() const
|
API_PROPERTY() virtual bool HasContentLoaded() const;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calls UnregisterObject for all objects in the actor hierarchy.
|
/// Calls UnregisterObject for all objects in the actor hierarchy.
|
||||||
@@ -660,9 +654,7 @@ public:
|
|||||||
/// Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. models are rendered during all passed but other actors are invoked only during GBufferFill pass).
|
/// Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. models are rendered during all passed but other actors are invoked only during GBufferFill pass).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="renderContext">The rendering context.</param>
|
/// <param name="renderContext">The rendering context.</param>
|
||||||
virtual void Draw(RenderContext& renderContext)
|
virtual void Draw(RenderContext& renderContext);
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draws this actor. Called during custom actor rendering or any other generic rendering from code.
|
/// Draws this actor. Called during custom actor rendering or any other generic rendering from code.
|
||||||
|
|||||||
Reference in New Issue
Block a user