dbf-udg

annotate 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
rev   line source
nuclear@5 1 /*
nuclear@5 2 metasurf - a library for implicit surface polygonization
nuclear@5 3 Copyright (C) 2011 John Tsiombikas <nuclear@member.fsf.org>
nuclear@5 4
nuclear@5 5 This program is free software: you can redistribute it and/or modify
nuclear@5 6 it under the terms of the GNU Lesser General Public License as published by
nuclear@5 7 the Free Software Foundation, either version 3 of the License, or
nuclear@5 8 (at your option) any later version.
nuclear@5 9
nuclear@5 10 This program is distributed in the hope that it will be useful,
nuclear@5 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@5 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@5 13 GNU Lesser General Public License for more details.
nuclear@5 14
nuclear@5 15 You should have received a copy of the GNU Lesser General Public License
nuclear@5 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@5 17 */
nuclear@5 18
nuclear@5 19 #ifndef METASURF_H_
nuclear@5 20 #define METASURF_H_
nuclear@5 21
nuclear@5 22 #define MSURF_GREATER 1
nuclear@5 23 #define MSURF_LESS 0
nuclear@5 24
nuclear@5 25 struct metasurface;
nuclear@5 26
nuclear@5 27 typedef float (*msurf_eval_func_t)(float, float, float);
nuclear@5 28 typedef void (*msurf_vertex_func_t)(float, float, float);
nuclear@5 29 typedef void (*msurf_normal_func_t)(float, float, float);
nuclear@5 30
nuclear@5 31 #ifdef __cplusplus
nuclear@5 32 extern "C" {
nuclear@5 33 #endif
nuclear@5 34
nuclear@5 35 struct metasurface *msurf_create(void);
nuclear@5 36 void msurf_free(struct metasurface *ms);
nuclear@5 37
nuclear@5 38 /* which is inside above or below the threshold */
nuclear@5 39 void msurf_inside(struct metasurface *ms, int inside);
nuclear@5 40
nuclear@5 41 /* set a scalar field evaluator function */
nuclear@5 42 void msurf_eval_func(struct metasurface *ms, msurf_eval_func_t func);
nuclear@5 43
nuclear@5 44 /* set a generated vertex callback function */
nuclear@5 45 void msurf_vertex_func(struct metasurface *ms, msurf_vertex_func_t func);
nuclear@5 46
nuclear@5 47 /* set a generated surface normal callback function (unused yet) */
nuclear@5 48 void msurf_normal_func(struct metasurface *ms, msurf_normal_func_t func);
nuclear@5 49
nuclear@5 50 /* set the bounding box (default: -1, -1, -1, 1, 1, 1)
nuclear@5 51 * keep this as tight as possible to avoid wasting grid resolution
nuclear@5 52 */
nuclear@5 53 void msurf_bounds(struct metasurface *ms, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax);
nuclear@5 54
nuclear@5 55 /* resolution of the 3D evaluation grid, the bigger, the better, the slower
nuclear@5 56 * (default: 40, 40, 40)
nuclear@5 57 */
nuclear@5 58 void msurf_resolution(struct metasurface *ms, int xres, int yres, int zres);
nuclear@5 59
nuclear@5 60 /* isosurface threshold value (default: 0) */
nuclear@5 61 void msurf_threshold(struct metasurface *ms, float thres);
nuclear@5 62
nuclear@5 63
nuclear@5 64 /* finally call this to perform the polygonization */
nuclear@5 65 int msurf_polygonize(struct metasurface *ms);
nuclear@5 66
nuclear@5 67
nuclear@5 68 #ifdef __cplusplus
nuclear@5 69 }
nuclear@5 70 #endif
nuclear@5 71
nuclear@5 72 #endif /* METASURF_H_ */