expanded the build instructions in the README
[dosdemo] / src / metasurf.h
1 #ifndef METASURF_H_
2 #define METASURF_H_
3
4 #include "3dgfx.h"
5
6 #define MSURF_GREATER   1
7 #define MSURF_LESS              0
8
9 #define MSURF_FLIP                      1
10 #define MSURF_NORMALIZE         2
11
12 struct metasurface;
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 struct metasurface *msurf_create(void);
19 void msurf_free(struct metasurface *ms);
20
21 void msurf_enable(struct metasurface *ms, unsigned int opt);
22 void msurf_disable(struct metasurface *ms, unsigned int opt);
23 int msurf_is_enabled(struct metasurface *ms, unsigned int opt);
24
25 /* which is inside above or below the threshold */
26 void msurf_set_inside(struct metasurface *ms, int inside);
27 int msurf_get_inside(struct metasurface *ms);
28
29 /* set the bounding box (default: -1, -1, -1, 1, 1, 1)
30  * keep this as tight as possible to avoid wasting grid resolution
31  */
32 void msurf_set_bounds(struct metasurface *ms, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax);
33 void msurf_get_bounds(struct metasurface *ms, float *xmin, float *ymin, float *zmin, float *xmax, float *ymax, float *zmax);
34
35 /* resolution of the 3D evaluation grid, the bigger, the better, the slower
36  * (default: 40, 40, 40)
37  */
38 void msurf_set_resolution(struct metasurface *ms, int xres, int yres, int zres);
39 void msurf_get_resolution(struct metasurface *ms, int *xres, int *yres, int *zres);
40
41 /* isosurface threshold value (default: 0) */
42 void msurf_set_threshold(struct metasurface *ms, float thres);
43 float msurf_get_threshold(struct metasurface *ms);
44
45 /* get pointer to the scalar field */
46 float *msurf_voxels(struct metasurface *ms);
47 float *msurf_slice(struct metasurface *ms, int idx);
48
49 /* finally call this to perform the polygonization */
50 int msurf_polygonize(struct metasurface *ms);
51
52 int msurf_vertex_count(struct metasurface *ms);
53 struct g3d_vertex *msurf_vertices(struct metasurface *ms);
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif  /* METASURF_H_ */