mirror of
https://github.com/recastnavigation/recastnavigation.git
synced 2026-09-17 07:44:35 +00:00
Changed tiled stat mesh demo from 'tiling' to 'tiled'.
Added ugly tiled nav mesh demo.
This commit is contained in:
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -255,7 +255,7 @@
|
||||
<dict>
|
||||
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
|
||||
<array>
|
||||
<real>228</real>
|
||||
<real>282</real>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
|
||||
<array>
|
||||
@@ -268,6 +268,8 @@
|
||||
<array>
|
||||
<string>29B97314FDCFA39411CA2CEA</string>
|
||||
<string>080E96DDFE201D6D7F000001</string>
|
||||
<string>6BDD9E030F91110C00904EEF</string>
|
||||
<string>6B137C7D0F7FCBE800459200</string>
|
||||
<string>29B97315FDCFA39411CA2CEA</string>
|
||||
<string>29B97317FDCFA39411CA2CEA</string>
|
||||
<string>1C37FBAC04509CD000000102</string>
|
||||
@@ -276,13 +278,13 @@
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
||||
<array>
|
||||
<array>
|
||||
<integer>19</integer>
|
||||
<integer>33</integer>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</array>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
||||
<string>{{0, 0}, {228, 660}}</string>
|
||||
<string>{{0, 22}, {282, 660}}</string>
|
||||
</dict>
|
||||
<key>PBXTopSmartGroupGIDs</key>
|
||||
<array/>
|
||||
@@ -292,11 +294,11 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {245, 678}}</string>
|
||||
<string>{{0, 0}, {299, 678}}</string>
|
||||
<key>GroupTreeTableConfiguration</key>
|
||||
<array>
|
||||
<string>MainColumn</string>
|
||||
<real>228</real>
|
||||
<real>282</real>
|
||||
</array>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>0 59 1280 719 0 0 1280 778 </string>
|
||||
@@ -304,18 +306,20 @@
|
||||
<key>Module</key>
|
||||
<string>PBXSmartGroupTreeModule</string>
|
||||
<key>Proportion</key>
|
||||
<string>245pt</string>
|
||||
<string>299pt</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Dock</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BecomeActive</key>
|
||||
<true/>
|
||||
<key>ContentConfiguration</key>
|
||||
<dict>
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>6B8632A30F78115100E2684A</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>ChunkyTriMesh.cpp</string>
|
||||
<string>BuilderTiledMesh.cpp</string>
|
||||
<key>PBXSplitModuleInNavigatorKey</key>
|
||||
<dict>
|
||||
<key>Split0</key>
|
||||
@@ -323,65 +327,78 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>6B8632A40F78115100E2684A</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>ChunkyTriMesh.cpp</string>
|
||||
<string>BuilderTiledMesh.cpp</string>
|
||||
<key>_historyCapacity</key>
|
||||
<integer>0</integer>
|
||||
<key>bookmark</key>
|
||||
<string>6B25B62F0FFAAAF4004F1BC4</string>
|
||||
<string>6B024BD01005DFAB00CF7107</string>
|
||||
<key>history</key>
|
||||
<array>
|
||||
<string>6BB87E0B0F9DE8A300E33F12</string>
|
||||
<string>6B7707AF0FBD66CF00D21BAE</string>
|
||||
<string>6B7707F00FBD90F100D21BAE</string>
|
||||
<string>6BB7876B0FC03EAD003C24DB</string>
|
||||
<string>6B8171D70FC327630022159F</string>
|
||||
<string>6BB85D3A0FCEAA6300758966</string>
|
||||
<string>6B09CE5C0FD5BDE6005637D5</string>
|
||||
<string>6B09CE5F0FD5BDE6005637D5</string>
|
||||
<string>6B09CE730FD5BEC3005637D5</string>
|
||||
<string>6B8FD1CF0FD7F56C0059D643</string>
|
||||
<string>6BAE920D0FD8014C002875DB</string>
|
||||
<string>6B8B580A0FD80DA20088BD0D</string>
|
||||
<string>6B8A71F40FDAB52200A0A6FB</string>
|
||||
<string>6B995BDF0FE0D9B300D5C493</string>
|
||||
<string>6B6BC6C70FE7A3A4009E3CB9</string>
|
||||
<string>6B6BC6CA0FE7A3A4009E3CB9</string>
|
||||
<string>6BC745A70FF527E50083A694</string>
|
||||
<string>6BC745A80FF527E50083A694</string>
|
||||
<string>6B9B7D990FF91AC600A9090F</string>
|
||||
<string>6B9B7D9D0FF91AC600A9090F</string>
|
||||
<string>6B25B3A60FFA124D004F1BC4</string>
|
||||
<string>6B25B3A80FFA124D004F1BC4</string>
|
||||
<string>6B25B3AB0FFA124D004F1BC4</string>
|
||||
<string>6B25B43E0FFA1786004F1BC4</string>
|
||||
<string>6B25B44B0FFA1968004F1BC4</string>
|
||||
<string>6B25B4710FFA1FE0004F1BC4</string>
|
||||
<string>6B25B4740FFA1FE0004F1BC4</string>
|
||||
<string>6B25B54F0FFA5899004F1BC4</string>
|
||||
<string>6B25B5AF0FFA5A5A004F1BC4</string>
|
||||
<string>6B25B5CB0FFA5CCE004F1BC4</string>
|
||||
<string>6B25B6230FFA63C8004F1BC4</string>
|
||||
<string>6B25B6240FFA63C8004F1BC4</string>
|
||||
<string>6B2AEC5C0FFB8AB0005BE9CC</string>
|
||||
<string>6B2AEC610FFB8AB0005BE9CC</string>
|
||||
<string>6B2AEC620FFB8AB0005BE9CC</string>
|
||||
<string>6B2AEC670FFB8AB0005BE9CC</string>
|
||||
<string>6B2AEC6F0FFB8AB0005BE9CC</string>
|
||||
<string>6B2AECED0FFB8B41005BE9CC</string>
|
||||
<string>6B2AECEE0FFB8B41005BE9CC</string>
|
||||
<string>6B2AECEF0FFB8B41005BE9CC</string>
|
||||
<string>6B2AECF80FFB9075005BE9CC</string>
|
||||
<string>6B2AECF90FFB9075005BE9CC</string>
|
||||
<string>6B2AED8E0FFBA45B005BE9CC</string>
|
||||
<string>6B2AEDA00FFBA507005BE9CC</string>
|
||||
<string>6B092B4F0FFCA0A20088D3A5</string>
|
||||
<string>6B092B500FFCA0A20088D3A5</string>
|
||||
<string>6B092BAB0FFCEC1A0088D3A5</string>
|
||||
<string>6B092BB50FFCEC1A0088D3A5</string>
|
||||
<string>6B092BB70FFCEC1A0088D3A5</string>
|
||||
<string>6B092C5F0FFCFF790088D3A5</string>
|
||||
<string>6B092CC10FFE40160088D3A5</string>
|
||||
<string>6B092CC30FFE40160088D3A5</string>
|
||||
<string>6B02497E1003751300CF7107</string>
|
||||
<string>6B0249821003751300CF7107</string>
|
||||
<string>6B02499F1003766D00CF7107</string>
|
||||
<string>6B0249BE1003793900CF7107</string>
|
||||
<string>6B024ACD1004AC8D00CF7107</string>
|
||||
<string>6B024ACE1004AC8D00CF7107</string>
|
||||
<string>6B024B391004CCCC00CF7107</string>
|
||||
<string>6B024BA81005DC3A00CF7107</string>
|
||||
<string>6B024BB71005DF5700CF7107</string>
|
||||
<string>6B024BB81005DF5700CF7107</string>
|
||||
<string>6B024BB91005DF5700CF7107</string>
|
||||
<string>6B024BC91005DFAB00CF7107</string>
|
||||
<string>6B024BCA1005DFAB00CF7107</string>
|
||||
<string>6B024BCB1005DFAB00CF7107</string>
|
||||
<string>6B024BCC1005DFAB00CF7107</string>
|
||||
</array>
|
||||
<key>prevStack</key>
|
||||
<array>
|
||||
<string>6B1E02680F924A8500CC0038</string>
|
||||
<string>6B1E02750F924A8500CC0038</string>
|
||||
<string>6B1E028F0F924D5A00CC0038</string>
|
||||
<string>6B1E029B0F924D8B00CC0038</string>
|
||||
<string>6B1E02FC0F92563500CC0038</string>
|
||||
<string>6B1E032E0F925D9100CC0038</string>
|
||||
<string>6B8DB38F0F9798DE007FA9E1</string>
|
||||
<string>6B8DB3900F9798DE007FA9E1</string>
|
||||
<string>6BB87E0E0F9DE8A300E33F12</string>
|
||||
<string>6B458EA80FB4540500044EA9</string>
|
||||
<string>6B77072C0FBD540400D21BAE</string>
|
||||
<string>6B7707B90FBD66CF00D21BAE</string>
|
||||
<string>6B7707F70FBD90F100D21BAE</string>
|
||||
<string>6B7707F90FBD90F100D21BAE</string>
|
||||
<string>6B7708F70FBDA96300D21BAE</string>
|
||||
<string>6BB787C30FC03EAD003C24DB</string>
|
||||
<string>6BB787D40FC03EAD003C24DB</string>
|
||||
<string>6BB788290FC0593E003C24DB</string>
|
||||
<string>6BB7882A0FC0593E003C24DB</string>
|
||||
<string>6BB7882B0FC0593E003C24DB</string>
|
||||
@@ -392,47 +409,113 @@
|
||||
<string>6BC745AF0FF527E50083A694</string>
|
||||
<string>6B9B7DA30FF91AC600A9090F</string>
|
||||
<string>6B9B7DA40FF91AC600A9090F</string>
|
||||
<string>6B25B3B70FFA124D004F1BC4</string>
|
||||
<string>6B25B3B80FFA124D004F1BC4</string>
|
||||
<string>6B25B3B90FFA124D004F1BC4</string>
|
||||
<string>6B25B3BA0FFA124D004F1BC4</string>
|
||||
<string>6B25B3BB0FFA124D004F1BC4</string>
|
||||
<string>6B25B3BC0FFA124D004F1BC4</string>
|
||||
<string>6B25B3BD0FFA124D004F1BC4</string>
|
||||
<string>6B25B3BE0FFA124D004F1BC4</string>
|
||||
<string>6B25B3BF0FFA124D004F1BC4</string>
|
||||
<string>6B25B3C00FFA124D004F1BC4</string>
|
||||
<string>6B25B3C20FFA124D004F1BC4</string>
|
||||
<string>6B25B3C60FFA124D004F1BC4</string>
|
||||
<string>6B25B3C70FFA124D004F1BC4</string>
|
||||
<string>6B25B3F40FFA124D004F1BC4</string>
|
||||
<string>6B25B4120FFA1545004F1BC4</string>
|
||||
<string>6B25B4130FFA1545004F1BC4</string>
|
||||
<string>6B86333B0F7813A600E2684A</string>
|
||||
<string>6B25B4080FFA13E9004F1BC4</string>
|
||||
<string>6B25B4280FFA16C0004F1BC4</string>
|
||||
<string>6B25B4360FFA174A004F1BC4</string>
|
||||
<string>6B25B4370FFA174A004F1BC4</string>
|
||||
<string>6B25B4400FFA1786004F1BC4</string>
|
||||
<string>6B25B4420FFA1786004F1BC4</string>
|
||||
<string>6B25B4500FFA1968004F1BC4</string>
|
||||
<string>6B25B4510FFA1968004F1BC4</string>
|
||||
<string>6B25B4530FFA1968004F1BC4</string>
|
||||
<string>6B25B4550FFA1968004F1BC4</string>
|
||||
<string>6B25B4560FFA1968004F1BC4</string>
|
||||
<string>6B25B4580FFA1968004F1BC4</string>
|
||||
<string>6B25B4590FFA1968004F1BC4</string>
|
||||
<string>6B25B45A0FFA1968004F1BC4</string>
|
||||
<string>6B25B4780FFA1FE0004F1BC4</string>
|
||||
<string>6B25B4850FFA1FE0004F1BC4</string>
|
||||
<string>6B25B55A0FFA5899004F1BC4</string>
|
||||
<string>6B25B56D0FFA5899004F1BC4</string>
|
||||
<string>6B25B5770FFA5899004F1BC4</string>
|
||||
<string>6B25B5890FFA58F3004F1BC4</string>
|
||||
<string>6B25B5A00FFA5A03004F1BC4</string>
|
||||
<string>6B25B5CF0FFA5CCE004F1BC4</string>
|
||||
<string>6B25B5D80FFA5CCE004F1BC4</string>
|
||||
<string>6B25B6250FFA63C8004F1BC4</string>
|
||||
<string>6B2AEC730FFB8AB0005BE9CC</string>
|
||||
<string>6B2AEC740FFB8AB0005BE9CC</string>
|
||||
<string>6B2AEC750FFB8AB0005BE9CC</string>
|
||||
<string>6B2AECB50FFB8AB0005BE9CC</string>
|
||||
<string>6B2AECE10FFB8AB0005BE9CC</string>
|
||||
<string>6B2AED930FFBA45B005BE9CC</string>
|
||||
<string>6B2AED940FFBA45B005BE9CC</string>
|
||||
<string>6B092B1A0FFC98FF0088D3A5</string>
|
||||
<string>6B092B530FFCA0A20088D3A5</string>
|
||||
<string>6B092BBC0FFCEC1A0088D3A5</string>
|
||||
<string>6B092BEB0FFCEC1A0088D3A5</string>
|
||||
<string>6B092BED0FFCEC1A0088D3A5</string>
|
||||
<string>6B2AEC970FFB8AB0005BE9CC</string>
|
||||
<string>6B0248B81001E4FE00CF7107</string>
|
||||
<string>6B0248D51001E64300CF7107</string>
|
||||
<string>6B0248E21001E7F200CF7107</string>
|
||||
<string>6B0248FE1001EABD00CF7107</string>
|
||||
<string>6B0249051001EABD00CF7107</string>
|
||||
<string>6B02493E1002118200CF7107</string>
|
||||
<string>6B0249841003751300CF7107</string>
|
||||
<string>6B0249861003751300CF7107</string>
|
||||
<string>6B0249871003751300CF7107</string>
|
||||
<string>6B0249881003751300CF7107</string>
|
||||
<string>6B0249891003751300CF7107</string>
|
||||
<string>6B02498C1003751300CF7107</string>
|
||||
<string>6B02498D1003751300CF7107</string>
|
||||
<string>6B02498E1003751300CF7107</string>
|
||||
<string>6B0249901003751300CF7107</string>
|
||||
<string>6B024995100375AF00CF7107</string>
|
||||
<string>6B024996100375AF00CF7107</string>
|
||||
<string>6B024997100375AF00CF7107</string>
|
||||
<string>6B02499C1003762100CF7107</string>
|
||||
<string>6B0249A11003766D00CF7107</string>
|
||||
<string>6B0249AA1003774A00CF7107</string>
|
||||
<string>6B0249C11003793900CF7107</string>
|
||||
<string>6B0249F910037CFB00CF7107</string>
|
||||
<string>6B024A0410037DB300CF7107</string>
|
||||
<string>6B024A0510037DB300CF7107</string>
|
||||
<string>6B024A0610037DB300CF7107</string>
|
||||
<string>6B024A0710037DB300CF7107</string>
|
||||
<string>6B024A0810037DB300CF7107</string>
|
||||
<string>6B024A0D10037DB300CF7107</string>
|
||||
<string>6B024A2910037F3100CF7107</string>
|
||||
<string>6B024A4B1004806000CF7107</string>
|
||||
<string>6B024A721004A2FE00CF7107</string>
|
||||
<string>6B024AAE1004A83400CF7107</string>
|
||||
<string>6B024AAF1004A83400CF7107</string>
|
||||
<string>6B024ABA1004A95900CF7107</string>
|
||||
<string>6B024ABB1004A95900CF7107</string>
|
||||
<string>6B024AD01004AC8D00CF7107</string>
|
||||
<string>6B024AE91004B12B00CF7107</string>
|
||||
<string>6B024AEC1004B12B00CF7107</string>
|
||||
<string>6B024B011004C41E00CF7107</string>
|
||||
<string>6B024B111004C7E200CF7107</string>
|
||||
<string>6B024B151004C7E200CF7107</string>
|
||||
<string>6B024B181004C7E200CF7107</string>
|
||||
<string>6B024B1A1004C7E200CF7107</string>
|
||||
<string>6B024B1B1004C7E200CF7107</string>
|
||||
<string>6B024B1D1004C7E200CF7107</string>
|
||||
<string>6B024B1F1004C7E200CF7107</string>
|
||||
<string>6B024B281004CC4800CF7107</string>
|
||||
<string>6B024B2A1004CC4800CF7107</string>
|
||||
<string>6B024B2C1004CC4800CF7107</string>
|
||||
<string>6B024B341004CC8700CF7107</string>
|
||||
<string>6B024B3C1004CCCC00CF7107</string>
|
||||
<string>6B024B4C1004D22F00CF7107</string>
|
||||
<string>6B024B4E1004D22F00CF7107</string>
|
||||
<string>6B024B501004D22F00CF7107</string>
|
||||
<string>6B024B521004D22F00CF7107</string>
|
||||
<string>6B024B5B1005D2CB00CF7107</string>
|
||||
<string>6B024B5D1005D2CB00CF7107</string>
|
||||
<string>6B024B5F1005D2CB00CF7107</string>
|
||||
<string>6B024B691005D68E00CF7107</string>
|
||||
<string>6B024B6B1005D68E00CF7107</string>
|
||||
<string>6B024B6D1005D68E00CF7107</string>
|
||||
<string>6B024B6F1005D68E00CF7107</string>
|
||||
<string>6B024B711005D68E00CF7107</string>
|
||||
<string>6B024B731005D68E00CF7107</string>
|
||||
<string>6B024B751005D68E00CF7107</string>
|
||||
<string>6B024B7C1005D6EC00CF7107</string>
|
||||
<string>6B024B831005D76000CF7107</string>
|
||||
<string>6B024B851005D76000CF7107</string>
|
||||
<string>6B024B931005D98C00CF7107</string>
|
||||
<string>6B024B951005D98C00CF7107</string>
|
||||
<string>6B024B971005D98C00CF7107</string>
|
||||
<string>6B024B9A1005D98C00CF7107</string>
|
||||
<string>6B024BAB1005DC3A00CF7107</string>
|
||||
<string>6B024BAC1005DC3A00CF7107</string>
|
||||
<string>6B024BAD1005DC3A00CF7107</string>
|
||||
<string>6B024BAE1005DC3A00CF7107</string>
|
||||
<string>6B024BBB1005DF5700CF7107</string>
|
||||
<string>6B024BBC1005DF5700CF7107</string>
|
||||
<string>6B024BBD1005DF5700CF7107</string>
|
||||
<string>6B024BBE1005DF5700CF7107</string>
|
||||
<string>6B024BBF1005DF5700CF7107</string>
|
||||
<string>6B024BC01005DF5700CF7107</string>
|
||||
<string>6B024BC11005DF5700CF7107</string>
|
||||
<string>6B024BC21005DF5700CF7107</string>
|
||||
<string>6B024BC31005DF5700CF7107</string>
|
||||
<string>6B024BCD1005DFAB00CF7107</string>
|
||||
<string>6B024BCE1005DFAB00CF7107</string>
|
||||
<string>6B024BCF1005DFAB00CF7107</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>SplitCount</key>
|
||||
@@ -446,18 +529,18 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {1030, 512}}</string>
|
||||
<string>{{0, 0}, {976, 531}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>0 59 1280 719 0 0 1280 778 </string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXNavigatorGroup</string>
|
||||
<key>Proportion</key>
|
||||
<string>512pt</string>
|
||||
<string>531pt</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Proportion</key>
|
||||
<string>161pt</string>
|
||||
<string>142pt</string>
|
||||
<key>Tabs</key>
|
||||
<array>
|
||||
<dict>
|
||||
@@ -471,7 +554,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {1030, 134}}</string>
|
||||
<string>{{10, 27}, {976, 83}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>XCDetailModule</string>
|
||||
@@ -487,7 +570,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {1030, -27}}</string>
|
||||
<string>{{10, 27}, {976, 99}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXProjectFindModule</string>
|
||||
@@ -511,8 +594,6 @@
|
||||
<string>PBXCVSModule</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BecomeActive</key>
|
||||
<true/>
|
||||
<key>ContentConfiguration</key>
|
||||
<dict>
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
@@ -527,7 +608,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {1030, 134}}</string>
|
||||
<string>{{10, 27}, {976, 115}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>0 59 1280 719 0 0 1280 778 </string>
|
||||
</dict>
|
||||
@@ -538,7 +619,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>Proportion</key>
|
||||
<string>1030pt</string>
|
||||
<string>976pt</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Name</key>
|
||||
@@ -557,11 +638,11 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>6B25B3F90FFA1250004F1BC4</string>
|
||||
<string>6B0248C51001E53600CF7107</string>
|
||||
<string>1CA23ED40692098700951B8B</string>
|
||||
<string>6B25B3FA0FFA1250004F1BC4</string>
|
||||
<string>6B0248C61001E53600CF7107</string>
|
||||
<string>6B8632A30F78115100E2684A</string>
|
||||
<string>6B25B3FB0FFA1250004F1BC4</string>
|
||||
<string>6B0248C71001E53600CF7107</string>
|
||||
<string>1CA23EDF0692099D00951B8B</string>
|
||||
<string>1CA23EE00692099D00951B8B</string>
|
||||
<string>1CA23EE10692099D00951B8B</string>
|
||||
@@ -610,12 +691,12 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {1280, 199}}</string>
|
||||
<string>{{0, 0}, {1280, 254}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXDebugCLIModule</string>
|
||||
<key>Proportion</key>
|
||||
<string>199pt</string>
|
||||
<string>254pt</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ContentConfiguration</key>
|
||||
@@ -634,8 +715,8 @@
|
||||
<string>yes</string>
|
||||
<key>sizes</key>
|
||||
<array>
|
||||
<string>{{0, 0}, {637, 130}}</string>
|
||||
<string>{{637, 0}, {643, 130}}</string>
|
||||
<string>{{0, 0}, {637, 115}}</string>
|
||||
<string>{{637, 0}, {643, 115}}</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>VerticalSplitView</key>
|
||||
@@ -650,8 +731,8 @@
|
||||
<string>yes</string>
|
||||
<key>sizes</key>
|
||||
<array>
|
||||
<string>{{0, 0}, {1280, 130}}</string>
|
||||
<string>{{0, 130}, {1280, 344}}</string>
|
||||
<string>{{0, 0}, {1280, 115}}</string>
|
||||
<string>{{0, 115}, {1280, 304}}</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
@@ -671,7 +752,7 @@
|
||||
<key>DebugSTDIOWindowFrame</key>
|
||||
<string>{{200, 200}, {500, 300}}</string>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 204}, {1280, 474}}</string>
|
||||
<string>{{0, 259}, {1280, 419}}</string>
|
||||
<key>PBXDebugSessionStackFrameViewKey</key>
|
||||
<dict>
|
||||
<key>DebugVariablesTableConfiguration</key>
|
||||
@@ -684,13 +765,13 @@
|
||||
<real>413</real>
|
||||
</array>
|
||||
<key>Frame</key>
|
||||
<string>{{637, 0}, {643, 130}}</string>
|
||||
<string>{{637, 0}, {643, 115}}</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXDebugSessionModule</string>
|
||||
<key>Proportion</key>
|
||||
<string>474pt</string>
|
||||
<string>419pt</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Name</key>
|
||||
@@ -708,13 +789,13 @@
|
||||
</array>
|
||||
<key>TableOfContents</key>
|
||||
<array>
|
||||
<string>6B25B3FC0FFA1250004F1BC4</string>
|
||||
<string>6B0248C81001E53600CF7107</string>
|
||||
<string>1CCC7628064C1048000F2A68</string>
|
||||
<string>1CCC7629064C1048000F2A68</string>
|
||||
<string>6B25B3FD0FFA1250004F1BC4</string>
|
||||
<string>6B25B3FE0FFA1250004F1BC4</string>
|
||||
<string>6B25B3FF0FFA1250004F1BC4</string>
|
||||
<string>6B25B4000FFA1250004F1BC4</string>
|
||||
<string>6B0248C91001E53600CF7107</string>
|
||||
<string>6B0248CA1001E53600CF7107</string>
|
||||
<string>6B0248CB1001E53600CF7107</string>
|
||||
<string>6B0248CC1001E53600CF7107</string>
|
||||
<string>6B8632A30F78115100E2684A</string>
|
||||
</array>
|
||||
<key>ToolbarConfiguration</key>
|
||||
@@ -745,8 +826,8 @@
|
||||
<integer>5</integer>
|
||||
<key>WindowOrderList</key>
|
||||
<array>
|
||||
<string>6B25B4CD0FFA2673004F1BC4</string>
|
||||
<string>6B25B4CE0FFA2673004F1BC4</string>
|
||||
<string>6B0248CD1001E53600CF7107</string>
|
||||
<string>6B0248CE1001E53600CF7107</string>
|
||||
<string>/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/Recast.xcodeproj</string>
|
||||
</array>
|
||||
<key>WindowString</key>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
|
||||
6B092B940FFCC2BD0088D3A5 /* DetourTiledNavMeshBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B092B930FFCC2BD0088D3A5 /* DetourTiledNavMeshBuilder.cpp */; };
|
||||
6B137C700F7FCBBB00459200 /* glfont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6B0F7FCBBB00459200 /* glfont.cpp */; };
|
||||
6B137C710F7FCBBB00459200 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6C0F7FCBBB00459200 /* imgui.cpp */; };
|
||||
6B137C720F7FCBBB00459200 /* MeshLoaderObj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */; };
|
||||
@@ -24,8 +25,10 @@
|
||||
6B25B6190FFA62BE004F1BC4 /* Builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B25B6140FFA62BE004F1BC4 /* Builder.cpp */; };
|
||||
6B25B61A0FFA62BE004F1BC4 /* BuilderStatMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B25B6150FFA62BE004F1BC4 /* BuilderStatMesh.cpp */; };
|
||||
6B25B61B0FFA62BE004F1BC4 /* BuilderStatMeshSimple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B25B6160FFA62BE004F1BC4 /* BuilderStatMeshSimple.cpp */; };
|
||||
6B25B61C0FFA62BE004F1BC4 /* BuilderStatMeshTiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B25B6170FFA62BE004F1BC4 /* BuilderStatMeshTiling.cpp */; };
|
||||
6B25B61D0FFA62BE004F1BC4 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; };
|
||||
6B2AEC530FFB8958005BE9CC /* BuilderTiledMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B2AEC520FFB8958005BE9CC /* BuilderTiledMesh.cpp */; };
|
||||
6B2AEC560FFB89E7005BE9CC /* BuilderStatMeshTiled.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B2AEC550FFB89E7005BE9CC /* BuilderStatMeshTiled.cpp */; };
|
||||
6B2AEC5A0FFB8A7A005BE9CC /* DetourTiledNavMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B2AEC590FFB8A7A005BE9CC /* DetourTiledNavMesh.cpp */; };
|
||||
6B8632DA0F78122C00E2684A /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632D90F78122C00E2684A /* SDL.framework */; };
|
||||
6B8632DC0F78123E00E2684A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632DB0F78123E00E2684A /* OpenGL.framework */; };
|
||||
6BB788170FC0472B003C24DB /* ChunkyTriMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */; };
|
||||
@@ -44,6 +47,8 @@
|
||||
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
32CA4F630368D1EE00C91783 /* Recast_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Recast_Prefix.pch; sourceTree = "<group>"; };
|
||||
6B092B920FFCC2AC0088D3A5 /* DetourTiledNavMeshBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourTiledNavMeshBuilder.h; path = ../../../Detour/Include/DetourTiledNavMeshBuilder.h; sourceTree = SOURCE_ROOT; };
|
||||
6B092B930FFCC2BD0088D3A5 /* DetourTiledNavMeshBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourTiledNavMeshBuilder.cpp; path = ../../../Detour/Source/DetourTiledNavMeshBuilder.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C6B0F7FCBBB00459200 /* glfont.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glfont.cpp; path = ../../Source/glfont.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C6C0F7FCBBB00459200 /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../Source/imgui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MeshLoaderObj.cpp; path = ../../Source/MeshLoaderObj.cpp; sourceTree = SOURCE_ROOT; };
|
||||
@@ -68,12 +73,16 @@
|
||||
6B25B6100FFA62AD004F1BC4 /* Builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Builder.h; path = ../../Include/Builder.h; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6110FFA62AD004F1BC4 /* BuilderStatMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BuilderStatMesh.h; path = ../../Include/BuilderStatMesh.h; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6120FFA62AD004F1BC4 /* BuilderStatMeshSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BuilderStatMeshSimple.h; path = ../../Include/BuilderStatMeshSimple.h; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6130FFA62AD004F1BC4 /* BuilderStatMeshTiling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BuilderStatMeshTiling.h; path = ../../Include/BuilderStatMeshTiling.h; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6140FFA62BE004F1BC4 /* Builder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Builder.cpp; path = ../../Source/Builder.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6150FFA62BE004F1BC4 /* BuilderStatMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BuilderStatMesh.cpp; path = ../../Source/BuilderStatMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6160FFA62BE004F1BC4 /* BuilderStatMeshSimple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BuilderStatMeshSimple.cpp; path = ../../Source/BuilderStatMeshSimple.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6170FFA62BE004F1BC4 /* BuilderStatMeshTiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BuilderStatMeshTiling.cpp; path = ../../Source/BuilderStatMeshTiling.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B25B6180FFA62BE004F1BC4 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../Source/main.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B2AEC510FFB8946005BE9CC /* BuilderTiledMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BuilderTiledMesh.h; path = ../../Include/BuilderTiledMesh.h; sourceTree = SOURCE_ROOT; };
|
||||
6B2AEC520FFB8958005BE9CC /* BuilderTiledMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BuilderTiledMesh.cpp; path = ../../Source/BuilderTiledMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B2AEC550FFB89E7005BE9CC /* BuilderStatMeshTiled.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BuilderStatMeshTiled.cpp; path = ../../Source/BuilderStatMeshTiled.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B2AEC570FFB89F4005BE9CC /* BuilderStatMeshTiled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BuilderStatMeshTiled.h; path = ../../Include/BuilderStatMeshTiled.h; sourceTree = SOURCE_ROOT; };
|
||||
6B2AEC580FFB8A68005BE9CC /* DetourTiledNavMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourTiledNavMesh.h; path = ../../../Detour/Include/DetourTiledNavMesh.h; sourceTree = SOURCE_ROOT; };
|
||||
6B2AEC590FFB8A7A005BE9CC /* DetourTiledNavMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourTiledNavMesh.cpp; path = ../../../Detour/Source/DetourTiledNavMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||
6B8632D90F78122C00E2684A /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = Library/Frameworks/SDL.framework; sourceTree = SDKROOT; };
|
||||
6B8632DB0F78123E00E2684A /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
||||
6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChunkyTriMesh.cpp; path = ../../Source/ChunkyTriMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||
@@ -105,25 +114,27 @@
|
||||
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6B25B6140FFA62BE004F1BC4 /* Builder.cpp */,
|
||||
6B25B6150FFA62BE004F1BC4 /* BuilderStatMesh.cpp */,
|
||||
6B25B6160FFA62BE004F1BC4 /* BuilderStatMeshSimple.cpp */,
|
||||
6B25B6170FFA62BE004F1BC4 /* BuilderStatMeshTiling.cpp */,
|
||||
6B25B6180FFA62BE004F1BC4 /* main.cpp */,
|
||||
6B25B6100FFA62AD004F1BC4 /* Builder.h */,
|
||||
6B25B6110FFA62AD004F1BC4 /* BuilderStatMesh.h */,
|
||||
6B25B6120FFA62AD004F1BC4 /* BuilderStatMeshSimple.h */,
|
||||
6B25B6130FFA62AD004F1BC4 /* BuilderStatMeshTiling.h */,
|
||||
6BDD9E030F91110C00904EEF /* Detour */,
|
||||
6B137C7D0F7FCBE800459200 /* Recast */,
|
||||
6B25B6100FFA62AD004F1BC4 /* Builder.h */,
|
||||
6B25B6140FFA62BE004F1BC4 /* Builder.cpp */,
|
||||
6B2AEC510FFB8946005BE9CC /* BuilderTiledMesh.h */,
|
||||
6B2AEC520FFB8958005BE9CC /* BuilderTiledMesh.cpp */,
|
||||
6B2AEC570FFB89F4005BE9CC /* BuilderStatMeshTiled.h */,
|
||||
6B2AEC550FFB89E7005BE9CC /* BuilderStatMeshTiled.cpp */,
|
||||
6B25B6110FFA62AD004F1BC4 /* BuilderStatMesh.h */,
|
||||
6B25B6150FFA62BE004F1BC4 /* BuilderStatMesh.cpp */,
|
||||
6B25B6120FFA62AD004F1BC4 /* BuilderStatMeshSimple.h */,
|
||||
6B25B6160FFA62BE004F1BC4 /* BuilderStatMeshSimple.cpp */,
|
||||
6B25B6180FFA62BE004F1BC4 /* main.cpp */,
|
||||
6B137C790F7FCBE400459200 /* glfont.h */,
|
||||
6B137C6B0F7FCBBB00459200 /* glfont.cpp */,
|
||||
6B137C7A0F7FCBE400459200 /* imgui.h */,
|
||||
6B137C6C0F7FCBBB00459200 /* imgui.cpp */,
|
||||
6B137C7B0F7FCBE400459200 /* MeshLoaderObj.h */,
|
||||
6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */,
|
||||
6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */,
|
||||
6BB788180FC04753003C24DB /* ChunkyTriMesh.h */,
|
||||
6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */,
|
||||
6B137C7C0F7FCBE400459200 /* SDLMain.h */,
|
||||
6B137C6E0F7FCBBB00459200 /* SDLMain.m */,
|
||||
);
|
||||
@@ -220,12 +231,16 @@
|
||||
6BDD9E030F91110C00904EEF /* Detour */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6BDD9E070F91113800904EEF /* DetourDebugDraw.cpp */,
|
||||
6BDD9E080F91113800904EEF /* DetourStatNavMesh.cpp */,
|
||||
6BDD9E090F91113800904EEF /* DetourStatNavMeshBuilder.cpp */,
|
||||
6BDD9E040F91112200904EEF /* DetourDebugDraw.h */,
|
||||
6BDD9E070F91113800904EEF /* DetourDebugDraw.cpp */,
|
||||
6BDD9E050F91112200904EEF /* DetourStatNavMesh.h */,
|
||||
6BDD9E080F91113800904EEF /* DetourStatNavMesh.cpp */,
|
||||
6BDD9E060F91112200904EEF /* DetourStatNavMeshBuilder.h */,
|
||||
6BDD9E090F91113800904EEF /* DetourStatNavMeshBuilder.cpp */,
|
||||
6B2AEC580FFB8A68005BE9CC /* DetourTiledNavMesh.h */,
|
||||
6B2AEC590FFB8A7A005BE9CC /* DetourTiledNavMesh.cpp */,
|
||||
6B092B920FFCC2AC0088D3A5 /* DetourTiledNavMeshBuilder.h */,
|
||||
6B092B930FFCC2BD0088D3A5 /* DetourTiledNavMeshBuilder.cpp */,
|
||||
);
|
||||
name = Detour;
|
||||
sourceTree = "<group>";
|
||||
@@ -305,8 +320,11 @@
|
||||
6B25B6190FFA62BE004F1BC4 /* Builder.cpp in Sources */,
|
||||
6B25B61A0FFA62BE004F1BC4 /* BuilderStatMesh.cpp in Sources */,
|
||||
6B25B61B0FFA62BE004F1BC4 /* BuilderStatMeshSimple.cpp in Sources */,
|
||||
6B25B61C0FFA62BE004F1BC4 /* BuilderStatMeshTiling.cpp in Sources */,
|
||||
6B25B61D0FFA62BE004F1BC4 /* main.cpp in Sources */,
|
||||
6B2AEC530FFB8958005BE9CC /* BuilderTiledMesh.cpp in Sources */,
|
||||
6B2AEC560FFB89E7005BE9CC /* BuilderStatMeshTiled.cpp in Sources */,
|
||||
6B2AEC5A0FFB8A7A005BE9CC /* DetourTiledNavMesh.cpp in Sources */,
|
||||
6B092B940FFCC2BD0088D3A5 /* DetourTiledNavMeshBuilder.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "RecastLog.h"
|
||||
#include "ChunkyTriMesh.h"
|
||||
|
||||
class BuilderStatMeshTiling : public BuilderStatMesh
|
||||
class BuilderStatMeshTiled : public BuilderStatMesh
|
||||
{
|
||||
protected:
|
||||
|
||||
@@ -31,6 +31,7 @@ protected:
|
||||
Tile* tiles;
|
||||
};
|
||||
|
||||
bool m_measurePerTileTimings;
|
||||
bool m_keepInterResults;
|
||||
float m_tileSize;
|
||||
rcBuildTimes m_buildTimes;
|
||||
@@ -39,6 +40,12 @@ protected:
|
||||
rcPolyMesh* m_polyMesh;
|
||||
rcConfig m_cfg;
|
||||
TileSet* m_tileSet;
|
||||
|
||||
static const int MAX_STAT_BUCKETS = 1000;
|
||||
int m_statPolysPerTile[MAX_STAT_BUCKETS];
|
||||
int m_statPolysPerTileSamples;
|
||||
int m_statTimePerTile[MAX_STAT_BUCKETS];
|
||||
int m_statTimePerTileSamples;
|
||||
|
||||
|
||||
enum DrawMode
|
||||
@@ -66,8 +73,8 @@ protected:
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
BuilderStatMeshTiling();
|
||||
virtual ~BuilderStatMeshTiling();
|
||||
BuilderStatMeshTiled();
|
||||
virtual ~BuilderStatMeshTiled();
|
||||
|
||||
virtual void handleSettings();
|
||||
virtual void handleDebugMode();
|
||||
113
RecastDemo/Include/BuilderTiledMesh.h
Normal file
113
RecastDemo/Include/BuilderTiledMesh.h
Normal file
@@ -0,0 +1,113 @@
|
||||
#ifndef RECASTBUILDERTILEDMESH_H
|
||||
#define RECASTBUILDERTILEDMESH_H
|
||||
|
||||
#include "Builder.h"
|
||||
#include "DetourTiledNavMesh.h"
|
||||
#include "Recast.h"
|
||||
#include "RecastLog.h"
|
||||
#include "ChunkyTriMesh.h"
|
||||
|
||||
class BuilderTiledMesh : public Builder
|
||||
{
|
||||
protected:
|
||||
|
||||
bool m_keepInterResults;
|
||||
rcBuildTimes m_buildTimes;
|
||||
|
||||
dtTiledNavMesh* m_navMesh;
|
||||
rcChunkyTriMesh* m_chunkyMesh;
|
||||
unsigned char* m_triflags;
|
||||
rcHeightfield* m_solid;
|
||||
rcCompactHeightfield* m_chf;
|
||||
rcContourSet* m_cset;
|
||||
rcPolyMesh* m_polyMesh;
|
||||
rcConfig m_cfg;
|
||||
|
||||
float m_tileSize;
|
||||
|
||||
float m_spos[3];
|
||||
float m_epos[3];
|
||||
bool m_sposSet;
|
||||
bool m_eposSet;
|
||||
|
||||
float m_tileCol[4];
|
||||
float m_tileBmin[3];
|
||||
float m_tileBmax[3];
|
||||
float m_tileBuildTime;
|
||||
int m_tileTriCount;
|
||||
|
||||
enum ToolMode
|
||||
{
|
||||
TOOLMODE_CREATE_TILES,
|
||||
TOOLMODE_PATHFIND,
|
||||
TOOLMODE_RAYCAST,
|
||||
TOOLMODE_DISTANCE_TO_WALL,
|
||||
TOOLMODE_FIND_POLYS_AROUND,
|
||||
};
|
||||
|
||||
dtTilePolyRef m_startRef;
|
||||
dtTilePolyRef m_endRef;
|
||||
float m_polyPickExt[3];
|
||||
|
||||
static const int MAX_POLYS = 256;
|
||||
|
||||
dtTilePolyRef m_polys[MAX_POLYS];
|
||||
dtTilePolyRef m_parent[MAX_POLYS];
|
||||
int m_npolys;
|
||||
float m_straightPath[MAX_POLYS*3];
|
||||
int m_nstraightPath;
|
||||
float m_hitPos[3];
|
||||
float m_hitNormal[3];
|
||||
float m_distanceToWall;
|
||||
|
||||
ToolMode m_toolMode;
|
||||
|
||||
void toolRecalc();
|
||||
|
||||
/* static const int MAX_POLYS = 256;
|
||||
|
||||
dtPolyRef m_startRef;
|
||||
dtPolyRef m_endRef;
|
||||
dtPolyRef m_polys[MAX_POLYS];
|
||||
dtPolyRef m_parent[MAX_POLYS];
|
||||
int m_npolys;
|
||||
float m_straightPath[MAX_POLYS*3];
|
||||
int m_nstraightPath;
|
||||
float m_polyPickExt[3];
|
||||
|
||||
float m_spos[3];
|
||||
float m_epos[3];
|
||||
float m_hitPos[3];
|
||||
float m_hitNormal[3];
|
||||
float m_distanceToWall;
|
||||
bool m_sposSet;
|
||||
bool m_eposSet;*/
|
||||
|
||||
void buildTile(const float* pos);
|
||||
void removeTile(const float* pos);
|
||||
|
||||
unsigned char* buildTileMesh(const float* bmin, const float* bmax, int& dataSize);
|
||||
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
BuilderTiledMesh();
|
||||
virtual ~BuilderTiledMesh();
|
||||
|
||||
virtual void handleSettings();
|
||||
virtual void handleTools();
|
||||
virtual void handleDebugMode();
|
||||
|
||||
virtual void setToolStartPos(const float* p);
|
||||
virtual void setToolEndPos(const float* p);
|
||||
|
||||
virtual void handleRender();
|
||||
virtual void handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view);
|
||||
virtual void handleMeshChanged(const float* verts, int nverts,
|
||||
const int* tris, const float* trinorms, int ntris,
|
||||
const float* bmin, const float* bmax);
|
||||
virtual bool handleBuild();
|
||||
};
|
||||
|
||||
|
||||
#endif // RECASTBUILDERTILEDMESH_H
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "imgui.h"
|
||||
#include "glfont.h"
|
||||
#include "Builder.h"
|
||||
#include "BuilderStatMeshTiling.h"
|
||||
#include "BuilderStatMeshTiled.h"
|
||||
#include "Recast.h"
|
||||
#include "RecastTimer.h"
|
||||
#include "RecastDebugDraw.h"
|
||||
@@ -19,22 +19,25 @@
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
BuilderStatMeshTiling::BuilderStatMeshTiling() :
|
||||
BuilderStatMeshTiled::BuilderStatMeshTiled() :
|
||||
m_keepInterResults(false),
|
||||
m_measurePerTileTimings(false),
|
||||
m_tileSize(64),
|
||||
m_chunkyMesh(0),
|
||||
m_tileSet(0),
|
||||
m_polyMesh(0),
|
||||
m_drawMode(DRAWMODE_NAVMESH)
|
||||
m_drawMode(DRAWMODE_NAVMESH),
|
||||
m_statTimePerTileSamples(0),
|
||||
m_statPolysPerTileSamples(0)
|
||||
{
|
||||
}
|
||||
|
||||
BuilderStatMeshTiling::~BuilderStatMeshTiling()
|
||||
BuilderStatMeshTiled::~BuilderStatMeshTiled()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiling::cleanup()
|
||||
void BuilderStatMeshTiled::cleanup()
|
||||
{
|
||||
delete m_chunkyMesh;
|
||||
m_chunkyMesh = 0;
|
||||
@@ -43,9 +46,11 @@ void BuilderStatMeshTiling::cleanup()
|
||||
delete m_polyMesh;
|
||||
m_polyMesh = 0;
|
||||
toolCleanup();
|
||||
m_statTimePerTileSamples = 0;
|
||||
m_statPolysPerTileSamples = 0;
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiling::handleSettings()
|
||||
void BuilderStatMeshTiled::handleSettings()
|
||||
{
|
||||
Builder::handleCommonSettings();
|
||||
|
||||
@@ -64,11 +69,13 @@ void BuilderStatMeshTiling::handleSettings()
|
||||
imguiSeparator();
|
||||
if (imguiCheck(GENID, "Keep Itermediate Results", m_keepInterResults))
|
||||
m_keepInterResults = !m_keepInterResults;
|
||||
if (imguiCheck(GENID, "Measure Per Tile Timings", m_measurePerTileTimings))
|
||||
m_measurePerTileTimings = !m_measurePerTileTimings;
|
||||
|
||||
imguiSeparator();
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiling::handleDebugMode()
|
||||
void BuilderStatMeshTiled::handleDebugMode()
|
||||
{
|
||||
// Check which modes are valid.
|
||||
bool valid[MAX_DRAWMODE];
|
||||
@@ -156,7 +163,7 @@ void BuilderStatMeshTiling::handleDebugMode()
|
||||
}
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiling::handleRender()
|
||||
void BuilderStatMeshTiled::handleRender()
|
||||
{
|
||||
if (!m_verts || !m_tris || !m_trinorms)
|
||||
return;
|
||||
@@ -352,21 +359,152 @@ void BuilderStatMeshTiling::handleRender()
|
||||
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiling::handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
|
||||
static float nicenum(float x, int round)
|
||||
{
|
||||
toolRenderOverlay(font, proj, model, view);
|
||||
float expv = floorf(log10f(x));
|
||||
float f = x / powf(10.0f, expv);
|
||||
float nf;
|
||||
if (round)
|
||||
{
|
||||
if (f < 1.5f) nf = 1.0f;
|
||||
else if (f < 3.0f) nf = 2.0f;
|
||||
else if (f < 7.0f) nf = 5.0f;
|
||||
else nf = 10.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (f <= 1.0f) nf = 1.0f;
|
||||
else if (f <= 2.0f) nf = 2.0f;
|
||||
else if (f <= 5.0f) nf = 5.0f;
|
||||
else nf = 10.0f;
|
||||
}
|
||||
return nf*powf(10.0f, expv);
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiling::handleMeshChanged(const float* verts, int nverts,
|
||||
static void drawLabels(int x, int y, int w, int h,
|
||||
int nticks, float vmin, float vmax, const char* unit, GLFont* font)
|
||||
{
|
||||
char str[8], temp[32];
|
||||
|
||||
float range = nicenum(vmax-vmin, 0);
|
||||
float d = nicenum(range/(float)(nticks-1), 1);
|
||||
float graphmin = floorf(vmin/d)*d;
|
||||
float graphmax = ceilf(vmax/d)*d;
|
||||
int nfrac = -floorf(log10f(d));
|
||||
if (nfrac < 0) nfrac = 0;
|
||||
snprintf(str, 6, "%%.%df %%s", nfrac);
|
||||
|
||||
for (float v = graphmin; v < graphmax+d/2; v += d)
|
||||
{
|
||||
int lx = x + (int)((v-vmin) / (vmax-vmin) * w);
|
||||
if (lx < 0 || lx > w) continue;
|
||||
snprintf(temp, 20, str, v, unit);
|
||||
font->drawText(lx+2, y+2, temp, GLFont::RGBA(255,255,255));
|
||||
glColor4ub(0,0,0,64);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(lx,y);
|
||||
glVertex2f(lx,y+h);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
static void drawGraph(const char* name, int x, int y, int w, int h, float sd,
|
||||
const int* samples, int n, int nsamples, const char* unit, GLFont* font)
|
||||
{
|
||||
char text[64];
|
||||
int first, last, maxval;
|
||||
first = 0;
|
||||
last = n-1;
|
||||
while (first < n && samples[first] == 0)
|
||||
first++;
|
||||
while (last >= 0 && samples[last] == 0)
|
||||
last--;
|
||||
if (first == last)
|
||||
return;
|
||||
maxval = 1;
|
||||
for (int i = first; i <= last; ++i)
|
||||
{
|
||||
if (samples[i] > maxval)
|
||||
maxval = samples[i];
|
||||
}
|
||||
const float sx = (float)w / (float)(last-first);
|
||||
const float sy = (float)h / (float)maxval;
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glColor4ub(32,32,32,64);
|
||||
glVertex2i(x,y);
|
||||
glVertex2i(x+w,y);
|
||||
glVertex2i(x+w,y+h);
|
||||
glVertex2i(x,y+h);
|
||||
glEnd();
|
||||
|
||||
glColor4ub(255,255,255,64);
|
||||
glBegin(GL_LINES);
|
||||
for (int i = 0; i <= 4; ++i)
|
||||
{
|
||||
int yy = y+i*h/4;
|
||||
glVertex2i(x,yy);
|
||||
glVertex2i(x+w,yy);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glColor4ub(0,196,255,255);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (int i = first; i <= last; ++i)
|
||||
{
|
||||
float fx = x + (i-first)*sx;
|
||||
float fy = y + samples[i]*sy;
|
||||
glVertex2f(fx,fy);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
snprintf(text,64,"%d", maxval);
|
||||
font->drawText(x+w-20+2,y+h-2-font->getLineHeight(),text,GLFont::RGBA(0,0,0));
|
||||
|
||||
font->drawText(x+2,y+h-2-font->getLineHeight(),name,GLFont::RGBA(255,255,255));
|
||||
|
||||
drawLabels(x, y, w, h, 10, first*sd, last*sd, unit, font);
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiled::handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
|
||||
{
|
||||
toolRenderOverlay(font, proj, model, view);
|
||||
|
||||
if (m_measurePerTileTimings)
|
||||
{
|
||||
if (m_statTimePerTileSamples)
|
||||
drawGraph("Build Time/Tile", 10, 10, 500, 100, 1.0f, m_statTimePerTile, MAX_STAT_BUCKETS, m_statTimePerTileSamples, "ms", font);
|
||||
|
||||
if (m_statPolysPerTileSamples)
|
||||
drawGraph("Polygons/Tile", 10, 120, 500, 100, 1.0f, m_statPolysPerTile, MAX_STAT_BUCKETS, m_statPolysPerTileSamples, "", font);
|
||||
|
||||
int validTiles = 0;
|
||||
if (m_tileSet)
|
||||
{
|
||||
for (int i = 0; i < m_tileSet->width*m_tileSet->height; ++i)
|
||||
{
|
||||
if (m_tileSet->tiles[i].buildTime > 0)
|
||||
validTiles++;
|
||||
}
|
||||
}
|
||||
char text[64];
|
||||
snprintf(text,64,"Tiles %d\n", validTiles);
|
||||
font->drawText(10, 240, text, GLFont::RGBA(255,255,255));
|
||||
}
|
||||
}
|
||||
|
||||
void BuilderStatMeshTiled::handleMeshChanged(const float* verts, int nverts,
|
||||
const int* tris, const float* trinorms, int ntris,
|
||||
const float* bmin, const float* bmax)
|
||||
{
|
||||
Builder::handleMeshChanged(verts, nverts, tris, trinorms, ntris, bmin, bmax);
|
||||
toolCleanup();
|
||||
toolReset();
|
||||
m_statTimePerTileSamples = 0;
|
||||
m_statPolysPerTileSamples = 0;
|
||||
}
|
||||
|
||||
bool BuilderStatMeshTiling::handleBuild()
|
||||
bool BuilderStatMeshTiled::handleBuild()
|
||||
{
|
||||
if (!m_verts || ! m_tris)
|
||||
{
|
||||
@@ -374,6 +512,14 @@ bool BuilderStatMeshTiling::handleBuild()
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Input mesh is not specified.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_measurePerTileTimings)
|
||||
{
|
||||
memset(m_statPolysPerTile, 0, sizeof(m_statPolysPerTile));
|
||||
memset(m_statTimePerTile, 0, sizeof(m_statTimePerTile));
|
||||
m_statPolysPerTileSamples = 0;
|
||||
m_statTimePerTileSamples = 0;
|
||||
}
|
||||
|
||||
cleanup();
|
||||
toolCleanup();
|
||||
@@ -610,6 +756,47 @@ bool BuilderStatMeshTiling::handleBuild()
|
||||
delete [] triangleFlags;
|
||||
delete solid;
|
||||
delete chf;
|
||||
|
||||
|
||||
// Some extra code to measure some per tile statistics,
|
||||
// such as build time and how many polygons there are per tile.
|
||||
if (m_measurePerTileTimings)
|
||||
{
|
||||
for (int y = 0; y < m_tileSet->height; ++y)
|
||||
{
|
||||
for (int x = 0; x < m_tileSet->width; ++x)
|
||||
{
|
||||
Tile& tile = m_tileSet->tiles[x + y*m_tileSet->width];
|
||||
|
||||
if (!tile.cset)
|
||||
continue;
|
||||
|
||||
rcTimeVal startTime = rcGetPerformanceTimer();
|
||||
rcPolyMesh* polyMesh = new rcPolyMesh;
|
||||
if (!polyMesh)
|
||||
continue;
|
||||
if (rcBuildPolyMesh(*tile.cset, m_cfg.bmin, m_cfg.bmax,
|
||||
m_cfg.cs, m_cfg.ch, m_cfg.maxVertsPerPoly, *polyMesh))
|
||||
{
|
||||
int bucket = polyMesh->npolys;
|
||||
if (bucket < 0) bucket = 0;
|
||||
if (bucket >= MAX_STAT_BUCKETS) bucket = MAX_STAT_BUCKETS-1;
|
||||
m_statPolysPerTile[bucket]++;
|
||||
m_statPolysPerTileSamples++;
|
||||
}
|
||||
delete polyMesh;
|
||||
|
||||
rcTimeVal endTime = rcGetPerformanceTimer();
|
||||
int time = tile.buildTime += rcGetDeltaTimeUsec(startTime, endTime);
|
||||
|
||||
int bucket = (time+500)/1000;
|
||||
if (bucket < 0) bucket = 0;
|
||||
if (bucket >= MAX_STAT_BUCKETS) bucket = MAX_STAT_BUCKETS-1;
|
||||
m_statTimePerTile[bucket]++;
|
||||
m_statTimePerTileSamples++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that the vertices along the tile edges match,
|
||||
// so that they can be later properly stitched together.
|
||||
871
RecastDemo/Source/BuilderTiledMesh.cpp
Normal file
871
RecastDemo/Source/BuilderTiledMesh.cpp
Normal file
@@ -0,0 +1,871 @@
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_Opengl.h"
|
||||
#include "imgui.h"
|
||||
#include "glfont.h"
|
||||
#include "Builder.h"
|
||||
#include "BuilderTiledMesh.h"
|
||||
#include "Recast.h"
|
||||
#include "RecastTimer.h"
|
||||
#include "RecastDebugDraw.h"
|
||||
#include "DetourTiledNavMesh.h"
|
||||
#include "DetourTiledNavMeshBuilder.h"
|
||||
#include "DetourDebugDraw.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
|
||||
BuilderTiledMesh::BuilderTiledMesh() :
|
||||
m_tileSize(32),
|
||||
m_navMesh(0),
|
||||
m_chunkyMesh(0),
|
||||
m_keepInterResults(true),
|
||||
m_tileBuildTime(0),
|
||||
m_triflags(0),
|
||||
m_solid(0),
|
||||
m_chf(0),
|
||||
m_cset(0),
|
||||
m_polyMesh(0),
|
||||
m_tileTriCount(0),
|
||||
m_toolMode(TOOLMODE_CREATE_TILES),
|
||||
m_startRef(0),
|
||||
m_endRef(0),
|
||||
m_npolys(0),
|
||||
m_nstraightPath(0)
|
||||
{
|
||||
resetCommonSettings();
|
||||
memset(m_tileBmin, 0, sizeof(m_tileBmin));
|
||||
memset(m_tileBmax, 0, sizeof(m_tileBmax));
|
||||
m_polyPickExt[0] = 2;
|
||||
m_polyPickExt[1] = 4;
|
||||
m_polyPickExt[2] = 2;
|
||||
}
|
||||
|
||||
BuilderTiledMesh::~BuilderTiledMesh()
|
||||
{
|
||||
cleanup();
|
||||
delete m_navMesh;
|
||||
delete m_chunkyMesh;
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::cleanup()
|
||||
{
|
||||
delete [] m_triflags;
|
||||
m_triflags = 0;
|
||||
delete m_solid;
|
||||
m_solid = 0;
|
||||
delete m_chf;
|
||||
m_chf = 0;
|
||||
delete m_cset;
|
||||
m_cset = 0;
|
||||
delete m_polyMesh;
|
||||
m_polyMesh = 0;
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::handleSettings()
|
||||
{
|
||||
Builder::handleCommonSettings();
|
||||
|
||||
imguiLabel(GENID, "Tiling");
|
||||
imguiSlider(GENID, "TileSize", &m_tileSize, 16.0f, 1024.0f, 16.0f);
|
||||
|
||||
char text[64];
|
||||
int gw = 0, gh = 0;
|
||||
rcCalcGridSize(m_bmin, m_bmax, m_cellSize, &gw, &gh);
|
||||
const int ts = (int)m_tileSize;
|
||||
const int tw = (gw + ts-1) / ts;
|
||||
const int th = (gh + ts-1) / ts;
|
||||
snprintf(text, 64, "Tiles %d x %d", tw, th);
|
||||
imguiValue(GENID, text);
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::toolRecalc()
|
||||
{
|
||||
m_startRef = 0;
|
||||
if (m_sposSet)
|
||||
m_startRef = m_navMesh->findNearestPoly(m_spos, m_polyPickExt);
|
||||
|
||||
m_endRef = 0;
|
||||
if (m_eposSet)
|
||||
m_endRef = m_navMesh->findNearestPoly(m_epos, m_polyPickExt);
|
||||
|
||||
// if (m_eposSet)
|
||||
// m_npolys = m_navMesh->queryPolygons(m_epos, m_polyPickExt, m_polys, MAX_POLYS);
|
||||
|
||||
/* if (m_startRef && m_endRef)
|
||||
{
|
||||
m_npolys = m_navMesh->findPath(m_startRef, m_endRef, m_polys, MAX_POLYS);
|
||||
if (m_npolys)
|
||||
m_nstraightPath = m_navMesh->findStraightPath(m_spos, m_epos, m_polys, m_npolys, m_straightPath, MAX_POLYS);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_npolys = 0;
|
||||
m_nstraightPath = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
if (m_toolMode == TOOLMODE_PATHFIND)
|
||||
{
|
||||
if (m_sposSet && m_eposSet && m_startRef && m_endRef)
|
||||
{
|
||||
m_npolys = m_navMesh->findPath(m_startRef, m_endRef, m_polys, MAX_POLYS);
|
||||
if (m_npolys)
|
||||
m_nstraightPath = m_navMesh->findStraightPath(m_spos, m_epos, m_polys, m_npolys, m_straightPath, MAX_POLYS);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_npolys = 0;
|
||||
m_nstraightPath = 0;
|
||||
}
|
||||
}
|
||||
else if (m_toolMode == TOOLMODE_RAYCAST)
|
||||
{
|
||||
m_nstraightPath = 0;
|
||||
if (m_sposSet && m_eposSet && m_startRef)
|
||||
{
|
||||
float t = 0;
|
||||
m_npolys = 0;
|
||||
m_nstraightPath = 2;
|
||||
m_straightPath[0] = m_spos[0];
|
||||
m_straightPath[1] = m_spos[1];
|
||||
m_straightPath[2] = m_spos[2];
|
||||
m_npolys = m_navMesh->raycast(m_startRef, m_spos, m_epos, t, m_polys, MAX_POLYS);
|
||||
if (m_npolys && t < 1)
|
||||
{
|
||||
m_straightPath[3] = m_spos[0] + (m_epos[0] - m_spos[0]) * t;
|
||||
m_straightPath[4] = m_spos[1] + (m_epos[1] - m_spos[1]) * t;
|
||||
m_straightPath[5] = m_spos[2] + (m_epos[2] - m_spos[2]) * t;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_straightPath[3] = m_epos[0];
|
||||
m_straightPath[4] = m_epos[1];
|
||||
m_straightPath[5] = m_epos[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_toolMode == TOOLMODE_DISTANCE_TO_WALL)
|
||||
{
|
||||
m_distanceToWall = 0;
|
||||
if (m_sposSet && m_startRef)
|
||||
m_distanceToWall = m_navMesh->findDistanceToWall(m_startRef, m_spos, 100.0f, m_hitPos, m_hitNormal);
|
||||
}
|
||||
else if (m_toolMode == TOOLMODE_FIND_POLYS_AROUND)
|
||||
{
|
||||
if (m_sposSet && m_startRef && m_eposSet)
|
||||
{
|
||||
const float dx = m_epos[0] - m_spos[0];
|
||||
const float dz = m_epos[2] - m_spos[2];
|
||||
float dist = sqrtf(dx*dx + dz*dz);
|
||||
m_npolys = m_navMesh->findPolysAround(m_startRef, m_spos, dist, m_polys, m_parent, 0, 0, MAX_POLYS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::handleTools()
|
||||
{
|
||||
if (imguiCheck(GENID, "Create Tiles", m_toolMode == TOOLMODE_CREATE_TILES))
|
||||
{
|
||||
m_toolMode = TOOLMODE_CREATE_TILES;
|
||||
toolRecalc();
|
||||
}
|
||||
if (imguiCheck(GENID, "Pathfind", m_toolMode == TOOLMODE_PATHFIND))
|
||||
{
|
||||
m_toolMode = TOOLMODE_PATHFIND;
|
||||
toolRecalc();
|
||||
}
|
||||
if (imguiCheck(GENID, "Distance to Wall", m_toolMode == TOOLMODE_DISTANCE_TO_WALL))
|
||||
{
|
||||
m_toolMode = TOOLMODE_DISTANCE_TO_WALL;
|
||||
toolRecalc();
|
||||
}
|
||||
if (imguiCheck(GENID, "Raycast", m_toolMode == TOOLMODE_RAYCAST))
|
||||
{
|
||||
m_toolMode = TOOLMODE_RAYCAST;
|
||||
toolRecalc();
|
||||
}
|
||||
if (imguiCheck(GENID, "Find Polys Around", m_toolMode == TOOLMODE_FIND_POLYS_AROUND))
|
||||
{
|
||||
m_toolMode = TOOLMODE_FIND_POLYS_AROUND;
|
||||
toolRecalc();
|
||||
}
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::handleDebugMode()
|
||||
{
|
||||
}
|
||||
|
||||
static void getPolyCenter(dtTiledNavMesh* navMesh, dtTilePolyRef ref, float* center)
|
||||
{
|
||||
const dtTilePoly* p = navMesh->getPolyByRef(ref);
|
||||
if (!p) return;
|
||||
const float* verts = navMesh->getPolyVertsByRef(ref);
|
||||
center[0] = 0;
|
||||
center[1] = 0;
|
||||
center[2] = 0;
|
||||
for (int i = 0; i < (int)p->nv; ++i)
|
||||
{
|
||||
const float* v = &verts[p->v[i]*3];
|
||||
center[0] += v[0];
|
||||
center[1] += v[1];
|
||||
center[2] += v[2];
|
||||
}
|
||||
const float s = 1.0f / p->nv;
|
||||
center[0] *= s;
|
||||
center[1] *= s;
|
||||
center[2] *= s;
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::handleRender()
|
||||
{
|
||||
if (!m_verts || !m_tris || !m_trinorms)
|
||||
return;
|
||||
|
||||
// Draw mesh
|
||||
rcDebugDrawMesh(m_verts, m_nverts, m_tris, m_trinorms, m_ntris, 0);
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
// Draw bounds
|
||||
float col[4] = {1,1,1,0.5f};
|
||||
rcDebugDrawBoxWire(m_bmin[0],m_bmin[1],m_bmin[2], m_bmax[0],m_bmax[1],m_bmax[2], col);
|
||||
|
||||
// Tiling grid.
|
||||
const int ts = (int)m_tileSize;
|
||||
int gw = 0, gh = 0;
|
||||
rcCalcGridSize(m_bmin, m_bmax, m_cellSize, &gw, &gh);
|
||||
int tw = (gw + ts-1) / ts;
|
||||
int th = (gh + ts-1) / ts;
|
||||
const float s = ts*m_cellSize;
|
||||
glBegin(GL_LINES);
|
||||
glColor4ub(0,0,0,64);
|
||||
for (int y = 0; y < th; ++y)
|
||||
{
|
||||
for (int x = 0; x < tw; ++x)
|
||||
{
|
||||
float fx, fy, fz;
|
||||
fx = m_bmin[0] + x*s;
|
||||
fy = m_bmin[1];
|
||||
fz = m_bmin[2] + y*s;
|
||||
|
||||
glVertex3f(fx,fy,fz);
|
||||
glVertex3f(fx+s,fy,fz);
|
||||
glVertex3f(fx,fy,fz);
|
||||
glVertex3f(fx,fy,fz+s);
|
||||
|
||||
if (x+1 >= tw)
|
||||
{
|
||||
glVertex3f(fx+s,fy,fz);
|
||||
glVertex3f(fx+s,fy,fz+s);
|
||||
}
|
||||
if (y+1 >= th)
|
||||
{
|
||||
glVertex3f(fx,fy,fz+s);
|
||||
glVertex3f(fx+s,fy,fz+s);
|
||||
}
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
// Draw active tile
|
||||
rcDebugDrawBoxWire(m_tileBmin[0],m_tileBmin[1],m_tileBmin[2], m_tileBmax[0],m_tileBmax[1],m_tileBmax[2], m_tileCol);
|
||||
|
||||
/* if (m_eposSet)
|
||||
{
|
||||
col[0] = 1; col[1] = 1; col[2] = 1; col[3] = 1;
|
||||
const float s = 0.2f;
|
||||
rcDebugDrawBoxWire(m_epos[0]-s,m_epos[1]-s,m_epos[2]-s, m_epos[0]+s,m_epos[1]+s,m_epos[2]+s, col);
|
||||
}*/
|
||||
|
||||
/* if (m_polyMesh)
|
||||
rcDebugDrawPolyMesh(*m_polyMesh);*/
|
||||
|
||||
if (m_navMesh)
|
||||
dtDebugDrawTiledNavMesh(m_navMesh);
|
||||
|
||||
if (m_sposSet)
|
||||
{
|
||||
const float s = 0.5f;
|
||||
glColor4ub(128,0,0,255);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(m_spos[0]-s,m_spos[1],m_spos[2]);
|
||||
glVertex3f(m_spos[0]+s,m_spos[1],m_spos[2]);
|
||||
glVertex3f(m_spos[0],m_spos[1]-s,m_spos[2]);
|
||||
glVertex3f(m_spos[0],m_spos[1]+s,m_spos[2]);
|
||||
glVertex3f(m_spos[0],m_spos[1],m_spos[2]-s);
|
||||
glVertex3f(m_spos[0],m_spos[1],m_spos[2]+s);
|
||||
glEnd();
|
||||
}
|
||||
if (m_eposSet)
|
||||
{
|
||||
const float s = 0.5f;
|
||||
glColor4ub(0,128,0,255);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(m_epos[0]-s,m_epos[1],m_epos[2]);
|
||||
glVertex3f(m_epos[0]+s,m_epos[1],m_epos[2]);
|
||||
glVertex3f(m_epos[0],m_epos[1]-s,m_epos[2]);
|
||||
glVertex3f(m_epos[0],m_epos[1]+s,m_epos[2]);
|
||||
glVertex3f(m_epos[0],m_epos[1],m_epos[2]-s);
|
||||
glVertex3f(m_epos[0],m_epos[1],m_epos[2]+s);
|
||||
glEnd();
|
||||
col[0] = 0; col[1] = 1; col[2] = 0; col[3] = 1;
|
||||
rcDebugDrawBoxWire(m_epos[0]-m_polyPickExt[0],m_epos[1]-m_polyPickExt[1],m_epos[2]-m_polyPickExt[2],
|
||||
m_epos[0]+m_polyPickExt[0],m_epos[1]+m_polyPickExt[1],m_epos[2]+m_polyPickExt[2], col);
|
||||
}
|
||||
|
||||
/* if (m_startRef && m_navMesh)
|
||||
{
|
||||
col[0] = 1; col[1] = 0; col[2] = 0; col[3] = 1;
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_startRef, col);
|
||||
}
|
||||
if (m_endRef && m_navMesh)
|
||||
{
|
||||
col[0] = 0; col[1] = 1; col[2] = 0; col[3] = 1;
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_endRef, col);
|
||||
dtTilePolyRef nei[DT_TILE_VERTS_PER_POLYGON*2];
|
||||
int nn = m_navMesh->getPolyNeighbours(m_endRef, nei, DT_TILE_VERTS_PER_POLYGON*2);
|
||||
if (nn)
|
||||
{
|
||||
col[0] = 0; col[1] = 0; col[2] = 1; col[3] = 1;
|
||||
for (int i = 0; i < nn; ++i)
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, nei[i], col);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_npolys && m_navMesh)
|
||||
{
|
||||
col[0] = 0; col[1] = 0; col[2] = 0; col[3] = 1;
|
||||
for (int i = 0; i < m_npolys; ++i)
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_polys[i], col);
|
||||
}
|
||||
if (m_nstraightPath && m_navMesh)
|
||||
{
|
||||
glColor4ub(128,16,0,220);
|
||||
glLineWidth(3.0f);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (int i = 0; i < m_nstraightPath; ++i)
|
||||
glVertex3f(m_straightPath[i*3], m_straightPath[i*3+1]+0.4f, m_straightPath[i*3+2]);
|
||||
glEnd();
|
||||
glLineWidth(1.0f);
|
||||
glPointSize(4.0f);
|
||||
glBegin(GL_POINTS);
|
||||
for (int i = 0; i < m_nstraightPath; ++i)
|
||||
glVertex3f(m_straightPath[i*3], m_straightPath[i*3+1]+0.4f, m_straightPath[i*3+2]);
|
||||
glEnd();
|
||||
glPointSize(1.0f);
|
||||
}*/
|
||||
|
||||
|
||||
static const float startCol[4] = { 0.5f, 0.1f, 0.0f, 0.75f };
|
||||
static const float endCol[4] = { 0.2f, 0.4f, 0.0f, 0.75f };
|
||||
static const float pathCol[4] = {0,0,0,0.25f};
|
||||
|
||||
if (m_toolMode == TOOLMODE_PATHFIND)
|
||||
{
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_startRef, startCol);
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_endRef, endCol);
|
||||
|
||||
if (m_npolys)
|
||||
{
|
||||
for (int i = 1; i < m_npolys-1; ++i)
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_polys[i], pathCol);
|
||||
}
|
||||
if (m_nstraightPath)
|
||||
{
|
||||
glColor4ub(128,16,0,220);
|
||||
glLineWidth(3.0f);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (int i = 0; i < m_nstraightPath; ++i)
|
||||
glVertex3f(m_straightPath[i*3], m_straightPath[i*3+1]+0.4f, m_straightPath[i*3+2]);
|
||||
glEnd();
|
||||
glLineWidth(1.0f);
|
||||
glPointSize(4.0f);
|
||||
glBegin(GL_POINTS);
|
||||
for (int i = 0; i < m_nstraightPath; ++i)
|
||||
glVertex3f(m_straightPath[i*3], m_straightPath[i*3+1]+0.4f, m_straightPath[i*3+2]);
|
||||
glEnd();
|
||||
glPointSize(1.0f);
|
||||
}
|
||||
}
|
||||
else if (m_toolMode == TOOLMODE_RAYCAST)
|
||||
{
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_startRef, startCol);
|
||||
|
||||
if (m_nstraightPath)
|
||||
{
|
||||
for (int i = 1; i < m_npolys; ++i)
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_polys[i], pathCol);
|
||||
|
||||
glColor4ub(128,16,0,220);
|
||||
glLineWidth(3.0f);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (int i = 0; i < m_nstraightPath; ++i)
|
||||
glVertex3f(m_straightPath[i*3], m_straightPath[i*3+1]+0.4f, m_straightPath[i*3+2]);
|
||||
glEnd();
|
||||
glLineWidth(1.0f);
|
||||
glPointSize(4.0f);
|
||||
glBegin(GL_POINTS);
|
||||
for (int i = 0; i < m_nstraightPath; ++i)
|
||||
glVertex3f(m_straightPath[i*3], m_straightPath[i*3+1]+0.4f, m_straightPath[i*3+2]);
|
||||
glEnd();
|
||||
glPointSize(1.0f);
|
||||
}
|
||||
}
|
||||
else if (m_toolMode == TOOLMODE_DISTANCE_TO_WALL)
|
||||
{
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_startRef, startCol);
|
||||
const float col[4] = {1,1,1,0.5f};
|
||||
rcDebugDrawCylinderWire(m_spos[0]-m_distanceToWall, m_spos[1]+0.02f, m_spos[2]-m_distanceToWall,
|
||||
m_spos[0]+m_distanceToWall, m_spos[1]+m_agentHeight, m_spos[2]+m_distanceToWall, col);
|
||||
glLineWidth(3.0f);
|
||||
glColor4fv(col);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(m_hitPos[0], m_hitPos[1] + 0.02f, m_hitPos[2]);
|
||||
glVertex3f(m_hitPos[0], m_hitPos[1] + m_agentHeight, m_hitPos[2]);
|
||||
glEnd();
|
||||
glLineWidth(1.0f);
|
||||
}
|
||||
else if (m_toolMode == TOOLMODE_FIND_POLYS_AROUND)
|
||||
{
|
||||
glLineWidth(2.0f);
|
||||
for (int i = 0; i < m_npolys; ++i)
|
||||
{
|
||||
dtDebugDrawTiledNavMeshPoly(m_navMesh, m_polys[i], pathCol);
|
||||
if (m_parent[i])
|
||||
{
|
||||
float p0[3], p1[3];
|
||||
getPolyCenter(m_navMesh, m_polys[i], p0);
|
||||
getPolyCenter(m_navMesh, m_parent[i], p1);
|
||||
glColor4ub(0,0,0,128);
|
||||
rcDrawArc(p0, p1);
|
||||
}
|
||||
}
|
||||
glLineWidth(1.0f);
|
||||
|
||||
const float dx = m_epos[0] - m_spos[0];
|
||||
const float dz = m_epos[2] - m_spos[2];
|
||||
float dist = sqrtf(dx*dx + dz*dz);
|
||||
const float col[4] = {1,1,1,0.5f};
|
||||
rcDebugDrawCylinderWire(m_spos[0]-dist, m_spos[1]+0.02f, m_spos[2]-dist,
|
||||
m_spos[0]+dist, m_spos[1]+m_agentHeight, m_spos[2]+dist, col);
|
||||
}
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::handleRenderOverlay(class GLFont* font, double* proj, double* model, int* view)
|
||||
{
|
||||
GLdouble x, y, z;
|
||||
|
||||
// Draw start and end point labels
|
||||
if (m_tileBuildTime > 0.0f && gluProject((GLdouble)(m_tileBmin[0]+m_tileBmax[0])/2, (GLdouble)(m_tileBmin[1]+m_tileBmax[1])/2, (GLdouble)(m_tileBmin[2]+m_tileBmax[2])/2,
|
||||
model, proj, view, &x, &y, &z))
|
||||
{
|
||||
char text[32];
|
||||
snprintf(text,32,"%.3f ms %d Tris", m_tileBuildTime, m_tileTriCount);
|
||||
const float len = font->getTextLength(text);
|
||||
font->drawText((float)x - len/2, (float)y-font->getLineHeight(), text, GLFont::RGBA(0,0,0,220));
|
||||
}
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::handleMeshChanged(const float* verts, int nverts,
|
||||
const int* tris, const float* trinorms, int ntris,
|
||||
const float* bmin, const float* bmax)
|
||||
{
|
||||
m_verts = verts;
|
||||
m_nverts = nverts;
|
||||
m_tris = tris;
|
||||
m_trinorms = trinorms;
|
||||
m_ntris = ntris;
|
||||
vcopy(m_bmin, bmin);
|
||||
vcopy(m_bmax, bmax);
|
||||
|
||||
delete m_chunkyMesh;
|
||||
m_chunkyMesh = 0;
|
||||
delete m_navMesh;
|
||||
m_navMesh = 0;
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::setToolStartPos(const float* p)
|
||||
{
|
||||
m_sposSet = true;
|
||||
vcopy(m_spos, p);
|
||||
|
||||
if (m_toolMode == TOOLMODE_CREATE_TILES)
|
||||
removeTile(m_spos);
|
||||
else
|
||||
toolRecalc();
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::setToolEndPos(const float* p)
|
||||
{
|
||||
if (!m_navMesh)
|
||||
return;
|
||||
|
||||
m_eposSet = true;
|
||||
vcopy(m_epos, p);
|
||||
|
||||
if (m_toolMode == TOOLMODE_CREATE_TILES)
|
||||
buildTile(m_epos);
|
||||
else
|
||||
toolRecalc();
|
||||
}
|
||||
|
||||
bool BuilderTiledMesh::handleBuild()
|
||||
{
|
||||
if (!m_verts || !m_tris)
|
||||
return false;
|
||||
|
||||
delete m_navMesh;
|
||||
m_navMesh = new dtTiledNavMesh;
|
||||
if (!m_navMesh)
|
||||
return false;
|
||||
if (!m_navMesh->init(m_bmin, m_tileSize*m_cellSize, m_agentMaxClimb*m_cellHeight))
|
||||
return false;
|
||||
|
||||
// Build chunky mesh.
|
||||
m_chunkyMesh = new rcChunkyTriMesh;
|
||||
if (!m_chunkyMesh)
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildTiledNavigation: Out of memory 'm_chunkyMesh'.");
|
||||
return false;
|
||||
}
|
||||
if (!rcCreateChunkyTriMesh(m_verts, m_tris, m_ntris, 256, m_chunkyMesh))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildTiledNavigation: Could not build chunky mesh.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::buildTile(const float* pos)
|
||||
{
|
||||
if (!m_navMesh)
|
||||
return;
|
||||
|
||||
const float ts = m_tileSize*m_cellSize;
|
||||
const int tx = (int)floorf((pos[0]-m_bmin[0]) / ts);
|
||||
const int ty = (int)floorf((pos[2]-m_bmin[2]) / ts);
|
||||
if (tx < 0 || ty < 0)
|
||||
return;
|
||||
|
||||
m_tileBmin[0] = m_bmin[0] + tx*ts;
|
||||
m_tileBmin[1] = m_bmin[1];
|
||||
m_tileBmin[2] = m_bmin[2] + ty*ts;
|
||||
|
||||
m_tileBmax[0] = m_bmin[0] + (tx+1)*ts;
|
||||
m_tileBmax[1] = m_bmax[1];
|
||||
m_tileBmax[2] = m_bmin[2] + (ty+1)*ts;
|
||||
|
||||
m_tileCol[0] = 0.2f; m_tileCol[1] = 1; m_tileCol[2] = 0; m_tileCol[3] = 1;
|
||||
|
||||
int dataSize = 0;
|
||||
unsigned char* data = buildTileMesh(m_tileBmin, m_tileBmax, dataSize);
|
||||
|
||||
if (data)
|
||||
m_navMesh->addTile(tx,ty,data,dataSize);
|
||||
}
|
||||
|
||||
void BuilderTiledMesh::removeTile(const float* pos)
|
||||
{
|
||||
if (!m_navMesh)
|
||||
return;
|
||||
|
||||
const float ts = m_tileSize*m_cellSize;
|
||||
const int tx = (int)floorf((pos[0]-m_bmin[0]) / ts);
|
||||
const int ty = (int)floorf((pos[2]-m_bmin[2]) / ts);
|
||||
|
||||
m_tileBmin[0] = m_bmin[0] + tx*ts;
|
||||
m_tileBmin[1] = m_bmin[1];
|
||||
m_tileBmin[2] = m_bmin[2] + ty*ts;
|
||||
|
||||
m_tileBmax[0] = m_bmin[0] + (tx+1)*ts;
|
||||
m_tileBmax[1] = m_bmax[1];
|
||||
m_tileBmax[2] = m_bmin[2] + (ty+1)*ts;
|
||||
|
||||
m_tileCol[0] = 1; m_tileCol[1] = 0; m_tileCol[2] = 0; m_tileCol[3] = 1;
|
||||
|
||||
m_navMesh->removeTile(tx,ty);
|
||||
}
|
||||
|
||||
unsigned char* BuilderTiledMesh::buildTileMesh(const float* bmin, const float* bmax, int& dataSize)
|
||||
{
|
||||
if (!m_verts || ! m_tris)
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Input mesh is not specified.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cleanup();
|
||||
|
||||
// Init build configuration from GUI
|
||||
memset(&m_cfg, 0, sizeof(m_cfg));
|
||||
m_cfg.cs = m_cellSize;
|
||||
m_cfg.ch = m_cellHeight;
|
||||
m_cfg.walkableSlopeAngle = m_agentMaxSlope;
|
||||
m_cfg.walkableHeight = (int)ceilf(m_agentHeight / m_cfg.ch);
|
||||
m_cfg.walkableClimb = (int)ceilf(m_agentMaxClimb / m_cfg.ch);
|
||||
m_cfg.walkableRadius = (int)ceilf(m_agentRadius / m_cfg.cs);
|
||||
m_cfg.maxEdgeLen = (int)(m_edgeMaxLen / m_cellSize);
|
||||
m_cfg.maxSimplificationError = m_edgeMaxError;
|
||||
m_cfg.minRegionSize = (int)rcSqr(m_regionMinSize);
|
||||
m_cfg.mergeRegionSize = (int)rcSqr(m_regionMergeSize);
|
||||
m_cfg.maxVertsPerPoly = (int)m_vertsPerPoly;
|
||||
m_cfg.tileSize = (int)m_tileSize;
|
||||
m_cfg.borderSize = m_cfg.walkableRadius*2 + 2; // Reserve enough padding.
|
||||
m_cfg.width = m_cfg.tileSize + m_cfg.borderSize*2;
|
||||
m_cfg.height = m_cfg.tileSize + m_cfg.borderSize*2;
|
||||
|
||||
/* if (m_cfg.maxVertsPerPoly == DT_VERTS_PER_POLYGON)
|
||||
m_drawMode = DRAWMODE_NAVMESH;
|
||||
else
|
||||
m_drawMode = DRAWMODE_POLYMESH;*/
|
||||
|
||||
vcopy(m_cfg.bmin, bmin);
|
||||
vcopy(m_cfg.bmax, bmax);
|
||||
m_cfg.bmin[0] -= m_cfg.borderSize*m_cfg.cs;
|
||||
m_cfg.bmin[2] -= m_cfg.borderSize*m_cfg.cs;
|
||||
m_cfg.bmax[0] += m_cfg.borderSize*m_cfg.cs;
|
||||
m_cfg.bmax[2] += m_cfg.borderSize*m_cfg.cs;
|
||||
|
||||
// Reset build times gathering.
|
||||
memset(&m_buildTimes, 0, sizeof(m_buildTimes));
|
||||
rcSetBuildTimes(&m_buildTimes);
|
||||
|
||||
// Start the build process.
|
||||
rcTimeVal totStartTime = rcGetPerformanceTimer();
|
||||
|
||||
if (rcGetLog())
|
||||
{
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Building navigation:");
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - %d x %d cells", m_cfg.width, m_cfg.height);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - %.1fK verts, %.1fK tris", m_nverts/1000.0f, m_ntris/1000.0f);
|
||||
}
|
||||
|
||||
// Allocate voxel heighfield where we rasterize our input data to.
|
||||
m_solid = new rcHeightfield;
|
||||
if (!m_solid)
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Out of memory 'solid'.");
|
||||
return 0;
|
||||
}
|
||||
if (!rcCreateHeightfield(*m_solid, m_cfg.width, m_cfg.height, m_cfg.bmin, m_cfg.bmax, m_cfg.cs, m_cfg.ch))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Could not create solid heightfield.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Allocate array that can hold triangle flags.
|
||||
// If you have multiple meshes you need to process, allocate
|
||||
// and array which can hold the max number of triangles you need to process.
|
||||
m_triflags = new unsigned char[m_chunkyMesh->maxTrisPerChunk];
|
||||
if (!m_triflags)
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Out of memory 'triangleFlags' (%d).", m_chunkyMesh->maxTrisPerChunk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
float tbmin[2], tbmax[2];
|
||||
tbmin[0] = m_cfg.bmin[0];
|
||||
tbmin[1] = m_cfg.bmin[2];
|
||||
tbmax[0] = m_cfg.bmax[0];
|
||||
tbmax[1] = m_cfg.bmax[2];
|
||||
int cid[256];// TODO: Make grow when returning too many items.
|
||||
const int ncid = rcGetChunksInRect(m_chunkyMesh, tbmin, tbmax, cid, 256);
|
||||
if (!ncid)
|
||||
return 0;
|
||||
|
||||
m_tileTriCount = 0;
|
||||
|
||||
for (int i = 0; i < ncid; ++i)
|
||||
{
|
||||
const rcChunkyTriMeshNode& node = m_chunkyMesh->nodes[cid[i]];
|
||||
const int* tris = &m_chunkyMesh->tris[node.i*3];
|
||||
const int ntris = node.n;
|
||||
|
||||
m_tileTriCount += ntris;
|
||||
|
||||
memset(m_triflags, 0, ntris*sizeof(unsigned char));
|
||||
rcMarkWalkableTriangles(m_cfg.walkableSlopeAngle,
|
||||
m_verts, m_nverts, tris, ntris, m_triflags);
|
||||
|
||||
rcRasterizeTriangles(m_verts, m_nverts, tris, m_triflags, ntris, *m_solid);
|
||||
}
|
||||
|
||||
if (!m_keepInterResults)
|
||||
{
|
||||
delete [] m_triflags;
|
||||
m_triflags = 0;
|
||||
}
|
||||
|
||||
// Once all geoemtry is rasterized, we do initial pass of filtering to
|
||||
// remove unwanted overhangs caused by the conservative rasterization
|
||||
// as well as filter spans where the character cannot possibly stand.
|
||||
rcFilterLedgeSpans(m_cfg.walkableHeight, m_cfg.walkableClimb, *m_solid);
|
||||
rcFilterWalkableLowHeightSpans(m_cfg.walkableHeight, *m_solid);
|
||||
|
||||
// Compact the heightfield so that it is faster to handle from now on.
|
||||
// This will result more cache coherent data as well as the neighbours
|
||||
// between walkable cells will be calculated.
|
||||
m_chf = new rcCompactHeightfield;
|
||||
if (!m_chf)
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Out of memory 'chf'.");
|
||||
return 0;
|
||||
}
|
||||
if (!rcBuildCompactHeightfield(m_cfg.walkableHeight, m_cfg.walkableClimb, RC_WALKABLE, *m_solid, *m_chf))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Could not build compact data.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!m_keepInterResults)
|
||||
{
|
||||
delete m_solid;
|
||||
m_solid = 0;
|
||||
}
|
||||
|
||||
// Prepare for region partitioning, by calculating distance field along the walkable surface.
|
||||
if (!rcBuildDistanceField(*m_chf))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Could not build distance field.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Partition the walkable surface into simple regions without holes.
|
||||
if (!rcBuildRegions(*m_chf, m_cfg.walkableRadius, m_cfg.borderSize, m_cfg.minRegionSize, m_cfg.mergeRegionSize))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Could not build regions.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Create contours.
|
||||
m_cset = new rcContourSet;
|
||||
if (!m_cset)
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Out of memory 'cset'.");
|
||||
return 0;
|
||||
}
|
||||
if (!rcBuildContours(*m_chf, m_cfg.maxSimplificationError, m_cfg.maxEdgeLen, *m_cset))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Could not create contours.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!m_keepInterResults)
|
||||
{
|
||||
delete m_chf;
|
||||
m_chf = 0;
|
||||
}
|
||||
|
||||
// Build polygon navmesh from the contours.
|
||||
m_polyMesh = new rcPolyMesh;
|
||||
if (!m_polyMesh)
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Out of memory 'polyMesh'.");
|
||||
return 0;
|
||||
}
|
||||
if (!rcBuildPolyMesh(*m_cset, m_cfg.bmin, m_cfg.bmax, m_cfg.cs, m_cfg.ch, m_cfg.maxVertsPerPoly, *m_polyMesh))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "buildNavigation: Could not triangulate contours.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!m_keepInterResults)
|
||||
{
|
||||
delete m_cset;
|
||||
m_cset = 0;
|
||||
}
|
||||
|
||||
unsigned char* navData = 0;
|
||||
int navDataSize = 0;
|
||||
|
||||
if (m_cfg.maxVertsPerPoly == DT_TILE_VERTS_PER_POLYGON)
|
||||
{
|
||||
// Remove padding from the polymesh data.
|
||||
for (int i = 0; i < m_polyMesh->nverts; ++i)
|
||||
{
|
||||
unsigned short* v = &m_polyMesh->verts[i*3];
|
||||
v[0] -= (unsigned short)m_cfg.borderSize;
|
||||
v[2] -= (unsigned short)m_cfg.borderSize;
|
||||
}
|
||||
|
||||
if (!dtCreateNavMeshTileData(m_polyMesh->verts, m_polyMesh->nverts,
|
||||
m_polyMesh->polys, m_polyMesh->npolys, m_polyMesh->nvp,
|
||||
bmin, bmax, m_cfg.cs, m_cfg.ch, m_cfg.tileSize, m_cfg.walkableClimb, &navData, &navDataSize))
|
||||
{
|
||||
if (rcGetLog())
|
||||
rcGetLog()->log(RC_LOG_ERROR, "Could not build Detour navmesh.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
rcTimeVal totEndTime = rcGetPerformanceTimer();
|
||||
|
||||
// Show performance stats.
|
||||
if (rcGetLog())
|
||||
{
|
||||
const float pc = 100.0f / rcGetDeltaTimeUsec(totStartTime, totEndTime);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Rasterize: %.1fms (%.1f%%)", m_buildTimes.rasterizeTriangles/1000.0f, m_buildTimes.rasterizeTriangles*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Build Compact: %.1fms (%.1f%%)", m_buildTimes.buildCompact/1000.0f, m_buildTimes.buildCompact*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Filter Border: %.1fms (%.1f%%)", m_buildTimes.filterBorder/1000.0f, m_buildTimes.filterBorder*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Filter Walkable: %.1fms (%.1f%%)", m_buildTimes.filterWalkable/1000.0f, m_buildTimes.filterWalkable*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Filter Reachable: %.1fms (%.1f%%)", m_buildTimes.filterMarkReachable/1000.0f, m_buildTimes.filterMarkReachable*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Build Distancefield: %.1fms (%.1f%%)", m_buildTimes.buildDistanceField/1000.0f, m_buildTimes.buildDistanceField*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - distance: %.1fms (%.1f%%)", m_buildTimes.buildDistanceFieldDist/1000.0f, m_buildTimes.buildDistanceFieldDist*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - blur: %.1fms (%.1f%%)", m_buildTimes.buildDistanceFieldBlur/1000.0f, m_buildTimes.buildDistanceFieldBlur*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Build Regions: %.1fms (%.1f%%)", m_buildTimes.buildRegions/1000.0f, m_buildTimes.buildRegions*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - watershed: %.1fms (%.1f%%)", m_buildTimes.buildRegionsReg/1000.0f, m_buildTimes.buildRegionsReg*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - expand: %.1fms (%.1f%%)", m_buildTimes.buildRegionsExp/1000.0f, m_buildTimes.buildRegionsExp*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - find catchment basins: %.1fms (%.1f%%)", m_buildTimes.buildRegionsFlood/1000.0f, m_buildTimes.buildRegionsFlood*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - filter: %.1fms (%.1f%%)", m_buildTimes.buildRegionsFilter/1000.0f, m_buildTimes.buildRegionsFilter*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Build Contours: %.1fms (%.1f%%)", m_buildTimes.buildContours/1000.0f, m_buildTimes.buildContours*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - trace: %.1fms (%.1f%%)", m_buildTimes.buildContoursTrace/1000.0f, m_buildTimes.buildContoursTrace*pc);
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, " - simplify: %.1fms (%.1f%%)", m_buildTimes.buildContoursSimplify/1000.0f, m_buildTimes.buildContoursSimplify*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Fixup contours: %.1fms (%.1f%%)", m_buildTimes.fixupContours/1000.0f, m_buildTimes.fixupContours*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Build Polymesh: %.1fms (%.1f%%)", m_buildTimes.buildPolymesh/1000.0f, m_buildTimes.buildPolymesh*pc);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "Polymesh: Verts:%d Polys:%d", m_polyMesh->nverts, m_polyMesh->npolys);
|
||||
|
||||
rcGetLog()->log(RC_LOG_PROGRESS, "TOTAL: %.1fms", rcGetDeltaTimeUsec(totStartTime, totEndTime)/1000.0f);
|
||||
}
|
||||
|
||||
m_tileBuildTime = rcGetDeltaTimeUsec(totStartTime, totEndTime)/1000.0f;
|
||||
|
||||
dataSize = navDataSize;
|
||||
return navData;
|
||||
}
|
||||
@@ -16,7 +16,8 @@
|
||||
#include "RecastDebugDraw.h"
|
||||
#include "MeshLoaderObj.h"
|
||||
#include "BuilderStatMeshSimple.h"
|
||||
#include "BuilderStatMeshTiling.h"
|
||||
#include "BuilderStatMeshTiled.h"
|
||||
#include "BuilderTiledMesh.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# define snprintf _snprintf
|
||||
@@ -547,10 +548,15 @@ int main(int argc, char *argv[])
|
||||
newBuilder = new BuilderStatMeshSimple();
|
||||
if (newBuilder) strcpy(builderName, "Simple Static Mesh");
|
||||
}
|
||||
if (imguiItem(GENID, "Tiling Static Mesh"))
|
||||
if (imguiItem(GENID, "Tiled Static Mesh"))
|
||||
{
|
||||
newBuilder = new BuilderStatMeshTiling();
|
||||
if (newBuilder) strcpy(builderName, "Tiling Static Mesh");
|
||||
newBuilder = new BuilderStatMeshTiled();
|
||||
if (newBuilder) strcpy(builderName, "Tiled Static Mesh");
|
||||
}
|
||||
if (imguiItem(GENID, "Tiled Mesh"))
|
||||
{
|
||||
newBuilder = new BuilderTiledMesh();
|
||||
if (newBuilder) strcpy(builderName, "Tiled Mesh");
|
||||
}
|
||||
|
||||
if (newBuilder)
|
||||
|
||||
Reference in New Issue
Block a user