Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#ifndef DETOURTILECACHE_H
#define DETOURTILECACHE_H

#include "DetourStatus.h"



typedef unsigned int dtObstacleRef;

typedef unsigned int dtCompressedTileRef;

/// Flags for addTile
enum dtCompressedTileFlags
{
    DT_COMPRESSEDTILE_FREE_DATA = 0x01,                    ///< Navmesh owns the tile memory and should free it.
};

struct dtCompressedTile
{
    unsigned int salt;                        ///< Counter describing modifications to the tile.
    struct dtTileCacheLayerHeader* header;
    unsigned char* compressed;
    int compressedSize;
    unsigned char* data;
    int dataSize;
    unsigned int flags;
    dtCompressedTile* next;
};

enum ObstacleState
{
    DT_OBSTACLE_EMPTY,
    DT_OBSTACLE_PROCESSING,
    DT_OBSTACLE_PROCESSED,
    DT_OBSTACLE_REMOVING,
};

static const int DT_MAX_TOUCHED_TILES = 8;
struct dtTileCacheObstacle
{
    float pos[3], radius, height;
    dtCompressedTileRef touched[DT_MAX_TOUCHED_TILES];
    dtCompressedTileRef pending[DT_MAX_TOUCHED_TILES];
    unsigned short salt;
    unsigned char state;
    unsigned char ntouched;
    unsigned char npending;
    dtTileCacheObstacle* next;
};

struct dtTileCacheParams
{
    float orig[3];
    float cs, ch;
    int width, height;
    float walkableHeight;
    float walkableRadius;
    float walkableClimb;
    float maxSimplificationError;
    int maxTiles;
    int maxObstacles;
};

struct dtTileCacheMeshProcess
{
    virtual ~dtTileCacheMeshProcess() { }

    virtual void process(struct dtNavMeshCreateParams* params,
                         unsigned char* polyAreas, unsigned short* polyFlags) = 0;
};


class dtTileCache
{
public:
    dtTileCache();
    ~dtTileCache();
    
    struct dtTileCacheAlloc* getAlloc() { return m_talloc; }
    struct dtTileCacheCompressor* getCompressor() { return m_tcomp; }
    const dtTileCacheParams* getParams() const { return &m_params; }
    
    inline int getTileCount() const { return m_params.maxTiles; }
    inline const dtCompressedTile* getTile(const int i) const { return &m_tiles[i]; }
    
    inline int getObstacleCount() const { return m_params.maxObstacles; }
    inline const dtTileCacheObstacle* getObstacle(const int i) const { return &m_obstacles[i]; }
    
    const dtTileCacheObstacle* getObstacleByRef(dtObstacleRef ref);
    
    dtObstacleRef getObstacleRef(const dtTileCacheObstacle* obmin) const;
    
    dtStatus init(const dtTileCacheParams* params,
                  struct dtTileCacheAlloc* talloc,
                  struct dtTileCacheCompressor* tcomp,
                  struct dtTileCacheMeshProcess* tmproc);
    
    int getTilesAt(const int tx, const int ty, dtCompressedTileRef* tiles, const int maxTiles) const ;
    
    dtCompressedTile* getTileAt(const int tx, const int ty, const int tlayer);
    dtCompressedTileRef getTileRef(const dtCompressedTile* tile) const;
    const dtCompressedTile* getTileByRef(dtCompressedTileRef ref) const;
    
    dtStatus addTile(unsigned char* data, const int dataSize, unsigned char flags, dtCompressedTileRef* result);
    
    dtStatus removeTile(dtCompressedTileRef ref, unsigned char** data, int* dataSize);
    
    dtStatus addObstacle(const float* pos, const float radius, const float height, dtObstacleRef* result);
    dtStatus removeObstacle(const dtObstacleRef ref);
    
    dtStatus queryTiles(const float* bmin, const float* bmax,
                        dtCompressedTileRef* results, int* resultCount, const int maxResults) const;
    
    dtStatus update(const float /*dt*/, class dtNavMesh* navmesh);
    
    dtStatus buildNavMeshTilesAt(const int tx, const int ty, class dtNavMesh* navmesh);
    
    dtStatus buildNavMeshTile(const dtCompressedTileRef ref, class dtNavMesh* navmesh);
    
    void calcTightTileBounds(const struct dtTileCacheLayerHeader* header, float* bmin, float* bmax) const;
    
    void getObstacleBounds(const struct dtTileCacheObstacle* ob, float* bmin, float* bmax) const;
    

    /// Encodes a tile id.
    inline dtCompressedTileRef encodeTileId(unsigned int salt, unsigned int it) const
    {
        return ((dtCompressedTileRef)salt << m_tileBits) | (dtCompressedTileRef)it;
    }
    
    /// Decodes a tile salt.
    inline unsigned int decodeTileIdSalt(dtCompressedTileRef ref) const
    {
        const dtCompressedTileRef saltMask = ((dtCompressedTileRef)1<<m_saltBits)-1;
        return (unsigned int)((ref >> m_tileBits) & saltMask);
    }
    
    /// Decodes a tile id.
    inline unsigned int decodeTileIdTile(dtCompressedTileRef ref) const
    {
        const dtCompressedTileRef tileMask = ((dtCompressedTileRef)1<<m_tileBits)-1;
        return (unsigned int)(ref & tileMask);
    }

    /// Encodes an obstacle id.
    inline dtObstacleRef encodeObstacleId(unsigned int salt, unsigned int it) const
    {
        return ((dtObstacleRef)salt << 16) | (dtObstacleRef)it;
    }
    
    /// Decodes an obstacle salt.
    inline unsigned int decodeObstacleIdSalt(dtObstacleRef ref) const
    {
        const dtObstacleRef saltMask = ((dtObstacleRef)1<<16)-1;
        return (unsigned int)((ref >> 16) & saltMask);
    }
    
    /// Decodes an obstacle id.
    inline unsigned int decodeObstacleIdObstacle(dtObstacleRef ref) const
    {
        const dtObstacleRef tileMask = ((dtObstacleRef)1<<16)-1;
        return (unsigned int)(ref & tileMask);
    }
    
    
private:
    
    enum ObstacleRequestAction
    {
        REQUEST_ADD,
        REQUEST_REMOVE,
    };
    
    struct ObstacleRequest
    {
        int action;
        dtObstacleRef ref;
    };
    
    int m_tileLutSize;                        ///< Tile hash lookup size (must be pot).
    int m_tileLutMask;                        ///< Tile hash lookup mask.
    
    dtCompressedTile** m_posLookup;            ///< Tile hash lookup.
    dtCompressedTile* m_nextFreeTile;        ///< Freelist of tiles.
    dtCompressedTile* m_tiles;                ///< List of tiles.
    
    unsigned int m_saltBits;                ///< Number of salt bits in the tile ID.
    unsigned int m_tileBits;                ///< Number of tile bits in the tile ID.
    
    dtTileCacheParams m_params;
    
    dtTileCacheAlloc* m_talloc;
    dtTileCacheCompressor* m_tcomp;
    dtTileCacheMeshProcess* m_tmproc;
    
    dtTileCacheObstacle* m_obstacles;
    dtTileCacheObstacle* m_nextFreeObstacle;
    
    static const int MAX_REQUESTS = 64;
    ObstacleRequest m_reqs[MAX_REQUESTS];
    int m_nreqs;
    
    static const int MAX_UPDATE = 64;
    dtCompressedTileRef m_update[MAX_UPDATE];
    int m_nupdate;
    
};

dtTileCache* dtAllocTileCache();
void dtFreeTileCache(dtTileCache* tc);

#endif

Commits for Divide-Framework/trunk/Source Code/Libs/src/ReCast/DetourTileCache/Include/DetourTileCache.h

Diff revisions: vs.
Revision Author Commited Message
337 Diff Diff IonutCava picture IonutCava Wed 17 Dec, 2014 17:25:16 +0000

[Ionut]
- Replaced all tabs with 4 spaces (some spacing may be off now. no way to check all the files.)
- Moved implementation details for ParamHandler, BoundingBox, BoundingSphere and ProfileTimer to proper .inl and .cpp files. (more to follow)
- Update all forward declared enums with the required storage type (as requested by the C++11 standard)

315 Diff Diff IonutCava picture IonutCava Mon 25 Aug, 2014 15:23:33 +0000

[Ionut]
- Update ReCast to the latest version available on GitHub
- Improved nav mesh target point selection
- Added basic “go to enemy flag” logic for the WarScene teams

152 Diff Diff k1ngp1n picture k1ngp1n Thu 20 Jun, 2013 14:23:31 +0000

[Ionut] [[BR]]
- New rendering pipeline (experimental and unstable): [[BR]]
— OpenGL 3.x clean context (glLight commands are still used for now, but UBO support is there, but not used yet) [[BR]]
— Custom matrix stacks and UBO based shader data (UBOs cause some link errors on some nVidia cards)[[BR]]
— Multi-threaded texture loading and shader compilation (mt shader compilation disabled for now. needs more tests) [[BR]]
— VAO rendering is self contained (no more enable/disable calls before a draw request) [[BR]]
— Render instance class used for rendering information [[BR]]
[[BR]]
- New unique ID generation base class: GUIDWrapper. Each class that derives from this, gets an application wide unique id on construction [[BR]]
- Added base code for an in-game editor using CEGUI [[BR]]
- Replaced some mutex locks with lockless data structures or atomic data [[BR]]
- CEGUI 0.8.2, FTGL-GL3 and GLIM 0.4 modified to support GLEW_MX if defined [[BR]]
- Dropped VS2008 support [[BR]]
- Networking library, server framework and ReCast files are now projects inside the Divide Framework solution [[BR]]
- New console command “setFov” that modifies the horizontal FoV value in realtime [[BR]]
- New console command “recompileShader” that reparses shader files, recompiles shaders and relinks shader programs who’s names match or contain the argument string [[BR]]
- New debug utility: axis angle drawn in corner of the screen if needed [[BR]]
- More ‘const’-s pasted around the code, more loop performance tweaks (allocations before a loop, tighter loops, etc), more utility member functions added to various classes [[BR]]

151 k1ngp1n picture k1ngp1n Tue 07 May, 2013 00:00:52 +0000

[Ionut] [[BR]]
- Better ReCast integration [[BR]]
— Any entity can be used as an obstacle in the NavMesh if that’s specified in each scene’s assets.xml file for said entity [[BR]]
— New console command, “createNavMesh”, that passes geometry data to ReCast [[BR]]
-— NavMesh generation is not yet complete [[BR]]
- Better PhysX integration [[BR]]
— Each scene passes data to and gets data from the Physics API better and safer[[BR]]
- Multi-threaded support extended: [[BR]]
— Event class replaced with Task [[BR]]
— Kernel uses a threadpool for scene tasks [[BR]]
— Each task can be added to a different threadpool if needed [[BR]]
— Most critical sections use the new boost::atomic wrapper for thread safety [[BR]]
- Rendering system updated [[BR]]
— VBO’s keep track of the geometry type internally [[BR]]
— Rendering by specific element list is internal to the VBO [[BR]]
— VBO’s can draw a “lite” version that doesn’t send Tangent, BiTangent and TexCoord data for depth rendering (disabled) [[BR]]
- Reflectors now offer a preview of the generated reflective texture if needed [[BR]]
- Buttons are now added and rendered by CEGUI [[BR]]
[[BR]]
Deprecation: [[BR]]
- Removed fixed pipeline material system [[BR]]
- Removed BoundingBox late update system [[BR]]
- Shadow references in the material system are now depth references [[BR]]
[[BR]]
Bug fixes: [[BR]]
- Problematic FBO double bind check removed [[BR]]
- Faster terrain rendering via chunk size selection through each scene’s terrain.xml[[BR]]
- Rendering is paused when the window is minimized [[BR]]
- CEGUI and impostors now render properly in deferred rendering mode [[BR]]
- Fixed various level 4 (VS2008) warnings [[BR]]
- Better state management and cleaning [[BR]]
- Better SceneGraph node management and trasformation/AABB update calls [[BR]]
- AITenisScene has proper collisions now [[BR]]