-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathdetour_util.h
45 lines (38 loc) · 1.28 KB
/
detour_util.h
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
#ifndef __NMS_DETOUR_UTIL_H__
#define __NMS_DETOUR_UTIL_H__
#include <DetourTileCacheBuilder.h>
#include <DetourTileCache.h>
namespace NavMeshScene {
class LinearAllocator : public dtTileCacheAlloc
{
public:
LinearAllocator(const size_t cap);
~LinearAllocator();
void resize(const size_t cap);
void reset() override;
void* alloc(const size_t size) override;
void free(void* ptr) override;
private:
unsigned char* buffer;
size_t capacity;
size_t top;
size_t high;
};
class FastLZCompressor : public dtTileCacheCompressor
{
public:
int maxCompressedSize(const int bufferSize) override;
dtStatus compress(const unsigned char* buffer, const int bufferSize,
unsigned char* compressed, const int maxCompressedSize, int* compressedSize) override;
dtStatus decompress(const unsigned char* compressed, const int compressedSize,
unsigned char* buffer, const int maxBufferSize, int* bufferSize) override;
};
class MeshProcess : public dtTileCacheMeshProcess
{
public:
MeshProcess();
void process(struct dtNavMeshCreateParams* params,
unsigned char* polyAreas, unsigned short* polyFlags) override;
};
}
#endif