@@ -627,8 +627,8 @@ namespace FlaxEditor.Viewport
|
||||
}
|
||||
|
||||
// Debug draw all actors in prefab and collect actors
|
||||
var viewFlags = Task.ViewFlags;
|
||||
var collectActors = (viewFlags & ViewFlags.PhysicsDebug) != 0 || (viewFlags & ViewFlags.LightsDebug) != 0;
|
||||
var view = Task.View;
|
||||
var collectActors = (view.Flags & ViewFlags.PhysicsDebug) != 0 || view.Mode == ViewMode.PhysicsColliders || (view.Flags & ViewFlags.LightsDebug) != 0;
|
||||
_debugDrawActors.Clear();
|
||||
foreach (var child in SceneGraphRoot.ChildNodes)
|
||||
{
|
||||
@@ -641,19 +641,17 @@ namespace FlaxEditor.Viewport
|
||||
}
|
||||
|
||||
// Draw physics debug
|
||||
if ((viewFlags & ViewFlags.PhysicsDebug) != 0)
|
||||
if ((view.Flags & ViewFlags.PhysicsDebug) != 0 || view.Mode == ViewMode.PhysicsColliders)
|
||||
{
|
||||
foreach (var actor in _debugDrawActors)
|
||||
{
|
||||
if (actor is Collider c && c.IsActiveInHierarchy)
|
||||
{
|
||||
DebugDraw.DrawColliderDebugPhysics(c, renderContext.View);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw lights debug
|
||||
if ((viewFlags & ViewFlags.LightsDebug) != 0)
|
||||
if ((view.Flags & ViewFlags.LightsDebug) != 0)
|
||||
{
|
||||
foreach (var actor in _debugDrawActors)
|
||||
{
|
||||
|
||||
@@ -788,7 +788,7 @@ void DebugDraw::Draw(RenderContext& renderContext, GPUTextureView* target, GPUTe
|
||||
Matrix vp;
|
||||
Matrix::Multiply(view.View, view.Projection, vp);
|
||||
Matrix::Transpose(vp, data.ViewProjection);
|
||||
data.ClipPosZBias = -0.2f; // Reduce Z-fighting artifacts (eg. editor grid)
|
||||
data.ClipPosZBias = view.IsPerspectiveProjection() ? -0.2f : 0.0f; // Reduce Z-fighting artifacts (eg. editor grid)
|
||||
data.EnableDepthTest = enableDepthTest;
|
||||
context->UpdateCB(cb, &data);
|
||||
context->BindCB(0, cb);
|
||||
@@ -953,11 +953,11 @@ void DebugDraw::DrawActorsTree(Actor* actor)
|
||||
}
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
void DebugDraw::DrawColliderDebugPhysics(Collider* collider, RenderView& view)
|
||||
{
|
||||
if (!collider)
|
||||
return;
|
||||
|
||||
collider->DrawPhysicsDebug(view);
|
||||
}
|
||||
|
||||
@@ -965,10 +965,11 @@ void DebugDraw::DrawLightDebug(Light* light, RenderView& view)
|
||||
{
|
||||
if (!light)
|
||||
return;
|
||||
|
||||
light->DrawLightsDebug(view);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DebugDraw::DrawAxisFromDirection(const Vector3& origin, const Vector3& direction, float size, float duration, bool depthTest)
|
||||
{
|
||||
CHECK_DEBUG(direction.IsNormalized());
|
||||
|
||||
@@ -75,6 +75,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
/// </summary>
|
||||
/// <param name="actor">The actor to start drawing at.</param>
|
||||
API_FUNCTION() static void DrawActorsTree(Actor* actor);
|
||||
|
||||
#if USE_EDITOR
|
||||
/// <summary>
|
||||
/// Draws the physics debug shapes for the given collider. Editor Only
|
||||
@@ -90,6 +91,7 @@ API_CLASS(Static) class FLAXENGINE_API DebugDraw
|
||||
/// <param name="view">The render view to draw in.</param>
|
||||
API_FUNCTION() static void DrawLightDebug(Light* light, RenderView& view);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Draws the lines axis from direction.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user