~rebel/horde3d/trunk

« back to all changes in this revision

Viewing changes to trunk/Tools/Dependencies/RecastNavigation/Detour/Include/DetourNode.h

  • Committer: felix
  • Date: 2015-07-07 12:57:07 UTC
  • Revision ID: svn-v4:5ce291ac-9df0-446f-9e4f-d57731c4dda7::1699
- Updated RecastNavigation to latest version and fixed multiple issues.
- Adapted GameDetourComponent, GameDetourCrowdComponent, DetourCrowdDemo and AAA accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
{
26
26
        DT_NODE_OPEN = 0x01,
27
27
        DT_NODE_CLOSED = 0x02,
 
28
        DT_NODE_PARENT_DETACHED = 0x04, // parent of the node is not adjacent. Found using raycast.
28
29
};
29
30
 
30
31
typedef unsigned short dtNodeIndex;
35
36
        float pos[3];                           ///< Position of the node.
36
37
        float cost;                                     ///< Cost from previous node to current node.
37
38
        float total;                            ///< Cost up to the node.
38
 
        unsigned int pidx : 30;         ///< Index to parent node.
39
 
        unsigned int flags : 2;         ///< Node flags 0/open/closed.
 
39
        unsigned int pidx : 24;         ///< Index to parent node.
 
40
        unsigned int state : 2;         ///< extra state information. A polyRef can have multiple nodes with different extra info. see DT_MAX_STATES_PER_NODE
 
41
        unsigned int flags : 3;         ///< Node flags. A combination of dtNodeFlags.
40
42
        dtPolyRef id;                           ///< Polygon ref the node corresponds to.
41
43
};
42
44
 
43
45
 
 
46
static const int DT_MAX_STATES_PER_NODE = 4;    // number of extra states per node. See dtNode::state
 
47
 
 
48
 
 
49
 
44
50
class dtNodePool
45
51
{
46
52
public:
48
54
        ~dtNodePool();
49
55
        inline void operator=(const dtNodePool&) {}
50
56
        void clear();
51
 
        dtNode* getNode(dtPolyRef id);
52
 
        dtNode* findNode(dtPolyRef id);
 
57
 
 
58
        // Get a dtNode by ref and extra state information. If there is none then - allocate
 
59
        // There can be more than one node for the same polyRef but with different extra state information
 
60
        dtNode* getNode(dtPolyRef id, unsigned char state=0);   
 
61
        dtNode* findNode(dtPolyRef id, unsigned char state);
 
62
        unsigned int findNodes(dtPolyRef id, dtNode** nodes, const int maxNodes);
53
63
 
54
64
        inline unsigned int getNodeIdx(const dtNode* node) const
55
65
        {
82
92
        inline int getHashSize() const { return m_hashSize; }
83
93
        inline dtNodeIndex getFirst(int bucket) const { return m_first[bucket]; }
84
94
        inline dtNodeIndex getNext(int i) const { return m_next[i]; }
 
95
        inline int getNodeCount() const { return m_nodeCount; }
85
96
        
86
97
private:
87
98