dbf-udg
view libs/metasurf/metasurf.h @ 6:57ea4988a9f2
added code to dump the ditherblock image
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 18 Feb 2013 04:41:26 +0200 |
parents | |
children |
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 #define MSURF_GREATER 1
23 #define MSURF_LESS 0
25 struct metasurface;
27 typedef float (*msurf_eval_func_t)(float, float, float);
28 typedef void (*msurf_vertex_func_t)(float, float, float);
29 typedef void (*msurf_normal_func_t)(float, float, float);
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 struct metasurface *msurf_create(void);
36 void msurf_free(struct metasurface *ms);
38 /* which is inside above or below the threshold */
39 void msurf_inside(struct metasurface *ms, int inside);
41 /* set a scalar field evaluator function */
42 void msurf_eval_func(struct metasurface *ms, msurf_eval_func_t func);
44 /* set a generated vertex callback function */
45 void msurf_vertex_func(struct metasurface *ms, msurf_vertex_func_t func);
47 /* set a generated surface normal callback function (unused yet) */
48 void msurf_normal_func(struct metasurface *ms, msurf_normal_func_t func);
50 /* set the bounding box (default: -1, -1, -1, 1, 1, 1)
51 * keep this as tight as possible to avoid wasting grid resolution
52 */
53 void msurf_bounds(struct metasurface *ms, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax);
55 /* resolution of the 3D evaluation grid, the bigger, the better, the slower
56 * (default: 40, 40, 40)
57 */
58 void msurf_resolution(struct metasurface *ms, int xres, int yres, int zres);
60 /* isosurface threshold value (default: 0) */
61 void msurf_threshold(struct metasurface *ms, float thres);
64 /* finally call this to perform the polygonization */
65 int msurf_polygonize(struct metasurface *ms);
68 #ifdef __cplusplus
69 }
70 #endif
72 #endif /* METASURF_H_ */