add 'Show Paths' checkbox
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include "graphics/render/WorldRenderer.hpp"
|
#include "graphics/render/WorldRenderer.hpp"
|
||||||
#include "graphics/render/ParticlesRenderer.hpp"
|
#include "graphics/render/ParticlesRenderer.hpp"
|
||||||
#include "graphics/render/ChunksRenderer.hpp"
|
#include "graphics/render/ChunksRenderer.hpp"
|
||||||
|
#include "graphics/render/DebugLinesRenderer.hpp"
|
||||||
#include "logic/scripting/scripting.hpp"
|
#include "logic/scripting/scripting.hpp"
|
||||||
#include "network/Network.hpp"
|
#include "network/Network.hpp"
|
||||||
#include "objects/Player.hpp"
|
#include "objects/Player.hpp"
|
||||||
@@ -45,6 +46,7 @@ static std::shared_ptr<Label> create_label(GUI& gui, wstringsupplier supplier) {
|
|||||||
// TODO: move to xml
|
// TODO: move to xml
|
||||||
// TODO: move to xml finally
|
// TODO: move to xml finally
|
||||||
// TODO: move to xml finally
|
// TODO: move to xml finally
|
||||||
|
// TODO: move to xml finally
|
||||||
std::shared_ptr<UINode> create_debug_panel(
|
std::shared_ptr<UINode> create_debug_panel(
|
||||||
Engine& engine,
|
Engine& engine,
|
||||||
Level& level,
|
Level& level,
|
||||||
@@ -261,6 +263,18 @@ std::shared_ptr<UINode> create_debug_panel(
|
|||||||
});
|
});
|
||||||
panel->add(checkbox);
|
panel->add(checkbox);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
auto checkbox = std::make_shared<FullCheckBox>(
|
||||||
|
gui, L"Show Paths", glm::vec2(400, 24)
|
||||||
|
);
|
||||||
|
checkbox->setSupplier([=]() {
|
||||||
|
return DebugLinesRenderer::showPaths;
|
||||||
|
});
|
||||||
|
checkbox->setConsumer([=](bool checked) {
|
||||||
|
DebugLinesRenderer::showPaths = checked;
|
||||||
|
});
|
||||||
|
panel->add(checkbox);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
auto checkbox = std::make_shared<FullCheckBox>(
|
auto checkbox = std::make_shared<FullCheckBox>(
|
||||||
gui, L"Show Generator Minimap", glm::vec2(400, 24)
|
gui, L"Show Generator Minimap", glm::vec2(400, 24)
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "voxels/Pathfinding.hpp"
|
#include "voxels/Pathfinding.hpp"
|
||||||
#include "maths/voxmaths.hpp"
|
#include "maths/voxmaths.hpp"
|
||||||
|
|
||||||
|
bool DebugLinesRenderer::showPaths = false;
|
||||||
|
|
||||||
static void draw_route(
|
static void draw_route(
|
||||||
LinesRenderer& lines, const voxels::Agent& agent
|
LinesRenderer& lines, const voxels::Agent& agent
|
||||||
) {
|
) {
|
||||||
@@ -99,9 +101,11 @@ void DebugLinesRenderer::render(
|
|||||||
bool showChunkBorders
|
bool showChunkBorders
|
||||||
) {
|
) {
|
||||||
// In-world lines
|
// In-world lines
|
||||||
|
if (showPaths) {
|
||||||
for (const auto& [_, agent] : level.pathfinding->getAgents()) {
|
for (const auto& [_, agent] : level.pathfinding->getAgents()) {
|
||||||
draw_route(renderer, agent);
|
draw_route(renderer, agent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
DrawContext ctx = pctx.sub(&linesBatch);
|
DrawContext ctx = pctx.sub(&linesBatch);
|
||||||
const auto& viewport = ctx.getViewport();
|
const auto& viewport = ctx.getViewport();
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ class Level;
|
|||||||
|
|
||||||
class DebugLinesRenderer {
|
class DebugLinesRenderer {
|
||||||
public:
|
public:
|
||||||
|
static bool showPaths;
|
||||||
|
|
||||||
DebugLinesRenderer(const Level& level)
|
DebugLinesRenderer(const Level& level)
|
||||||
: level(level) {};
|
: level(level) {};
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ class WorldRenderer {
|
|||||||
bool lightsDebug = false;
|
bool lightsDebug = false;
|
||||||
bool gbufferPipeline = false;
|
bool gbufferPipeline = false;
|
||||||
|
|
||||||
|
|
||||||
CompileTimeShaderSettings prevCTShaderSettings {};
|
CompileTimeShaderSettings prevCTShaderSettings {};
|
||||||
|
|
||||||
/// @brief Render block selection lines
|
/// @brief Render block selection lines
|
||||||
|
|||||||
Reference in New Issue
Block a user