Skip to content

Instantly share code, notes, and snippets.

@Shauren
Created February 12, 2019 20:24
Show Gist options
  • Save Shauren/769ec25c4709ddf54f3cf44825c2076b to your computer and use it in GitHub Desktop.
Save Shauren/769ec25c4709ddf54f3cf44825c2076b to your computer and use it in GitHub Desktop.
diff --git a/RecastDemo/Source/NavMeshTesterTool.cpp b/RecastDemo/Source/NavMeshTesterTool.cpp
index 8b99ac7..8c48929 100644
--- a/RecastDemo/Source/NavMeshTesterTool.cpp
+++ b/RecastDemo/Source/NavMeshTesterTool.cpp
@@ -414,22 +414,22 @@ void NavMeshTesterTool::handleMenu()
imguiLabel("Include Flags");
imguiIndent();
- if (imguiCheck("Walk", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_WALK) != 0))
+ if (imguiCheck("Ground", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_WALK) != 0))
{
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ SAMPLE_POLYFLAGS_WALK);
recalc();
}
- if (imguiCheck("Swim", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_SWIM) != 0))
+ if (imguiCheck("Magma", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_SWIM) != 0))
{
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ SAMPLE_POLYFLAGS_SWIM);
recalc();
}
- if (imguiCheck("Door", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_DOOR) != 0))
+ if (imguiCheck("Slime", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_DOOR) != 0))
{
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ SAMPLE_POLYFLAGS_DOOR);
recalc();
}
- if (imguiCheck("Jump", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_JUMP) != 0))
+ if (imguiCheck("Water", (m_filter.getIncludeFlags() & SAMPLE_POLYFLAGS_JUMP) != 0))
{
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ SAMPLE_POLYFLAGS_JUMP);
recalc();
@@ -440,22 +440,22 @@ void NavMeshTesterTool::handleMenu()
imguiLabel("Exclude Flags");
imguiIndent();
- if (imguiCheck("Walk", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_WALK) != 0))
+ if (imguiCheck("Ground", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_WALK) != 0))
{
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ SAMPLE_POLYFLAGS_WALK);
recalc();
}
- if (imguiCheck("Swim", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_SWIM) != 0))
+ if (imguiCheck("Magma", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_SWIM) != 0))
{
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ SAMPLE_POLYFLAGS_SWIM);
recalc();
}
- if (imguiCheck("Door", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_DOOR) != 0))
+ if (imguiCheck("Slime", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_DOOR) != 0))
{
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ SAMPLE_POLYFLAGS_DOOR);
recalc();
}
- if (imguiCheck("Jump", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_JUMP) != 0))
+ if (imguiCheck("Water", (m_filter.getExcludeFlags() & SAMPLE_POLYFLAGS_JUMP) != 0))
{
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ SAMPLE_POLYFLAGS_JUMP);
recalc();
diff --git a/RecastDemo/Source/Sample.cpp b/RecastDemo/Source/Sample.cpp
index cd5fb3d..b343aeb 100644
--- a/RecastDemo/Source/Sample.cpp
+++ b/RecastDemo/Source/Sample.cpp
@@ -40,10 +40,13 @@ unsigned int SampleDebugDraw::areaToCol(unsigned int area)
switch(area)
{
// Ground (0) : light blue
+ case 63:
case SAMPLE_POLYAREA_GROUND: return duRGBA(0, 192, 255, 255);
// Water : blue
+ case 62:
case SAMPLE_POLYAREA_WATER: return duRGBA(0, 0, 255, 255);
// Road : brown
+ case 61:
case SAMPLE_POLYAREA_ROAD: return duRGBA(50, 20, 12, 255);
// Door : cyan
case SAMPLE_POLYAREA_DOOR: return duRGBA(0, 255, 255, 255);
diff --git a/RecastDemo/Source/main.cpp b/RecastDemo/Source/main.cpp
index f196f91..5b8dd02 100644
--- a/RecastDemo/Source/main.cpp
+++ b/RecastDemo/Source/main.cpp
@@ -379,7 +379,7 @@ int main(int /*argc*/, char** /*argv*/)
{
float pos[3];
pos[0] = rayStart[0] + (rayEnd[0] - rayStart[0]) * hitTime;
- pos[1] = rayStart[1] + (rayEnd[1] - rayStart[1]) * hitTime;
+ pos[1] = rayStart[1] + (rayEnd[1] - rayStart[1]) * hitTime + 0.5f;
pos[2] = rayStart[2] + (rayEnd[2] - rayStart[2]) * hitTime;
sample->handleClick(rayStart, pos, processHitTestShift);
}
@@ -607,7 +607,7 @@ int main(int /*argc*/, char** /*argv*/)
showLog = true;
logScroll = 0;
}
- ctx.dumpLog("Load log %s:", meshName);
+ ctx.dumpLog("Load log %s:", meshName.c_str());
// Clear test.
delete test;
@@ -622,7 +622,7 @@ int main(int /*argc*/, char** /*argv*/)
showLog = true;
logScroll = 0;
}
- ctx.dumpLog("Load log %s:", meshName);
+ ctx.dumpLog("Load log %s:", meshName.c_str());
// Clear test.
delete test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment