VMan
1.0
Library for voxel managment.
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
vman.h
Go to the documentation of this file.
1
#ifndef __VMAN_H__
2
#define __VMAN_H__
3
4
// VMAN_SHARED: Define this if your linking vman dynamically.
5
// VMAN_BUILDING_SHARED: Define this when actually building the shared library.
6
7
#if defined(VMAN_SHARED)
8
#if defined(_WIN32) || defined(__CYGWIN__)
9
#if defined(VMAN_BUILDING_SHARED)
10
#if defined(__GNUC__)
11
#define VMAN_API __attribute__ ((dllexport))
12
#else
13
#define VMAN_API __declspec(dllexport)
14
#endif
15
#else
16
#if defined(__GNUC__)
17
#define VMAN_API __attribute__ ((dllimport))
18
#else
19
#define VMAN_API __declspec(dllimport)
20
#endif
21
#endif
22
#else
23
#if (__GNUC__ >= 4)
24
#define VMAN_API __attribute__ ((visibility ("default")))
25
#else
26
#define VMAN_API
27
#endif
28
#endif
29
#else
30
#define VMAN_API
31
#endif
32
33
#ifdef __cplusplus
34
extern
"C"
35
{
36
#endif
37
38
39
// -- Status --
40
41
typedef
enum
42
{
43
VMAN_NO_ERROR
= 0,
44
VMAN_OUT_OF_MEMORY
45
}
vmanError
;
46
47
VMAN_API
int
vmanGetError
();
48
49
53
VMAN_API
void
vmanPanicExit
();
54
55
56
enum
57
{
58
VMAN_MAX_LAYER_NAME_LENGTH
= 31
59
};
60
61
// -- Layer --
62
63
typedef
struct
64
{
69
const
char
*
name
;
70
74
int
voxelSize
;
75
79
int
revision
;
80
86
void (*serializeFn)(
const
void
* source,
void
* destination,
int
count );
87
93
void (*deserializeFn)(
const
void
* source,
void
* destination,
int
count );
94
95
// ...
96
}
vmanLayer
;
97
98
99
// -- Statistics --
100
101
typedef
struct
102
{
103
int
chunkGetHits
;
104
int
chunkGetMisses
;
105
106
int
chunkLoadOps
;
107
int
chunkSaveOps
;
108
int
chunkUnloadOps
;
109
110
int
readOps
;
111
int
writeOps
;
112
113
int
maxLoadedChunks
;
114
int
maxScheduledChecks
;
115
int
maxEnqueuedJobs
;
116
}
vmanStatistics
;
117
118
119
// -- Volume --
120
121
typedef
enum
122
{
123
VMAN_LOG_DEBUG
= 0,
124
VMAN_LOG_INFO
,
125
VMAN_LOG_WARNING
,
126
VMAN_LOG_ERROR
127
}
vmanLogLevel
;
128
129
typedef
struct
130
{
134
const
vmanLayer
*
layers
;
135
139
int
layerCount
;
140
145
int
chunkEdgeLength
;
146
151
const
char
*
baseDir
;
152
156
bool
enableStatistics
;
157
162
void (*logFn)(
vmanLogLevel
level,
const
char
* message );
163
164
}
vmanVolumeParameters
;
165
166
170
VMAN_API
void
vmanInitVolumeParameters
(
vmanVolumeParameters
* parameters );
171
172
173
174
typedef
void
*
vmanVolume
;
175
176
182
VMAN_API
vmanVolume
vmanCreateVolume
(
const
vmanVolumeParameters
* parameters );
183
184
188
VMAN_API
void
vmanDeleteVolume
(
const
vmanVolume volume );
189
190
195
VMAN_API
void
vmanSetUnusedChunkTimeout
(
const
vmanVolume volume,
int
seconds );
196
197
202
VMAN_API
void
vmanSetModifiedChunkTimeout
(
const
vmanVolume volume,
int
seconds );
203
204
208
VMAN_API
void
vmanResetStatistics
(
const
vmanVolume volume );
209
210
216
VMAN_API
bool
vmanGetStatistics
(
const
vmanVolume volume,
vmanStatistics
* statisticsDestination );
217
218
219
// -- Selection --
220
221
typedef
struct
222
{
223
int
x, y,
z
;
224
int
w
, h, d;
225
}
vmanSelection
;
226
227
228
// -- Access --
229
230
typedef
enum
231
{
232
VMAN_READ_ACCESS
= 1,
233
VMAN_WRITE_ACCESS
= 2
234
}
vmanAccessMode
;
235
236
typedef
void
*
vmanAccess
;
237
244
VMAN_API
vmanAccess
vmanCreateAccess
(
const
vmanVolume volume );
245
249
VMAN_API
void
vmanDeleteAccess
(
const
vmanAccess access );
250
256
VMAN_API
void
vmanSelect
( vmanAccess access,
const
vmanSelection
* selection );
257
266
VMAN_API
void
vmanLockAccess
( vmanAccess access,
int
mode );
267
268
274
VMAN_API
int
vmanTryLockAccess
( vmanAccess access,
int
mode );
275
276
280
VMAN_API
void
vmanUnlockAccess
( vmanAccess access );
281
287
VMAN_API
const
void
*
vmanReadVoxelLayer
(
const
vmanAccess access,
int
x,
int
y,
int
z,
int
layer );
288
295
VMAN_API
void
*
vmanReadWriteVoxelLayer
(
const
vmanAccess access,
int
x,
int
y,
int
z,
int
layer );
296
297
298
#ifdef __cplusplus
299
}
300
#endif
301
302
#endif
src
vman.h
Generated on Mon Aug 19 2013 17:06:46 for VMan by
1.8.3.1