Detour version change! Added user ID per off-mesh connection. Fixed off-mesh connection draw flags after using off-mesh con tool.
This commit is contained in:
parent
ccf401d3da
commit
1be9de72d8
@ -34,7 +34,7 @@ typedef unsigned int dtTileRef;
|
||||
static const int DT_VERTS_PER_POLYGON = 6;
|
||||
|
||||
static const int DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V'; //'DNAV';
|
||||
static const int DT_NAVMESH_VERSION = 5;
|
||||
static const int DT_NAVMESH_VERSION = 6;
|
||||
|
||||
static const int DT_NAVMESH_STATE_MAGIC = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S'; //'DNMS';
|
||||
static const int DT_NAVMESH_STATE_VERSION = 1;
|
||||
@ -124,6 +124,7 @@ struct dtOffMeshConnection
|
||||
unsigned short poly; // Poly Id
|
||||
unsigned char flags; // Link flags
|
||||
unsigned char side; // End point side.
|
||||
unsigned int userId; // User ID to identify this connection.
|
||||
};
|
||||
|
||||
struct dtMeshHeader
|
||||
@ -283,6 +284,9 @@ public:
|
||||
// endPos[3] - (out) end point of the link.
|
||||
// Returns: true if link is found.
|
||||
dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float* startPos, float* endPos) const;
|
||||
|
||||
// Returns pointer to off-mesh connection based on polyref, or null if ref not valid.
|
||||
const dtOffMeshConnection* getOffMeshConnectionByRef(dtPolyRef ref) const;
|
||||
|
||||
// Sets polygon flags.
|
||||
dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags);
|
||||
|
@ -47,6 +47,7 @@ struct dtNavMeshCreateParams
|
||||
const unsigned short* offMeshConFlags; // Off-mesh connection flags.
|
||||
const unsigned char* offMeshConAreas; // Off-mesh connection area ids.
|
||||
const unsigned char* offMeshConDir; // Off-mesh connection direction flags (1 = bidir, 0 = oneway).
|
||||
const unsigned int* offMeshConUserID; // Off-mesh connection user id (optional).
|
||||
int offMeshConCount; // Number of off-mesh connections
|
||||
// Tile location
|
||||
unsigned int userId; // User ID bound to the tile.
|
||||
|
@ -1150,6 +1150,27 @@ dtStatus dtNavMesh::getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyR
|
||||
}
|
||||
|
||||
|
||||
const dtOffMeshConnection* dtNavMesh::getOffMeshConnectionByRef(dtPolyRef ref) const
|
||||
{
|
||||
unsigned int salt, it, ip;
|
||||
|
||||
// Get current polygon
|
||||
decodePolyId(ref, salt, it, ip);
|
||||
if (it >= (unsigned int)m_maxTiles) return 0;
|
||||
if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return 0;
|
||||
const dtMeshTile* tile = &m_tiles[it];
|
||||
if (ip >= (unsigned int)tile->header->polyCount) return 0;
|
||||
const dtPoly* poly = &tile->polys[ip];
|
||||
|
||||
// Make sure that the current poly is indeed off-mesh link.
|
||||
if (poly->getType() != DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||
return 0;
|
||||
|
||||
const unsigned int idx = ip - tile->header->offMeshBase;
|
||||
dtAssert(idx < (unsigned int)tile->header->offMeshConCount);
|
||||
return &tile->offMeshCons[idx];
|
||||
}
|
||||
|
||||
|
||||
dtStatus dtNavMesh::setPolyFlags(dtPolyRef ref, unsigned short flags)
|
||||
{
|
||||
|
@ -530,6 +530,8 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData,
|
||||
con->rad = params->offMeshConRad[i];
|
||||
con->flags = params->offMeshConDir[i] ? DT_OFFMESH_CON_BIDIR : 0;
|
||||
con->side = offMeshConClass[i*2+1];
|
||||
if (params->offMeshConUserID)
|
||||
con->userId = params->offMeshConUserID[i];
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -200,8 +200,8 @@
|
||||
<array/>
|
||||
<key>PerspectiveWidths</key>
|
||||
<array>
|
||||
<integer>1278</integer>
|
||||
<integer>1278</integer>
|
||||
<integer>1200</integer>
|
||||
<integer>1200</integer>
|
||||
</array>
|
||||
<key>Perspectives</key>
|
||||
<array>
|
||||
@ -284,14 +284,14 @@
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
|
||||
<array>
|
||||
<array>
|
||||
<integer>52</integer>
|
||||
<integer>51</integer>
|
||||
<integer>10</integer>
|
||||
<integer>2</integer>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</array>
|
||||
</array>
|
||||
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
|
||||
<string>{{0, 577}, {264, 622}}</string>
|
||||
<string>{{0, 0}, {264, 622}}</string>
|
||||
</dict>
|
||||
<key>PBXTopSmartGroupGIDs</key>
|
||||
<array/>
|
||||
@ -326,7 +326,7 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>6B8632A30F78115100E2684A</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>CrowdTool.cpp</string>
|
||||
<string>DetourDebugDraw.cpp</string>
|
||||
<key>PBXSplitModuleInNavigatorKey</key>
|
||||
<dict>
|
||||
<key>Split0</key>
|
||||
@ -334,46 +334,51 @@
|
||||
<key>PBXProjectModuleGUID</key>
|
||||
<string>6B8632A40F78115100E2684A</string>
|
||||
<key>PBXProjectModuleLabel</key>
|
||||
<string>CrowdTool.cpp</string>
|
||||
<string>DetourDebugDraw.cpp</string>
|
||||
<key>_historyCapacity</key>
|
||||
<integer>0</integer>
|
||||
<key>bookmark</key>
|
||||
<string>6B74B7631286BB6900262888</string>
|
||||
<string>6B74B7CC1286FAD800262888</string>
|
||||
<key>history</key>
|
||||
<array>
|
||||
<string>6B8D565F127ADB0D0077C699</string>
|
||||
<string>6B8D566F127ADB7D0077C699</string>
|
||||
<string>6B8D56C7127AEC100077C699</string>
|
||||
<string>6B8D56D2127AEC100077C699</string>
|
||||
<string>6B4DE62F12807542001CFDF4</string>
|
||||
<string>6B4DE647128079E0001CFDF4</string>
|
||||
<string>6B4DE649128079E0001CFDF4</string>
|
||||
<string>6B4DE64A128079E0001CFDF4</string>
|
||||
<string>6B74B5F3128312AC00262888</string>
|
||||
<string>6B74B5F4128312AC00262888</string>
|
||||
<string>6B74B60F128312E900262888</string>
|
||||
<string>6B74B623128314A500262888</string>
|
||||
<string>6B74B624128314A500262888</string>
|
||||
<string>6B74B626128314A500262888</string>
|
||||
<string>6B74B627128314A500262888</string>
|
||||
<string>6B74B628128314A500262888</string>
|
||||
<string>6B74B629128314A500262888</string>
|
||||
<string>6B74B62A128314A500262888</string>
|
||||
<string>6B74B62B128314A500262888</string>
|
||||
<string>6B74B62C128314A500262888</string>
|
||||
<string>6B74B66412869CE100262888</string>
|
||||
<string>6B74B66712869CE100262888</string>
|
||||
<string>6B74B66F12869E3000262888</string>
|
||||
<string>6B74B6BF1286AA0C00262888</string>
|
||||
<string>6B74B6D81286ABC000262888</string>
|
||||
<string>6B74B6FC1286AE0B00262888</string>
|
||||
<string>6B74B7061286AEBD00262888</string>
|
||||
<string>6B74B7071286AEBD00262888</string>
|
||||
<string>6B74B7401286B7C400262888</string>
|
||||
<string>6B74B75F1286BB6900262888</string>
|
||||
<string>6B74B7601286BB6900262888</string>
|
||||
<string>6B74B7611286BB6900262888</string>
|
||||
<string>6B74B7621286BB6900262888</string>
|
||||
<string>6B74B76B1286F56B00262888</string>
|
||||
<string>6B74B76F1286F56B00262888</string>
|
||||
<string>6B74B7761286F61200262888</string>
|
||||
<string>6B74B7771286F61200262888</string>
|
||||
<string>6B74B7801286F72D00262888</string>
|
||||
<string>6B74B7811286F72D00262888</string>
|
||||
<string>6B74B7821286F72D00262888</string>
|
||||
<string>6B74B7831286F72D00262888</string>
|
||||
<string>6B74B7841286F72D00262888</string>
|
||||
<string>6B74B7901286F77500262888</string>
|
||||
<string>6B74B7991286F7CD00262888</string>
|
||||
<string>6B74B7AD1286F93000262888</string>
|
||||
<string>6B74B7B21286F99100262888</string>
|
||||
<string>6B74B7C01286FA5200262888</string>
|
||||
<string>6B74B7C51286FAB500262888</string>
|
||||
<string>6B74B7CB1286FAD800262888</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>SplitCount</key>
|
||||
@ -387,18 +392,18 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {914, 472}}</string>
|
||||
<string>{{0, 0}, {914, 543}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>47 97 1200 681 0 0 1280 778 </string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXNavigatorGroup</string>
|
||||
<key>Proportion</key>
|
||||
<string>472pt</string>
|
||||
<string>543pt</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Proportion</key>
|
||||
<string>164pt</string>
|
||||
<string>93pt</string>
|
||||
<key>Tabs</key>
|
||||
<array>
|
||||
<dict>
|
||||
@ -428,7 +433,9 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {992, 169}}</string>
|
||||
<string>{{10, 27}, {914, 66}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>47 97 1200 681 0 0 1280 778 </string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXProjectFindModule</string>
|
||||
@ -466,9 +473,7 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{10, 27}, {914, 137}}</string>
|
||||
<key>RubberWindowFrame</key>
|
||||
<string>47 97 1200 681 0 0 1280 778 </string>
|
||||
<string>{{10, 27}, {914, 87}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXBuildResultsModule</string>
|
||||
@ -550,12 +555,12 @@
|
||||
<key>GeometryConfiguration</key>
|
||||
<dict>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 0}, {1278, 276}}</string>
|
||||
<string>{{0, 0}, {1200, 260}}</string>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXDebugCLIModule</string>
|
||||
<key>Proportion</key>
|
||||
<string>276pt</string>
|
||||
<string>260pt</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ContentConfiguration</key>
|
||||
@ -574,8 +579,8 @@
|
||||
<string>yes</string>
|
||||
<key>sizes</key>
|
||||
<array>
|
||||
<string>{{0, 0}, {580, 119}}</string>
|
||||
<string>{{580, 0}, {698, 119}}</string>
|
||||
<string>{{0, 0}, {545, 112}}</string>
|
||||
<string>{{545, 0}, {655, 112}}</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>VerticalSplitView</key>
|
||||
@ -590,8 +595,8 @@
|
||||
<string>yes</string>
|
||||
<key>sizes</key>
|
||||
<array>
|
||||
<string>{{0, 0}, {1278, 119}}</string>
|
||||
<string>{{0, 119}, {1278, 278}}</string>
|
||||
<string>{{0, 0}, {1200, 112}}</string>
|
||||
<string>{{0, 112}, {1200, 263}}</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -611,7 +616,7 @@
|
||||
<key>DebugSTDIOWindowFrame</key>
|
||||
<string>{{200, 200}, {500, 300}}</string>
|
||||
<key>Frame</key>
|
||||
<string>{{0, 281}, {1278, 397}}</string>
|
||||
<string>{{0, 265}, {1200, 375}}</string>
|
||||
<key>PBXDebugSessionStackFrameViewKey</key>
|
||||
<dict>
|
||||
<key>DebugVariablesTableConfiguration</key>
|
||||
@ -621,16 +626,16 @@
|
||||
<string>Value</string>
|
||||
<real>168</real>
|
||||
<string>Summary</string>
|
||||
<real>322</real>
|
||||
<real>279</real>
|
||||
</array>
|
||||
<key>Frame</key>
|
||||
<string>{{580, 0}, {698, 119}}</string>
|
||||
<string>{{545, 0}, {655, 112}}</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>Module</key>
|
||||
<string>PBXDebugSessionModule</string>
|
||||
<key>Proportion</key>
|
||||
<string>397pt</string>
|
||||
<string>375pt</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Name</key>
|
||||
@ -687,6 +692,7 @@
|
||||
<integer>5</integer>
|
||||
<key>WindowOrderList</key>
|
||||
<array>
|
||||
<string>6B74B7C81286FAB500262888</string>
|
||||
<string>6B74B604128312AC00262888</string>
|
||||
<string>6B74B605128312AC00262888</string>
|
||||
<string>/Users/memon/Code/recastnavigation/RecastDemo/Build/Xcode/Recast.xcodeproj</string>
|
||||
|
@ -44,6 +44,7 @@ class InputGeom
|
||||
unsigned char m_offMeshConDirs[MAX_OFFMESH_CONNECTIONS];
|
||||
unsigned char m_offMeshConAreas[MAX_OFFMESH_CONNECTIONS];
|
||||
unsigned short m_offMeshConFlags[MAX_OFFMESH_CONNECTIONS];
|
||||
unsigned int m_offMeshConId[MAX_OFFMESH_CONNECTIONS];
|
||||
int m_offMeshConCount;
|
||||
|
||||
// Convex Volumes.
|
||||
@ -74,6 +75,7 @@ public:
|
||||
const unsigned char* getOffMeshConnectionDirs() const { return m_offMeshConDirs; }
|
||||
const unsigned char* getOffMeshConnectionAreas() const { return m_offMeshConAreas; }
|
||||
const unsigned short* getOffMeshConnectionFlags() const { return m_offMeshConFlags; }
|
||||
const unsigned int* getOffMeshConnectionId() const { return m_offMeshConId; }
|
||||
void addOffMeshConnection(const float* spos, const float* epos, const float rad,
|
||||
unsigned char bidir, unsigned char area, unsigned short flags);
|
||||
void deleteOffMeshConnection(int i);
|
||||
|
@ -126,9 +126,9 @@ CrowdTool::~CrowdTool()
|
||||
|
||||
void CrowdTool::init(Sample* sample)
|
||||
{
|
||||
m_sample = sample;
|
||||
if (m_sample)
|
||||
if (m_sample != sample)
|
||||
{
|
||||
m_sample = sample;
|
||||
m_oldFlags = m_sample->getNavMeshDrawFlags();
|
||||
m_sample->setNavMeshDrawFlags(m_oldFlags & ~DU_DRAWNAVMESH_CLOSEDLIST);
|
||||
}
|
||||
|
@ -374,6 +374,7 @@ void InputGeom::addOffMeshConnection(const float* spos, const float* epos, const
|
||||
m_offMeshConDirs[m_offMeshConCount] = bidir;
|
||||
m_offMeshConAreas[m_offMeshConCount] = area;
|
||||
m_offMeshConFlags[m_offMeshConCount] = flags;
|
||||
m_offMeshConId[m_offMeshConCount] = 1000 + m_offMeshConCount;
|
||||
rcVcopy(&v[0], spos);
|
||||
rcVcopy(&v[3], epos);
|
||||
m_offMeshConCount++;
|
||||
|
@ -53,9 +53,9 @@ OffMeshConnectionTool::~OffMeshConnectionTool()
|
||||
|
||||
void OffMeshConnectionTool::init(Sample* sample)
|
||||
{
|
||||
m_sample = sample;
|
||||
if (m_sample)
|
||||
if (m_sample != sample)
|
||||
{
|
||||
m_sample = sample;
|
||||
m_oldFlags = m_sample->getNavMeshDrawFlags();
|
||||
m_sample->setNavMeshDrawFlags(m_oldFlags & ~DU_DRAWNAVMESH_OFFMESHCONS);
|
||||
}
|
||||
|
@ -616,6 +616,7 @@ bool Sample_SoloMeshSimple::handleBuild()
|
||||
params.offMeshConDir = m_geom->getOffMeshConnectionDirs();
|
||||
params.offMeshConAreas = m_geom->getOffMeshConnectionAreas();
|
||||
params.offMeshConFlags = m_geom->getOffMeshConnectionFlags();
|
||||
params.offMeshConUserID = m_geom->getOffMeshConnectionId();
|
||||
params.offMeshConCount = m_geom->getOffMeshConnectionCount();
|
||||
params.walkableHeight = m_agentHeight;
|
||||
params.walkableRadius = m_agentRadius;
|
||||
|
@ -1058,6 +1058,7 @@ bool Sample_SoloMeshTiled::handleBuild()
|
||||
params.offMeshConDir = m_geom->getOffMeshConnectionDirs();
|
||||
params.offMeshConAreas = m_geom->getOffMeshConnectionAreas();
|
||||
params.offMeshConFlags = m_geom->getOffMeshConnectionFlags();
|
||||
params.offMeshConUserID = m_geom->getOffMeshConnectionId();
|
||||
params.offMeshConCount = m_geom->getOffMeshConnectionCount();
|
||||
params.walkableHeight = m_agentHeight;
|
||||
params.walkableRadius = m_agentRadius;
|
||||
|
@ -1153,6 +1153,7 @@ unsigned char* Sample_TileMesh::buildTileMesh(const int tx, const int ty, const
|
||||
params.offMeshConDir = m_geom->getOffMeshConnectionDirs();
|
||||
params.offMeshConAreas = m_geom->getOffMeshConnectionAreas();
|
||||
params.offMeshConFlags = m_geom->getOffMeshConnectionFlags();
|
||||
params.offMeshConUserID = m_geom->getOffMeshConnectionId();
|
||||
params.offMeshConCount = m_geom->getOffMeshConnectionCount();
|
||||
params.walkableHeight = m_agentHeight;
|
||||
params.walkableRadius = m_agentRadius;
|
||||
|
Loading…
x
Reference in New Issue
Block a user