diff --git a/RecastDemo/Bin/Recast.exe b/RecastDemo/Bin/Recast.exe index 31fcb2c..004bf46 100644 Binary files a/RecastDemo/Bin/Recast.exe and b/RecastDemo/Bin/Recast.exe differ diff --git a/RecastDemo/Build/VC9/Recast.vcproj b/RecastDemo/Build/VC9/Recast.vcproj index 59b42bf..1869aab 100644 --- a/RecastDemo/Build/VC9/Recast.vcproj +++ b/RecastDemo/Build/VC9/Recast.vcproj @@ -259,6 +259,10 @@ RelativePath="..\..\..\Detour\Include\DetourAlloc.h" > + + @@ -271,6 +275,10 @@ RelativePath="..\..\..\Detour\Include\DetourNavMeshBuilder.h" > + + @@ -295,6 +303,10 @@ RelativePath="..\..\..\Detour\Source\DetourNavMeshBuilder.cpp" > + + @@ -315,6 +327,10 @@ RelativePath="..\..\Include\ConvexVolumeTool.h" > + + @@ -391,6 +407,10 @@ RelativePath="..\..\Source\ConvexVolumeTool.cpp" > + + diff --git a/RecastDemo/Include/imgui.h b/RecastDemo/Include/imgui.h index 226429b..d198fe6 100644 --- a/RecastDemo/Include/imgui.h +++ b/RecastDemo/Include/imgui.h @@ -46,6 +46,7 @@ void imguiEndScrollArea(); void imguiIndent(); void imguiUnindent(); void imguiSeparator(); +void imguiSeparatorLine(); bool imguiButton(const char* text, bool enabled = true); bool imguiItem(const char* text, bool enabled = true); diff --git a/RecastDemo/Source/ConvexVolumeTool.cpp b/RecastDemo/Source/ConvexVolumeTool.cpp index fcd9082..ff6a0c6 100644 --- a/RecastDemo/Source/ConvexVolumeTool.cpp +++ b/RecastDemo/Source/ConvexVolumeTool.cpp @@ -161,7 +161,7 @@ void ConvexVolumeTool::handleMenu() imguiSeparator(); } -void ConvexVolumeTool::handleClick(const float* s, const float* p, bool shift) +void ConvexVolumeTool::handleClick(const float* /*s*/, const float* p, bool shift) { if (!m_sample) return; InputGeom* geom = m_sample->getInputGeom(); @@ -234,7 +234,7 @@ void ConvexVolumeTool::handleStep() { } -void ConvexVolumeTool::handleUpdate(const float dt) +void ConvexVolumeTool::handleUpdate(const float /*dt*/) { } diff --git a/RecastDemo/Source/CrowdTool.cpp b/RecastDemo/Source/CrowdTool.cpp index da19501..e836445 100644 --- a/RecastDemo/Source/CrowdTool.cpp +++ b/RecastDemo/Source/CrowdTool.cpp @@ -366,7 +366,7 @@ static void processSamples(Body* agent, const float vmax, for (int i = 0; i < nobs; ++i) { const Body* ob = &obs[i]; - float htmin, htmax; + float htmin = 0, htmax = 0; if (ob->type == BODY_CIRCLE) { @@ -719,7 +719,7 @@ void CrowdManager::update(const float dt, unsigned int flags, dtNavMeshQuery* na if (flags & CROWDMAN_DRUNK) { ag->t += dt * (1.0f - ag->var*0.25f); - ag->maxspeed = MAX_SPEED*(1 + dtSqr(cosf(ag->t*2.0))*0.3f); + ag->maxspeed = MAX_SPEED*(1 + dtSqr(cosf(ag->t*2.0f))*0.3f); } else { diff --git a/RecastDemo/Source/NavMeshTesterTool.cpp b/RecastDemo/Source/NavMeshTesterTool.cpp index cce6302..c644aa1 100644 --- a/RecastDemo/Source/NavMeshTesterTool.cpp +++ b/RecastDemo/Source/NavMeshTesterTool.cpp @@ -228,16 +228,25 @@ void NavMeshTesterTool::handleMenu() m_toolMode = TOOLMODE_PATHFIND_SLICED; recalc(); } + + imguiSeparator(); + if (imguiCheck("Distance to Wall", m_toolMode == TOOLMODE_DISTANCE_TO_WALL)) { m_toolMode = TOOLMODE_DISTANCE_TO_WALL; recalc(); } + + imguiSeparator(); + if (imguiCheck("Raycast", m_toolMode == TOOLMODE_RAYCAST)) { m_toolMode = TOOLMODE_RAYCAST; recalc(); } + + imguiSeparator(); + if (imguiCheck("Find Polys in Circle", m_toolMode == TOOLMODE_FIND_POLYS_IN_CIRCLE)) { m_toolMode = TOOLMODE_FIND_POLYS_IN_CIRCLE; @@ -248,6 +257,9 @@ void NavMeshTesterTool::handleMenu() m_toolMode = TOOLMODE_FIND_POLYS_IN_SHAPE; recalc(); } + + imguiSeparator(); + if (imguiCheck("Find Local Neighbourhood", m_toolMode == TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD)) { m_toolMode = TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD; @@ -325,7 +337,7 @@ void NavMeshTesterTool::handleMenu() } } -void NavMeshTesterTool::handleClick(const float* s, const float* p, bool shift) +void NavMeshTesterTool::handleClick(const float* /*s*/, const float* p, bool shift) { if (shift) { @@ -487,7 +499,7 @@ void NavMeshTesterTool::handleStep() } -void NavMeshTesterTool::handleUpdate(const float dt) +void NavMeshTesterTool::handleUpdate(const float /*dt*/) { if (m_pathFindState == DT_QUERY_RUNNING) { diff --git a/RecastDemo/Source/OffMeshConnectionTool.cpp b/RecastDemo/Source/OffMeshConnectionTool.cpp index 0286561..a93175d 100644 --- a/RecastDemo/Source/OffMeshConnectionTool.cpp +++ b/RecastDemo/Source/OffMeshConnectionTool.cpp @@ -83,7 +83,7 @@ void OffMeshConnectionTool::handleMenu() } } -void OffMeshConnectionTool::handleClick(const float* s, const float* p, bool shift) +void OffMeshConnectionTool::handleClick(const float* /*s*/, const float* p, bool shift) { if (!m_sample) return; InputGeom* geom = m_sample->getInputGeom(); @@ -136,7 +136,7 @@ void OffMeshConnectionTool::handleStep() { } -void OffMeshConnectionTool::handleUpdate(const float dt) +void OffMeshConnectionTool::handleUpdate(const float /*dt*/) { } diff --git a/RecastDemo/Source/Sample_SoloMeshSimple.cpp b/RecastDemo/Source/Sample_SoloMeshSimple.cpp index fe415d6..a61db16 100644 --- a/RecastDemo/Source/Sample_SoloMeshSimple.cpp +++ b/RecastDemo/Source/Sample_SoloMeshSimple.cpp @@ -117,10 +117,15 @@ void Sample_SoloMeshSimple::handleTools() setTool(new CrowdTool); } - imguiSeparator(); + imguiSeparatorLine(); + + imguiIndent(); if (m_tool) m_tool->handleMenu(); + + imguiUnindent(); + } void Sample_SoloMeshSimple::handleDebugMode() diff --git a/RecastDemo/Source/Sample_SoloMeshTiled.cpp b/RecastDemo/Source/Sample_SoloMeshTiled.cpp index fce6d99..43a003f 100644 --- a/RecastDemo/Source/Sample_SoloMeshTiled.cpp +++ b/RecastDemo/Source/Sample_SoloMeshTiled.cpp @@ -89,7 +89,7 @@ public: virtual void handleStep() {} - virtual void handleUpdate(const float dt) {} + virtual void handleUpdate(const float /*dt*/) {} virtual void handleRender() { @@ -227,10 +227,14 @@ void Sample_SoloMeshTiled::handleTools() setTool(new TileHighlightTool); } - imguiSeparator(); - + imguiSeparatorLine(); + + imguiIndent(); + if (m_tool) m_tool->handleMenu(); + + imguiUnindent(); } void Sample_SoloMeshTiled::handleDebugMode() diff --git a/RecastDemo/Source/Sample_TileMesh.cpp b/RecastDemo/Source/Sample_TileMesh.cpp index b1d119e..6723813 100644 --- a/RecastDemo/Source/Sample_TileMesh.cpp +++ b/RecastDemo/Source/Sample_TileMesh.cpp @@ -113,7 +113,7 @@ public: imguiValue("Shift+LMB to remove a tile."); } - virtual void handleClick(const float* s, const float* p, bool shift) + virtual void handleClick(const float* /*s*/, const float* p, bool shift) { m_hitPosSet = true; rcVcopy(m_hitPos,p); @@ -128,7 +128,7 @@ public: virtual void handleStep() {} - virtual void handleUpdate(const float dt) {} + virtual void handleUpdate(const float /*dt*/) {} virtual void handleRender() { @@ -415,10 +415,14 @@ void Sample_TileMesh::handleTools() setTool(new CrowdTool); } - imguiSeparator(); - + imguiSeparatorLine(); + + imguiIndent(); + if (m_tool) m_tool->handleMenu(); + + imguiUnindent(); } void Sample_TileMesh::handleDebugMode() diff --git a/RecastDemo/Source/imgui.cpp b/RecastDemo/Source/imgui.cpp index fc9b98c..a350e81 100644 --- a/RecastDemo/Source/imgui.cpp +++ b/RecastDemo/Source/imgui.cpp @@ -66,7 +66,6 @@ static void addGfxCmdScissor(int x, int y, int w, int h) cmd.rect.h = (short)h; } -/* static void addGfxCmdRect(int x, int y, int w, int h, unsigned int color) { if (g_gfxCmdQueueSize >= GFXCMD_QUEUE_SIZE) @@ -81,7 +80,6 @@ static void addGfxCmdRect(int x, int y, int w, int h, unsigned int color) cmd.rect.h = (short)h; cmd.rect.r = 0; } -*/ static void addGfxCmdRoundedRect(int x, int y, int w, int h, int r, unsigned int color) { @@ -627,6 +625,17 @@ void imguiSeparator() g_state.widgetY -= DEFAULT_SPACING*3; } +void imguiSeparatorLine() +{ + int x = g_state.widgetX; + int y = g_state.widgetY - DEFAULT_SPACING*2; + int w = g_state.widgetW; + int h = 1; + g_state.widgetY -= DEFAULT_SPACING*4; + + addGfxCmdRect(x, y, w, h, imguiRGBA(255,255,255,32)); +} + void imguiDrawText(int x, int y, int align, const char* text, unsigned int color) { addGfxCmdText(x, y, align, text, color); diff --git a/RecastDemo/Source/imguiRenderGL.cpp b/RecastDemo/Source/imguiRenderGL.cpp index 5f80a83..3c5e5e0 100644 --- a/RecastDemo/Source/imguiRenderGL.cpp +++ b/RecastDemo/Source/imguiRenderGL.cpp @@ -131,10 +131,10 @@ static void drawRect(float x, float y, float w, float h, float fth, unsigned int { float verts[4*2] = { - x, y, - x+w, y, - x+w, y+h, - x, y+h, + x+0.5f, y+0.5f, + x+w-0.5f, y+0.5f, + x+w-0.5f, y+h-0.5f, + x+0.5f, y+h-0.5f, }; drawPolygon(verts, 4, fth, col); } diff --git a/RecastDemo/Source/main.cpp b/RecastDemo/Source/main.cpp index ffcf7fb..201066c 100644 --- a/RecastDemo/Source/main.cpp +++ b/RecastDemo/Source/main.cpp @@ -79,7 +79,7 @@ int main(int /*argc*/, char** /*argv*/) const SDL_VideoInfo* vi = SDL_GetVideoInfo(); - const bool presentationMode = false; + bool presentationMode = false; int width, height; SDL_Surface* screen = 0; @@ -882,7 +882,7 @@ int main(int /*argc*/, char** /*argv*/) // Tools if (!showTestCases && showTools && showMenu && geom && sample) { - if (imguiBeginScrollArea("Tools", 10, height - 10 - 350, 200, 350, &toolsScroll)) + if (imguiBeginScrollArea("Tools", 10, height - 10 - 350, 250, 350, &toolsScroll)) mouseOverMenu = true; sample->handleTools();