From 661300297c80037f1f625707a623887f31b87798 Mon Sep 17 00:00:00 2001 From: austin Date: Wed, 4 Jun 2025 21:46:31 -0400 Subject: [PATCH] debug rendering paths --- docs/src/progress/renderertodo.md | 3 ++- .../client/ui/menu/debug/server/ImGuiAI.java | 9 +++++++- .../electrosphere/renderer/actor/Actor.java | 4 ++-- .../pipelines/debug/DebugContentPipeline.java | 21 +++++++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 90168f4e..c9ea5ef7 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -2102,7 +2102,6 @@ ServerGroundMovementTree supports collidable entities ServerGroundMovementTree geom work ServerLODComponent replaces bodies with geometries instead of just destroying the geometries - (06/01/2025 - 06/04/2025) Fix rebase world origin routine Non-rigid-body collidables behave as expected @@ -2112,6 +2111,8 @@ Fix physics performance issues ServerGroundMovementTree actually moves collidable-based entities Client uses non-rigid-body collidables for farther away entities (via client LOD tree) Reorder main content draw calls to support non-OIT transparencies better +Content debug supports rendering paths +Rendering ai pathfinding paths diff --git a/src/main/java/electrosphere/client/ui/menu/debug/server/ImGuiAI.java b/src/main/java/electrosphere/client/ui/menu/debug/server/ImGuiAI.java index 7d253c07..c705897e 100644 --- a/src/main/java/electrosphere/client/ui/menu/debug/server/ImGuiAI.java +++ b/src/main/java/electrosphere/client/ui/menu/debug/server/ImGuiAI.java @@ -20,6 +20,7 @@ import electrosphere.renderer.actor.mask.ActorTextureMask; import electrosphere.renderer.ui.imgui.ImGuiWindow; import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback; import electrosphere.server.ai.AI; +import electrosphere.server.ai.blackboard.Blackboard; import electrosphere.server.ai.nodes.plan.PathfindingNode; import electrosphere.server.datacell.Realm; import electrosphere.server.datacell.gridded.GriddedDataCellManager; @@ -28,6 +29,7 @@ import electrosphere.server.macro.character.Character; import electrosphere.server.macro.character.CharacterUtils; import electrosphere.server.macro.character.goal.CharacterGoal; import electrosphere.server.macro.character.goal.CharacterGoal.CharacterGoalType; +import electrosphere.server.pathfinding.recast.PathingProgressiveData; import electrosphere.server.pathfinding.voxel.VoxelPathfinder; import electrosphere.server.pathfinding.voxel.VoxelPathfinder.PathfinderNode; import imgui.ImGui; @@ -80,7 +82,12 @@ public class ImGuiAI { ImGui.indent(); if(ImGui.collapsingHeader(ai.getParent().getId() + " - " + ai.getStatus())){ if(ImGui.button("Draw current pathing")){ - throw new Error("Unsupported currently!"); + Blackboard blackboard = ai.getBlackboard(); + PathingProgressiveData pathData = PathfindingNode.getPathfindingData(blackboard); + if(pathData != null){ + List points = pathData.getPoints(); + Globals.renderingEngine.getDebugContentPipeline().setPathPoints(points); + } } if(ImGui.button("Send off map")){ Entity entity = ai.getParent(); diff --git a/src/main/java/electrosphere/renderer/actor/Actor.java b/src/main/java/electrosphere/renderer/actor/Actor.java index 2faf4589..189c4352 100644 --- a/src/main/java/electrosphere/renderer/actor/Actor.java +++ b/src/main/java/electrosphere/renderer/actor/Actor.java @@ -354,7 +354,7 @@ public class Actor { * @param frustumCull Controls whether the frustum cull should actually be executed or not * @return true if it is within the box, false otherwise */ - static boolean isWithinFrustumBox(RenderPipelineState renderPipelineState, Model model, boolean frustumCull){ + private static boolean isWithinFrustumBox(RenderPipelineState renderPipelineState, Model model, boolean frustumCull){ if(!frustumCull){ return true; } @@ -375,7 +375,7 @@ public class Actor { * @param frustumCull Controls whether the frustum cull should actually be executed or not * @return true if it is within the box, false otherwise */ - static boolean isWithinFrustumBox(RenderPipelineState renderPipelineState, Model model, Vector3d position, boolean frustumCull){ + private static boolean isWithinFrustumBox(RenderPipelineState renderPipelineState, Model model, Vector3d position, boolean frustumCull){ if(!frustumCull){ return true; } diff --git a/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java b/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java index ebb86c25..5e0154a4 100644 --- a/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java +++ b/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java @@ -74,6 +74,11 @@ public class DebugContentPipeline implements RenderPipeline { */ private List macroNavEntities = new LinkedList(); + /** + * The set of points to visualize a path along + */ + private List pathPoints = null; + @Override public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) { Globals.profiler.beginCpuSample("DebugContentPipeline.render"); @@ -298,6 +303,14 @@ public class DebugContentPipeline implements RenderPipeline { } } + // + //Path points rendering + if(this.pathPoints != null && pathPoints.size() > 1){ + for(int i = 0; i < pathPoints.size() - 1; i++){ + DebugContentPipeline.renderTube(openGLState, renderPipelineState, modelTransformMatrix, pathPoints.get(i), pathPoints.get(i+1), 1, AssetDataStrings.TEXTURE_RED_TRANSPARENT); + } + } + // //Draw cell colliders data if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawClientCellColliders()){ @@ -617,6 +630,14 @@ public class DebugContentPipeline implements RenderPipeline { } } + /** + * Sets the path points to render + * @param pathPoints The set of points to render a path along + */ + public void setPathPoints(List pathPoints){ + this.pathPoints = pathPoints; + } + /** * Gets the bone debugging pipeline * @return The bone debugging pipeline