metasurf

view src/metasurf.h @ 3:52664d3451ad

added volume rendering example
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Oct 2011 13:30:03 +0300
parents 7aa4627e492b
children 2c575855f707
line source
1 /*
2 metasurf - a library for implicit surface polygonization
3 Copyright (C) 2011 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
19 #ifndef METASURF_H_
20 #define METASURF_H_
22 struct metasurface;
24 typedef float (*msurf_eval_func_t)(float, float, float);
25 typedef void (*msurf_vertex_func_t)(float, float, float);
26 typedef void (*msurf_normal_func_t)(float, float, float);
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 struct metasurface *msurf_create(void);
33 void msurf_free(struct metasurface *ms);
35 /* set a scalar field evaluator function */
36 void msurf_eval_func(struct metasurface *ms, msurf_eval_func_t func);
38 /* set a generated vertex callback function */
39 void msurf_vertex_func(struct metasurface *ms, msurf_vertex_func_t func);
41 /* set a generated surface normal callback function (unused yet) */
42 void msurf_normal_func(struct metasurface *ms, msurf_normal_func_t func);
44 /* set the bounding box (default: -1, -1, -1, 1, 1, 1)
45 * keep this as tight as possible to avoid wasting grid resolution
46 */
47 void msurf_bounds(struct metasurface *ms, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax);
49 /* resolution of the 3D evaluation grid, the bigger, the better, the slower
50 * (default: 40, 40, 40)
51 */
52 void msurf_resolution(struct metasurface *ms, int xres, int yres, int zres);
54 /* isosurface threshold value (default: 0) */
55 void msurf_threshold(struct metasurface *ms, float thres);
58 /* finally call this to perform the polygonization */
59 int msurf_polygonize(struct metasurface *ms);
62 #ifdef __cplusplus
63 }
64 #endif
66 #endif /* METASURF_H_ */