CMake: cleanup
[blender-staging.git] / extern / recastnavigation / recast-capi.h
1 /*
2  *
3  * ***** BEGIN GPL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  * The Original Code is Copyright (C) 2011 Blender Foundation.
20  * All rights reserved.
21  *
22  * Contributor(s): Sergey Sharybin
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 #ifndef RECAST_C_API_H
28 #define RECAST_C_API_H
29
30 // for size_t
31 #include <stddef.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 struct recast_polyMesh;
38 struct recast_polyMeshDetail;
39 struct recast_heightfield;
40 struct recast_compactHeightfield;
41 struct recast_heightfieldLayerSet;
42 struct recast_contourSet;
43
44 enum recast_BuildContoursFlags
45 {
46         RECAST_CONTOUR_TESS_WALL_EDGES = 0x01,
47         RECAST_CONTOUR_TESS_AREA_EDGES = 0x02,
48 };
49
50 int recast_buildMeshAdjacency(unsigned short* polys, const int npolys,
51                         const int nverts, const int vertsPerPoly);
52
53 void recast_calcBounds(const float *verts, int nv, float *bmin, float *bmax);
54
55 void recast_calcGridSize(const float *bmin, const float *bmax, float cs, int *w, int *h);
56
57 struct recast_heightfield *recast_newHeightfield(void);
58
59 void recast_destroyHeightfield(struct recast_heightfield *heightfield);
60
61 int recast_createHeightfield(struct recast_heightfield *hf, int width, int height,
62                         const float *bmin, const float* bmax, float cs, float ch);
63
64 void recast_markWalkableTriangles(const float walkableSlopeAngle,const float *verts, int nv,
65                         const int *tris, int nt, unsigned char *areas);
66
67 void recast_clearUnwalkableTriangles(const float walkableSlopeAngle, const float* verts, int nv,
68                         const int* tris, int nt, unsigned char* areas);
69
70 int recast_addSpan(struct recast_heightfield *hf, const int x, const int y,
71                         const unsigned short smin, const unsigned short smax,
72                         const unsigned char area, const int flagMergeThr);
73
74 int recast_rasterizeTriangle(const float* v0, const float* v1, const float* v2,
75                         const unsigned char area, struct recast_heightfield *solid,
76                         const int flagMergeThr);
77
78 int recast_rasterizeTriangles(const float *verts, const int nv, const int *tris,
79                         const unsigned char *areas, const int nt, struct recast_heightfield *solid,
80                         const int flagMergeThr);
81
82 void recast_filterLedgeSpans(const int walkableHeight, const int walkableClimb,
83                         struct recast_heightfield *solid);
84
85 void recast_filterWalkableLowHeightSpans(int walkableHeight, struct recast_heightfield *solid);
86
87 void recast_filterLowHangingWalkableObstacles(const int walkableClimb, struct recast_heightfield *solid);
88
89 int recast_getHeightFieldSpanCount(struct recast_heightfield *hf);
90
91 struct recast_heightfieldLayerSet *recast_newHeightfieldLayerSet(void);
92
93 void recast_destroyHeightfieldLayerSet(struct recast_heightfieldLayerSet *lset);
94
95 struct recast_compactHeightfield *recast_newCompactHeightfield(void);
96
97 void recast_destroyCompactHeightfield(struct recast_compactHeightfield *compactHeightfield);
98
99 int recast_buildCompactHeightfield(const int walkableHeight, const int walkableClimb,
100                         struct recast_heightfield *hf, struct recast_compactHeightfield *chf);
101
102 int recast_erodeWalkableArea(int radius, struct recast_compactHeightfield *chf);
103
104 int recast_medianFilterWalkableArea(struct recast_compactHeightfield *chf);
105
106 void recast_markBoxArea(const float *bmin, const float *bmax, unsigned char areaId,
107                         struct recast_compactHeightfield *chf);
108
109 void recast_markConvexPolyArea(const float* verts, const int nverts,
110                         const float hmin, const float hmax, unsigned char areaId,
111                         struct recast_compactHeightfield *chf);
112
113 int recast_offsetPoly(const float* verts, const int nverts,
114                         const float offset, float *outVerts, const int maxOutVerts);
115
116 void recast_markCylinderArea(const float* pos, const float r, const float h,
117                         unsigned char areaId, struct recast_compactHeightfield *chf);
118
119 int recast_buildDistanceField(struct recast_compactHeightfield *chf);
120
121 int recast_buildRegions(struct recast_compactHeightfield *chf,
122                         const int borderSize, const int minRegionArea, const int mergeRegionArea);
123
124 int recast_buildLayerRegions(struct recast_compactHeightfield *chf,
125                         const int borderSize, const int minRegionArea);
126
127 int recast_buildRegionsMonotone(struct recast_compactHeightfield *chf,
128                         const int borderSize, const int minRegionArea, const int mergeRegionArea);
129
130 /* Contour set */
131
132 struct recast_contourSet *recast_newContourSet(void);
133
134 void recast_destroyContourSet(struct recast_contourSet *contourSet);
135
136 int recast_buildContours(struct recast_compactHeightfield *chf,
137                         const float maxError, const int maxEdgeLen, struct recast_contourSet *cset,
138                         const int buildFlags);
139
140 /* Poly mesh */
141
142 struct recast_polyMesh *recast_newPolyMesh(void);
143
144 void recast_destroyPolyMesh(struct recast_polyMesh *polyMesh);
145
146 int recast_buildPolyMesh(struct recast_contourSet *cset, const int nvp, struct recast_polyMesh *mesh);
147
148 int recast_mergePolyMeshes(struct recast_polyMesh **meshes, const int nmeshes, struct recast_polyMesh *mesh);
149
150 int recast_copyPolyMesh(const struct recast_polyMesh *src, struct recast_polyMesh *dst);
151
152 unsigned short *recast_polyMeshGetVerts(struct recast_polyMesh *mesh, int *nverts);
153
154 void recast_polyMeshGetBoundbox(struct recast_polyMesh *mesh, float *bmin, float *bmax);
155
156 void recast_polyMeshGetCell(struct recast_polyMesh *mesh, float *cs, float *ch);
157
158 unsigned short *recast_polyMeshGetPolys(struct recast_polyMesh *mesh, int *npolys, int *nvp);
159
160 /* Poly mesh detail */
161
162 struct recast_polyMeshDetail *recast_newPolyMeshDetail(void);
163
164 void recast_destroyPolyMeshDetail(struct recast_polyMeshDetail *polyMeshDetail);
165
166 int recast_buildPolyMeshDetail(const struct recast_polyMesh *mesh, const struct recast_compactHeightfield *chf,
167                         const float sampleDist, const float sampleMaxError, struct recast_polyMeshDetail *dmesh);
168
169 int recast_mergePolyMeshDetails(struct recast_polyMeshDetail **meshes, const int nmeshes, struct recast_polyMeshDetail *mesh);
170
171 float *recast_polyMeshDetailGetVerts(struct recast_polyMeshDetail *mesh, int *nverts);
172
173 unsigned char *recast_polyMeshDetailGetTris(struct recast_polyMeshDetail *mesh, int *ntris);
174
175 unsigned int *recast_polyMeshDetailGetMeshes(struct recast_polyMeshDetail *mesh, int *nmeshes);
176
177 #ifdef __cplusplus
178 }
179 #endif
180
181 #endif // RECAST_C_API_H