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