├── .gitignore ├── CMakeLists.txt ├── DebugUtils ├── CMakeLists.txt ├── DebugDraw.cpp ├── DebugDraw.h ├── DebugUtils.vcxproj ├── DebugUtils.vcxproj.filters ├── DetourDebugDraw.cpp ├── DetourDebugDraw.h ├── ReadMe.txt ├── RecastDebugDraw.cpp ├── RecastDebugDraw.h ├── RecastDump.cpp └── RecastDump.h ├── Detour ├── CMakeLists.txt ├── Detour.vcxproj ├── Detour.vcxproj.filters ├── DetourAlloc.cpp ├── DetourAlloc.h ├── DetourAssert.h ├── DetourCommon.cpp ├── DetourCommon.h ├── DetourNavMesh.cpp ├── DetourNavMesh.h ├── DetourNavMeshBuilder.cpp ├── DetourNavMeshBuilder.h ├── DetourNavMeshQuery.cpp ├── DetourNavMeshQuery.h ├── DetourNode.cpp ├── DetourNode.h ├── DetourStatus.h └── ReadMe.txt ├── DetourCrowd ├── CMakeLists.txt ├── DetourCrowd.cpp ├── DetourCrowd.h ├── DetourCrowd.vcxproj ├── DetourCrowd.vcxproj.filters ├── DetourLocalBoundary.cpp ├── DetourLocalBoundary.h ├── DetourObstacleAvoidance.cpp ├── DetourObstacleAvoidance.h ├── DetourPathCorridor.cpp ├── DetourPathCorridor.h ├── DetourPathQueue.cpp ├── DetourPathQueue.h ├── DetourProximityGrid.cpp ├── DetourProximityGrid.h └── ReadMe.txt ├── DetourTileCache ├── CMakeLists.txt ├── DetourTileCache.cpp ├── DetourTileCache.h ├── DetourTileCache.vcxproj ├── DetourTileCache.vcxproj.filters ├── DetourTileCacheBuilder.cpp ├── DetourTileCacheBuilder.h └── ReadMe.txt ├── License.txt ├── README.md ├── Readme_old.txt ├── Recast.sln ├── Recast ├── CMakeLists.txt ├── ReadMe.txt ├── Recast.cpp ├── Recast.h ├── Recast.vcxproj ├── Recast.vcxproj.filters ├── RecastAlloc.cpp ├── RecastAlloc.h ├── RecastArea.cpp ├── RecastAssert.h ├── RecastContour.cpp ├── RecastFilter.cpp ├── RecastLayers.cpp ├── RecastMesh.cpp ├── RecastMeshDetail.cpp ├── RecastRasterization.cpp └── RecastRegion.cpp ├── RecastDemo ├── Bin │ ├── DroidSans.ttf │ ├── Meshes │ │ ├── dungeon.obj │ │ └── nav_test.obj │ ├── Recast.app │ │ └── Contents │ │ │ ├── Info.plist │ │ │ ├── MacOS │ │ │ └── Recast │ │ │ ├── PkgInfo │ │ │ └── Resources │ │ │ └── English.lproj │ │ │ ├── InfoPlist.strings │ │ │ └── MainMenu.nib │ ├── SDL.dll │ ├── Tests │ │ ├── movement_test.txt │ │ └── nav_mesh_test.txt │ ├── all_tiles_navmesh.bin │ └── test.chf ├── Build │ ├── Icon.png │ └── VC10 │ │ ├── RecastDemo.vcxproj │ │ ├── RecastDemo.vcxproj.filters │ │ └── RecastDemovcxproj.filters ├── CMakeLists.txt ├── Contrib │ ├── SDL │ │ ├── BUGS.txt │ │ ├── COPYING.txt │ │ ├── README-SDL.txt │ │ ├── VisualC.html │ │ ├── WhatsNew.txt │ │ ├── include │ │ │ ├── SDL.h │ │ │ ├── SDL_active.h │ │ │ ├── SDL_audio.h │ │ │ ├── SDL_byteorder.h │ │ │ ├── SDL_cdrom.h │ │ │ ├── SDL_config.h │ │ │ ├── SDL_config_dreamcast.h │ │ │ ├── SDL_config_macos.h │ │ │ ├── SDL_config_macosx.h │ │ │ ├── SDL_config_minimal.h │ │ │ ├── SDL_config_nds.h │ │ │ ├── SDL_config_os2.h │ │ │ ├── SDL_config_symbian.h │ │ │ ├── SDL_config_win32.h │ │ │ ├── SDL_copying.h │ │ │ ├── SDL_cpuinfo.h │ │ │ ├── SDL_endian.h │ │ │ ├── SDL_error.h │ │ │ ├── SDL_events.h │ │ │ ├── SDL_getenv.h │ │ │ ├── SDL_joystick.h │ │ │ ├── SDL_keyboard.h │ │ │ ├── SDL_keysym.h │ │ │ ├── SDL_loadso.h │ │ │ ├── SDL_main.h │ │ │ ├── SDL_mouse.h │ │ │ ├── SDL_mutex.h │ │ │ ├── SDL_name.h │ │ │ ├── SDL_opengl.h │ │ │ ├── SDL_platform.h │ │ │ ├── SDL_quit.h │ │ │ ├── SDL_rwops.h │ │ │ ├── SDL_stdinc.h │ │ │ ├── SDL_syswm.h │ │ │ ├── SDL_thread.h │ │ │ ├── SDL_timer.h │ │ │ ├── SDL_types.h │ │ │ ├── SDL_version.h │ │ │ ├── SDL_video.h │ │ │ ├── begin_code.h │ │ │ └── close_code.h │ │ ├── lib │ │ │ ├── SDL.dll │ │ │ ├── SDL.lib │ │ │ └── SDLmain.lib │ │ └── readme.txt │ ├── fastlz │ │ ├── README.TXT │ │ ├── fastlz.c │ │ └── fastlz.h │ ├── stb_image.h │ └── stb_truetype.h ├── Include │ ├── ChunkyTriMesh.h │ ├── ConvexVolumeTool.h │ ├── CrowdTool.h │ ├── Filelist.h │ ├── InputGeom.h │ ├── MeshLoaderObj.h │ ├── NavMeshTesterTool.h │ ├── NavmeshPruneTool.h │ ├── OffMeshConnectionTool.h │ ├── PerfTimer.h │ ├── SDLMain.h │ ├── Sample.h │ ├── SampleInterfaces.h │ ├── Sample_Debug.h │ ├── Sample_SoloMesh.h │ ├── Sample_TempObstacles.h │ ├── Sample_TileMesh.h │ ├── SlideShow.h │ ├── TestCase.h │ ├── ValueHistory.h │ ├── imgui.h │ └── imguiRenderGL.h └── Source │ ├── ChunkyTriMesh.cpp │ ├── ConvexVolumeTool.cpp │ ├── CrowdTool.cpp │ ├── Filelist.cpp │ ├── InputGeom.cpp │ ├── MeshLoaderObj.cpp │ ├── NavMeshPruneTool.cpp │ ├── NavMeshTesterTool.cpp │ ├── OffMeshConnectionTool.cpp │ ├── PerfTimer.cpp │ ├── SDLMain.m │ ├── Sample.cpp │ ├── SampleInterfaces.cpp │ ├── Sample_Debug.cpp │ ├── Sample_SoloMesh.cpp │ ├── Sample_TempObstacles.cpp │ ├── Sample_TileMesh.cpp │ ├── SlideShow.cpp │ ├── TestCase.cpp │ ├── ValueHistory.cpp │ ├── imgui.cpp │ ├── imguiRenderGL.cpp │ └── main.cpp ├── TODO.txt └── Test ├── Game.cpp ├── Game.h ├── Test.vcxproj └── Test.vcxproj.filters /.gitignore: -------------------------------------------------------------------------------- 1 | ## Compiled source # 2 | *.com 3 | *.class 4 | *.dll 5 | *.exe 6 | *.ilk 7 | *.o 8 | *.pdb 9 | *.so 10 | *.idb 11 | 12 | ## Linux exes have no extension 13 | RecastDemo/Bin/RecastDemo 14 | RecastDemo/Bin/Tests 15 | 16 | # Build directory 17 | RecastDemo/Build 18 | 19 | # Ignore meshes 20 | RecastDemo/Bin/Meshes/* 21 | 22 | ## Logs and databases # 23 | *.log 24 | *.sql 25 | *.sqlite 26 | 27 | ## OS generated files # 28 | .DS_Store 29 | .DS_Store? 30 | ._* 31 | .Spotlight-V100 32 | .Trashes 33 | ehthumbs.db 34 | Thumbs.db 35 | *.swp 36 | *.swo 37 | 38 | ## xcode specific 39 | *xcuserdata* 40 | 41 | ## SDL contrib 42 | RecastDemo/Contrib/SDL/* 43 | 44 | ## Generated doc files 45 | Docs/html 46 | 47 | /build/ 48 | RecastDemo/Bin/RecastDemo.app 49 | 50 | Debug/ 51 | /.vs/ 52 | *.vcxproj.user 53 | ipch/ 54 | *.sdf 55 | *.suo 56 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | PROJECT(RecastNavigation) 3 | 4 | add_subdirectory(DebugUtils) 5 | add_subdirectory(Detour) 6 | add_subdirectory(DetourCrowd) 7 | add_subdirectory(DetourTileCache) 8 | add_subdirectory(Recast) 9 | add_subdirectory(RecastDemo) 10 | -------------------------------------------------------------------------------- /DebugUtils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCE_FILES "*.h" "*.cpp") 2 | 3 | include_directories(../Detour ../DetourTileCache ../Recast) 4 | add_library(DebugUtils STATIC ${SOURCE_FILES}) 5 | -------------------------------------------------------------------------------- /DebugUtils/DebugUtils.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {582F7AF8-7017-401A-9DF6-52772B2AA67F} 15 | Win32Proj 16 | DebugUtils 17 | 18 | 19 | 20 | StaticLibrary 21 | true 22 | Unicode 23 | 24 | 25 | StaticLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Level3 46 | Disabled 47 | WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 48 | ..\Recast;..\Detour;..\DetourTileCache; 49 | 50 | 51 | Windows 52 | true 53 | 54 | 55 | 56 | 57 | Level3 58 | 59 | 60 | MaxSpeed 61 | true 62 | true 63 | WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 64 | ..\Recast;..\Detour;..\DetourTileCache; 65 | 66 | 67 | Windows 68 | true 69 | true 70 | true 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /DebugUtils/DebugUtils.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /DebugUtils/DetourDebugDraw.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURDEBUGDRAW_H 20 | #define DETOURDEBUGDRAW_H 21 | 22 | #include "DetourNavMesh.h" 23 | #include "DetourNavMeshQuery.h" 24 | #include "DetourTileCacheBuilder.h" 25 | 26 | enum DrawNavMeshFlags 27 | { 28 | DU_DRAWNAVMESH_OFFMESHCONS = 0x01, 29 | DU_DRAWNAVMESH_CLOSEDLIST = 0x02, 30 | DU_DRAWNAVMESH_COLOR_TILES = 0x04, 31 | }; 32 | 33 | void duDebugDrawNavMesh(struct duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags); 34 | void duDebugDrawNavMeshWithClosedList(struct duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery& query, unsigned char flags); 35 | void duDebugDrawNavMeshNodes(struct duDebugDraw* dd, const dtNavMeshQuery& query); 36 | void duDebugDrawNavMeshBVTree(struct duDebugDraw* dd, const dtNavMesh& mesh); 37 | void duDebugDrawNavMeshPortals(struct duDebugDraw* dd, const dtNavMesh& mesh); 38 | void duDebugDrawNavMeshPolysWithFlags(struct duDebugDraw* dd, const dtNavMesh& mesh, const unsigned short polyFlags, const unsigned int col); 39 | void duDebugDrawNavMeshPoly(struct duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef ref, const unsigned int col); 40 | 41 | void duDebugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch); 42 | void duDebugDrawTileCacheLayerRegions(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch); 43 | void duDebugDrawTileCacheContours(duDebugDraw* dd, const struct dtTileCacheContourSet& lcset, 44 | const float* orig, const float cs, const float ch); 45 | void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyMesh& lmesh, 46 | const float* orig, const float cs, const float ch); 47 | 48 | #endif // DETOURDEBUGDRAW_H -------------------------------------------------------------------------------- /DebugUtils/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : DebugUtils Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this DebugUtils library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | DebugUtils.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | DebugUtils.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /DebugUtils/RecastDebugDraw.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef RECAST_DEBUGDRAW_H 20 | #define RECAST_DEBUGDRAW_H 21 | 22 | void duDebugDrawTriMesh(struct duDebugDraw* dd, const float* verts, int nverts, const int* tris, const float* normals, int ntris, const unsigned char* flags, const float texScale); 23 | void duDebugDrawTriMeshSlope(struct duDebugDraw* dd, const float* verts, int nverts, const int* tris, const float* normals, int ntris, const float walkableSlopeAngle, const float texScale); 24 | 25 | void duDebugDrawHeightfieldSolid(struct duDebugDraw* dd, const struct rcHeightfield& hf); 26 | void duDebugDrawHeightfieldWalkable(struct duDebugDraw* dd, const struct rcHeightfield& hf); 27 | 28 | void duDebugDrawCompactHeightfieldSolid(struct duDebugDraw* dd, const struct rcCompactHeightfield& chf); 29 | void duDebugDrawCompactHeightfieldRegions(struct duDebugDraw* dd, const struct rcCompactHeightfield& chf); 30 | void duDebugDrawCompactHeightfieldDistance(struct duDebugDraw* dd, const struct rcCompactHeightfield& chf); 31 | 32 | void duDebugDrawHeightfieldLayer(duDebugDraw* dd, const struct rcHeightfieldLayer& layer, const int idx); 33 | void duDebugDrawHeightfieldLayers(duDebugDraw* dd, const struct rcHeightfieldLayerSet& lset); 34 | void duDebugDrawHeightfieldLayersRegions(duDebugDraw* dd, const struct rcHeightfieldLayerSet& lset); 35 | 36 | void duDebugDrawLayerContours(duDebugDraw* dd, const struct rcLayerContourSet& lcset); 37 | void duDebugDrawLayerPolyMesh(duDebugDraw* dd, const struct rcLayerPolyMesh& lmesh); 38 | 39 | 40 | void duDebugDrawRegionConnections(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f); 41 | void duDebugDrawRawContours(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f); 42 | void duDebugDrawContours(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f); 43 | void duDebugDrawPolyMesh(struct duDebugDraw* dd, const struct rcPolyMesh& mesh); 44 | void duDebugDrawPolyMeshDetail(struct duDebugDraw* dd, const struct rcPolyMeshDetail& dmesh); 45 | 46 | #endif // RECAST_DEBUGDRAW_H 47 | -------------------------------------------------------------------------------- /DebugUtils/RecastDump.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef RECAST_DUMP_H 20 | #define RECAST_DUMP_H 21 | 22 | struct duFileIO 23 | { 24 | virtual ~duFileIO() = 0; 25 | virtual bool isWriting() const = 0; 26 | virtual bool isReading() const = 0; 27 | virtual bool write(const void* ptr, const size_t size) = 0; 28 | virtual bool read(void* ptr, const size_t size) = 0; 29 | }; 30 | 31 | bool duDumpPolyMeshToObj(struct rcPolyMesh& pmesh, duFileIO* io); 32 | bool duDumpPolyMeshDetailToObj(struct rcPolyMeshDetail& dmesh, duFileIO* io); 33 | 34 | bool duDumpContourSet(struct rcContourSet& cset, duFileIO* io); 35 | bool duReadContourSet(struct rcContourSet& cset, duFileIO* io); 36 | 37 | bool duDumpCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io); 38 | bool duReadCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io); 39 | 40 | void duLogBuildTimes(rcContext& ctx, const int totalTileUsec); 41 | 42 | 43 | #endif // RECAST_DUMP_H 44 | -------------------------------------------------------------------------------- /Detour/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCE_FILES "*.h" "*.cpp") 2 | 3 | add_library(Detour STATIC ${SOURCE_FILES}) 4 | -------------------------------------------------------------------------------- /Detour/Detour.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | -------------------------------------------------------------------------------- /Detour/DetourAlloc.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #include 20 | #include "DetourAlloc.h" 21 | 22 | static void *dtAllocDefault(int size, dtAllocHint) 23 | { 24 | return malloc(size); 25 | } 26 | 27 | static void dtFreeDefault(void *ptr) 28 | { 29 | free(ptr); 30 | } 31 | 32 | static dtAllocFunc* sAllocFunc = dtAllocDefault; 33 | static dtFreeFunc* sFreeFunc = dtFreeDefault; 34 | 35 | void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc) 36 | { 37 | sAllocFunc = allocFunc ? allocFunc : dtAllocDefault; 38 | sFreeFunc = freeFunc ? freeFunc : dtFreeDefault; 39 | } 40 | 41 | void* dtAlloc(int size, dtAllocHint hint) 42 | { 43 | return sAllocFunc(size, hint); 44 | } 45 | 46 | void dtFree(void* ptr) 47 | { 48 | if (ptr) 49 | sFreeFunc(ptr); 50 | } 51 | -------------------------------------------------------------------------------- /Detour/DetourAlloc.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURALLOCATOR_H 20 | #define DETOURALLOCATOR_H 21 | 22 | /// Provides hint values to the memory allocator on how long the 23 | /// memory is expected to be used. 24 | enum dtAllocHint 25 | { 26 | DT_ALLOC_PERM, ///< Memory persist after a function call. 27 | DT_ALLOC_TEMP ///< Memory used temporarily within a function. 28 | }; 29 | 30 | /// A memory allocation function. 31 | // @param[in] size The size, in bytes of memory, to allocate. 32 | // @param[in] rcAllocHint A hint to the allocator on how long the memory is expected to be in use. 33 | // @return A pointer to the beginning of the allocated memory block, or null if the allocation failed. 34 | /// @see dtAllocSetCustom 35 | typedef void* (dtAllocFunc)(int size, dtAllocHint hint); 36 | 37 | /// A memory deallocation function. 38 | /// @param[in] ptr A pointer to a memory block previously allocated using #dtAllocFunc. 39 | /// @see dtAllocSetCustom 40 | typedef void (dtFreeFunc)(void* ptr); 41 | 42 | /// Sets the base custom allocation functions to be used by Detour. 43 | /// @param[in] allocFunc The memory allocation function to be used by #dtAlloc 44 | /// @param[in] freeFunc The memory de-allocation function to be used by #dtFree 45 | void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc); 46 | 47 | /// Allocates a memory block. 48 | /// @param[in] size The size, in bytes of memory, to allocate. 49 | /// @param[in] hint A hint to the allocator on how long the memory is expected to be in use. 50 | /// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed. 51 | /// @see dtFree 52 | void* dtAlloc(int size, dtAllocHint hint); 53 | 54 | /// Deallocates a memory block. 55 | /// @param[in] ptr A pointer to a memory block previously allocated using #dtAlloc. 56 | /// @see dtAlloc 57 | void dtFree(void* ptr); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /Detour/DetourAssert.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURASSERT_H 20 | #define DETOURASSERT_H 21 | 22 | // Note: This header file's only purpose is to include define assert. 23 | // Feel free to change the file and include your own implementation instead. 24 | 25 | #ifdef NDEBUG 26 | // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ 27 | # define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) 28 | #else 29 | # include 30 | # define dtAssert assert 31 | #endif 32 | 33 | #endif // DETOURASSERT_H 34 | -------------------------------------------------------------------------------- /Detour/DetourNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURNODE_H 20 | #define DETOURNODE_H 21 | 22 | #include "DetourNavMesh.h" 23 | 24 | enum dtNodeFlags 25 | { 26 | DT_NODE_OPEN = 0x01, 27 | DT_NODE_CLOSED = 0x02, 28 | }; 29 | 30 | typedef unsigned short dtNodeIndex; 31 | static const dtNodeIndex DT_NULL_IDX = (dtNodeIndex)~0; 32 | 33 | ///寻路的一个结点 34 | struct dtNode 35 | { 36 | float pos[3]; ///< Position of the node. 37 | float cost; ///< Cost from previous node to current node. 38 | float total; ///< Cost up to the node. 39 | unsigned int pidx : 30; ///< Index to parent node. 40 | unsigned int flags : 2; ///< Node flags 0/open/closed. 41 | dtPolyRef id; ///< Polygon ref the node corresponds to. 42 | }; 43 | 44 | 45 | class dtNodePool 46 | { 47 | public: 48 | dtNodePool(int maxNodes, int hashSize); 49 | ~dtNodePool(); 50 | inline void operator=(const dtNodePool&) {} 51 | void clear(); 52 | 53 | ///利用hash算法,得到id对应的node。如果node还没创建,则创建他。 54 | dtNode* getNode(dtPolyRef id); 55 | dtNode* findNode(dtPolyRef id); 56 | 57 | inline unsigned int getNodeIdx(const dtNode* node) const 58 | { 59 | if (!node) return 0; 60 | return (unsigned int)(node - m_nodes)+1; 61 | } 62 | 63 | inline dtNode* getNodeAtIdx(unsigned int idx) 64 | { 65 | if (!idx) return 0; 66 | return &m_nodes[idx-1]; 67 | } 68 | 69 | inline const dtNode* getNodeAtIdx(unsigned int idx) const 70 | { 71 | if (!idx) return 0; 72 | return &m_nodes[idx-1]; 73 | } 74 | 75 | inline int getMemUsed() const 76 | { 77 | return sizeof(*this) + 78 | sizeof(dtNode)*m_maxNodes + 79 | sizeof(dtNodeIndex)*m_maxNodes + 80 | sizeof(dtNodeIndex)*m_hashSize; 81 | } 82 | 83 | inline int getMaxNodes() const { return m_maxNodes; } 84 | 85 | inline int getHashSize() const { return m_hashSize; } 86 | inline dtNodeIndex getFirst(int bucket) const { return m_first[bucket]; } 87 | inline dtNodeIndex getNext(int i) const { return m_next[i]; } 88 | 89 | private: 90 | 91 | dtNode* m_nodes; 92 | dtNodeIndex* m_first; 93 | dtNodeIndex* m_next; 94 | const int m_maxNodes; 95 | const int m_hashSize; 96 | int m_nodeCount; 97 | }; 98 | 99 | class dtNodeQueue 100 | { 101 | public: 102 | dtNodeQueue(int n); 103 | ~dtNodeQueue(); 104 | inline void operator=(dtNodeQueue&) {} 105 | 106 | inline void clear() 107 | { 108 | m_size = 0; 109 | } 110 | 111 | inline dtNode* top() 112 | { 113 | return m_heap[0]; 114 | } 115 | 116 | inline dtNode* pop() 117 | { 118 | dtNode* result = m_heap[0]; 119 | m_size--; 120 | trickleDown(0, m_heap[m_size]); 121 | return result; 122 | } 123 | 124 | inline void push(dtNode* node) 125 | { 126 | m_size++; 127 | bubbleUp(m_size-1, node); 128 | } 129 | 130 | inline void modify(dtNode* node) 131 | { 132 | for (int i = 0; i < m_size; ++i) 133 | { 134 | if (m_heap[i] == node) 135 | { 136 | bubbleUp(i, node); 137 | return; 138 | } 139 | } 140 | } 141 | 142 | inline bool empty() const { return m_size == 0; } 143 | 144 | inline int getMemUsed() const 145 | { 146 | return sizeof(*this) + 147 | sizeof(dtNode*)*(m_capacity+1); 148 | } 149 | 150 | inline int getCapacity() const { return m_capacity; } 151 | 152 | private: 153 | void bubbleUp(int i, dtNode* node); 154 | void trickleDown(int i, dtNode* node); 155 | 156 | dtNode** m_heap; 157 | const int m_capacity; 158 | int m_size; 159 | }; 160 | 161 | 162 | #endif // DETOURNODE_H 163 | -------------------------------------------------------------------------------- /Detour/DetourStatus.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURSTATUS_H 20 | #define DETOURSTATUS_H 21 | 22 | typedef unsigned int dtStatus; 23 | 24 | // High level status. 25 | static const unsigned int DT_FAILURE = 1u << 31; // Operation failed. 26 | static const unsigned int DT_SUCCESS = 1u << 30; // Operation succeed. 27 | static const unsigned int DT_IN_PROGRESS = 1u << 29; // Operation still in progress. 28 | 29 | // Detail information for status. 30 | static const unsigned int DT_STATUS_DETAIL_MASK = 0x0ffffff; 31 | static const unsigned int DT_WRONG_MAGIC = 1 << 0; // Input data is not recognized. 32 | static const unsigned int DT_WRONG_VERSION = 1 << 1; // Input data is in wrong version. 33 | static const unsigned int DT_OUT_OF_MEMORY = 1 << 2; // Operation ran out of memory. 34 | static const unsigned int DT_INVALID_PARAM = 1 << 3; // An input parameter was invalid. 35 | static const unsigned int DT_BUFFER_TOO_SMALL = 1 << 4; // Result buffer for the query was too small to store all results. 36 | static const unsigned int DT_OUT_OF_NODES = 1 << 5; // Query ran out of nodes during search. 37 | static const unsigned int DT_PARTIAL_RESULT = 1 << 6; // Query did not reach the end location, returning best guess. 38 | 39 | 40 | // Returns true of status is success. 41 | inline bool dtStatusSucceed(dtStatus status) 42 | { 43 | return (status & DT_SUCCESS) != 0; 44 | } 45 | 46 | // Returns true of status is failure. 47 | inline bool dtStatusFailed(dtStatus status) 48 | { 49 | return (status & DT_FAILURE) != 0; 50 | } 51 | 52 | // Returns true of status is in progress. 53 | inline bool dtStatusInProgress(dtStatus status) 54 | { 55 | return (status & DT_IN_PROGRESS) != 0; 56 | } 57 | 58 | // Returns true if specific detail is set. 59 | inline bool dtStatusDetail(dtStatus status, unsigned int detail) 60 | { 61 | return (status & detail) != 0; 62 | } 63 | 64 | #endif // DETOURSTATUS_H 65 | -------------------------------------------------------------------------------- /Detour/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : Detour Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Detour library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | Detour.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | Detour.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /DetourCrowd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCE_FILES "*.h" "*.cpp") 2 | 3 | include_directories(../Detour ../Recast) 4 | add_library(DetourCrowd STATIC ${SOURCE_FILES}) 5 | -------------------------------------------------------------------------------- /DetourCrowd/DetourCrowd.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {B31EE616-2772-48A7-9C5E-42466B6DC8F1} 15 | Win32Proj 16 | DetourCrowd 17 | 18 | 19 | 20 | StaticLibrary 21 | true 22 | Unicode 23 | 24 | 25 | StaticLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Level3 46 | Disabled 47 | WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 48 | ..\Detour 49 | 50 | 51 | Windows 52 | true 53 | 54 | 55 | 56 | 57 | Level3 58 | 59 | 60 | MaxSpeed 61 | true 62 | true 63 | WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 64 | 65 | 66 | Windows 67 | true 68 | true 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /DetourCrowd/DetourCrowd.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | -------------------------------------------------------------------------------- /DetourCrowd/DetourLocalBoundary.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #include 20 | #include 21 | #include "DetourLocalBoundary.h" 22 | #include "DetourNavMeshQuery.h" 23 | #include "DetourCommon.h" 24 | #include "DetourAssert.h" 25 | 26 | 27 | dtLocalBoundary::dtLocalBoundary() : 28 | m_nsegs(0), 29 | m_npolys(0) 30 | { 31 | dtVset(m_center, FLT_MAX,FLT_MAX,FLT_MAX); 32 | } 33 | 34 | dtLocalBoundary::~dtLocalBoundary() 35 | { 36 | } 37 | 38 | void dtLocalBoundary::reset() 39 | { 40 | dtVset(m_center, FLT_MAX,FLT_MAX,FLT_MAX); 41 | m_npolys = 0; 42 | m_nsegs = 0; 43 | } 44 | 45 | void dtLocalBoundary::addSegment(const float dist, const float* s) 46 | { 47 | // Insert neighbour based on the distance. 48 | Segment* seg = 0; 49 | if (!m_nsegs) 50 | { 51 | // First, trivial accept. 52 | seg = &m_segs[0]; 53 | } 54 | else if (dist >= m_segs[m_nsegs-1].d) 55 | { 56 | // Further than the last segment, skip. 57 | if (m_nsegs >= MAX_LOCAL_SEGS) 58 | return; 59 | // Last, trivial accept. 60 | seg = &m_segs[m_nsegs]; 61 | } 62 | else 63 | { 64 | // Insert inbetween. 65 | int i; 66 | for (i = 0; i < m_nsegs; ++i) 67 | if (dist <= m_segs[i].d) 68 | break; 69 | const int tgt = i+1; 70 | const int n = dtMin(m_nsegs-i, MAX_LOCAL_SEGS-tgt); 71 | dtAssert(tgt+n <= MAX_LOCAL_SEGS); 72 | if (n > 0) 73 | memmove(&m_segs[tgt], &m_segs[i], sizeof(Segment)*n); 74 | seg = &m_segs[i]; 75 | } 76 | 77 | seg->d = dist; 78 | memcpy(seg->s, s, sizeof(float)*6); 79 | 80 | if (m_nsegs < MAX_LOCAL_SEGS) 81 | m_nsegs++; 82 | } 83 | 84 | void dtLocalBoundary::update(dtPolyRef ref, const float* pos, const float collisionQueryRange, 85 | dtNavMeshQuery* navquery, const dtQueryFilter* filter) 86 | { 87 | static const int MAX_SEGS_PER_POLY = DT_VERTS_PER_POLYGON*3; 88 | 89 | if (!ref) 90 | { 91 | dtVset(m_center, FLT_MAX,FLT_MAX,FLT_MAX); 92 | m_nsegs = 0; 93 | m_npolys = 0; 94 | return; 95 | } 96 | 97 | dtVcopy(m_center, pos); 98 | 99 | // First query non-overlapping polygons. 100 | navquery->findLocalNeighbourhood(ref, pos, collisionQueryRange, 101 | filter, m_polys, 0, &m_npolys, MAX_LOCAL_POLYS); 102 | 103 | // Secondly, store all polygon edges. 104 | m_nsegs = 0; 105 | float segs[MAX_SEGS_PER_POLY*6]; 106 | int nsegs = 0; 107 | for (int j = 0; j < m_npolys; ++j) 108 | { 109 | navquery->getPolyWallSegments(m_polys[j], filter, segs, 0, &nsegs, MAX_SEGS_PER_POLY); 110 | for (int k = 0; k < nsegs; ++k) 111 | { 112 | const float* s = &segs[k*6]; 113 | // Skip too distant segments. 114 | float tseg; 115 | const float distSqr = dtDistancePtSegSqr2D(pos, s, s+3, tseg); 116 | if (distSqr > dtSqr(collisionQueryRange)) 117 | continue; 118 | addSegment(distSqr, s); 119 | } 120 | } 121 | } 122 | 123 | bool dtLocalBoundary::isValid(dtNavMeshQuery* navquery, const dtQueryFilter* filter) 124 | { 125 | if (!m_npolys) 126 | return false; 127 | 128 | // Check that all polygons still pass query filter. 129 | for (int i = 0; i < m_npolys; ++i) 130 | { 131 | if (!navquery->isValidPolyRef(m_polys[i], filter)) 132 | return false; 133 | } 134 | 135 | return true; 136 | } 137 | 138 | -------------------------------------------------------------------------------- /DetourCrowd/DetourLocalBoundary.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURLOCALBOUNDARY_H 20 | #define DETOURLOCALBOUNDARY_H 21 | 22 | #include "DetourNavMeshQuery.h" 23 | 24 | 25 | class dtLocalBoundary 26 | { 27 | static const int MAX_LOCAL_SEGS = 8; 28 | static const int MAX_LOCAL_POLYS = 16; 29 | 30 | struct Segment 31 | { 32 | float s[6]; ///< Segment start/end 33 | float d; ///< Distance for pruning. 34 | }; 35 | 36 | float m_center[3]; 37 | Segment m_segs[MAX_LOCAL_SEGS]; 38 | int m_nsegs; 39 | 40 | dtPolyRef m_polys[MAX_LOCAL_POLYS]; 41 | int m_npolys; 42 | 43 | void addSegment(const float dist, const float* seg); 44 | 45 | public: 46 | dtLocalBoundary(); 47 | ~dtLocalBoundary(); 48 | 49 | void reset(); 50 | 51 | void update(dtPolyRef ref, const float* pos, const float collisionQueryRange, 52 | dtNavMeshQuery* navquery, const dtQueryFilter* filter); 53 | 54 | bool isValid(dtNavMeshQuery* navquery, const dtQueryFilter* filter); 55 | 56 | inline const float* getCenter() const { return m_center; } 57 | inline int getSegmentCount() const { return m_nsegs; } 58 | inline const float* getSegment(int i) const { return m_segs[i].s; } 59 | }; 60 | 61 | #endif // DETOURLOCALBOUNDARY_H 62 | -------------------------------------------------------------------------------- /DetourCrowd/DetourPathQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURPATHQUEUE_H 20 | #define DETOURPATHQUEUE_H 21 | 22 | #include "DetourNavMesh.h" 23 | #include "DetourNavMeshQuery.h" 24 | 25 | static const unsigned int DT_PATHQ_INVALID = 0; 26 | 27 | typedef unsigned int dtPathQueueRef; 28 | 29 | class dtPathQueue 30 | { 31 | struct PathQuery 32 | { 33 | dtPathQueueRef ref; 34 | /// Path find start and end location. 35 | float startPos[3], endPos[3]; 36 | dtPolyRef startRef, endRef; 37 | /// Result. 38 | dtPolyRef* path; 39 | int npath; 40 | /// State. 41 | dtStatus status; 42 | int keepAlive; 43 | const dtQueryFilter* filter; ///< TODO: This is potentially dangerous! 44 | }; 45 | 46 | static const int MAX_QUEUE = 8; 47 | PathQuery m_queue[MAX_QUEUE]; 48 | dtPathQueueRef m_nextHandle; 49 | int m_maxPathSize; 50 | int m_queueHead; 51 | dtNavMeshQuery* m_navquery; 52 | 53 | void purge(); 54 | 55 | public: 56 | dtPathQueue(); 57 | ~dtPathQueue(); 58 | 59 | bool init(const int maxPathSize, const int maxSearchNodeCount, dtNavMesh* nav); 60 | 61 | void update(const int maxIters); 62 | 63 | dtPathQueueRef request(dtPolyRef startRef, dtPolyRef endRef, 64 | const float* startPos, const float* endPos, 65 | const dtQueryFilter* filter); 66 | 67 | dtStatus getRequestStatus(dtPathQueueRef ref) const; 68 | 69 | dtStatus getPathResult(dtPathQueueRef ref, dtPolyRef* path, int* pathSize, const int maxPath); 70 | 71 | inline const dtNavMeshQuery* getNavQuery() const { return m_navquery; } 72 | 73 | }; 74 | 75 | #endif // DETOURPATHQUEUE_H 76 | -------------------------------------------------------------------------------- /DetourCrowd/DetourProximityGrid.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURPROXIMITYGRID_H 20 | #define DETOURPROXIMITYGRID_H 21 | 22 | class dtProximityGrid 23 | { 24 | int m_maxItems; 25 | float m_cellSize; 26 | float m_invCellSize; 27 | 28 | struct Item 29 | { 30 | unsigned short id; 31 | short x,y; 32 | unsigned short next; 33 | }; 34 | Item* m_pool; 35 | int m_poolHead; 36 | int m_poolSize; 37 | 38 | unsigned short* m_buckets; 39 | int m_bucketsSize; 40 | 41 | int m_bounds[4]; 42 | 43 | public: 44 | dtProximityGrid(); 45 | ~dtProximityGrid(); 46 | 47 | bool init(const int maxItems, const float cellSize); 48 | 49 | void clear(); 50 | 51 | void addItem(const unsigned short id, 52 | const float minx, const float miny, 53 | const float maxx, const float maxy); 54 | 55 | int queryItems(const float minx, const float miny, 56 | const float maxx, const float maxy, 57 | unsigned short* ids, const int maxIds) const; 58 | 59 | int getItemCountAt(const int x, const int y) const; 60 | 61 | inline const int* getBounds() const { return m_bounds; } 62 | inline const float getCellSize() const { return m_cellSize; } 63 | }; 64 | 65 | dtProximityGrid* dtAllocProximityGrid(); 66 | void dtFreeProximityGrid(dtProximityGrid* ptr); 67 | 68 | 69 | #endif // DETOURPROXIMITYGRID_H 70 | 71 | -------------------------------------------------------------------------------- /DetourCrowd/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : DetourCrowd Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this DetourCrowd library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | DetourCrowd.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | DetourCrowd.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /DetourTileCache/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCE_FILES "*.h" "*.cpp") 2 | 3 | include_directories(../Detour) 4 | add_library(DetourTileCache STATIC ${SOURCE_FILES}) 5 | -------------------------------------------------------------------------------- /DetourTileCache/DetourTileCache.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {8749E340-112B-4D01-A329-5D2FF4B627CC} 15 | Win32Proj 16 | DetourTileCache 17 | 18 | 19 | 20 | StaticLibrary 21 | true 22 | Unicode 23 | 24 | 25 | StaticLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Level3 46 | Disabled 47 | WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 48 | ..\Detour 49 | 50 | 51 | Windows 52 | true 53 | 54 | 55 | 56 | 57 | Level3 58 | 59 | 60 | MaxSpeed 61 | true 62 | true 63 | WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 64 | 65 | 66 | Windows 67 | true 68 | true 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /DetourTileCache/DetourTileCache.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | -------------------------------------------------------------------------------- /DetourTileCache/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : DetourTileCache Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this DetourTileCache library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | DetourTileCache.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | DetourTileCache.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Mikko Mononen memon@inside.org 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | recastnavigation原仓库:https://github.com/recastnavigation/recastnavigation 2 | 3 | 此仓库是本人学习recastnavigation建立的,对部分代码添加了一些代码注释。虽然版本比较老了,但是核心原理还是没变。 4 | -------------------------------------------------------------------------------- /Recast/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCE_FILES "*.h" "*.cpp") 2 | 3 | add_library(Recast STATIC ${SOURCE_FILES}) 4 | -------------------------------------------------------------------------------- /Recast/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : Recast Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Recast library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | Recast.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | Recast.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /Recast/Recast.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {CE9A24D1-F555-49C2-A7D8-D2D6F409C6D3} 15 | Win32Proj 16 | Recast 17 | 18 | 19 | 20 | StaticLibrary 21 | true 22 | Unicode 23 | 24 | 25 | StaticLibrary 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Level3 46 | Disabled 47 | WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) 48 | 49 | 50 | Windows 51 | true 52 | 53 | 54 | 55 | 56 | Level3 57 | 58 | 59 | MaxSpeed 60 | true 61 | true 62 | WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) 63 | 64 | 65 | Windows 66 | true 67 | true 68 | true 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /Recast/Recast.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | -------------------------------------------------------------------------------- /Recast/RecastAlloc.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #include 20 | #include 21 | #include "RecastAlloc.h" 22 | 23 | static void *rcAllocDefault(int size, rcAllocHint) 24 | { 25 | return malloc(size); 26 | } 27 | 28 | static void rcFreeDefault(void *ptr) 29 | { 30 | free(ptr); 31 | } 32 | 33 | static rcAllocFunc* sRecastAllocFunc = rcAllocDefault; 34 | static rcFreeFunc* sRecastFreeFunc = rcFreeDefault; 35 | 36 | /// @see rcAlloc, rcFree 37 | void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc) 38 | { 39 | sRecastAllocFunc = allocFunc ? allocFunc : rcAllocDefault; 40 | sRecastFreeFunc = freeFunc ? freeFunc : rcFreeDefault; 41 | } 42 | 43 | /// @see rcAllocSetCustom 44 | void* rcAlloc(int size, rcAllocHint hint) 45 | { 46 | return sRecastAllocFunc(size, hint); 47 | } 48 | 49 | /// @par 50 | /// 51 | /// @warning This function leaves the value of @p ptr unchanged. So it still 52 | /// points to the same (now invalid) location, and not to null. 53 | /// 54 | /// @see rcAllocSetCustom 55 | void rcFree(void* ptr) 56 | { 57 | if (ptr) 58 | sRecastFreeFunc(ptr); 59 | } 60 | 61 | /// @class rcIntArray 62 | /// 63 | /// While it is possible to pre-allocate a specific array size during 64 | /// construction or by using the #resize method, certain methods will 65 | /// automatically resize the array as needed. 66 | /// 67 | /// @warning The array memory is not initialized to zero when the size is 68 | /// manually set during construction or when using #resize. 69 | 70 | /// @par 71 | /// 72 | /// Using this method ensures the array is at least large enough to hold 73 | /// the specified number of elements. This can improve performance by 74 | /// avoiding auto-resizing during use. 75 | void rcIntArray::resize(int n) 76 | { 77 | if (n > m_cap) 78 | { 79 | if (!m_cap) m_cap = n; 80 | while (m_cap < n) m_cap *= 2; 81 | int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP); 82 | if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int)); 83 | rcFree(m_data); 84 | m_data = newData; 85 | } 86 | m_size = n; 87 | } 88 | 89 | -------------------------------------------------------------------------------- /Recast/RecastAssert.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef RECASTASSERT_H 20 | #define RECASTASSERT_H 21 | 22 | // Note: This header file's only purpose is to include define assert. 23 | // Feel free to change the file and include your own implementation instead. 24 | 25 | #ifdef NDEBUG 26 | // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ 27 | # define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) 28 | #else 29 | # include 30 | # define rcAssert assert 31 | #endif 32 | 33 | #endif // RECASTASSERT_H 34 | -------------------------------------------------------------------------------- /RecastDemo/Bin/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Bin/DroidSans.ttf -------------------------------------------------------------------------------- /RecastDemo/Bin/Recast.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | Recast 9 | CFBundleIconFile 10 | Icon.icns 11 | CFBundleIdentifier 12 | com.yourcompany.Recast 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | Recast 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /RecastDemo/Bin/Recast.app/Contents/MacOS/Recast: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Bin/Recast.app/Contents/MacOS/Recast -------------------------------------------------------------------------------- /RecastDemo/Bin/Recast.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/MainMenu.nib -------------------------------------------------------------------------------- /RecastDemo/Bin/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Bin/SDL.dll -------------------------------------------------------------------------------- /RecastDemo/Bin/Tests/movement_test.txt: -------------------------------------------------------------------------------- 1 | s Solo Mesh Simple 2 | f movement.obj 3 | pf -100.539185 -1.000000 54.028996 62.582016 15.757828 52.842243 0x3 0x0 4 | pf -100.539185 -1.000000 54.028996 -1.259964 -1.000000 50.116970 0x3 0x0 5 | pf -100.539185 -1.000000 54.028996 1.598934 -1.000000 23.528656 0x3 0x0 6 | pf -100.539185 -1.000000 54.028996 3.652847 -1.000000 -5.022881 0x3 0x0 7 | pf -100.539185 -1.000000 54.028996 -39.182816 8.999985 -24.697731 0x3 0x0 8 | pf -100.539185 -1.000000 54.028996 -66.847992 -1.000000 -28.908646 0x3 0x0 9 | pf -100.539185 -1.000000 54.028996 -90.966019 -1.000000 -3.219864 0x3 0x0 10 | pf -43.394421 -1.000000 13.312424 -90.966019 -1.000000 -3.219864 0x3 0x0 11 | pf -43.394421 -1.000000 13.312424 -36.447182 3.999992 -25.008087 0x3 0x0 12 | pf -43.394421 -1.000000 13.312424 26.394167 15.757812 -13.491264 0x3 0x0 13 | pf -43.394421 -1.000000 13.312424 -4.140746 6.944923 4.888435 0x3 0x0 14 | pf -43.394421 -1.000000 13.312424 -73.532791 -1.062469 23.137051 0x3 0x0 15 | pf -43.394421 -1.000000 13.312424 -72.902054 7.996834 15.076473 0x3 0x0 -------------------------------------------------------------------------------- /RecastDemo/Bin/Tests/nav_mesh_test.txt: -------------------------------------------------------------------------------- 1 | s Solo Mesh Simple 2 | f nav_test.obj 3 | pf 18.138550 -2.370003 -21.319118 -19.206181 -2.369133 24.802742 0x3 0x0 4 | pf 18.252758 -2.368240 -7.000238 -19.206181 -2.369133 24.802742 0x3 0x0 5 | pf 18.252758 -2.368240 -7.000238 -22.759071 -2.369453 2.003946 0x3 0x0 6 | pf 18.252758 -2.368240 -7.000238 -24.483898 -2.369728 -6.778278 0x3 0x0 7 | pf 18.252758 -2.368240 -7.000238 -24.068850 -2.370285 -18.879251 0x3 0x0 8 | pf 18.252758 -2.368240 -7.000238 12.124170 -2.369637 -21.222471 0x3 0x0 9 | pf 10.830146 -2.366791 19.002508 12.124170 -2.369637 -21.222471 0x3 0x0 10 | pf 10.830146 -2.366791 19.002508 -7.146484 -2.368736 -16.031403 0x3 0x0 11 | pf 10.830146 -2.366791 19.002508 -21.615391 -2.368706 -3.264029 0x3 0x0 12 | pf 10.830146 -2.366791 19.002508 -22.651268 -2.369354 1.053217 0x3 0x0 13 | pf 10.830146 -2.366791 19.002508 19.181122 -2.368134 3.011776 0x3 0x0 14 | pf 10.830146 -2.366791 19.002508 19.041592 -2.368713 -7.404587 0x3 0x0 15 | pf 6.054083 -2.365402 3.330421 19.041592 -2.368713 -7.404587 0x3 0x0 16 | pf 6.054083 -2.365402 3.330421 21.846087 -2.368568 17.918859 0x3 0x0 17 | pf 6.054083 -2.365402 3.330421 0.967449 -2.368439 25.767756 0x3 0x0 18 | pf 6.054083 -2.365402 3.330421 -17.518076 -2.368477 26.569633 0x3 0x0 19 | pf 6.054083 -2.365402 3.330421 -22.141787 -2.369209 2.440046 0x3 0x0 20 | pf 6.054083 -2.365402 3.330421 -23.296972 -2.369797 -17.411043 0x3 0x0 21 | pf 6.054083 -2.365402 3.330421 -1.564062 -2.369926 -20.452827 0x3 0x0 22 | pf 6.054083 -2.365402 3.330421 16.905643 -2.370193 -21.811655 0x3 0x0 23 | pf 6.054083 -2.365402 3.330421 19.289761 -2.368813 -6.954918 0x3 0x0 24 | -------------------------------------------------------------------------------- /RecastDemo/Bin/all_tiles_navmesh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Bin/all_tiles_navmesh.bin -------------------------------------------------------------------------------- /RecastDemo/Bin/test.chf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Bin/test.chf -------------------------------------------------------------------------------- /RecastDemo/Build/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Build/Icon.png -------------------------------------------------------------------------------- /RecastDemo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 |  2 | SET(recastdemo_SRCS 3 | Source/ChunkyTriMesh.cpp 4 | Source/ConvexVolumeTool.cpp 5 | Source/CrowdTool.cpp 6 | Source/Filelist.cpp 7 | Source/imgui.cpp 8 | Source/imguiRenderGL.cpp 9 | Source/InputGeom.cpp 10 | Source/main.cpp 11 | Source/MeshLoaderObj.cpp 12 | Source/NavMeshPruneTool.cpp 13 | Source/NavMeshTesterTool.cpp 14 | Source/OffMeshConnectionTool.cpp 15 | Source/PerfTimer.cpp 16 | Source/Sample.cpp 17 | Source/Sample_Debug.cpp 18 | Source/Sample_SoloMesh.cpp 19 | Source/Sample_TileMesh.cpp 20 | Source/Sample_TempObstacles.cpp 21 | Source/SampleInterfaces.cpp 22 | Source/SlideShow.cpp 23 | Source/TestCase.cpp 24 | Source/ValueHistory.cpp 25 | Contrib/fastlz/fastlz.c 26 | ) 27 | 28 | SET(recastdemo_HDRS 29 | Include/ChunkyTriMesh.h 30 | Include/ConvexVolumeTool.h 31 | Include/CrowdTool.h 32 | Include/Filelist.h 33 | Include/imgui.h 34 | Include/imguiRenderGL.h 35 | Include/InputGeom.h 36 | Include/MeshLoaderObj.h 37 | Include/NavMeshPruneTool.h 38 | Include/NavMeshTesterTool.h 39 | Include/OffMeshConnectionTool.h 40 | Include/PerfTimer.h 41 | Include/Sample.h 42 | Include/Sample_Debug.h 43 | Include/Sample_SoloMesh.h 44 | Include/Sample_TileMesh.h 45 | Include/Sample_TempObstacles.h 46 | Include/SampleInterfaces.h 47 | Include/SDLMain.h 48 | Include/SlideShow.h 49 | Include/TestCase.h 50 | Include/ValueHistory.h 51 | ) 52 | 53 | IF(MSVC) 54 | # Look in the Contrib directory for SDL when building with MSVC 55 | SET(CMAKE_PREFIX_PATH Contrib/SDL) 56 | ENDIF(MSVC) 57 | 58 | FIND_PACKAGE(OpenGL REQUIRED) 59 | FIND_PACKAGE(SDL REQUIRED) 60 | 61 | INCLUDE_DIRECTORIES(Include 62 | Contrib 63 | Contrib/fastlz 64 | ../DebugUtils 65 | ../Detour 66 | ../DetourCrowd 67 | ../DetourTileCache 68 | ../Recast 69 | ${SDL_INCLUDE_DIR} 70 | ) 71 | 72 | IF(XCODE) 73 | ADD_EXECUTABLE(RecastDemo MACOSX_BUNDLE Source/SDLMain.m Include/SDLMain.h ${recastdemo_SRCS} ${recastdemo_HDRS}) 74 | ELSE(XCODE) 75 | ADD_EXECUTABLE(RecastDemo WIN32 ${recastdemo_SRCS} ${recastdemo_HDRS}) 76 | ENDIF(XCODE) 77 | 78 | TARGET_LINK_LIBRARIES(RecastDemo DebugUtils Detour DetourCrowd DetourTileCache Recast ${SDL_LIBRARY} ${OPENGL_LIBRARIES}) 79 | 80 | IF(MSVC) 81 | # Enable some linker optimisations 82 | SET_TARGET_PROPERTIES(RecastDemo PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") 83 | SET_TARGET_PROPERTIES(RecastDemo PROPERTIES LINK_FLAGS_MINSIZEREL "/OPT:REF /OPT:ICF") 84 | SET_TARGET_PROPERTIES(RecastDemo PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/OPT:REF /OPT:ICF") 85 | ENDIF(MSVC) 86 | 87 | SET_TARGET_PROPERTIES(RecastDemo PROPERTIES 88 | RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/Bin 89 | RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/Bin 90 | ) 91 | 92 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/BUGS.txt: -------------------------------------------------------------------------------- 1 |  2 | Bugs are now managed in the SDL bug tracker, here: 3 | 4 | http://bugzilla.libsdl.org/ 5 | 6 | You may report bugs there, and search to see if a given issue has already 7 | been reported, discussed, and maybe even fixed. 8 | 9 | 10 | 11 | You may also find help at the SDL mailing list. Subscription information: 12 | 13 | http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org 14 | 15 | Bug reports are welcome here, but we really appreciate if you use Bugzilla, as 16 | bugs discussed on the mailing list may be forgotten or missed. 17 | 18 | 19 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/README-SDL.txt: -------------------------------------------------------------------------------- 1 |  2 | Please distribute this file with the SDL runtime environment: 3 | 4 | The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library 5 | designed to make it easy to write multi-media software, such as games and 6 | emulators. 7 | 8 | The Simple DirectMedia Layer library source code is available from: 9 | http://www.libsdl.org/ 10 | 11 | This library is distributed under the terms of the GNU LGPL license: 12 | http://www.gnu.org/copyleft/lesser.html 13 | 14 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL.h 24 | * Main include header for the SDL library 25 | */ 26 | 27 | #ifndef _SDL_H 28 | #define _SDL_H 29 | 30 | #include "SDL_main.h" 31 | #include "SDL_stdinc.h" 32 | #include "SDL_audio.h" 33 | #include "SDL_cdrom.h" 34 | #include "SDL_cpuinfo.h" 35 | #include "SDL_endian.h" 36 | #include "SDL_error.h" 37 | #include "SDL_events.h" 38 | #include "SDL_loadso.h" 39 | #include "SDL_mutex.h" 40 | #include "SDL_rwops.h" 41 | #include "SDL_thread.h" 42 | #include "SDL_timer.h" 43 | #include "SDL_video.h" 44 | #include "SDL_version.h" 45 | 46 | #include "begin_code.h" 47 | /* Set up for C function definitions, even when using C++ */ 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | /** @file SDL.h 53 | * @note As of version 0.5, SDL is loaded dynamically into the application 54 | */ 55 | 56 | /** @name SDL_INIT Flags 57 | * These are the flags which may be passed to SDL_Init() -- you should 58 | * specify the subsystems which you will be using in your application. 59 | */ 60 | /*@{*/ 61 | #define SDL_INIT_TIMER 0x00000001 62 | #define SDL_INIT_AUDIO 0x00000010 63 | #define SDL_INIT_VIDEO 0x00000020 64 | #define SDL_INIT_CDROM 0x00000100 65 | #define SDL_INIT_JOYSTICK 0x00000200 66 | #define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ 67 | #define SDL_INIT_EVENTTHREAD 0x01000000 /**< Not supported on all OS's */ 68 | #define SDL_INIT_EVERYTHING 0x0000FFFF 69 | /*@}*/ 70 | 71 | /** This function loads the SDL dynamically linked library and initializes 72 | * the subsystems specified by 'flags' (and those satisfying dependencies) 73 | * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup 74 | * signal handlers for some commonly ignored fatal signals (like SIGSEGV) 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); 77 | 78 | /** This function initializes specific SDL subsystems */ 79 | extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); 80 | 81 | /** This function cleans up specific SDL subsystems */ 82 | extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); 83 | 84 | /** This function returns mask of the specified subsystems which have 85 | * been initialized. 86 | * If 'flags' is 0, it returns a mask of all initialized subsystems. 87 | */ 88 | extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); 89 | 90 | /** This function cleans up all initialized subsystems and unloads the 91 | * dynamically linked library. You should call it upon all exit conditions. 92 | */ 93 | extern DECLSPEC void SDLCALL SDL_Quit(void); 94 | 95 | /* Ends C function definitions when using C++ */ 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | #include "close_code.h" 100 | 101 | #endif /* _SDL_H */ 102 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_active.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_active.h 25 | * Include file for SDL application focus event handling 26 | */ 27 | 28 | #ifndef _SDL_active_h 29 | #define _SDL_active_h 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | #include "begin_code.h" 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @name The available application states */ 41 | /*@{*/ 42 | #define SDL_APPMOUSEFOCUS 0x01 /**< The app has mouse coverage */ 43 | #define SDL_APPINPUTFOCUS 0x02 /**< The app has input focus */ 44 | #define SDL_APPACTIVE 0x04 /**< The application is active */ 45 | /*@}*/ 46 | 47 | /* Function prototypes */ 48 | /** 49 | * This function returns the current state of the application, which is a 50 | * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and 51 | * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to 52 | * see your application, otherwise it has been iconified or disabled. 53 | */ 54 | extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); 55 | 56 | 57 | /* Ends C function definitions when using C++ */ 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | #include "close_code.h" 62 | 63 | #endif /* _SDL_active_h */ 64 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_byteorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_byteorder.h 25 | * @deprecated Use SDL_endian.h instead 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_endian.h" 30 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_h 24 | #define _SDL_config_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* Add any platform that doesn't build using the configure system */ 29 | #if defined(__DREAMCAST__) 30 | #include "SDL_config_dreamcast.h" 31 | #elif defined(__MACOS__) 32 | #include "SDL_config_macos.h" 33 | #elif defined(__MACOSX__) 34 | #include "SDL_config_macosx.h" 35 | #elif defined(__SYMBIAN32__) 36 | #include "SDL_config_symbian.h" /* must be before win32! */ 37 | #elif defined(__WIN32__) 38 | #include "SDL_config_win32.h" 39 | #elif defined(__OS2__) 40 | #include "SDL_config_os2.h" 41 | #else 42 | #include "SDL_config_minimal.h" 43 | #endif /* platform config */ 44 | 45 | #endif /* _SDL_config_h */ 46 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_config_dreamcast.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_dreamcast_h 24 | #define _SDL_config_dreamcast_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | typedef signed char int8_t; 31 | typedef unsigned char uint8_t; 32 | typedef signed short int16_t; 33 | typedef unsigned short uint16_t; 34 | typedef signed int int32_t; 35 | typedef unsigned int uint32_t; 36 | typedef signed long long int64_t; 37 | typedef unsigned long long uint64_t; 38 | typedef unsigned long uintptr_t; 39 | #define SDL_HAS_64BIT_TYPE 1 40 | 41 | /* Useful headers */ 42 | #define HAVE_SYS_TYPES_H 1 43 | #define HAVE_STDIO_H 1 44 | #define STDC_HEADERS 1 45 | #define HAVE_STRING_H 1 46 | #define HAVE_CTYPE_H 1 47 | 48 | /* C library functions */ 49 | #define HAVE_MALLOC 1 50 | #define HAVE_CALLOC 1 51 | #define HAVE_REALLOC 1 52 | #define HAVE_FREE 1 53 | #define HAVE_ALLOCA 1 54 | #define HAVE_GETENV 1 55 | #define HAVE_PUTENV 1 56 | #define HAVE_QSORT 1 57 | #define HAVE_ABS 1 58 | #define HAVE_BCOPY 1 59 | #define HAVE_MEMSET 1 60 | #define HAVE_MEMCPY 1 61 | #define HAVE_MEMMOVE 1 62 | #define HAVE_MEMCMP 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRDUP 1 65 | #define HAVE_INDEX 1 66 | #define HAVE_RINDEX 1 67 | #define HAVE_STRCHR 1 68 | #define HAVE_STRRCHR 1 69 | #define HAVE_STRSTR 1 70 | #define HAVE_STRTOL 1 71 | #define HAVE_STRTOD 1 72 | #define HAVE_ATOI 1 73 | #define HAVE_ATOF 1 74 | #define HAVE_STRCMP 1 75 | #define HAVE_STRNCMP 1 76 | #define HAVE_STRICMP 1 77 | #define HAVE_STRCASECMP 1 78 | #define HAVE_SSCANF 1 79 | #define HAVE_SNPRINTF 1 80 | #define HAVE_VSNPRINTF 1 81 | 82 | /* Enable various audio drivers */ 83 | #define SDL_AUDIO_DRIVER_DC 1 84 | #define SDL_AUDIO_DRIVER_DISK 1 85 | #define SDL_AUDIO_DRIVER_DUMMY 1 86 | 87 | /* Enable various cdrom drivers */ 88 | #define SDL_CDROM_DC 1 89 | 90 | /* Enable various input drivers */ 91 | #define SDL_JOYSTICK_DC 1 92 | 93 | /* Enable various shared object loading systems */ 94 | #define SDL_LOADSO_DUMMY 1 95 | 96 | /* Enable various threading systems */ 97 | #define SDL_THREAD_DC 1 98 | 99 | /* Enable various timer systems */ 100 | #define SDL_TIMER_DC 1 101 | 102 | /* Enable various video drivers */ 103 | #define SDL_VIDEO_DRIVER_DC 1 104 | #define SDL_VIDEO_DRIVER_DUMMY 1 105 | 106 | #endif /* _SDL_config_dreamcast_h */ 107 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_config_macos.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_macos_h 24 | #define _SDL_config_macos_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | #include 31 | 32 | typedef SInt8 int8_t; 33 | typedef UInt8 uint8_t; 34 | typedef SInt16 int16_t; 35 | typedef UInt16 uint16_t; 36 | typedef SInt32 int32_t; 37 | typedef UInt32 uint32_t; 38 | typedef SInt64 int64_t; 39 | typedef UInt64 uint64_t; 40 | typedef unsigned long uintptr_t; 41 | 42 | #define SDL_HAS_64BIT_TYPE 1 43 | 44 | /* Useful headers */ 45 | #define HAVE_STDIO_H 1 46 | #define STDC_HEADERS 1 47 | #define HAVE_STRING_H 1 48 | #define HAVE_CTYPE_H 1 49 | #define HAVE_MATH_H 1 50 | #define HAVE_SIGNAL_H 1 51 | 52 | /* C library functions */ 53 | #define HAVE_MALLOC 1 54 | #define HAVE_CALLOC 1 55 | #define HAVE_REALLOC 1 56 | #define HAVE_FREE 1 57 | #define HAVE_ALLOCA 1 58 | #define HAVE_ABS 1 59 | #define HAVE_MEMSET 1 60 | #define HAVE_MEMCPY 1 61 | #define HAVE_MEMMOVE 1 62 | #define HAVE_MEMCMP 1 63 | #define HAVE_STRLEN 1 64 | #define HAVE_STRCHR 1 65 | #define HAVE_STRRCHR 1 66 | #define HAVE_STRSTR 1 67 | #define HAVE_ITOA 1 68 | #define HAVE_STRTOL 1 69 | #define HAVE_STRTOD 1 70 | #define HAVE_ATOI 1 71 | #define HAVE_ATOF 1 72 | #define HAVE_STRCMP 1 73 | #define HAVE_STRNCMP 1 74 | #define HAVE_SSCANF 1 75 | 76 | /* Enable various audio drivers */ 77 | #define SDL_AUDIO_DRIVER_SNDMGR 1 78 | #define SDL_AUDIO_DRIVER_DISK 1 79 | #define SDL_AUDIO_DRIVER_DUMMY 1 80 | 81 | /* Enable various cdrom drivers */ 82 | #if TARGET_API_MAC_CARBON 83 | #define SDL_CDROM_DUMMY 1 84 | #else 85 | #define SDL_CDROM_MACOS 1 86 | #endif 87 | 88 | /* Enable various input drivers */ 89 | #if TARGET_API_MAC_CARBON 90 | #define SDL_JOYSTICK_DUMMY 1 91 | #else 92 | #define SDL_JOYSTICK_MACOS 1 93 | #endif 94 | 95 | /* Enable various shared object loading systems */ 96 | #define SDL_LOADSO_MACOS 1 97 | 98 | /* Enable various threading systems */ 99 | #define SDL_THREADS_DISABLED 1 100 | 101 | /* Enable various timer systems */ 102 | #define SDL_TIMER_MACOS 1 103 | 104 | /* Enable various video drivers */ 105 | #define SDL_VIDEO_DRIVER_DUMMY 1 106 | #define SDL_VIDEO_DRIVER_DRAWSPROCKET 1 107 | #define SDL_VIDEO_DRIVER_TOOLBOX 1 108 | 109 | /* Enable OpenGL support */ 110 | #define SDL_VIDEO_OPENGL 1 111 | 112 | #endif /* _SDL_config_macos_h */ 113 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_config_minimal.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_minimal_h 24 | #define _SDL_config_minimal_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is the minimal configuration that can be used to build SDL */ 29 | 30 | #include 31 | 32 | typedef signed char int8_t; 33 | typedef unsigned char uint8_t; 34 | typedef signed short int16_t; 35 | typedef unsigned short uint16_t; 36 | typedef signed int int32_t; 37 | typedef unsigned int uint32_t; 38 | typedef unsigned int size_t; 39 | typedef unsigned long uintptr_t; 40 | 41 | /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ 42 | #define SDL_AUDIO_DRIVER_DUMMY 1 43 | 44 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 45 | #define SDL_CDROM_DISABLED 1 46 | 47 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 48 | #define SDL_JOYSTICK_DISABLED 1 49 | 50 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 51 | #define SDL_LOADSO_DISABLED 1 52 | 53 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 54 | #define SDL_THREADS_DISABLED 1 55 | 56 | /* Enable the stub timer support (src/timer/dummy/\*.c) */ 57 | #define SDL_TIMERS_DISABLED 1 58 | 59 | /* Enable the dummy video driver (src/video/dummy/\*.c) */ 60 | #define SDL_VIDEO_DRIVER_DUMMY 1 61 | 62 | #endif /* _SDL_config_minimal_h */ 63 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_config_nds.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_nds_h 24 | #define _SDL_config_nds_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | /* General platform specific identifiers */ 31 | #include "SDL_platform.h" 32 | 33 | /* C datatypes */ 34 | #define SDL_HAS_64BIT_TYPE 1 35 | 36 | /* Endianness */ 37 | #define SDL_BYTEORDER 1234 38 | 39 | /* Useful headers */ 40 | #define HAVE_ALLOCA_H 1 41 | #define HAVE_SYS_TYPES_H 1 42 | #define HAVE_STDIO_H 1 43 | #define STDC_HEADERS 1 44 | #define HAVE_STDLIB_H 1 45 | #define HAVE_STDARG_H 1 46 | #define HAVE_MALLOC_H 1 47 | #define HAVE_STRING_H 1 48 | #define HAVE_INTTYPES_H 1 49 | #define HAVE_STDINT_H 1 50 | #define HAVE_CTYPE_H 1 51 | #define HAVE_MATH_H 1 52 | #define HAVE_ICONV_H 1 53 | #define HAVE_SIGNAL_H 1 54 | 55 | /* C library functions */ 56 | #define HAVE_MALLOC 1 57 | #define HAVE_CALLOC 1 58 | #define HAVE_REALLOC 1 59 | #define HAVE_FREE 1 60 | #define HAVE_ALLOCA 1 61 | #define HAVE_GETENV 1 62 | #define HAVE_PUTENV 1 63 | #define HAVE_UNSETENV 1 64 | #define HAVE_QSORT 1 65 | #define HAVE_ABS 1 66 | #define HAVE_BCOPY 1 67 | #define HAVE_MEMSET 1 68 | #define HAVE_MEMCPY 1 69 | #define HAVE_MEMMOVE 1 70 | #define HAVE_STRLEN 1 71 | #define HAVE_STRLCPY 1 72 | #define HAVE_STRLCAT 1 73 | #define HAVE_STRDUP 1 74 | #define HAVE_STRCHR 1 75 | #define HAVE_STRRCHR 1 76 | #define HAVE_STRSTR 1 77 | #define HAVE_STRTOL 1 78 | #define HAVE_STRTOUL 1 79 | #define HAVE_STRTOLL 1 80 | #define HAVE_STRTOULL 1 81 | #define HAVE_ATOI 1 82 | #define HAVE_ATOF 1 83 | #define HAVE_STRCMP 1 84 | #define HAVE_STRNCMP 1 85 | #define HAVE_STRCASECMP 1 86 | #define HAVE_STRNCASECMP 1 87 | #define HAVE_SSCANF 1 88 | #define HAVE_SNPRINTF 1 89 | #define HAVE_VSNPRINTF 1 90 | #define HAVE_SETJMP 1 91 | 92 | /* Enable various audio drivers */ 93 | #define SDL_AUDIO_DRIVER_NDS 1 94 | #define SDL_AUDIO_DRIVER_DUMMY 1 95 | 96 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 97 | #define SDL_CDROM_DISABLED 1 98 | 99 | /* Enable various input drivers */ 100 | #define SDL_JOYSTICK_NDS 1 101 | 102 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 103 | #define SDL_LOADSO_DISABLED 1 104 | 105 | /* Enable the stub thread support (src/thread/generic/\*.c) */ 106 | #define SDL_THREADS_DISABLED 1 107 | 108 | /* Enable various timer systems */ 109 | #define SDL_TIMER_NDS 1 110 | 111 | /* Enable various video drivers */ 112 | #define SDL_VIDEO_DRIVER_NDS 1 113 | #define SDL_VIDEO_DRIVER_DUMMY 1 114 | 115 | #endif /* _SDL_config_nds_h */ 116 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_config_os2.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_config_os2_h 24 | #define _SDL_config_os2_h 25 | 26 | #include "SDL_platform.h" 27 | 28 | /* This is a set of defines to configure the SDL features */ 29 | 30 | typedef signed char int8_t; 31 | typedef unsigned char uint8_t; 32 | typedef signed short int16_t; 33 | typedef unsigned short uint16_t; 34 | typedef signed int int32_t; 35 | typedef unsigned int uint32_t; 36 | typedef unsigned int size_t; 37 | typedef unsigned long uintptr_t; 38 | typedef signed long long int64_t; 39 | typedef unsigned long long uint64_t; 40 | 41 | #define SDL_HAS_64BIT_TYPE 1 42 | 43 | /* Use Watcom's LIBC */ 44 | #define HAVE_LIBC 1 45 | 46 | /* Useful headers */ 47 | #define HAVE_SYS_TYPES_H 1 48 | #define HAVE_STDIO_H 1 49 | #define STDC_HEADERS 1 50 | #define HAVE_STDLIB_H 1 51 | #define HAVE_STDARG_H 1 52 | #define HAVE_MALLOC_H 1 53 | #define HAVE_MEMORY_H 1 54 | #define HAVE_STRING_H 1 55 | #define HAVE_STRINGS_H 1 56 | #define HAVE_INTTYPES_H 1 57 | #define HAVE_STDINT_H 1 58 | #define HAVE_CTYPE_H 1 59 | #define HAVE_MATH_H 1 60 | #define HAVE_SIGNAL_H 1 61 | 62 | /* C library functions */ 63 | #define HAVE_MALLOC 1 64 | #define HAVE_CALLOC 1 65 | #define HAVE_REALLOC 1 66 | #define HAVE_FREE 1 67 | #define HAVE_ALLOCA 1 68 | #define HAVE_GETENV 1 69 | #define HAVE_PUTENV 1 70 | #define HAVE_UNSETENV 1 71 | #define HAVE_QSORT 1 72 | #define HAVE_ABS 1 73 | #define HAVE_BCOPY 1 74 | #define HAVE_MEMSET 1 75 | #define HAVE_MEMCPY 1 76 | #define HAVE_MEMMOVE 1 77 | #define HAVE_MEMCMP 1 78 | #define HAVE_STRLEN 1 79 | #define HAVE_STRLCPY 1 80 | #define HAVE_STRLCAT 1 81 | #define HAVE_STRDUP 1 82 | #define HAVE__STRREV 1 83 | #define HAVE__STRUPR 1 84 | #define HAVE__STRLWR 1 85 | #define HAVE_INDEX 1 86 | #define HAVE_RINDEX 1 87 | #define HAVE_STRCHR 1 88 | #define HAVE_STRRCHR 1 89 | #define HAVE_STRSTR 1 90 | #define HAVE_ITOA 1 91 | #define HAVE__LTOA 1 92 | #define HAVE__UITOA 1 93 | #define HAVE__ULTOA 1 94 | #define HAVE_STRTOL 1 95 | #define HAVE__I64TOA 1 96 | #define HAVE__UI64TOA 1 97 | #define HAVE_STRTOLL 1 98 | #define HAVE_STRTOD 1 99 | #define HAVE_ATOI 1 100 | #define HAVE_ATOF 1 101 | #define HAVE_STRCMP 1 102 | #define HAVE_STRNCMP 1 103 | #define HAVE_STRICMP 1 104 | #define HAVE_STRCASECMP 1 105 | #define HAVE_SSCANF 1 106 | #define HAVE_SNPRINTF 1 107 | #define HAVE_VSNPRINTF 1 108 | #define HAVE_SETJMP 1 109 | #define HAVE_CLOCK_GETTIME 1 110 | 111 | /* Enable various audio drivers */ 112 | #define SDL_AUDIO_DRIVER_DART 1 113 | #define SDL_AUDIO_DRIVER_DISK 1 114 | #define SDL_AUDIO_DRIVER_DUMMY 1 115 | 116 | /* Enable various cdrom drivers */ 117 | #define SDL_CDROM_OS2 1 118 | 119 | /* Enable various input drivers */ 120 | #define SDL_JOYSTICK_OS2 1 121 | 122 | /* Enable various shared object loading systems */ 123 | #define SDL_LOADSO_OS2 1 124 | 125 | /* Enable various threading systems */ 126 | #define SDL_THREAD_OS2 1 127 | 128 | /* Enable various timer systems */ 129 | #define SDL_TIMER_OS2 1 130 | 131 | /* Enable various video drivers */ 132 | #define SDL_VIDEO_DRIVER_DUMMY 1 133 | #define SDL_VIDEO_DRIVER_OS2FS 1 134 | 135 | /* Enable OpenGL support */ 136 | /* Nothing here yet for OS/2... :( */ 137 | 138 | /* Enable assembly routines where available */ 139 | #define SDL_ASSEMBLY_ROUTINES 1 140 | 141 | #endif /* _SDL_config_os2_h */ 142 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_config_symbian.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /* 24 | 25 | Symbian version Markus Mertama 26 | 27 | */ 28 | 29 | 30 | #ifndef _SDL_CONFIG_SYMBIAN_H 31 | #define _SDL_CONFIG_SYMBIAN_H 32 | 33 | #include "SDL_platform.h" 34 | 35 | /* This is the minimal configuration that can be used to build SDL */ 36 | 37 | 38 | #include 39 | #include 40 | 41 | 42 | #ifdef __GCCE__ 43 | #define SYMBIAN32_GCCE 44 | #endif 45 | 46 | #ifndef _SIZE_T_DEFINED 47 | typedef unsigned int size_t; 48 | #endif 49 | 50 | #ifndef _INTPTR_T_DECLARED 51 | typedef unsigned int uintptr_t; 52 | #endif 53 | 54 | #ifndef _INT8_T_DECLARED 55 | typedef signed char int8_t; 56 | #endif 57 | 58 | #ifndef _UINT8_T_DECLARED 59 | typedef unsigned char uint8_t; 60 | #endif 61 | 62 | #ifndef _INT16_T_DECLARED 63 | typedef signed short int16_t; 64 | #endif 65 | 66 | #ifndef _UINT16_T_DECLARED 67 | typedef unsigned short uint16_t; 68 | #endif 69 | 70 | #ifndef _INT32_T_DECLARED 71 | typedef signed int int32_t; 72 | #endif 73 | 74 | #ifndef _UINT32_T_DECLARED 75 | typedef unsigned int uint32_t; 76 | #endif 77 | 78 | #ifndef _INT64_T_DECLARED 79 | typedef signed long long int64_t; 80 | #endif 81 | 82 | #ifndef _UINT64_T_DECLARED 83 | typedef unsigned long long uint64_t; 84 | #endif 85 | 86 | #define SDL_AUDIO_DRIVER_EPOCAUDIO 1 87 | 88 | 89 | /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ 90 | #define SDL_CDROM_DISABLED 1 91 | 92 | /* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ 93 | #define SDL_JOYSTICK_DISABLED 1 94 | 95 | /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ 96 | #define SDL_LOADSO_DISABLED 1 97 | 98 | #define SDL_THREAD_SYMBIAN 1 99 | 100 | #define SDL_VIDEO_DRIVER_EPOC 1 101 | 102 | #define SDL_VIDEO_OPENGL 0 103 | 104 | #define SDL_HAS_64BIT_TYPE 1 105 | 106 | #define HAVE_LIBC 1 107 | #define HAVE_STDIO_H 1 108 | #define STDC_HEADERS 1 109 | #define HAVE_STRING_H 1 110 | #define HAVE_CTYPE_H 1 111 | #define HAVE_MATH_H 1 112 | 113 | #define HAVE_MALLOC 1 114 | #define HAVE_CALLOC 1 115 | #define HAVE_REALLOC 1 116 | #define HAVE_FREE 1 117 | /*#define HAVE_ALLOCA 1*/ 118 | #define HAVE_QSORT 1 119 | #define HAVE_ABS 1 120 | #define HAVE_MEMSET 1 121 | #define HAVE_MEMCPY 1 122 | #define HAVE_MEMMOVE 1 123 | #define HAVE_MEMCMP 1 124 | #define HAVE_STRLEN 1 125 | #define HAVE__STRUPR 1 126 | #define HAVE_STRCHR 1 127 | #define HAVE_STRRCHR 1 128 | #define HAVE_STRSTR 1 129 | #define HAVE_ITOA 1 130 | #define HAVE_STRTOL 1 131 | #define HAVE_STRTOUL 1 132 | #define HAVE_STRTOLL 1 133 | #define HAVE_STRTOD 1 134 | #define HAVE_ATOI 1 135 | #define HAVE_ATOF 1 136 | #define HAVE_STRCMP 1 137 | #define HAVE_STRNCMP 1 138 | /*#define HAVE__STRICMP 1*/ 139 | #define HAVE__STRNICMP 1 140 | #define HAVE_SSCANF 1 141 | #define HAVE_STDARG_H 1 142 | #define HAVE_STDDEF_H 1 143 | 144 | 145 | 146 | #endif /* _SDL_CONFIG_SYMBIAN_H */ 147 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_cpuinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_cpuinfo.h 25 | * CPU feature detection for SDL 26 | */ 27 | 28 | #ifndef _SDL_cpuinfo_h 29 | #define _SDL_cpuinfo_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** This function returns true if the CPU has the RDTSC instruction */ 40 | extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); 41 | 42 | /** This function returns true if the CPU has MMX features */ 43 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); 44 | 45 | /** This function returns true if the CPU has MMX Ext. features */ 46 | extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void); 47 | 48 | /** This function returns true if the CPU has 3DNow features */ 49 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); 50 | 51 | /** This function returns true if the CPU has 3DNow! Ext. features */ 52 | extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void); 53 | 54 | /** This function returns true if the CPU has SSE features */ 55 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); 56 | 57 | /** This function returns true if the CPU has SSE2 features */ 58 | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); 59 | 60 | /** This function returns true if the CPU has AltiVec features */ 61 | extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* _SDL_cpuinfo_h */ 70 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file SDL_error.h 25 | * Simple error message routines for SDL 26 | */ 27 | 28 | #ifndef _SDL_error_h 29 | #define _SDL_error_h 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** 40 | * @name Public functions 41 | */ 42 | /*@{*/ 43 | extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); 44 | extern DECLSPEC char * SDLCALL SDL_GetError(void); 45 | extern DECLSPEC void SDLCALL SDL_ClearError(void); 46 | /*@}*/ 47 | 48 | /** 49 | * @name Private functions 50 | * @internal Private error message function - used internally 51 | */ 52 | /*@{*/ 53 | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) 54 | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) 55 | typedef enum { 56 | SDL_ENOMEM, 57 | SDL_EFREAD, 58 | SDL_EFWRITE, 59 | SDL_EFSEEK, 60 | SDL_UNSUPPORTED, 61 | SDL_LASTERROR 62 | } SDL_errorcode; 63 | extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code); 64 | /*@}*/ 65 | 66 | /* Ends C function definitions when using C++ */ 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | #include "close_code.h" 71 | 72 | #endif /* _SDL_error_h */ 73 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_getenv.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_getenv.h 24 | * @deprecated Use SDL_stdinc.h instead 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_loadso.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_loadso.h 24 | * System dependent library loading routines 25 | */ 26 | 27 | /** @file SDL_loadso.h 28 | * Some things to keep in mind: 29 | * - These functions only work on C function names. Other languages may 30 | * have name mangling and intrinsic language support that varies from 31 | * compiler to compiler. 32 | * - Make sure you declare your function pointers with the same calling 33 | * convention as the actual library function. Your code will crash 34 | * mysteriously if you do not do this. 35 | * - Avoid namespace collisions. If you load a symbol from the library, 36 | * it is not defined whether or not it goes into the global symbol 37 | * namespace for the application. If it does and it conflicts with 38 | * symbols in your code or other shared libraries, you will not get 39 | * the results you expect. :) 40 | */ 41 | 42 | 43 | #ifndef _SDL_loadso_h 44 | #define _SDL_loadso_h 45 | 46 | #include "SDL_stdinc.h" 47 | #include "SDL_error.h" 48 | 49 | #include "begin_code.h" 50 | /* Set up for C function definitions, even when using C++ */ 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | /** 56 | * This function dynamically loads a shared object and returns a pointer 57 | * to the object handle (or NULL if there was an error). 58 | * The 'sofile' parameter is a system dependent name of the object file. 59 | */ 60 | extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile); 61 | 62 | /** 63 | * Given an object handle, this function looks up the address of the 64 | * named function in the shared object and returns it. This address 65 | * is no longer valid after calling SDL_UnloadObject(). 66 | */ 67 | extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name); 68 | 69 | /** Unload a shared object from memory */ 70 | extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); 71 | 72 | /* Ends C function definitions when using C++ */ 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | #include "close_code.h" 77 | 78 | #endif /* _SDL_loadso_h */ 79 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | #ifndef _SDL_main_h 24 | #define _SDL_main_h 25 | 26 | #include "SDL_stdinc.h" 27 | 28 | /** @file SDL_main.h 29 | * Redefine main() on Win32 and MacOS so that it is called by winmain.c 30 | */ 31 | 32 | #if defined(__WIN32__) || \ 33 | (defined(__MWERKS__) && !defined(__BEOS__)) || \ 34 | defined(__MACOS__) || defined(__MACOSX__) || \ 35 | defined(__SYMBIAN32__) || defined(QWS) 36 | 37 | #ifdef __cplusplus 38 | #define C_LINKAGE "C" 39 | #else 40 | #define C_LINKAGE 41 | #endif /* __cplusplus */ 42 | 43 | /** The application's main() function must be called with C linkage, 44 | * and should be declared like this: 45 | * @code 46 | * #ifdef __cplusplus 47 | * extern "C" 48 | * #endif 49 | * int main(int argc, char *argv[]) 50 | * { 51 | * } 52 | * @endcode 53 | */ 54 | #define main SDL_main 55 | 56 | /** The prototype for the application's main() function */ 57 | extern C_LINKAGE int SDL_main(int argc, char *argv[]); 58 | 59 | 60 | /** @name From the SDL library code -- needed for registering the app on Win32 */ 61 | /*@{*/ 62 | #ifdef __WIN32__ 63 | 64 | #include "begin_code.h" 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /** This should be called from your WinMain() function, if any */ 70 | extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); 71 | /** This can also be called, but is no longer necessary */ 72 | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); 73 | /** This can also be called, but is no longer necessary (SDL_Quit calls it) */ 74 | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | #include "close_code.h" 79 | #endif 80 | /*@}*/ 81 | 82 | /** @name From the SDL library code -- needed for registering QuickDraw on MacOS */ 83 | /*@{*/ 84 | #if defined(__MACOS__) 85 | 86 | #include "begin_code.h" 87 | #ifdef __cplusplus 88 | extern "C" { 89 | #endif 90 | 91 | /** Forward declaration so we don't need to include QuickDraw.h */ 92 | struct QDGlobals; 93 | 94 | /** This should be called from your main() function, if any */ 95 | extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | #include "close_code.h" 101 | #endif 102 | /*@}*/ 103 | 104 | #endif /* Need to redefine main()? */ 105 | 106 | #endif /* _SDL_main_h */ 107 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_name.h: -------------------------------------------------------------------------------- 1 |  2 | #ifndef _SDLname_h_ 3 | #define _SDLname_h_ 4 | 5 | #if defined(__STDC__) || defined(__cplusplus) 6 | #define NeedFunctionPrototypes 1 7 | #endif 8 | 9 | #define SDL_NAME(X) SDL_##X 10 | 11 | #endif /* _SDLname_h_ */ 12 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_platform.h 24 | * Try to get a standard set of platform defines 25 | */ 26 | 27 | #ifndef _SDL_platform_h 28 | #define _SDL_platform_h 29 | 30 | #if defined(_AIX) 31 | #undef __AIX__ 32 | #define __AIX__ 1 33 | #endif 34 | #if defined(__BEOS__) 35 | #undef __BEOS__ 36 | #define __BEOS__ 1 37 | #endif 38 | #if defined(__HAIKU__) 39 | #undef __HAIKU__ 40 | #define __HAIKU__ 1 41 | #endif 42 | #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) 43 | #undef __BSDI__ 44 | #define __BSDI__ 1 45 | #endif 46 | #if defined(_arch_dreamcast) 47 | #undef __DREAMCAST__ 48 | #define __DREAMCAST__ 1 49 | #endif 50 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) 51 | #undef __FREEBSD__ 52 | #define __FREEBSD__ 1 53 | #endif 54 | #if defined(__HAIKU__) 55 | #undef __HAIKU__ 56 | #define __HAIKU__ 1 57 | #endif 58 | #if defined(hpux) || defined(__hpux) || defined(__hpux__) 59 | #undef __HPUX__ 60 | #define __HPUX__ 1 61 | #endif 62 | #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) 63 | #undef __IRIX__ 64 | #define __IRIX__ 1 65 | #endif 66 | #if defined(linux) || defined(__linux) || defined(__linux__) 67 | #undef __LINUX__ 68 | #define __LINUX__ 1 69 | #endif 70 | #if defined(__APPLE__) 71 | #undef __MACOSX__ 72 | #define __MACOSX__ 1 73 | #elif defined(macintosh) 74 | #undef __MACOS__ 75 | #define __MACOS__ 1 76 | #endif 77 | #if defined(__NetBSD__) 78 | #undef __NETBSD__ 79 | #define __NETBSD__ 1 80 | #endif 81 | #if defined(__OpenBSD__) 82 | #undef __OPENBSD__ 83 | #define __OPENBSD__ 1 84 | #endif 85 | #if defined(__OS2__) 86 | #undef __OS2__ 87 | #define __OS2__ 1 88 | #endif 89 | #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) 90 | #undef __OSF__ 91 | #define __OSF__ 1 92 | #endif 93 | #if defined(__QNXNTO__) 94 | #undef __QNXNTO__ 95 | #define __QNXNTO__ 1 96 | #endif 97 | #if defined(riscos) || defined(__riscos) || defined(__riscos__) 98 | #undef __RISCOS__ 99 | #define __RISCOS__ 1 100 | #endif 101 | #if defined(__SVR4) 102 | #undef __SOLARIS__ 103 | #define __SOLARIS__ 1 104 | #endif 105 | #if defined(WIN32) || defined(_WIN32) 106 | #undef __WIN32__ 107 | #define __WIN32__ 1 108 | #endif 109 | 110 | #endif /* _SDL_platform_h */ 111 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_quit.h 24 | * Include file for SDL quit event handling 25 | */ 26 | 27 | #ifndef _SDL_quit_h 28 | #define _SDL_quit_h 29 | 30 | #include "SDL_stdinc.h" 31 | #include "SDL_error.h" 32 | 33 | /** @file SDL_quit.h 34 | * An SDL_QUITEVENT is generated when the user tries to close the application 35 | * window. If it is ignored or filtered out, the window will remain open. 36 | * If it is not ignored or filtered, it is queued normally and the window 37 | * is allowed to close. When the window is closed, screen updates will 38 | * complete, but have no effect. 39 | * 40 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 41 | * and SIGTERM (system termination request), if handlers do not already 42 | * exist, that generate SDL_QUITEVENT events as well. There is no way 43 | * to determine the cause of an SDL_QUITEVENT, but setting a signal 44 | * handler in your application will override the default generation of 45 | * quit events for that signal. 46 | */ 47 | 48 | /** @file SDL_quit.h 49 | * There are no functions directly affecting the quit event 50 | */ 51 | 52 | #define SDL_QuitRequested() \ 53 | (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) 54 | 55 | #endif /* _SDL_quit_h */ 56 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_types.h 24 | * @deprecated Use SDL_stdinc.h instead. 25 | */ 26 | 27 | /* DEPRECATED */ 28 | #include "SDL_stdinc.h" 29 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/SDL_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** @file SDL_version.h 24 | * This header defines the current SDL version 25 | */ 26 | 27 | #ifndef _SDL_version_h 28 | #define _SDL_version_h 29 | 30 | #include "SDL_stdinc.h" 31 | 32 | #include "begin_code.h" 33 | /* Set up for C function definitions, even when using C++ */ 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @name Version Number 39 | * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL 40 | */ 41 | /*@{*/ 42 | #define SDL_MAJOR_VERSION 1 43 | #define SDL_MINOR_VERSION 2 44 | #define SDL_PATCHLEVEL 15 45 | /*@}*/ 46 | 47 | typedef struct SDL_version { 48 | Uint8 major; 49 | Uint8 minor; 50 | Uint8 patch; 51 | } SDL_version; 52 | 53 | /** 54 | * This macro can be used to fill a version structure with the compile-time 55 | * version of the SDL library. 56 | */ 57 | #define SDL_VERSION(X) \ 58 | { \ 59 | (X)->major = SDL_MAJOR_VERSION; \ 60 | (X)->minor = SDL_MINOR_VERSION; \ 61 | (X)->patch = SDL_PATCHLEVEL; \ 62 | } 63 | 64 | /** This macro turns the version numbers into a numeric value: 65 | * (1,2,3) -> (1203) 66 | * This assumes that there will never be more than 100 patchlevels 67 | */ 68 | #define SDL_VERSIONNUM(X, Y, Z) \ 69 | ((X)*1000 + (Y)*100 + (Z)) 70 | 71 | /** This is the version number macro for the current SDL version */ 72 | #define SDL_COMPILEDVERSION \ 73 | SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) 74 | 75 | /** This macro will evaluate to true if compiled with SDL at least X.Y.Z */ 76 | #define SDL_VERSION_ATLEAST(X, Y, Z) \ 77 | (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) 78 | 79 | /** This function gets the version of the dynamically linked SDL library. 80 | * it should NOT be used to fill a version structure, instead you should 81 | * use the SDL_Version() macro. 82 | */ 83 | extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void); 84 | 85 | /* Ends C function definitions when using C++ */ 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #include "close_code.h" 90 | 91 | #endif /* _SDL_version_h */ 92 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/include/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL - Simple DirectMedia Layer 3 | Copyright (C) 1997-2012 Sam Lantinga 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | Sam Lantinga 20 | slouken@libsdl.org 21 | */ 22 | 23 | /** 24 | * @file close_code.h 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #undef _begin_code_h 30 | 31 | /** 32 | * @file close_code.h 33 | * Reset structure packing at previous byte alignment 34 | */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #if (defined(__MWERKS__) && defined(__MACOS__)) 40 | #pragma options align=reset 41 | #pragma enumsalwaysint reset 42 | #else 43 | #pragma pack(pop) 44 | #endif 45 | #endif /* Compiler needs structure packing set */ 46 | 47 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/lib/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Contrib/SDL/lib/SDL.dll -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/lib/SDL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Contrib/SDL/lib/SDL.lib -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/lib/SDLmain.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/youlanhai/recastnavigation-learn/2eef0522574e4a144341f38cb59ca084e3294824/RecastDemo/Contrib/SDL/lib/SDLmain.lib -------------------------------------------------------------------------------- /RecastDemo/Contrib/SDL/readme.txt: -------------------------------------------------------------------------------- 1 |  2 | Simple DirectMedia Layer 3 | 4 | (SDL) 5 | 6 | Version 1.2 7 | 8 | --- 9 | http://www.libsdl.org/ 10 | 11 | This is the Simple DirectMedia Layer, a general API that provides low 12 | level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, 13 | and 2D framebuffer across multiple platforms. 14 | 15 | The current version supports Linux, Windows CE/95/98/ME/XP/Vista, BeOS, 16 | MacOS Classic, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, 17 | and QNX. The code contains support for Dreamcast, Atari, AIX, OSF/Tru64, 18 | RISC OS, SymbianOS, Nintendo DS, and OS/2, but these are not officially 19 | supported. 20 | 21 | SDL is written in C, but works with C++ natively, and has bindings to 22 | several other languages, including Ada, C#, Eiffel, Erlang, Euphoria, 23 | Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP, 24 | Pike, Pliant, Python, Ruby, and Smalltalk. 25 | 26 | This library is distributed under GNU LGPL version 2, which can be 27 | found in the file "COPYING". This license allows you to use SDL 28 | freely in commercial programs as long as you link with the dynamic 29 | library. 30 | 31 | The best way to learn how to use SDL is to check out the header files in 32 | the "include" subdirectory and the programs in the "test" subdirectory. 33 | The header files and test programs are well commented and always up to date. 34 | More documentation is available in HTML format in "docs/index.html", and 35 | a documentation wiki is available online at: 36 | http://www.libsdl.org/cgi/docwiki.cgi 37 | 38 | The test programs in the "test" subdirectory are in the public domain. 39 | 40 | Frequently asked questions are answered online: 41 | http://www.libsdl.org/faq.php 42 | 43 | If you need help with the library, or just want to discuss SDL related 44 | issues, you can join the developers mailing list: 45 | http://www.libsdl.org/mailing-list.php 46 | 47 | Enjoy! 48 | Sam Lantinga (slouken@libsdl.org) 49 | 50 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/fastlz/README.TXT: -------------------------------------------------------------------------------- 1 | FastLZ - lightning-fast lossless compression library 2 | 3 | Author: Ariya Hidayat 4 | Official website: http://www.fastlz.org 5 | 6 | FastLZ is distributed using the MIT license, see file LICENSE 7 | for details. 8 | 9 | FastLZ consists of two files: fastlz.h and fastlz.c. Just add these 10 | files to your project in order to use FastLZ. For information on 11 | compression and decompression routines, see fastlz.h. 12 | 13 | A simple file compressor called 6pack is included as an example 14 | on how to use FastLZ. The corresponding decompressor is 6unpack. 15 | 16 | To compile using GCC: 17 | 18 | gcc -o 6pack 6pack.c fastlz.c 19 | gcc -o 6unpack 6unpack.c fastlz.c 20 | 21 | To compile using MinGW: 22 | 23 | mingw32-gcc -o 6pack 6pack.c fastlz.c 24 | mingw32-gcc -o 6unpack 6unpack.c fastlz.c 25 | 26 | To compile using Microsoft Visual C++: 27 | 28 | cl 6pack.c fastlz.c 29 | cl 6unpack.c fastlz.c 30 | 31 | To compile using Borland C++: 32 | 33 | bcc32 6pack.c fastlz.c 34 | bcc32 6unpack.c fastlz.c 35 | 36 | To compile using OpenWatcom C/C++: 37 | 38 | cl386 6pack.c fastlz.c 39 | cl386 6unpack.c fastlz.c 40 | 41 | To compile using Intel C++ compiler for Windows: 42 | 43 | icl 6pack.c fastlz.c 44 | icl 6unpack.c fastlz.c 45 | 46 | To compile using Intel C++ compiler for Linux: 47 | 48 | icc -o 6pack 6pack.c fastlz.c 49 | icc -o 6unpack 6unpack.c fastlz.c 50 | 51 | To compile 6pack using LCC-Win32: 52 | 53 | lc 6pack.c fastlz.c 54 | lc 6unpack.c fastlz.c 55 | 56 | To compile 6pack using Pelles C: 57 | 58 | pocc 6pack.c 59 | pocc 6unpack.c 60 | pocc fastlz.c 61 | polink 6pack.obj fastlz.obj 62 | polink 6unpack.obj fastlz.obj 63 | 64 | For speed optimization, always use proper compile flags for optimization options. 65 | Typical compiler flags are given below: 66 | 67 | * GCC (pre 4.2): -march=pentium -O3 -fomit-frame-pointer -mtune=pentium 68 | * GCC 4.2 or later: -march=pentium -O3 -fomit-frame-pointer -mtune=generic 69 | * Digital Mars C/C++: -o+all -5 70 | * Intel C++ (Windows): /O3 /Qipo 71 | * Intel C++ (Linux): -O2 -march=pentium -mtune=pentium 72 | * Borland C++: -O2 -5 73 | * LCC-Win32: -O 74 | * Pelles C: /O2 75 | 76 | -------------------------------------------------------------------------------- /RecastDemo/Contrib/fastlz/fastlz.h: -------------------------------------------------------------------------------- 1 | /* 2 | FastLZ - lightning-fast lossless compression library 3 | 4 | Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) 5 | Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) 6 | Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | */ 26 | 27 | #ifndef FASTLZ_H 28 | #define FASTLZ_H 29 | 30 | #define FASTLZ_VERSION 0x000100 31 | 32 | #define FASTLZ_VERSION_MAJOR 0 33 | #define FASTLZ_VERSION_MINOR 0 34 | #define FASTLZ_VERSION_REVISION 0 35 | 36 | #define FASTLZ_VERSION_STRING "0.1.0" 37 | 38 | #if defined (__cplusplus) 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | Compress a block of data in the input buffer and returns the size of 44 | compressed block. The size of input buffer is specified by length. The 45 | minimum input buffer size is 16. 46 | 47 | The output buffer must be at least 5% larger than the input buffer 48 | and can not be smaller than 66 bytes. 49 | 50 | If the input is not compressible, the return value might be larger than 51 | length (input buffer size). 52 | 53 | The input buffer and the output buffer can not overlap. 54 | */ 55 | 56 | int fastlz_compress(const void* input, int length, void* output); 57 | 58 | /** 59 | Decompress a block of compressed data and returns the size of the 60 | decompressed block. If error occurs, e.g. the compressed data is 61 | corrupted or the output buffer is not large enough, then 0 (zero) 62 | will be returned instead. 63 | 64 | The input buffer and the output buffer can not overlap. 65 | 66 | Decompression is memory safe and guaranteed not to write the output buffer 67 | more than what is specified in maxout. 68 | */ 69 | 70 | int fastlz_decompress(const void* input, int length, void* output, int maxout); 71 | 72 | /** 73 | Compress a block of data in the input buffer and returns the size of 74 | compressed block. The size of input buffer is specified by length. The 75 | minimum input buffer size is 16. 76 | 77 | The output buffer must be at least 5% larger than the input buffer 78 | and can not be smaller than 66 bytes. 79 | 80 | If the input is not compressible, the return value might be larger than 81 | length (input buffer size). 82 | 83 | The input buffer and the output buffer can not overlap. 84 | 85 | Compression level can be specified in parameter level. At the moment, 86 | only level 1 and level 2 are supported. 87 | Level 1 is the fastest compression and generally useful for short data. 88 | Level 2 is slightly slower but it gives better compression ratio. 89 | 90 | Note that the compressed data, regardless of the level, can always be 91 | decompressed using the function fastlz_decompress above. 92 | */ 93 | 94 | int fastlz_compress_level(int level, const void* input, int length, void* output); 95 | 96 | #if defined (__cplusplus) 97 | } 98 | #endif 99 | 100 | #endif /* FASTLZ_H */ 101 | -------------------------------------------------------------------------------- /RecastDemo/Include/ChunkyTriMesh.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef CHUNKYTRIMESH_H 20 | #define CHUNKYTRIMESH_H 21 | 22 | struct rcChunkyTriMeshNode 23 | { 24 | float bmin[2], bmax[2]; 25 | int i, n; 26 | }; 27 | 28 | struct rcChunkyTriMesh 29 | { 30 | inline rcChunkyTriMesh() : nodes(0), tris(0) {}; 31 | inline ~rcChunkyTriMesh() { delete [] nodes; delete [] tris; } 32 | 33 | rcChunkyTriMeshNode* nodes; 34 | int nnodes; 35 | int* tris; 36 | int ntris; 37 | int maxTrisPerChunk; 38 | }; 39 | 40 | /// Creates partitioned triangle mesh (AABB tree), 41 | /// where each node contains at max trisPerChunk triangles. 42 | bool rcCreateChunkyTriMesh(const float* verts, const int* tris, int ntris, 43 | int trisPerChunk, rcChunkyTriMesh* cm); 44 | 45 | /// Returns the chunk indices which overlap the input rectable. 46 | int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm, float bmin[2], float bmax[2], int* ids, const int maxIds); 47 | 48 | /// Returns the chunk indices which overlap the input segment. 49 | int rcGetChunksOverlappingSegment(const rcChunkyTriMesh* cm, float p[2], float q[2], int* ids, const int maxIds); 50 | 51 | 52 | #endif // CHUNKYTRIMESH_H 53 | -------------------------------------------------------------------------------- /RecastDemo/Include/ConvexVolumeTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef CONVEXVOLUMETOOL_H 20 | #define CONVEXVOLUMETOOL_H 21 | 22 | #include "Sample.h" 23 | 24 | // Tool to create convex volumess for InputGeom 25 | 26 | class ConvexVolumeTool : public SampleTool 27 | { 28 | Sample* m_sample; 29 | int m_areaType; 30 | float m_polyOffset; 31 | float m_boxHeight; 32 | float m_boxDescent; 33 | 34 | static const int MAX_PTS = 12; 35 | float m_pts[MAX_PTS*3]; 36 | int m_npts; 37 | int m_hull[MAX_PTS]; 38 | int m_nhull; 39 | 40 | public: 41 | ConvexVolumeTool(); 42 | ~ConvexVolumeTool(); 43 | 44 | virtual int type() { return TOOL_CONVEX_VOLUME; } 45 | virtual void init(Sample* sample); 46 | virtual void reset(); 47 | virtual void handleMenu(); 48 | virtual void handleClick(const float* s, const float* p, bool shift); 49 | virtual void handleToggle(); 50 | virtual void handleStep(); 51 | virtual void handleUpdate(const float dt); 52 | virtual void handleRender(); 53 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 54 | }; 55 | 56 | #endif // CONVEXVOLUMETOOL_H 57 | -------------------------------------------------------------------------------- /RecastDemo/Include/CrowdTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef CROWDTOOL_H 20 | #define CROWDTOOL_H 21 | 22 | #include "Sample.h" 23 | #include "DetourNavMesh.h" 24 | #include "DetourObstacleAvoidance.h" 25 | #include "ValueHistory.h" 26 | #include "DetourCrowd.h" 27 | 28 | // Tool to create crowds. 29 | 30 | struct CrowdToolParams 31 | { 32 | bool m_expandSelectedDebugDraw; 33 | bool m_showCorners; 34 | bool m_showCollisionSegments; 35 | bool m_showPath; 36 | bool m_showVO; 37 | bool m_showOpt; 38 | bool m_showNeis; 39 | 40 | bool m_expandDebugDraw; 41 | bool m_showLabels; 42 | bool m_showGrid; 43 | bool m_showNodes; 44 | bool m_showPerfGraph; 45 | bool m_showDetailAll; 46 | 47 | bool m_expandOptions; 48 | bool m_anticipateTurns; 49 | bool m_optimizeVis; 50 | bool m_optimizeTopo; 51 | bool m_obstacleAvoidance; 52 | float m_obstacleAvoidanceType; 53 | bool m_separation; 54 | float m_separationWeight; 55 | }; 56 | 57 | class CrowdToolState : public SampleToolState 58 | { 59 | Sample* m_sample; 60 | dtNavMesh* m_nav; 61 | dtCrowd* m_crowd; 62 | 63 | float m_targetPos[3]; 64 | dtPolyRef m_targetRef; 65 | 66 | dtCrowdAgentDebugInfo m_agentDebug; 67 | dtObstacleAvoidanceDebugData* m_vod; 68 | 69 | static const int AGENT_MAX_TRAIL = 64; 70 | static const int MAX_AGENTS = 128; 71 | struct AgentTrail 72 | { 73 | float trail[AGENT_MAX_TRAIL*3]; 74 | int htrail; 75 | }; 76 | AgentTrail m_trails[MAX_AGENTS]; 77 | 78 | ValueHistory m_crowdTotalTime; 79 | ValueHistory m_crowdSampleCount; 80 | 81 | CrowdToolParams m_toolParams; 82 | 83 | bool m_run; 84 | 85 | public: 86 | CrowdToolState(); 87 | virtual ~CrowdToolState(); 88 | 89 | virtual void init(class Sample* sample); 90 | virtual void reset(); 91 | virtual void handleRender(); 92 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 93 | virtual void handleUpdate(const float dt); 94 | 95 | inline bool isRunning() const { return m_run; } 96 | inline void setRunning(const bool s) { m_run = s; } 97 | 98 | void addAgent(const float* pos); 99 | void removeAgent(const int idx); 100 | void hilightAgent(const int idx); 101 | void updateAgentParams(); 102 | int hitTestAgents(const float* s, const float* p); 103 | void setMoveTarget(const float* p, bool adjust); 104 | void updateTick(const float dt); 105 | 106 | inline CrowdToolParams* getToolParams() { return &m_toolParams; } 107 | }; 108 | 109 | 110 | class CrowdTool : public SampleTool 111 | { 112 | Sample* m_sample; 113 | CrowdToolState* m_state; 114 | 115 | enum ToolMode 116 | { 117 | TOOLMODE_CREATE, 118 | TOOLMODE_MOVE_TARGET, 119 | TOOLMODE_SELECT, 120 | TOOLMODE_TOGGLE_POLYS, 121 | }; 122 | ToolMode m_mode; 123 | 124 | void updateAgentParams(); 125 | void updateTick(const float dt); 126 | 127 | public: 128 | CrowdTool(); 129 | virtual ~CrowdTool(); 130 | 131 | virtual int type() { return TOOL_CROWD; } 132 | virtual void init(Sample* sample); 133 | virtual void reset(); 134 | virtual void handleMenu(); 135 | virtual void handleClick(const float* s, const float* p, bool shift); 136 | virtual void handleToggle(); 137 | virtual void handleStep(); 138 | virtual void handleUpdate(const float dt); 139 | virtual void handleRender(); 140 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 141 | }; 142 | 143 | #endif // CROWDTOOL_H 144 | -------------------------------------------------------------------------------- /RecastDemo/Include/Filelist.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef FILELIST_H 20 | #define FILELIST_H 21 | 22 | struct FileList 23 | { 24 | static const int MAX_FILES = 256; 25 | 26 | FileList(); 27 | ~FileList(); 28 | 29 | char* files[MAX_FILES]; 30 | int size; 31 | }; 32 | 33 | void scanDirectory(const char* path, const char* ext, FileList& list); 34 | 35 | #endif // FILELIST_H 36 | -------------------------------------------------------------------------------- /RecastDemo/Include/InputGeom.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef INPUTGEOM_H 20 | #define INPUTGEOM_H 21 | 22 | #include "ChunkyTriMesh.h" 23 | #include "MeshLoaderObj.h" 24 | 25 | static const int MAX_CONVEXVOL_PTS = 12; 26 | /// 凸多边形体。是一个柱状凸多边形,xz平面最多12边。 27 | struct ConvexVolume 28 | { 29 | // 凸多边形的顶点数据 30 | float verts[MAX_CONVEXVOL_PTS*3]; 31 | // 高度值的最小和最大值 32 | float hmin, hmax; 33 | // 顶点数量 34 | int nverts; 35 | // 该区域标记 36 | int area; 37 | }; 38 | 39 | class InputGeom 40 | { 41 | rcChunkyTriMesh* m_chunkyMesh; 42 | rcMeshLoaderObj* m_mesh; 43 | float m_meshBMin[3], m_meshBMax[3]; 44 | 45 | /// @name Off-Mesh connections. 46 | ///@{ 47 | static const int MAX_OFFMESH_CONNECTIONS = 256; 48 | float m_offMeshConVerts[MAX_OFFMESH_CONNECTIONS*3*2]; 49 | float m_offMeshConRads[MAX_OFFMESH_CONNECTIONS]; 50 | unsigned char m_offMeshConDirs[MAX_OFFMESH_CONNECTIONS]; 51 | unsigned char m_offMeshConAreas[MAX_OFFMESH_CONNECTIONS]; 52 | unsigned short m_offMeshConFlags[MAX_OFFMESH_CONNECTIONS]; 53 | unsigned int m_offMeshConId[MAX_OFFMESH_CONNECTIONS]; 54 | int m_offMeshConCount; 55 | ///@} 56 | 57 | /// @name Convex Volumes. 58 | ///@{ 59 | static const int MAX_VOLUMES = 256; 60 | ConvexVolume m_volumes[MAX_VOLUMES]; 61 | int m_volumeCount; 62 | ///@} 63 | 64 | public: 65 | InputGeom(); 66 | ~InputGeom(); 67 | 68 | bool loadMesh(class rcContext* ctx, const char* filepath); 69 | 70 | bool load(class rcContext* ctx, const char* filepath); 71 | bool save(const char* filepath); 72 | 73 | /// Method to return static mesh data. 74 | inline const rcMeshLoaderObj* getMesh() const { return m_mesh; } 75 | inline const float* getMeshBoundsMin() const { return m_meshBMin; } 76 | inline const float* getMeshBoundsMax() const { return m_meshBMax; } 77 | inline const rcChunkyTriMesh* getChunkyMesh() const { return m_chunkyMesh; } 78 | bool raycastMesh(float* src, float* dst, float& tmin); 79 | 80 | /// @name Off-Mesh connections. 81 | ///@{ 82 | int getOffMeshConnectionCount() const { return m_offMeshConCount; } 83 | const float* getOffMeshConnectionVerts() const { return m_offMeshConVerts; } 84 | const float* getOffMeshConnectionRads() const { return m_offMeshConRads; } 85 | const unsigned char* getOffMeshConnectionDirs() const { return m_offMeshConDirs; } 86 | const unsigned char* getOffMeshConnectionAreas() const { return m_offMeshConAreas; } 87 | const unsigned short* getOffMeshConnectionFlags() const { return m_offMeshConFlags; } 88 | const unsigned int* getOffMeshConnectionId() const { return m_offMeshConId; } 89 | void addOffMeshConnection(const float* spos, const float* epos, const float rad, 90 | unsigned char bidir, unsigned char area, unsigned short flags); 91 | void deleteOffMeshConnection(int i); 92 | void drawOffMeshConnections(struct duDebugDraw* dd, bool hilight = false); 93 | ///@} 94 | 95 | /// @name Box Volumes. 96 | ///@{ 97 | int getConvexVolumeCount() const { return m_volumeCount; } 98 | const ConvexVolume* getConvexVolumes() const { return m_volumes; } 99 | void addConvexVolume(const float* verts, const int nverts, 100 | const float minh, const float maxh, unsigned char area); 101 | void deleteConvexVolume(int i); 102 | void drawConvexVolumes(struct duDebugDraw* dd, bool hilight = false); 103 | ///@} 104 | }; 105 | 106 | #endif // INPUTGEOM_H 107 | -------------------------------------------------------------------------------- /RecastDemo/Include/MeshLoaderObj.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef MESHLOADER_OBJ 20 | #define MESHLOADER_OBJ 21 | 22 | class rcMeshLoaderObj 23 | { 24 | public: 25 | rcMeshLoaderObj(); 26 | ~rcMeshLoaderObj(); 27 | 28 | bool load(const char* fileName); 29 | 30 | inline const float* getVerts() const { return m_verts; } 31 | inline const float* getNormals() const { return m_normals; } 32 | inline const int* getTris() const { return m_tris; } 33 | inline int getVertCount() const { return m_vertCount; } 34 | inline int getTriCount() const { return m_triCount; } 35 | inline const char* getFileName() const { return m_filename; } 36 | 37 | private: 38 | 39 | void addVertex(float x, float y, float z, int& cap); 40 | void addTriangle(int a, int b, int c, int& cap); 41 | 42 | char m_filename[260]; 43 | float m_scale; 44 | float* m_verts; 45 | int* m_tris; 46 | float* m_normals; 47 | int m_vertCount; 48 | int m_triCount; 49 | }; 50 | 51 | #endif // MESHLOADER_OBJ 52 | -------------------------------------------------------------------------------- /RecastDemo/Include/NavMeshTesterTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef NAVMESHTESTERTOOL_H 20 | #define NAVMESHTESTERTOOL_H 21 | 22 | #include "Sample.h" 23 | #include "DetourNavMesh.h" 24 | #include "DetourNavMeshQuery.h" 25 | 26 | ///测试自动寻路 27 | class NavMeshTesterTool : public SampleTool 28 | { 29 | //用于生成导航网格 30 | Sample* m_sample; 31 | 32 | //导航网格 33 | dtNavMesh* m_navMesh; 34 | dtNavMeshQuery* m_navQuery; 35 | 36 | dtQueryFilter m_filter; 37 | 38 | //寻路状态 39 | dtStatus m_pathFindStatus; 40 | 41 | enum ToolMode 42 | { 43 | TOOLMODE_PATHFIND_FOLLOW, 44 | TOOLMODE_PATHFIND_STRAIGHT, 45 | TOOLMODE_PATHFIND_SLICED, 46 | TOOLMODE_RAYCAST, 47 | TOOLMODE_DISTANCE_TO_WALL, 48 | TOOLMODE_FIND_POLYS_IN_CIRCLE, 49 | TOOLMODE_FIND_POLYS_IN_SHAPE, 50 | TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD, 51 | }; 52 | 53 | ToolMode m_toolMode; 54 | 55 | int m_straightPathOptions; 56 | 57 | static const int MAX_POLYS = 256; 58 | static const int MAX_SMOOTH = 2048; 59 | 60 | dtPolyRef m_startRef; 61 | dtPolyRef m_endRef; 62 | dtPolyRef m_polys[MAX_POLYS]; 63 | dtPolyRef m_parent[MAX_POLYS]; 64 | int m_npolys; 65 | float m_straightPath[MAX_POLYS*3]; 66 | unsigned char m_straightPathFlags[MAX_POLYS]; 67 | dtPolyRef m_straightPathPolys[MAX_POLYS]; 68 | int m_nstraightPath; 69 | float m_polyPickExt[3]; 70 | float m_smoothPath[MAX_SMOOTH*3]; 71 | int m_nsmoothPath; 72 | float m_queryPoly[4*3]; 73 | 74 | static const int MAX_RAND_POINTS = 64; 75 | float m_randPoints[MAX_RAND_POINTS*3]; 76 | int m_nrandPoints; 77 | bool m_randPointsInCircle; 78 | 79 | float m_spos[3];//起点 80 | float m_epos[3];//终点 81 | float m_hitPos[3]; 82 | float m_hitNormal[3]; 83 | bool m_hitResult; 84 | float m_distanceToWall; 85 | float m_neighbourhoodRadius; 86 | float m_randomRadius; 87 | bool m_sposSet;//设置了起点 88 | bool m_eposSet;//设置了终点 89 | 90 | int m_pathIterNum; 91 | dtPolyRef m_pathIterPolys[MAX_POLYS]; 92 | int m_pathIterPolyCount; 93 | float m_prevIterPos[3], m_iterPos[3], m_steerPos[3], m_targetPos[3]; 94 | 95 | static const int MAX_STEER_POINTS = 10; 96 | float m_steerPoints[MAX_STEER_POINTS*3]; 97 | int m_steerPointCount; 98 | 99 | public: 100 | NavMeshTesterTool(); 101 | ~NavMeshTesterTool(); 102 | 103 | virtual int type() { return TOOL_NAVMESH_TESTER; } 104 | virtual void init(Sample* sample); 105 | virtual void reset(); 106 | virtual void handleMenu(); 107 | ///鼠标点击消息 108 | virtual void handleClick(const float* s, const float* p, bool shift); 109 | virtual void handleToggle(); 110 | virtual void handleStep(); 111 | virtual void handleUpdate(const float dt); 112 | virtual void handleRender(); 113 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 114 | 115 | ///计算自动寻路 116 | void recalc(); 117 | void drawAgent(const float* pos, float r, float h, float c, const unsigned int col); 118 | }; 119 | 120 | #endif // NAVMESHTESTERTOOL_H -------------------------------------------------------------------------------- /RecastDemo/Include/NavmeshPruneTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef NAVMESHPRUNETOOL_H 20 | #define NAVMESHPRUNETOOL_H 21 | 22 | #include "Sample.h" 23 | 24 | // Prune navmesh to accessible locations from a point. 25 | 26 | class NavMeshPruneTool : public SampleTool 27 | { 28 | Sample* m_sample; 29 | 30 | class NavmeshFlags* m_flags; 31 | 32 | float m_hitPos[3]; 33 | bool m_hitPosSet; 34 | 35 | public: 36 | NavMeshPruneTool(); 37 | ~NavMeshPruneTool(); 38 | 39 | virtual int type() { return TOOL_NAVMESH_PRUNE; } 40 | virtual void init(Sample* sample); 41 | virtual void reset(); 42 | virtual void handleMenu(); 43 | virtual void handleClick(const float* s, const float* p, bool shift); 44 | virtual void handleToggle(); 45 | virtual void handleStep(); 46 | virtual void handleUpdate(const float dt); 47 | virtual void handleRender(); 48 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 49 | }; 50 | 51 | #endif // NAVMESHPRUNETOOL_H 52 | -------------------------------------------------------------------------------- /RecastDemo/Include/OffMeshConnectionTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef OFFMESHCONNECTIONTOOL_H 20 | #define OFFMESHCONNECTIONTOOL_H 21 | 22 | #include "Sample.h" 23 | 24 | // Tool to create off-mesh connection for InputGeom 25 | 26 | class OffMeshConnectionTool : public SampleTool 27 | { 28 | Sample* m_sample; 29 | float m_hitPos[3]; 30 | bool m_hitPosSet; 31 | bool m_bidir; 32 | unsigned char m_oldFlags; 33 | 34 | public: 35 | OffMeshConnectionTool(); 36 | ~OffMeshConnectionTool(); 37 | 38 | virtual int type() { return TOOL_OFFMESH_CONNECTION; } 39 | virtual void init(Sample* sample); 40 | virtual void reset(); 41 | virtual void handleMenu(); 42 | virtual void handleClick(const float* s, const float* p, bool shift); 43 | virtual void handleToggle(); 44 | virtual void handleStep(); 45 | virtual void handleUpdate(const float dt); 46 | virtual void handleRender(); 47 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 48 | }; 49 | 50 | #endif // OFFMESHCONNECTIONTOOL_H 51 | -------------------------------------------------------------------------------- /RecastDemo/Include/PerfTimer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef PERFTIMER_H 20 | #define PERFTIMER_H 21 | 22 | #ifdef __GNUC__ 23 | #include 24 | typedef int64_t TimeVal; 25 | #else 26 | typedef __int64 TimeVal; 27 | #endif 28 | 29 | TimeVal getPerfTime(); 30 | int getPerfDeltaTimeUsec(const TimeVal start, const TimeVal end); 31 | 32 | #endif // PERFTIMER_H -------------------------------------------------------------------------------- /RecastDemo/Include/SDLMain.h: -------------------------------------------------------------------------------- 1 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app 2 | Initial Version: Darrell Walisser 3 | Non-NIB-Code & other changes: Max Horn 4 | 5 | Feel free to customize this file to suit your needs 6 | */ 7 | 8 | #import 9 | 10 | @interface SDLMain : NSObject 11 | @end 12 | -------------------------------------------------------------------------------- /RecastDemo/Include/SampleInterfaces.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef SAMPLEINTERFACES_H 20 | #define SAMPLEINTERFACES_H 21 | 22 | #include "DebugDraw.h" 23 | #include "Recast.h" 24 | #include "RecastDump.h" 25 | #include "PerfTimer.h" 26 | 27 | // These are example implementations of various interfaces used in Recast and Detour. 28 | 29 | /// Recast build context. 30 | class BuildContext : public rcContext 31 | { 32 | TimeVal m_startTime[RC_MAX_TIMERS]; 33 | int m_accTime[RC_MAX_TIMERS]; 34 | 35 | static const int MAX_MESSAGES = 1000; 36 | const char* m_messages[MAX_MESSAGES]; 37 | int m_messageCount; 38 | static const int TEXT_POOL_SIZE = 8000; 39 | char m_textPool[TEXT_POOL_SIZE]; 40 | int m_textPoolSize; 41 | 42 | public: 43 | BuildContext(); 44 | virtual ~BuildContext(); 45 | 46 | /// Dumps the log to stdout. 47 | void dumpLog(const char* format, ...); 48 | /// Returns number of log messages. 49 | int getLogCount() const; 50 | /// Returns log message text. 51 | const char* getLogText(const int i) const; 52 | 53 | protected: 54 | /// Virtual functions for custom implementations. 55 | ///@{ 56 | virtual void doResetLog(); 57 | virtual void doLog(const rcLogCategory /*category*/, const char* /*msg*/, const int /*len*/); 58 | virtual void doResetTimers(); 59 | virtual void doStartTimer(const rcTimerLabel /*label*/); 60 | virtual void doStopTimer(const rcTimerLabel /*label*/); 61 | virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const; 62 | ///@} 63 | }; 64 | 65 | /// OpenGL debug draw implementation. 66 | class DebugDrawGL : public duDebugDraw 67 | { 68 | public: 69 | virtual void depthMask(bool state); 70 | virtual void texture(bool state); 71 | virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f); 72 | virtual void vertex(const float* pos, unsigned int color); 73 | virtual void vertex(const float x, const float y, const float z, unsigned int color); 74 | virtual void vertex(const float* pos, unsigned int color, const float* uv); 75 | virtual void vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v); 76 | virtual void end(); 77 | }; 78 | 79 | /// stdio file implementation. 80 | class FileIO : public duFileIO 81 | { 82 | FILE* m_fp; 83 | int m_mode; 84 | public: 85 | FileIO(); 86 | virtual ~FileIO(); 87 | bool openForWrite(const char* path); 88 | bool openForRead(const char* path); 89 | virtual bool isWriting() const; 90 | virtual bool isReading() const; 91 | virtual bool write(const void* ptr, const size_t size); 92 | virtual bool read(void* ptr, const size_t size); 93 | }; 94 | 95 | #endif // SAMPLEINTERFACES_H 96 | 97 | -------------------------------------------------------------------------------- /RecastDemo/Include/Sample_Debug.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef RECASTSAMPLEDEBUG_H 20 | #define RECASTSAMPLEDEBUG_H 21 | 22 | #include "Sample.h" 23 | #include "DetourNavMesh.h" 24 | #include "Recast.h" 25 | 26 | /// Sample used for random debugging. 27 | class Sample_Debug : public Sample 28 | { 29 | protected: 30 | rcCompactHeightfield* m_chf; 31 | rcContourSet* m_cset; 32 | rcPolyMesh* m_pmesh; 33 | 34 | float m_ext[3]; 35 | float m_center[3]; 36 | float m_bmin[3], m_bmax[3]; 37 | dtPolyRef m_ref; 38 | 39 | public: 40 | Sample_Debug(); 41 | virtual ~Sample_Debug(); 42 | 43 | virtual void handleSettings(); 44 | virtual void handleTools(); 45 | virtual void handleDebugMode(); 46 | virtual void handleClick(const float* s, const float* p, bool shift); 47 | virtual void handleToggle(); 48 | virtual void handleRender(); 49 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 50 | virtual void handleMeshChanged(class InputGeom* geom); 51 | virtual bool handleBuild(); 52 | 53 | virtual const float* getBoundsMin(); 54 | virtual const float* getBoundsMax(); 55 | }; 56 | 57 | 58 | #endif // RECASTSAMPLE_H 59 | -------------------------------------------------------------------------------- /RecastDemo/Include/Sample_SoloMesh.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef RECASTSAMPLESOLOMESH_H 20 | #define RECASTSAMPLESOLOMESH_H 21 | 22 | #include "Sample.h" 23 | #include "DetourNavMesh.h" 24 | #include "Recast.h" 25 | 26 | class Sample_SoloMesh : public Sample 27 | { 28 | protected: 29 | bool m_keepInterResults; 30 | float m_totalBuildTimeMs; 31 | 32 | // 配置信息 33 | rcConfig m_cfg; 34 | 35 | // 三角形的可通行标记 36 | unsigned char* m_triareas; 37 | // 实心高度场 38 | rcHeightfield* m_solid; 39 | // 开放的紧凑型高度场 40 | rcCompactHeightfield* m_chf; 41 | // 轮廓集合 42 | rcContourSet* m_cset; 43 | // 多边形网格 44 | rcPolyMesh* m_pmesh; 45 | // 精细的多边形网格。高度信息更精确。 46 | rcPolyMeshDetail* m_dmesh; 47 | 48 | enum DrawMode 49 | { 50 | DRAWMODE_NAVMESH, 51 | DRAWMODE_NAVMESH_TRANS, 52 | DRAWMODE_NAVMESH_BVTREE, 53 | DRAWMODE_NAVMESH_NODES, 54 | DRAWMODE_NAVMESH_INVIS, 55 | DRAWMODE_MESH, 56 | DRAWMODE_VOXELS, 57 | DRAWMODE_VOXELS_WALKABLE, 58 | DRAWMODE_COMPACT, 59 | DRAWMODE_COMPACT_DISTANCE, 60 | DRAWMODE_COMPACT_REGIONS, 61 | DRAWMODE_REGION_CONNECTIONS, 62 | DRAWMODE_RAW_CONTOURS, 63 | DRAWMODE_BOTH_CONTOURS, 64 | DRAWMODE_CONTOURS, 65 | DRAWMODE_POLYMESH, 66 | DRAWMODE_POLYMESH_DETAIL, 67 | MAX_DRAWMODE 68 | }; 69 | 70 | DrawMode m_drawMode; 71 | 72 | void cleanup(); 73 | 74 | public: 75 | Sample_SoloMesh(); 76 | virtual ~Sample_SoloMesh(); 77 | 78 | virtual void handleSettings(); 79 | virtual void handleTools(); 80 | virtual void handleDebugMode(); 81 | 82 | virtual void handleRender(); 83 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 84 | virtual void handleMeshChanged(class InputGeom* geom); 85 | virtual bool handleBuild(); 86 | }; 87 | 88 | 89 | #endif // RECASTSAMPLESOLOMESHSIMPLE_H 90 | -------------------------------------------------------------------------------- /RecastDemo/Include/Sample_TempObstacles.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef RECASTSAMPLETEMPOBSTACLE_H 20 | #define RECASTSAMPLETEMPOBSTACLE_H 21 | 22 | #include "Sample.h" 23 | #include "DetourNavMesh.h" 24 | #include "Recast.h" 25 | #include "ChunkyTriMesh.h" 26 | 27 | 28 | class Sample_TempObstacles : public Sample 29 | { 30 | protected: 31 | bool m_keepInterResults; 32 | 33 | struct LinearAllocator* m_talloc; 34 | struct FastLZCompressor* m_tcomp; 35 | struct MeshProcess* m_tmproc; 36 | 37 | class dtTileCache* m_tileCache; 38 | 39 | float m_cacheBuildTimeMs; 40 | int m_cacheCompressedSize; 41 | int m_cacheRawSize; 42 | int m_cacheLayerCount; 43 | int m_cacheBuildMemUsage; 44 | 45 | enum DrawMode 46 | { 47 | DRAWMODE_NAVMESH, 48 | DRAWMODE_NAVMESH_TRANS, 49 | DRAWMODE_NAVMESH_BVTREE, 50 | DRAWMODE_NAVMESH_NODES, 51 | DRAWMODE_NAVMESH_PORTALS, 52 | DRAWMODE_NAVMESH_INVIS, 53 | DRAWMODE_MESH, 54 | DRAWMODE_CACHE_BOUNDS, 55 | MAX_DRAWMODE 56 | }; 57 | 58 | DrawMode m_drawMode; 59 | 60 | int m_maxTiles; 61 | int m_maxPolysPerTile; 62 | float m_tileSize; 63 | 64 | public: 65 | Sample_TempObstacles(); 66 | virtual ~Sample_TempObstacles(); 67 | 68 | virtual void handleSettings(); 69 | virtual void handleTools(); 70 | virtual void handleDebugMode(); 71 | virtual void handleRender(); 72 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 73 | virtual void handleMeshChanged(class InputGeom* geom); 74 | virtual bool handleBuild(); 75 | virtual void handleUpdate(const float dt); 76 | 77 | void getTilePos(const float* pos, int& tx, int& ty); 78 | 79 | void renderCachedTile(const int tx, const int ty, const int type); 80 | void renderCachedTileOverlay(const int tx, const int ty, double* proj, double* model, int* view); 81 | 82 | void addTempObstacle(const float* pos); 83 | void removeTempObstacle(const float* sp, const float* sq); 84 | void clearAllTempObstacles(); 85 | }; 86 | 87 | 88 | #endif // RECASTSAMPLETEMPOBSTACLE_H 89 | -------------------------------------------------------------------------------- /RecastDemo/Include/Sample_TileMesh.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef RECASTSAMPLETILEMESH_H 20 | #define RECASTSAMPLETILEMESH_H 21 | 22 | #include "Sample.h" 23 | #include "DetourNavMesh.h" 24 | #include "Recast.h" 25 | #include "ChunkyTriMesh.h" 26 | 27 | class Sample_TileMesh : public Sample 28 | { 29 | protected: 30 | bool m_keepInterResults; 31 | bool m_buildAll; 32 | float m_totalBuildTimeMs; 33 | 34 | unsigned char* m_triareas; 35 | rcHeightfield* m_solid; 36 | rcCompactHeightfield* m_chf; 37 | rcContourSet* m_cset; 38 | rcPolyMesh* m_pmesh; 39 | rcPolyMeshDetail* m_dmesh; 40 | rcConfig m_cfg; 41 | 42 | enum DrawMode 43 | { 44 | DRAWMODE_NAVMESH, 45 | DRAWMODE_NAVMESH_TRANS, 46 | DRAWMODE_NAVMESH_BVTREE, 47 | DRAWMODE_NAVMESH_NODES, 48 | DRAWMODE_NAVMESH_PORTALS, 49 | DRAWMODE_NAVMESH_INVIS, 50 | DRAWMODE_MESH, 51 | DRAWMODE_VOXELS, 52 | DRAWMODE_VOXELS_WALKABLE, 53 | DRAWMODE_COMPACT, 54 | DRAWMODE_COMPACT_DISTANCE, 55 | DRAWMODE_COMPACT_REGIONS, 56 | DRAWMODE_REGION_CONNECTIONS, 57 | DRAWMODE_RAW_CONTOURS, 58 | DRAWMODE_BOTH_CONTOURS, 59 | DRAWMODE_CONTOURS, 60 | DRAWMODE_POLYMESH, 61 | DRAWMODE_POLYMESH_DETAIL, 62 | MAX_DRAWMODE 63 | }; 64 | 65 | DrawMode m_drawMode; 66 | 67 | int m_maxTiles; 68 | int m_maxPolysPerTile; 69 | float m_tileSize; 70 | 71 | unsigned int m_tileCol; 72 | float m_tileBmin[3]; 73 | float m_tileBmax[3]; 74 | float m_tileBuildTime; 75 | float m_tileMemUsage; 76 | int m_tileTriCount; 77 | 78 | unsigned char* buildTileMesh(const int tx, const int ty, const float* bmin, const float* bmax, int& dataSize); 79 | 80 | void cleanup(); 81 | 82 | void saveAll(const char* path, const dtNavMesh* mesh); 83 | dtNavMesh* loadAll(const char* path); 84 | 85 | public: 86 | Sample_TileMesh(); 87 | virtual ~Sample_TileMesh(); 88 | 89 | virtual void handleSettings(); 90 | virtual void handleTools(); 91 | virtual void handleDebugMode(); 92 | virtual void handleRender(); 93 | virtual void handleRenderOverlay(double* proj, double* model, int* view); 94 | virtual void handleMeshChanged(class InputGeom* geom); 95 | virtual bool handleBuild(); 96 | 97 | void getTilePos(const float* pos, int& tx, int& ty); 98 | 99 | void buildTile(const float* pos); 100 | void removeTile(const float* pos); 101 | void buildAllTiles(); 102 | void removeAllTiles(); 103 | }; 104 | 105 | 106 | #endif // RECASTSAMPLETILEMESH_H 107 | -------------------------------------------------------------------------------- /RecastDemo/Include/SlideShow.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef SLIDESHOW_H 20 | #define SLIDESHOW_H 21 | 22 | #include "Filelist.h" 23 | 24 | class SlideShow 25 | { 26 | FileList m_files; 27 | char m_path[256]; 28 | 29 | int m_width; 30 | int m_height; 31 | unsigned int m_texId; 32 | 33 | void purgeImage(); 34 | bool loadImage(const char* path); 35 | 36 | bool m_showSlides; 37 | bool m_showCurSlide; 38 | float m_slideAlpha; 39 | int m_curSlide; 40 | int m_nextSlide; 41 | 42 | public: 43 | SlideShow(); 44 | ~SlideShow(); 45 | 46 | bool init(const char* path); 47 | void nextSlide(); 48 | void prevSlide(); 49 | void setSlide(int n); 50 | void updateAndDraw(float dt, const float w, const float h); 51 | }; 52 | 53 | #endif // SLIDESHOW_H 54 | -------------------------------------------------------------------------------- /RecastDemo/Include/TestCase.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef TESTCASE_H 20 | #define TESTCASE_H 21 | 22 | #include "DetourNavMesh.h" 23 | 24 | class TestCase 25 | { 26 | enum TestType 27 | { 28 | TEST_PATHFIND, 29 | }; 30 | 31 | struct Test 32 | { 33 | Test() : straight(0), nstraight(0), polys(0), npolys(0) {}; 34 | ~Test() 35 | { 36 | delete [] straight; 37 | delete [] polys; 38 | } 39 | 40 | TestType type; 41 | float spos[3], epos[3]; 42 | float radius; 43 | int includeFlags, excludeFlags; 44 | bool expand; 45 | 46 | float* straight; 47 | int nstraight; 48 | dtPolyRef* polys; 49 | int npolys; 50 | 51 | int findNearestPolyTime; 52 | int findPathTime; 53 | int findStraightPathTime; 54 | 55 | Test* next; 56 | }; 57 | 58 | char m_sampleName[256]; 59 | char m_geomFileName[256]; 60 | Test* m_tests; 61 | 62 | void resetTimes(); 63 | 64 | public: 65 | TestCase(); 66 | ~TestCase(); 67 | 68 | bool load(const char* filePath); 69 | 70 | inline const char* getSampleName() const { return m_sampleName; } 71 | inline const char* getGeomFileName() const { return m_geomFileName; } 72 | 73 | void doTests(class dtNavMesh* navmesh, class dtNavMeshQuery* navquery); 74 | 75 | void handleRender(); 76 | bool handleRenderOverlay(double* proj, double* model, int* view); 77 | }; 78 | 79 | #endif // TESTCASE_H -------------------------------------------------------------------------------- /RecastDemo/Include/ValueHistory.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUEHISTORY_H 2 | #define VALUEHISTORY_H 3 | 4 | class ValueHistory 5 | { 6 | static const int MAX_HISTORY = 256; 7 | float m_samples[MAX_HISTORY]; 8 | int m_hsamples; 9 | public: 10 | ValueHistory(); 11 | ~ValueHistory(); 12 | 13 | inline void addSample(const float val) 14 | { 15 | m_hsamples = (m_hsamples+MAX_HISTORY-1) % MAX_HISTORY; 16 | m_samples[m_hsamples] = val; 17 | } 18 | 19 | inline int getSampleCount() const 20 | { 21 | return MAX_HISTORY; 22 | } 23 | 24 | inline float getSample(const int i) const 25 | { 26 | return m_samples[(m_hsamples+i) % MAX_HISTORY]; 27 | } 28 | 29 | float getSampleMin() const; 30 | float getSampleMax() const; 31 | float getAverage() const; 32 | }; 33 | 34 | struct GraphParams 35 | { 36 | void setRect(int ix, int iy, int iw, int ih, int ipad); 37 | void setValueRange(float ivmin, float ivmax, int indiv, const char* iunits); 38 | 39 | int x, y, w, h, pad; 40 | float vmin, vmax; 41 | int ndiv; 42 | char units[16]; 43 | }; 44 | 45 | void drawGraphBackground(const GraphParams* p); 46 | 47 | void drawGraph(const GraphParams* p, const ValueHistory* graph, 48 | int idx, const char* label, const unsigned int col); 49 | 50 | 51 | #endif // VALUEHISTORY_H -------------------------------------------------------------------------------- /RecastDemo/Include/imgui.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef IMGUI_H 20 | #define IMGUI_H 21 | 22 | enum imguiMouseButton 23 | { 24 | IMGUI_MBUT_LEFT = 0x01, 25 | IMGUI_MBUT_RIGHT = 0x02, 26 | }; 27 | 28 | enum imguiTextAlign 29 | { 30 | IMGUI_ALIGN_LEFT, 31 | IMGUI_ALIGN_CENTER, 32 | IMGUI_ALIGN_RIGHT, 33 | }; 34 | 35 | inline unsigned int imguiRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) 36 | { 37 | return (r) | (g << 8) | (b << 16) | (a << 24); 38 | } 39 | 40 | void imguiBeginFrame(int mx, int my, unsigned char mbut, int scroll); 41 | void imguiEndFrame(); 42 | 43 | bool imguiBeginScrollArea(const char* name, int x, int y, int w, int h, int* scroll); 44 | void imguiEndScrollArea(); 45 | 46 | void imguiIndent(); 47 | void imguiUnindent(); 48 | void imguiSeparator(); 49 | void imguiSeparatorLine(); 50 | 51 | bool imguiButton(const char* text, bool enabled = true); 52 | bool imguiItem(const char* text, bool enabled = true); 53 | bool imguiCheck(const char* text, bool checked, bool enabled = true); 54 | bool imguiCollapse(const char* text, const char* subtext, bool checked, bool enabled = true); 55 | void imguiLabel(const char* text); 56 | void imguiValue(const char* text); 57 | bool imguiSlider(const char* text, float* val, float vmin, float vmax, float vinc, bool enabled = true); 58 | 59 | void imguiDrawText(int x, int y, int align, const char* text, unsigned int color); 60 | void imguiDrawLine(float x0, float y0, float x1, float y1, float r, unsigned int color); 61 | void imguiDrawRoundedRect(float x, float y, float w, float h, float r, unsigned int color); 62 | void imguiDrawRect(float x, float y, float w, float h, unsigned int color); 63 | 64 | // Pull render interface. 65 | enum imguiGfxCmdType 66 | { 67 | IMGUI_GFXCMD_RECT, 68 | IMGUI_GFXCMD_TRIANGLE, 69 | IMGUI_GFXCMD_LINE, 70 | IMGUI_GFXCMD_TEXT, 71 | IMGUI_GFXCMD_SCISSOR, 72 | }; 73 | 74 | struct imguiGfxRect 75 | { 76 | short x,y,w,h,r; 77 | }; 78 | 79 | struct imguiGfxText 80 | { 81 | short x,y,align; 82 | const char* text; 83 | }; 84 | 85 | struct imguiGfxLine 86 | { 87 | short x0,y0,x1,y1,r; 88 | }; 89 | 90 | struct imguiGfxCmd 91 | { 92 | char type; 93 | char flags; 94 | char pad[2]; 95 | unsigned int col; 96 | union 97 | { 98 | imguiGfxLine line; 99 | imguiGfxRect rect; 100 | imguiGfxText text; 101 | }; 102 | }; 103 | 104 | const imguiGfxCmd* imguiGetRenderQueue(); 105 | int imguiGetRenderQueueSize(); 106 | 107 | 108 | #endif // IMGUI_H 109 | -------------------------------------------------------------------------------- /RecastDemo/Include/imguiRenderGL.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef IMGUI_RENDER_GL_H 20 | #define IMGUI_RENDER_GL_H 21 | 22 | bool imguiRenderGLInit(const char* fontpath); 23 | void imguiRenderGLDestroy(); 24 | void imguiRenderGLDraw(); 25 | 26 | #endif // IMGUI_RENDER_GL_H -------------------------------------------------------------------------------- /RecastDemo/Source/Filelist.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #include "Filelist.h" 20 | #include 21 | #include 22 | #include 23 | #ifdef WIN32 24 | # include 25 | #else 26 | # include 27 | #endif 28 | 29 | static void fileListAdd(FileList& list, const char* path) 30 | { 31 | if (list.size >= FileList::MAX_FILES) 32 | return; 33 | int n = strlen(path); 34 | list.files[list.size] = new char[n+1]; 35 | strcpy(list.files[list.size], path); 36 | list.size++; 37 | } 38 | 39 | static void fileListClear(FileList& list) 40 | { 41 | for (int i = 0; i < list.size; ++i) 42 | delete [] list.files[i]; 43 | list.size = 0; 44 | } 45 | 46 | FileList::FileList() : size(0) 47 | { 48 | memset(files, 0, sizeof(char*)*MAX_FILES); 49 | } 50 | 51 | FileList::~FileList() 52 | { 53 | fileListClear(*this); 54 | } 55 | 56 | static int cmp(const void* a, const void* b) 57 | { 58 | return strcmp(*(const char**)a, *(const char**)b); 59 | } 60 | 61 | void scanDirectory(const char* path, const char* ext, FileList& list) 62 | { 63 | fileListClear(list); 64 | 65 | #ifdef WIN32 66 | _finddata_t dir; 67 | char pathWithExt[260]; 68 | long fh; 69 | strcpy(pathWithExt, path); 70 | strcat(pathWithExt, "/*"); 71 | strcat(pathWithExt, ext); 72 | fh = _findfirst(pathWithExt, &dir); 73 | if (fh == -1L) 74 | return; 75 | do 76 | { 77 | fileListAdd(list, dir.name); 78 | } 79 | while (_findnext(fh, &dir) == 0); 80 | _findclose(fh); 81 | #else 82 | dirent* current = 0; 83 | DIR* dp = opendir(path); 84 | if (!dp) 85 | return; 86 | 87 | while ((current = readdir(dp)) != 0) 88 | { 89 | int len = strlen(current->d_name); 90 | if (len > 4 && strncmp(current->d_name+len-4, ext, 4) == 0) 91 | { 92 | fileListAdd(list, current->d_name); 93 | } 94 | } 95 | closedir(dp); 96 | #endif 97 | 98 | if (list.size > 1) 99 | qsort(list.files, list.size, sizeof(char*), cmp); 100 | } 101 | -------------------------------------------------------------------------------- /RecastDemo/Source/PerfTimer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #include "PerfTimer.h" 20 | 21 | #if defined(WIN32) 22 | 23 | // Win32 24 | #include 25 | 26 | TimeVal getPerfTime() 27 | { 28 | __int64 count; 29 | QueryPerformanceCounter((LARGE_INTEGER*)&count); 30 | return count; 31 | } 32 | 33 | int getPerfDeltaTimeUsec(const TimeVal start, const TimeVal end) 34 | { 35 | static __int64 freq = 0; 36 | if (freq == 0) 37 | QueryPerformanceFrequency((LARGE_INTEGER*)&freq); 38 | __int64 elapsed = end - start; 39 | return (int)(elapsed*1000000 / freq); 40 | } 41 | 42 | #else 43 | 44 | // Linux, BSD, OSX 45 | 46 | #include 47 | 48 | TimeVal getPerfTime() 49 | { 50 | timeval now; 51 | gettimeofday(&now, 0); 52 | return (TimeVal)now.tv_sec*1000000L + (TimeVal)now.tv_usec; 53 | } 54 | 55 | int getPerfDeltaTimeUsec(const TimeVal start, const TimeVal end) 56 | { 57 | return (int)(end - start); 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /RecastDemo/Source/ValueHistory.cpp: -------------------------------------------------------------------------------- 1 | #include "ValueHistory.h" 2 | #include "imgui.h" 3 | #include 4 | #include 5 | 6 | #ifdef WIN32 7 | # define snprintf _snprintf 8 | #endif 9 | 10 | ValueHistory::ValueHistory() : 11 | m_hsamples(0) 12 | { 13 | for (int i = 0; i < MAX_HISTORY; ++i) 14 | m_samples[i] = 0; 15 | } 16 | 17 | ValueHistory::~ValueHistory() 18 | { 19 | } 20 | 21 | float ValueHistory::getSampleMin() const 22 | { 23 | float val = m_samples[0]; 24 | for (int i = 1; i < MAX_HISTORY; ++i) 25 | if (m_samples[i] < val) 26 | val = m_samples[i]; 27 | return val; 28 | } 29 | 30 | float ValueHistory::getSampleMax() const 31 | { 32 | float val = m_samples[0]; 33 | for (int i = 1; i < MAX_HISTORY; ++i) 34 | if (m_samples[i] > val) 35 | val = m_samples[i]; 36 | return val; 37 | } 38 | 39 | float ValueHistory::getAverage() const 40 | { 41 | float val = 0; 42 | for (int i = 0; i < MAX_HISTORY; ++i) 43 | val += m_samples[i]; 44 | return val/(float)MAX_HISTORY; 45 | } 46 | 47 | void GraphParams::setRect(int ix, int iy, int iw, int ih, int ipad) 48 | { 49 | x = ix; 50 | y = iy; 51 | w = iw; 52 | h = ih; 53 | pad = ipad; 54 | } 55 | 56 | void GraphParams::setValueRange(float ivmin, float ivmax, int indiv, const char* iunits) 57 | { 58 | vmin = ivmin; 59 | vmax = ivmax; 60 | ndiv = indiv; 61 | strcpy(units, iunits); 62 | } 63 | 64 | void drawGraphBackground(const GraphParams* p) 65 | { 66 | // BG 67 | imguiDrawRoundedRect((float)p->x, (float)p->y, (float)p->w, (float)p->h, (float)p->pad, imguiRGBA(64,64,64,128)); 68 | 69 | const float sy = (p->h-p->pad*2) / (p->vmax-p->vmin); 70 | const float oy = p->y+p->pad-p->vmin*sy; 71 | 72 | char text[64]; 73 | 74 | // Divider Lines 75 | for (int i = 0; i <= p->ndiv; ++i) 76 | { 77 | const float u = (float)i/(float)p->ndiv; 78 | const float v = p->vmin + (p->vmax-p->vmin)*u; 79 | snprintf(text, 64, "%.2f %s", v, p->units); 80 | const float fy = oy + v*sy; 81 | imguiDrawText(p->x + p->w - p->pad, (int)fy-4, IMGUI_ALIGN_RIGHT, text, imguiRGBA(0,0,0,255)); 82 | imguiDrawLine((float)p->x + (float)p->pad, fy, (float)p->x + (float)p->w - (float)p->pad - 50, fy, 1.0f, imguiRGBA(0,0,0,64)); 83 | } 84 | } 85 | 86 | void drawGraph(const GraphParams* p, const ValueHistory* graph, 87 | int idx, const char* label, const unsigned int col) 88 | { 89 | const float sx = (p->w - p->pad*2) / (float)graph->getSampleCount(); 90 | const float sy = (p->h - p->pad*2) / (p->vmax - p->vmin); 91 | const float ox = (float)p->x + (float)p->pad; 92 | const float oy = (float)p->y + (float)p->pad - p->vmin*sy; 93 | 94 | // Values 95 | float px=0, py=0; 96 | for (int i = 0; i < graph->getSampleCount()-1; ++i) 97 | { 98 | const float x = ox + i*sx; 99 | const float y = oy + graph->getSample(i)*sy; 100 | if (i > 0) 101 | imguiDrawLine(px,py, x,y, 2.0f, col); 102 | px = x; 103 | py = y; 104 | } 105 | 106 | // Label 107 | const int size = 15; 108 | const int spacing = 10; 109 | int ix = p->x + p->w + 5; 110 | int iy = p->y + p->h - (idx+1)*(size+spacing); 111 | 112 | imguiDrawRoundedRect((float)ix, (float)iy, (float)size, (float)size, 2.0f, col); 113 | 114 | char text[64]; 115 | snprintf(text, 64, "%.2f %s", graph->getAverage(), p->units); 116 | imguiDrawText(ix+size+5, iy+3, IMGUI_ALIGN_LEFT, label, imguiRGBA(255,255,255,192)); 117 | imguiDrawText(ix+size+150, iy+3, IMGUI_ALIGN_RIGHT, text, imguiRGBA(255,255,255,128)); 118 | } 119 | 120 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | TODO/Roadmap 2 | 3 | Summer/Autumn 2009 4 | 5 | - Off mesh links (jump links) 6 | - Area annotations 7 | - Embed extra data per polygon 8 | - Height conforming navmesh 9 | 10 | 11 | Autumn/Winter 2009/2010 12 | 13 | - Detour path following 14 | - More dynamic example with tile navmesh 15 | - Faster small tile process 16 | 17 | 18 | More info at http://digestingduck.blogspot.com/2009/07/recast-and-detour-roadmap.html 19 | 20 | - 21 | -------------------------------------------------------------------------------- /Test/Game.h: -------------------------------------------------------------------------------- 1 | //Game.h 2 | #pragma once 3 | 4 | #include "../../LZ3DEngine/LZ3DEngine.h" 5 | #include "../../LZData/lzdheader.h" 6 | 7 | //#define USE_GUI 8 | 9 | #ifdef USE_GUI 10 | #include "../../LZGUI/LZGUI.h" 11 | #endif 12 | 13 | 14 | //游戏类 15 | class CGame :public CApp 16 | { 17 | public: 18 | CGame(); 19 | ~CGame(); 20 | 21 | /*注册窗口类消息。请实现该消息来修改窗口风格。*/ 22 | void onRegisterClass(WNDCLASSEX *pwc); 23 | 24 | /*创建设备消息。实现该方法来修改设备。*/ 25 | void onCreateDevice(D3DPRESENT_PARAMETERS * pParam); 26 | 27 | /*游戏初始化*/ 28 | bool init(void); 29 | 30 | /*游戏更新*/ 31 | void update(void); 32 | 33 | /*渲染*/ 34 | void render(void); 35 | 36 | /*释放资源*/ 37 | void clear(void); 38 | 39 | void updateCamera(float fElapse); 40 | 41 | /**窗口过程。不需要调用默认窗口处理过程,如果未处理消息请返回0,否则请返回非0。*/ 42 | virtual LRESULT wndProc(HWND ,UINT ,WPARAM ,LPARAM ); 43 | public: 44 | /*注意:所有指针成员,需在构造函数中进行赋空值初始化。*/ 45 | bool m_bGameStart; 46 | RefPtr m_pCamera; 47 | RefPtr m_pFPS; 48 | RefPtr m_pCube; 49 | RefPtr m_pSquare; 50 | 51 | #ifdef USE_GUI 52 | RefPtr m_pGUIMgr; 53 | #endif 54 | }; -------------------------------------------------------------------------------- /Test/Test.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {E719B3CA-A3C8-4659-B762-A59EB8BB0414} 15 | Win32Proj 16 | Test 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | 49 | 50 | Level3 51 | Disabled 52 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 53 | 54 | 55 | Windows 56 | true 57 | ../Debug 58 | Font.lib;LZData.lib;LZ3DEngine.lib;utility.lib;Physics.lib;%(AdditionalDependencies) 59 | 60 | 61 | 62 | 63 | Level3 64 | 65 | 66 | MaxSpeed 67 | true 68 | true 69 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 70 | 71 | 72 | Windows 73 | true 74 | true 75 | true 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /Test/Test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | --------------------------------------------------------------------------------