Humble beginnings of test cases.

This commit is contained in:
Mikko Mononen 2010-01-28 15:04:01 +00:00
parent 3648ebe765
commit bd2e60a008
11 changed files with 3030 additions and 155 deletions

View File

@ -0,0 +1,15 @@
s Solo Mesh Simple
f movement.obj
pf -100.539185 -1.000000 54.028996 62.582016 15.757828 52.842243 0x3 0x0
pf -100.539185 -1.000000 54.028996 -1.259964 -1.000000 50.116970 0x3 0x0
pf -100.539185 -1.000000 54.028996 1.598934 -1.000000 23.528656 0x3 0x0
pf -100.539185 -1.000000 54.028996 3.652847 -1.000000 -5.022881 0x3 0x0
pf -100.539185 -1.000000 54.028996 -39.182816 8.999985 -24.697731 0x3 0x0
pf -100.539185 -1.000000 54.028996 -66.847992 -1.000000 -28.908646 0x3 0x0
pf -100.539185 -1.000000 54.028996 -90.966019 -1.000000 -3.219864 0x3 0x0
pf -43.394421 -1.000000 13.312424 -90.966019 -1.000000 -3.219864 0x3 0x0
pf -43.394421 -1.000000 13.312424 -36.447182 3.999992 -25.008087 0x3 0x0
pf -43.394421 -1.000000 13.312424 26.394167 15.757812 -13.491264 0x3 0x0
pf -43.394421 -1.000000 13.312424 -4.140746 6.944923 4.888435 0x3 0x0
pf -43.394421 -1.000000 13.312424 -73.532791 -1.062469 23.137051 0x3 0x0
pf -43.394421 -1.000000 13.312424 -72.902054 7.996834 15.076473 0x3 0x0

View File

@ -0,0 +1,23 @@
s Solo Mesh Simple
f nav_test.obj
pf 18.138550 -2.370003 -21.319118 -19.206181 -2.369133 24.802742 0x3 0x0
pf 18.252758 -2.368240 -7.000238 -19.206181 -2.369133 24.802742 0x3 0x0
pf 18.252758 -2.368240 -7.000238 -22.759071 -2.369453 2.003946 0x3 0x0
pf 18.252758 -2.368240 -7.000238 -24.483898 -2.369728 -6.778278 0x3 0x0
pf 18.252758 -2.368240 -7.000238 -24.068850 -2.370285 -18.879251 0x3 0x0
pf 18.252758 -2.368240 -7.000238 12.124170 -2.369637 -21.222471 0x3 0x0
pf 10.830146 -2.366791 19.002508 12.124170 -2.369637 -21.222471 0x3 0x0
pf 10.830146 -2.366791 19.002508 -7.146484 -2.368736 -16.031403 0x3 0x0
pf 10.830146 -2.366791 19.002508 -21.615391 -2.368706 -3.264029 0x3 0x0
pf 10.830146 -2.366791 19.002508 -22.651268 -2.369354 1.053217 0x3 0x0
pf 10.830146 -2.366791 19.002508 19.181122 -2.368134 3.011776 0x3 0x0
pf 10.830146 -2.366791 19.002508 19.041592 -2.368713 -7.404587 0x3 0x0
pf 6.054083 -2.365402 3.330421 19.041592 -2.368713 -7.404587 0x3 0x0
pf 6.054083 -2.365402 3.330421 21.846087 -2.368568 17.918859 0x3 0x0
pf 6.054083 -2.365402 3.330421 0.967449 -2.368439 25.767756 0x3 0x0
pf 6.054083 -2.365402 3.330421 -17.518076 -2.368477 26.569633 0x3 0x0
pf 6.054083 -2.365402 3.330421 -22.141787 -2.369209 2.440046 0x3 0x0
pf 6.054083 -2.365402 3.330421 -23.296972 -2.369797 -17.411043 0x3 0x0
pf 6.054083 -2.365402 3.330421 -1.564062 -2.369926 -20.452827 0x3 0x0
pf 6.054083 -2.365402 3.330421 16.905643 -2.370193 -21.811655 0x3 0x0
pf 6.054083 -2.365402 3.330421 19.289761 -2.368813 -6.954918 0x3 0x0

File diff suppressed because it is too large Load Diff

View File

@ -281,14 +281,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array> <array>
<array> <array>
<integer>13</integer> <integer>61</integer>
<integer>12</integer>
<integer>1</integer> <integer>1</integer>
<integer>0</integer> <integer>0</integer>
</array> </array>
</array> </array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 115}, {358, 643}}</string> <string>{{0, 539}, {358, 643}}</string>
</dict> </dict>
<key>PBXTopSmartGroupGIDs</key> <key>PBXTopSmartGroupGIDs</key>
<array/> <array/>
@ -323,7 +322,7 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>6B8632A30F78115100E2684A</string> <string>6B8632A30F78115100E2684A</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>DetourNavMesh.cpp</string> <string>TestCase.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key> <key>PBXSplitModuleInNavigatorKey</key>
<dict> <dict>
<key>Split0</key> <key>Split0</key>
@ -331,19 +330,17 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>6B8632A40F78115100E2684A</string> <string>6B8632A40F78115100E2684A</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>DetourNavMesh.cpp</string> <string>TestCase.cpp</string>
<key>_historyCapacity</key> <key>_historyCapacity</key>
<integer>0</integer> <integer>0</integer>
<key>bookmark</key> <key>bookmark</key>
<string>6BF7C12F11116FFB002B3F46</string> <string>6BF7C24A1111DAC1002B3F46</string>
<key>history</key> <key>history</key>
<array> <array>
<string>6B57D358108C66B200DDD053</string>
<string>6B8DE70D10B01BBF00DF20FB</string> <string>6B8DE70D10B01BBF00DF20FB</string>
<string>6BB4965F10C8F2AE00BC0805</string> <string>6BB4965F10C8F2AE00BC0805</string>
<string>6BB93D1510CFFC6D00F74F2B</string> <string>6BB93D1510CFFC6D00F74F2B</string>
<string>6BBB883C10EA9B6F008FEA1F</string> <string>6BBB883C10EA9B6F008FEA1F</string>
<string>6BBB884E10EA9ECC008FEA1F</string>
<string>6BB7FDC010F37703006DA0A6</string> <string>6BB7FDC010F37703006DA0A6</string>
<string>6BB7FDC110F37703006DA0A6</string> <string>6BB7FDC110F37703006DA0A6</string>
<string>6BB7FE1010F37CF7006DA0A6</string> <string>6BB7FE1010F37CF7006DA0A6</string>
@ -355,38 +352,43 @@
<string>6BCF34031105E98C009445BF</string> <string>6BCF34031105E98C009445BF</string>
<string>6BCF341A1105EC43009445BF</string> <string>6BCF341A1105EC43009445BF</string>
<string>6B4260301109E1EE00C48C36</string> <string>6B4260301109E1EE00C48C36</string>
<string>6B84BED0110E1818007D997B</string>
<string>6B84BEFE110E1E10007D997B</string>
<string>6BF7BE1F110F0792002B3F46</string> <string>6BF7BE1F110F0792002B3F46</string>
<string>6BF7BE39110F1576002B3F46</string>
<string>6BF7BE5C110F170A002B3F46</string> <string>6BF7BE5C110F170A002B3F46</string>
<string>6BF7BE5D110F170A002B3F46</string> <string>6BF7BE5D110F170A002B3F46</string>
<string>6BF7BE60110F170A002B3F46</string> <string>6BF7BE60110F170A002B3F46</string>
<string>6BF7BE73110F1832002B3F46</string>
<string>6BF7BE74110F1832002B3F46</string>
<string>6BF7BE75110F1832002B3F46</string> <string>6BF7BE75110F1832002B3F46</string>
<string>6BF7BE76110F1832002B3F46</string>
<string>6BF7BE82110F196C002B3F46</string> <string>6BF7BE82110F196C002B3F46</string>
<string>6BF7BE83110F196C002B3F46</string>
<string>6BF7C0E311116E74002B3F46</string> <string>6BF7C0E311116E74002B3F46</string>
<string>6BF7C0E411116E74002B3F46</string>
<string>6BF7C0E511116E74002B3F46</string> <string>6BF7C0E511116E74002B3F46</string>
<string>6BF7C0E611116E74002B3F46</string> <string>6BF7C0E611116E74002B3F46</string>
<string>6BF7C0E711116E74002B3F46</string> <string>6BF7C0E711116E74002B3F46</string>
<string>6BF7C0E811116E74002B3F46</string> <string>6BF7C0E811116E74002B3F46</string>
<string>6BF7C0E911116E74002B3F46</string> <string>6BF7C0E911116E74002B3F46</string>
<string>6BF7C0EA11116E74002B3F46</string> <string>6BF7C0EA11116E74002B3F46</string>
<string>6BF7C0EB11116E74002B3F46</string>
<string>6BF7C0EC11116E74002B3F46</string> <string>6BF7C0EC11116E74002B3F46</string>
<string>6BF7C0ED11116E74002B3F46</string> <string>6BF7C0ED11116E74002B3F46</string>
<string>6BF7C0EE11116E74002B3F46</string> <string>6BF7C0EE11116E74002B3F46</string>
<string>6BF7C0EF11116E74002B3F46</string> <string>6BF7C0EF11116E74002B3F46</string>
<string>6BF7C0F011116E74002B3F46</string> <string>6BF7C0F011116E74002B3F46</string>
<string>6BF7C0F111116E74002B3F46</string>
<string>6BF7C0F311116E74002B3F46</string> <string>6BF7C0F311116E74002B3F46</string>
<string>6BF7C12811116FFB002B3F46</string> <string>6BF7C13411118CEB002B3F46</string>
<string>6BF7C12911116FFB002B3F46</string> <string>6BF7C13511118CEB002B3F46</string>
<string>6BF7C12A11116FFB002B3F46</string> <string>6BF7C14511119BB4002B3F46</string>
<string>6BF7C16211119C69002B3F46</string>
<string>6BF7C16C11119D8F002B3F46</string>
<string>6BF7C1A21111A9C0002B3F46</string>
<string>6BF7C1CF1111BCF2002B3F46</string>
<string>6BF7C1D01111BCF2002B3F46</string>
<string>6BF7C1E21111BD81002B3F46</string>
<string>6BF7C1EB1111C0A6002B3F46</string>
<string>6BF7C1EC1111C0A6002B3F46</string>
<string>6BF7C1ED1111C0A6002B3F46</string>
<string>6BF7C1F91111D204002B3F46</string>
<string>6BF7C20F1111D361002B3F46</string>
<string>6BF7C2421111DAC1002B3F46</string>
<string>6BF7C2431111DAC1002B3F46</string>
<string>6BF7C2441111DAC1002B3F46</string>
<string>6BF7C2451111DAC1002B3F46</string>
</array> </array>
<key>prevStack</key> <key>prevStack</key>
<array> <array>
@ -396,7 +398,6 @@
<string>6BBB883F10EA9B6F008FEA1F</string> <string>6BBB883F10EA9B6F008FEA1F</string>
<string>6BBB885510EA9ECC008FEA1F</string> <string>6BBB885510EA9ECC008FEA1F</string>
<string>6BBB889D10EAA094008FEA1F</string> <string>6BBB889D10EAA094008FEA1F</string>
<string>6BB7FD6310F3564B006DA0A6</string>
<string>6BB7FDC710F37703006DA0A6</string> <string>6BB7FDC710F37703006DA0A6</string>
<string>6BB7FDD910F37703006DA0A6</string> <string>6BB7FDD910F37703006DA0A6</string>
<string>6BB7FDDA10F37703006DA0A6</string> <string>6BB7FDDA10F37703006DA0A6</string>
@ -421,11 +422,6 @@
<string>6BCF33811105BBA2009445BF</string> <string>6BCF33811105BBA2009445BF</string>
<string>6BCF340B1105E98C009445BF</string> <string>6BCF340B1105E98C009445BF</string>
<string>6BCF340C1105E98C009445BF</string> <string>6BCF340C1105E98C009445BF</string>
<string>6B4260411109E27F00C48C36</string>
<string>6BF7C0CD1110857A002B3F46</string>
<string>6BF7C0CF1110857A002B3F46</string>
<string>6BF7C0D11110857A002B3F46</string>
<string>6BF7C0D31110857A002B3F46</string>
<string>6BF7C0F611116E74002B3F46</string> <string>6BF7C0F611116E74002B3F46</string>
<string>6BF7C0F711116E74002B3F46</string> <string>6BF7C0F711116E74002B3F46</string>
<string>6BF7C0F811116E74002B3F46</string> <string>6BF7C0F811116E74002B3F46</string>
@ -449,23 +445,68 @@
<string>6BF7C10A11116E74002B3F46</string> <string>6BF7C10A11116E74002B3F46</string>
<string>6BF7C10B11116E74002B3F46</string> <string>6BF7C10B11116E74002B3F46</string>
<string>6BF7C10C11116E74002B3F46</string> <string>6BF7C10C11116E74002B3F46</string>
<string>6BF7C10D11116E74002B3F46</string>
<string>6BF7C10E11116E74002B3F46</string> <string>6BF7C10E11116E74002B3F46</string>
<string>6BF7C10F11116E74002B3F46</string> <string>6BF7C10F11116E74002B3F46</string>
<string>6BF7C11011116E74002B3F46</string> <string>6BF7C11011116E74002B3F46</string>
<string>6BF7C11111116E74002B3F46</string>
<string>6BF7C11211116E74002B3F46</string> <string>6BF7C11211116E74002B3F46</string>
<string>6BF7C11311116E74002B3F46</string>
<string>6BF7C11411116E74002B3F46</string> <string>6BF7C11411116E74002B3F46</string>
<string>6BF7C11511116E74002B3F46</string> <string>6BF7C11511116E74002B3F46</string>
<string>6BF7C11611116E74002B3F46</string>
<string>6BF7C11711116E74002B3F46</string> <string>6BF7C11711116E74002B3F46</string>
<string>6BF7C11811116E74002B3F46</string>
<string>6BF7C11911116E74002B3F46</string> <string>6BF7C11911116E74002B3F46</string>
<string>6BF7C12B11116FFB002B3F46</string>
<string>6BF7C12C11116FFB002B3F46</string> <string>6BF7C12C11116FFB002B3F46</string>
<string>6BF7C12D11116FFB002B3F46</string>
<string>6BF7C12E11116FFB002B3F46</string> <string>6BF7C12E11116FFB002B3F46</string>
<string>6BF7C13911118CEB002B3F46</string>
<string>6BF7C13A11118CEB002B3F46</string>
<string>6BF7C14911119BB4002B3F46</string>
<string>6BF7C14A11119BB4002B3F46</string>
<string>6BF7C14E11119BB4002B3F46</string>
<string>6BF7C14F11119BB4002B3F46</string>
<string>6BF7C15411119BB4002B3F46</string>
<string>6BF7C16611119C69002B3F46</string>
<string>6BF7C16711119C69002B3F46</string>
<string>6BF7C16E11119D8F002B3F46</string>
<string>6BF7C17511119EDD002B3F46</string>
<string>6BF7C17711119EDD002B3F46</string>
<string>6BF7C17911119EDD002B3F46</string>
<string>6BF7C17B11119EDD002B3F46</string>
<string>6BF7C17D11119EDD002B3F46</string>
<string>6BF7C18211119F2B002B3F46</string>
<string>6BF7C1951111A8DB002B3F46</string>
<string>6BF7C1961111A8DB002B3F46</string>
<string>6BF7C1981111A8DB002B3F46</string>
<string>6BF7C1A51111A9C0002B3F46</string>
<string>6BF7C1C51111AB95002B3F46</string>
<string>6BF7C1D21111BCF2002B3F46</string>
<string>6BF7C1D31111BCF2002B3F46</string>
<string>6BF7C1D41111BCF2002B3F46</string>
<string>6BF7C1DE1111BD29002B3F46</string>
<string>6BF7C1E51111BD81002B3F46</string>
<string>6BF7C1EF1111C0A6002B3F46</string>
<string>6BF7C1F01111C0A6002B3F46</string>
<string>6BF7C1F11111C0A6002B3F46</string>
<string>6BF7C1F21111C0A6002B3F46</string>
<string>6BF7C15711119BB4002B3F46</string>
<string>6BF7C20B1111D299002B3F46</string>
<string>6BF7C2131111D361002B3F46</string>
<string>6BF7C2141111D361002B3F46</string>
<string>6BF7C2151111D361002B3F46</string>
<string>6BF7C2161111D361002B3F46</string>
<string>6BF7C2171111D361002B3F46</string>
<string>6BF7C2181111D361002B3F46</string>
<string>6BF7C2191111D361002B3F46</string>
<string>6BF7C21A1111D361002B3F46</string>
<string>6BF7C21B1111D361002B3F46</string>
<string>6BF7C21C1111D361002B3F46</string>
<string>6BF7C21D1111D361002B3F46</string>
<string>6BF7C21E1111D361002B3F46</string>
<string>6BF7C21F1111D361002B3F46</string>
<string>6BF7C2201111D361002B3F46</string>
<string>6BF7C2261111D491002B3F46</string>
<string>6BF7C2271111D491002B3F46</string>
<string>6BF7C2461111DAC1002B3F46</string>
<string>6BF7C2471111DAC1002B3F46</string>
<string>6BF7C2481111DAC1002B3F46</string>
<string>6BF7C2491111DAC1002B3F46</string>
</array> </array>
</dict> </dict>
<key>SplitCount</key> <key>SplitCount</key>
@ -479,18 +520,18 @@
<key>GeometryConfiguration</key> <key>GeometryConfiguration</key>
<dict> <dict>
<key>Frame</key> <key>Frame</key>
<string>{{0, 0}, {876, 569}}</string> <string>{{0, 0}, {876, 555}}</string>
<key>RubberWindowFrame</key> <key>RubberWindowFrame</key>
<string>11 76 1256 702 0 0 1280 778 </string> <string>11 76 1256 702 0 0 1280 778 </string>
</dict> </dict>
<key>Module</key> <key>Module</key>
<string>PBXNavigatorGroup</string> <string>PBXNavigatorGroup</string>
<key>Proportion</key> <key>Proportion</key>
<string>569pt</string> <string>555pt</string>
</dict> </dict>
<dict> <dict>
<key>Proportion</key> <key>Proportion</key>
<string>87pt</string> <string>101pt</string>
<key>Tabs</key> <key>Tabs</key>
<array> <array>
<dict> <dict>
@ -558,7 +599,7 @@
<key>GeometryConfiguration</key> <key>GeometryConfiguration</key>
<dict> <dict>
<key>Frame</key> <key>Frame</key>
<string>{{10, 27}, {876, 60}}</string> <string>{{10, 27}, {876, 74}}</string>
<key>RubberWindowFrame</key> <key>RubberWindowFrame</key>
<string>11 76 1256 702 0 0 1280 778 </string> <string>11 76 1256 702 0 0 1280 778 </string>
</dict> </dict>
@ -684,7 +725,7 @@
<key>sizes</key> <key>sizes</key>
<array> <array>
<string>{{0, 0}, {1256, 80}}</string> <string>{{0, 0}, {1256, 80}}</string>
<string>{{0, 76}, {1256, 213}}</string> <string>{{0, 79}, {1256, 210}}</string>
</array> </array>
</dict> </dict>
</dict> </dict>
@ -780,6 +821,8 @@
<integer>5</integer> <integer>5</integer>
<key>WindowOrderList</key> <key>WindowOrderList</key>
<array> <array>
<string>6BF7C2061111D276002B3F46</string>
<string>6BF7C2071111D276002B3F46</string>
<string>/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/Recast.xcodeproj</string> <string>/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/Recast.xcodeproj</string>
</array> </array>
<key>WindowString</key> <key>WindowString</key>

View File

@ -41,6 +41,7 @@
6BB93C7F10CFE1D500F74F2B /* RecastDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */; }; 6BB93C7F10CFE1D500F74F2B /* RecastDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */; };
6BB93CF610CFEC4500F74F2B /* RecastDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */; }; 6BB93CF610CFEC4500F74F2B /* RecastDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */; };
6BCF32361104CD05009445BF /* OffMeshConnectionTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */; }; 6BCF32361104CD05009445BF /* OffMeshConnectionTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */; };
6BF7C1401111953A002B3F46 /* TestCase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BF7C13F1111953A002B3F46 /* TestCase.cpp */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -110,6 +111,8 @@
6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastDump.cpp; path = ../../../DebugUtils/Source/RecastDump.cpp; sourceTree = SOURCE_ROOT; }; 6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastDump.cpp; path = ../../../DebugUtils/Source/RecastDump.cpp; sourceTree = SOURCE_ROOT; };
6BCF32341104CD05009445BF /* OffMeshConnectionTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OffMeshConnectionTool.h; path = ../../Include/OffMeshConnectionTool.h; sourceTree = SOURCE_ROOT; }; 6BCF32341104CD05009445BF /* OffMeshConnectionTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OffMeshConnectionTool.h; path = ../../Include/OffMeshConnectionTool.h; sourceTree = SOURCE_ROOT; };
6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OffMeshConnectionTool.cpp; path = ../../Source/OffMeshConnectionTool.cpp; sourceTree = SOURCE_ROOT; }; 6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OffMeshConnectionTool.cpp; path = ../../Source/OffMeshConnectionTool.cpp; sourceTree = SOURCE_ROOT; };
6BF7C13E11119520002B3F46 /* TestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestCase.h; path = ../../Include/TestCase.h; sourceTree = SOURCE_ROOT; };
6BF7C13F1111953A002B3F46 /* TestCase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestCase.cpp; path = ../../Source/TestCase.cpp; sourceTree = SOURCE_ROOT; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Recast.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Recast.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8D1107320486CEB800E47090 /* Recast.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Recast.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -150,6 +153,8 @@
6B137C6E0F7FCBBB00459200 /* SDLMain.m */, 6B137C6E0F7FCBBB00459200 /* SDLMain.m */,
6BB7FDA310F36EFC006DA0A6 /* InputGeom.h */, 6BB7FDA310F36EFC006DA0A6 /* InputGeom.h */,
6BB7FDA410F36F0E006DA0A6 /* InputGeom.cpp */, 6BB7FDA410F36F0E006DA0A6 /* InputGeom.cpp */,
6BF7C13E11119520002B3F46 /* TestCase.h */,
6BF7C13F1111953A002B3F46 /* TestCase.cpp */,
); );
name = Classes; name = Classes;
sourceTree = "<group>"; sourceTree = "<group>";
@ -383,6 +388,7 @@
6BB7FC0B10EBB6AA006DA0A6 /* NavMeshTesterTool.cpp in Sources */, 6BB7FC0B10EBB6AA006DA0A6 /* NavMeshTesterTool.cpp in Sources */,
6BB7FDA510F36F0E006DA0A6 /* InputGeom.cpp in Sources */, 6BB7FDA510F36F0E006DA0A6 /* InputGeom.cpp in Sources */,
6BCF32361104CD05009445BF /* OffMeshConnectionTool.cpp in Sources */, 6BCF32361104CD05009445BF /* OffMeshConnectionTool.cpp in Sources */,
6BF7C1401111953A002B3F46 /* TestCase.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -0,0 +1,80 @@
//
// Copyright (c) 2009 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef TESTCASE_H
#define TESTCASE_H
#include "DetourNavMesh.h"
#include "RecastTimer.h"
class TestCase
{
enum TestType
{
TEST_PATHFIND,
};
struct Test
{
Test() : straight(0), nstraight(0), polys(0), npolys(0) {};
~Test()
{
delete [] straight;
delete [] polys;
}
TestType type;
float spos[3], epos[3];
float radius;
int includeFlags, excludeFlags;
bool expand;
float* straight;
int nstraight;
dtPolyRef* polys;
int npolys;
rcTimeVal findNearestPolyTime;
rcTimeVal findPathTime;
rcTimeVal findStraightPathTime;
Test* next;
};
char m_sampleName[256];
char m_geomFileName[256];
Test* m_tests;
void resetTimes();
public:
TestCase();
~TestCase();
bool load(const char* filePath);
inline const char* getSampleName() const { return m_sampleName; }
inline const char* getGeomFileName() const { return m_geomFileName; }
void doTests(class dtNavMesh* navmesh);
void handleRender();
bool handleRenderOverlay(double* proj, double* model, int* view);
};
#endif // TESTCASE_H

View File

@ -35,6 +35,9 @@
# define snprintf _snprintf # define snprintf _snprintf
#endif #endif
// Uncomment this to dump all the requests in stdout.
#define DUMP_REQS
inline bool inRange(const float* v1, const float* v2, const float r, const float h) inline bool inRange(const float* v1, const float* v2, const float r, const float h)
{ {
const float dx = v2[0] - v1[0]; const float dx = v2[0] - v1[0];
@ -252,6 +255,11 @@ void NavMeshTesterTool::recalc()
{ {
if (m_sposSet && m_eposSet && m_startRef && m_endRef) if (m_sposSet && m_eposSet && m_startRef && m_endRef)
{ {
#ifdef DUMP_REQS
printf("pi %f %f %f %f %f %f 0x%x 0x%x\n",
m_spos[0],m_spos[1],m_spos[2], m_epos[0],m_epos[1],m_epos[2],
m_filter.includeFlags, m_filter.excludeFlags);
#endif
m_npolys = m_navMesh->findPath(m_startRef, m_endRef, m_spos, m_epos, &m_filter, m_polys, MAX_POLYS); m_npolys = m_navMesh->findPath(m_startRef, m_endRef, m_spos, m_epos, &m_filter, m_polys, MAX_POLYS);
m_nsmoothPath = 0; m_nsmoothPath = 0;
@ -386,6 +394,11 @@ void NavMeshTesterTool::recalc()
{ {
if (m_sposSet && m_eposSet && m_startRef && m_endRef) if (m_sposSet && m_eposSet && m_startRef && m_endRef)
{ {
#ifdef DUMP_REQS
printf("ps %f %f %f %f %f %f 0x%x 0x%x\n",
m_spos[0],m_spos[1],m_spos[2], m_epos[0],m_epos[1],m_epos[2],
m_filter.includeFlags, m_filter.excludeFlags);
#endif
m_npolys = m_navMesh->findPath(m_startRef, m_endRef, m_spos, m_epos, &m_filter, m_polys, MAX_POLYS); m_npolys = m_navMesh->findPath(m_startRef, m_endRef, m_spos, m_epos, &m_filter, m_polys, MAX_POLYS);
m_nstraightPath = 0; m_nstraightPath = 0;
if (m_npolys) if (m_npolys)
@ -406,6 +419,11 @@ void NavMeshTesterTool::recalc()
m_nstraightPath = 0; m_nstraightPath = 0;
if (m_sposSet && m_eposSet && m_startRef) if (m_sposSet && m_eposSet && m_startRef)
{ {
#ifdef DUMP_REQS
printf("rc %f %f %f %f %f %f 0x%x 0x%x\n",
m_spos[0],m_spos[1],m_spos[2], m_epos[0],m_epos[1],m_epos[2],
m_filter.includeFlags, m_filter.excludeFlags);
#endif
float t = 0; float t = 0;
m_npolys = 0; m_npolys = 0;
m_nstraightPath = 2; m_nstraightPath = 2;
@ -427,8 +445,15 @@ void NavMeshTesterTool::recalc()
{ {
m_distanceToWall = 0; m_distanceToWall = 0;
if (m_sposSet && m_startRef) if (m_sposSet && m_startRef)
{
#ifdef DUMP_REQS
printf("dw %f %f %f %f 0x%x 0x%x\n",
m_spos[0],m_spos[1],m_spos[2], 100.0f,
m_filter.includeFlags, m_filter.excludeFlags);
#endif
m_distanceToWall = m_navMesh->findDistanceToWall(m_startRef, m_spos, 100.0f, &m_filter, m_hitPos, m_hitNormal); m_distanceToWall = m_navMesh->findDistanceToWall(m_startRef, m_spos, 100.0f, &m_filter, m_hitPos, m_hitNormal);
} }
}
else if (m_toolMode == TOOLMODE_FIND_POLYS_AROUND) else if (m_toolMode == TOOLMODE_FIND_POLYS_AROUND)
{ {
if (m_sposSet && m_startRef && m_eposSet) if (m_sposSet && m_startRef && m_eposSet)
@ -436,6 +461,11 @@ void NavMeshTesterTool::recalc()
const float dx = m_epos[0] - m_spos[0]; const float dx = m_epos[0] - m_spos[0];
const float dz = m_epos[2] - m_spos[2]; const float dz = m_epos[2] - m_spos[2];
float dist = sqrtf(dx*dx + dz*dz); float dist = sqrtf(dx*dx + dz*dz);
#ifdef DUMP_REQS
printf("fp %f %f %f %f 0x%x 0x%x\n",
m_spos[0],m_spos[1],m_spos[2], dist,
m_filter.includeFlags, m_filter.excludeFlags);
#endif
m_npolys = m_navMesh->findPolysAround(m_startRef, m_spos, dist, &m_filter, m_polys, m_parent, 0, MAX_POLYS); m_npolys = m_navMesh->findPolysAround(m_startRef, m_spos, dist, &m_filter, m_polys, m_parent, 0, MAX_POLYS);
} }
} }

View File

@ -0,0 +1,336 @@
//
// Copyright (c) 2009 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include "TestCase.h"
#include "DetourNavMesh.h"
#include "SDL.h"
#include "SDL_opengl.h"
#include "imgui.h"
#include "Recast.h"
TestCase::TestCase() :
m_tests(0)
{
}
TestCase::~TestCase()
{
Test* iter = m_tests;
while (iter)
{
Test* next = iter->next;
delete iter;
iter = next;
}
}
static char* parseRow(char* buf, char* bufEnd, char* row, int len)
{
bool start = true;
bool done = false;
int n = 0;
while (!done && buf < bufEnd)
{
char c = *buf;
buf++;
// multirow
switch (c)
{
case '\n':
if (start) break;
done = true;
break;
case '\r':
break;
case '\t':
case ' ':
if (start) break;
default:
start = false;
row[n++] = c;
if (n >= len-1)
done = true;
break;
}
}
row[n] = '\0';
return buf;
}
static void copyName(char* dst, const char* src)
{
// Skip white spaces
while (*src && isspace(*src))
src++;
strcpy(dst, src);
}
bool TestCase::load(const char* filePath)
{
char* buf = 0;
FILE* fp = fopen(filePath, "rb");
if (!fp)
return false;
fseek(fp, 0, SEEK_END);
int bufSize = ftell(fp);
fseek(fp, 0, SEEK_SET);
buf = new char[bufSize];
if (!buf)
{
fclose(fp);
return false;
}
fread(buf, bufSize, 1, fp);
fclose(fp);
char* src = buf;
char* srcEnd = buf + bufSize;
char row[512];
while (src < srcEnd)
{
// Parse one row
row[0] = '\0';
src = parseRow(src, srcEnd, row, sizeof(row)/sizeof(char));
if (row[0] == 's')
{
// Sample name.
copyName(m_sampleName, row+1);
}
else if (row[0] == 'f')
{
// File name.
copyName(m_geomFileName, row+1);
}
else if (row[0] == 'p' && row[1] == 'f')
{
// Pathfind test.
Test* test = new Test;
memset(test, 0, sizeof(Test));
test->type = TEST_PATHFIND;
test->expand = false;
test->next = m_tests;
m_tests = test;
sscanf(row+2, "%f %f %f %f %f %f %x %x",
&test->spos[0], &test->spos[1], &test->spos[2],
&test->epos[0], &test->epos[1], &test->epos[2],
&test->includeFlags, &test->excludeFlags);
}
}
delete [] buf;
return true;
}
void TestCase::resetTimes()
{
for (Test* iter = m_tests; iter; iter = iter->next)
{
iter->findNearestPolyTime = 0;
iter->findPathTime = 0;
iter->findStraightPathTime = 0;
}
}
void TestCase::doTests(dtNavMesh* navmesh)
{
if (!navmesh)
return;
resetTimes();
static const int MAX_POLYS = 256;
dtPolyRef polys[MAX_POLYS];
float straight[MAX_POLYS*3];
const float polyPickExt[3] = {2,4,2};
for (Test* iter = m_tests; iter; iter = iter->next)
{
delete [] iter->polys;
iter->polys = 0;
iter->npolys = 0;
delete [] iter->straight;
iter->straight = 0;
iter->nstraight = 0;
dtQueryFilter filter;
filter.includeFlags = (unsigned short)iter->includeFlags;
filter.excludeFlags = (unsigned short)iter->excludeFlags;
// Find start points
rcTimeVal findNearestPolyStart = rcGetPerformanceTimer();
dtPolyRef startRef = navmesh->findNearestPoly(iter->spos, polyPickExt, &filter, 0);
dtPolyRef endRef = navmesh->findNearestPoly(iter->epos, polyPickExt, &filter, 0);
rcTimeVal findNearestPolyEnd = rcGetPerformanceTimer();
iter->findNearestPolyTime += rcGetDeltaTimeUsec(findNearestPolyStart, findNearestPolyEnd);
if (!startRef || ! endRef)
continue;
// Find path
rcTimeVal findPathStart = rcGetPerformanceTimer();
iter->npolys = navmesh->findPath(startRef, endRef, iter->spos, iter->epos, &filter, polys, MAX_POLYS);
rcTimeVal findPathEnd = rcGetPerformanceTimer();
iter->findPathTime += rcGetDeltaTimeUsec(findPathStart, findPathEnd);
// Find straight path
if (iter->npolys)
{
rcTimeVal findStraightPathStart = rcGetPerformanceTimer();
iter->nstraight = navmesh->findStraightPath(iter->spos, iter->epos, polys, iter->npolys,
straight, 0, 0, MAX_POLYS);
rcTimeVal findStraightPathEnd = rcGetPerformanceTimer();
iter->findStraightPathTime += rcGetDeltaTimeUsec(findStraightPathStart, findStraightPathEnd);
}
// Copy results
if (iter->npolys)
{
iter->polys = new dtPolyRef[iter->npolys];
memcpy(iter->polys, polys, sizeof(dtPolyRef)*iter->npolys);
}
if (iter->nstraight)
{
iter->straight = new float[iter->nstraight*3];
memcpy(iter->straight, straight, sizeof(float)*3*iter->nstraight);
}
}
}
void TestCase::handleRender()
{
glLineWidth(2.0f);
glBegin(GL_LINES);
for (Test* iter = m_tests; iter; iter = iter->next)
{
float dir[3];
vsub(dir, iter->epos, iter->spos);
vnormalize(dir);
glColor4ub(128,25,0,192);
glVertex3f(iter->spos[0],iter->spos[1]-0.3f,iter->spos[2]);
glVertex3f(iter->spos[0],iter->spos[1]+0.3f,iter->spos[2]);
glVertex3f(iter->spos[0],iter->spos[1]+0.3f,iter->spos[2]);
glVertex3f(iter->spos[0]+dir[0]*0.3f,iter->spos[1]+0.3f+dir[1]*0.3f,iter->spos[2]+dir[2]*0.3f);
glColor4ub(51,102,0,129);
glVertex3f(iter->epos[0],iter->epos[1]-0.3f,iter->epos[2]);
glVertex3f(iter->epos[0],iter->epos[1]+0.3f,iter->epos[2]);
if (iter->expand)
glColor4ub(255,192,0,255);
else
glColor4ub(0,0,0,64);
for (int i = 0; i < iter->nstraight-1; ++i)
{
glVertex3f(iter->straight[i*3+0],iter->straight[i*3+1]+0.3f,iter->straight[i*3+2]);
glVertex3f(iter->straight[(i+1)*3+0],iter->straight[(i+1)*3+1]+0.3f,iter->straight[(i+1)*3+2]);
}
}
glEnd();
glLineWidth(1.0f);
}
bool TestCase::handleRenderOverlay(double* proj, double* model, int* view)
{
GLdouble x, y, z;
char text[64];
int n = 0;
static const float LABEL_DIST = 1.0f;
for (Test* iter = m_tests; iter; iter = iter->next)
{
float pt[3], dir[3];
if (iter->nstraight)
{
vcopy(pt, &iter->straight[3]);
if (vdist(pt, iter->spos) > LABEL_DIST)
{
vsub(dir, pt, iter->spos);
vnormalize(dir);
vmad(pt, iter->spos, dir, LABEL_DIST);
}
pt[1]+=0.5f;
}
else
{
vsub(dir, iter->epos, iter->spos);
vnormalize(dir);
vmad(pt, iter->spos, dir, LABEL_DIST);
pt[1]+=0.5f;
}
if (gluProject((GLdouble)pt[0], (GLdouble)pt[1], (GLdouble)pt[2],
model, proj, view, &x, &y, &z))
{
snprintf(text, 64, "Path %d\n", n);
unsigned int col = imguiRGBA(0,0,0,128);
if (iter->expand)
col = imguiRGBA(255,192,0,220);
imguiDrawText((int)x, (int)(y-25), IMGUI_ALIGN_CENTER, text, col);
}
n++;
}
static int resScroll = 0;
bool mouseOverMenu = imguiBeginScrollArea("Test Results", 10, view[3] - 10 - 350, 200, 350, &resScroll);
// mouseOverMenu = true;
n = 0;
for (Test* iter = m_tests; iter; iter = iter->next)
{
snprintf(text, 64, "Path %d\n", n);
if (imguiCollapse(text, iter->expand))
iter->expand = !iter->expand;
if (iter->expand)
{
snprintf(text, 64, "Poly: %.4f ms\n", (float)iter->findNearestPolyTime/1000.0f);
imguiValue(text);
snprintf(text, 64, "Path: %.4f ms\n", (float)iter->findPathTime/1000.0f);
imguiValue(text);
snprintf(text, 64, "Straight: %.4f ms\n", (float)iter->findStraightPathTime/1000.0f);
imguiValue(text);
}
rcTimeVal total = iter->findNearestPolyTime + iter->findPathTime + iter->findStraightPathTime;
snprintf(text, 64, "Total: %.4f ms\n", (float)total/1000.0f);
imguiValue(text);
// imguiDrawText(10, 700-n*20, IMGUI_ALIGN_LEFT, text, imguiRGBA(255,255,255,220));
n++;
}
imguiEndScrollArea();
return mouseOverMenu;
}

View File

@ -508,9 +508,9 @@ bool imguiCollapse(const char* text, bool checked, bool enabled)
bool res = buttonLogic(id, over); bool res = buttonLogic(id, over);
if (checked) if (checked)
addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, imguiRGBA(255,255,255,isActive(id)?255:200));
else
addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 2, imguiRGBA(255,255,255,isActive(id)?255:200)); addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 2, imguiRGBA(255,255,255,isActive(id)?255:200));
else
addGfxCmdTriangle(cx, cy, CHECK_SIZE, CHECK_SIZE, 1, imguiRGBA(255,255,255,isActive(id)?255:200));
addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200)); addGfxCmdText(x+BUTTON_HEIGHT, y+BUTTON_HEIGHT/2-TEXT_HEIGHT/2, IMGUI_ALIGN_LEFT, text, isHot(id) ? imguiRGBA(255,196,0,255) : imguiRGBA(255,255,255,200));

View File

@ -32,6 +32,7 @@
#include "Recast.h" #include "Recast.h"
#include "RecastDebugDraw.h" #include "RecastDebugDraw.h"
#include "InputGeom.h" #include "InputGeom.h"
#include "TestCase.h"
#include "Sample_SoloMeshSimple.h" #include "Sample_SoloMeshSimple.h"
#include "Sample_SoloMeshTiled.h" #include "Sample_SoloMeshTiled.h"
@ -195,6 +196,7 @@ int main(int argc, char *argv[])
bool showTools = true; bool showTools = true;
bool showLevels = false; bool showLevels = false;
bool showSample = false; bool showSample = false;
bool showTestCases = false;
int propScroll = 0; int propScroll = 0;
int logScroll = 0; int logScroll = 0;
@ -203,15 +205,15 @@ int main(int argc, char *argv[])
char sampleName[64] = "Choose Sample..."; char sampleName[64] = "Choose Sample...";
FileList meshFiles; FileList files;
char meshName[128] = "Choose Mesh..."; char meshName[128] = "Choose Mesh...";
InputGeom* geom = 0;
float mpos[3]; float mpos[3];
bool mposSet = false; bool mposSet = false;
InputGeom* geom = 0;
Sample* sample = 0; Sample* sample = 0;
TestCase* test = 0;
rcLog log; rcLog log;
log.clear(); log.clear();
@ -247,6 +249,13 @@ int main(int argc, char *argv[])
{ {
done = true; done = true;
} }
else if (event.key.keysym.sym == SDLK_TAB)
{
showLevels = false;
showSample = false;
showTestCases = true;
scanDirectory("Tests", ".txt", files);
}
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
@ -404,6 +413,8 @@ int main(int argc, char *argv[])
if (sample) if (sample)
sample->handleRender(); sample->handleRender();
if (test)
test->handleRender();
glDisable(GL_FOG); glDisable(GL_FOG);
@ -415,12 +426,19 @@ int main(int argc, char *argv[])
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
mouseOverMenu = false;
imguiBeginFrame(mx,my,mbut,mscroll); imguiBeginFrame(mx,my,mbut,mscroll);
if (sample) if (sample)
{ {
sample->handleRenderOverlay((double*)proj, (double*)model, (int*)view); sample->handleRenderOverlay((double*)proj, (double*)model, (int*)view);
} }
if (test)
{
if (test->handleRenderOverlay((double*)proj, (double*)model, (int*)view))
mouseOverMenu = true;
}
// Help text. // Help text.
if (showMenu) if (showMenu)
@ -429,8 +447,6 @@ int main(int argc, char *argv[])
imguiDrawText(width/2, height-20, IMGUI_ALIGN_CENTER, msg, imguiRGBA(255,255,255,128)); imguiDrawText(width/2, height-20, IMGUI_ALIGN_CENTER, msg, imguiRGBA(255,255,255,128));
} }
mouseOverMenu = false;
if (showMenu) if (showMenu)
{ {
int propDiv = showDebugMode ? (int)(height*0.6f) : height; int propDiv = showDebugMode ? (int)(height*0.6f) : height;
@ -458,6 +474,7 @@ int main(int argc, char *argv[])
{ {
showSample = true; showSample = true;
showLevels = false; showLevels = false;
showTestCases = false;
} }
} }
@ -474,8 +491,9 @@ int main(int argc, char *argv[])
else else
{ {
showSample = false; showSample = false;
showTestCases = false;
showLevels = true; showLevels = true;
scanDirectory("Meshes", ".obj", meshFiles); scanDirectory("Meshes", ".obj", files);
} }
} }
if (geom) if (geom)
@ -504,6 +522,10 @@ int main(int argc, char *argv[])
printf("Build log %s:\n", meshName); printf("Build log %s:\n", meshName);
for (int i = 0; i < log.getMessageCount(); ++i) for (int i = 0; i < log.getMessageCount(); ++i)
printf("%s\n", log.getMessageText(i)); printf("%s\n", log.getMessageText(i));
// Clear test.
delete test;
test = 0;
} }
imguiSeparator(); imguiSeparator();
@ -564,15 +586,15 @@ int main(int argc, char *argv[])
mouseOverMenu = true; mouseOverMenu = true;
int levelToLoad = -1; int levelToLoad = -1;
for (int i = 0; i < meshFiles.size; ++i) for (int i = 0; i < files.size; ++i)
{ {
if (imguiItem(meshFiles.files[i])) if (imguiItem(files.files[i]))
levelToLoad = i; levelToLoad = i;
} }
if (levelToLoad != -1) if (levelToLoad != -1)
{ {
strncpy(meshName, meshFiles.files[levelToLoad], sizeof(meshName)); strncpy(meshName, files.files[levelToLoad], sizeof(meshName));
meshName[sizeof(meshName)-1] = '\0'; meshName[sizeof(meshName)-1] = '\0';
showLevels = false; showLevels = false;
@ -591,7 +613,7 @@ int main(int argc, char *argv[])
showLog = true; showLog = true;
logScroll = 0; logScroll = 0;
printf("Build log %s:\n", meshName); printf("Geom load log %s:\n", meshName);
for (int i = 0; i < log.getMessageCount(); ++i) for (int i = 0; i < log.getMessageCount(); ++i)
printf("%s\n", log.getMessageText(i)); printf("%s\n", log.getMessageText(i));
} }
@ -623,6 +645,115 @@ int main(int argc, char *argv[])
} }
// Test cases
if (showTestCases)
{
static int testScroll = 0;
if (imguiBeginScrollArea("Choose Test To Run", width-10-250-10-200, height-10-450, 200, 450, &testScroll))
mouseOverMenu = true;
int testToLoad = -1;
for (int i = 0; i < files.size; ++i)
{
if (imguiItem(files.files[i]))
testToLoad = i;
}
if (testToLoad != -1)
{
char path[256];
strcpy(path, "Tests/");
strcat(path, files.files[testToLoad]);
test = new TestCase;
if (test)
{
// Load the test.
if (!test->load(path))
{
delete test;
test = 0;
}
// Create sample
Sample* newSample = 0;
for (int i = 0; i < g_nsamples; ++i)
{
if (strcmp(g_samples[i].name, test->getSampleName()) == 0)
{
newSample = g_samples[i].create();
if (newSample) strcpy(sampleName, g_samples[i].name);
}
}
if (newSample)
{
delete sample;
sample = newSample;
showSample = false;
}
// Load geom.
strcpy(meshName, test->getGeomFileName());
meshName[sizeof(meshName)-1] = '\0';
delete geom;
geom = 0;
strcpy(path, "Meshes/");
strcat(path, meshName);
geom = new InputGeom;
if (!geom || !geom->loadMesh(path))
{
delete geom;
geom = 0;
showLog = true;
logScroll = 0;
printf("Geom load log %s:\n", meshName);
for (int i = 0; i < log.getMessageCount(); ++i)
printf("%s\n", log.getMessageText(i));
}
if (sample && geom)
{
sample->handleMeshChanged(geom);
}
log.clear();
if (sample && !sample->handleBuild())
{
printf("Build log %s:\n", meshName);
for (int i = 0; i < log.getMessageCount(); ++i)
printf("%s\n", log.getMessageText(i));
}
if (geom)
{
const float* bmin = geom->getMeshBoundsMin();
const float* bmax = geom->getMeshBoundsMax();
// Reset camera and fog to match the mesh bounds.
camr = sqrtf(rcSqr(bmax[0]-bmin[0]) +
rcSqr(bmax[1]-bmin[1]) +
rcSqr(bmax[2]-bmin[2])) / 2;
camx = (bmax[0] + bmin[0]) / 2 + camr;
camy = (bmax[1] + bmin[1]) / 2 + camr;
camz = (bmax[2] + bmin[2]) / 2 + camr;
camr *= 3;
rx = 45;
ry = -45;
glFogf(GL_FOG_START, camr*0.2f);
glFogf(GL_FOG_END, camr*1.25f);
}
// Do the tests.
if (sample)
test->doTests(sample->getNavMesh());
}
}
imguiEndScrollArea();
}
// Log // Log
if (showLog && showMenu) if (showLog && showMenu)
{ {
@ -634,9 +765,9 @@ int main(int argc, char *argv[])
} }
// Tools // Tools
if (showTools && showMenu && geom && sample) if (!showTestCases && showTools && showMenu && geom && sample)
{ {
if (imguiBeginScrollArea("Tools", 10, height - 10 - 250, 200, 250, &toolsScroll)) if (imguiBeginScrollArea("Tools", 10, height - 10 - 350, 200, 350, &toolsScroll))
mouseOverMenu = true; mouseOverMenu = true;
sample->handleTools(); sample->handleTools();