dbf-udg

diff libs/metasurf/metasurf.h @ 5:e09cbb2e9d4f

metaballs
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 18 Feb 2013 03:46:52 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/metasurf/metasurf.h	Mon Feb 18 03:46:52 2013 +0200
     1.3 @@ -0,0 +1,72 @@
     1.4 +/*
     1.5 +metasurf - a library for implicit surface polygonization
     1.6 +Copyright (C) 2011  John Tsiombikas <nuclear@member.fsf.org>
     1.7 +
     1.8 +This program is free software: you can redistribute it and/or modify
     1.9 +it under the terms of the GNU Lesser General Public License as published by
    1.10 +the Free Software Foundation, either version 3 of the License, or
    1.11 +(at your option) any later version.
    1.12 +
    1.13 +This program is distributed in the hope that it will be useful,
    1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +GNU Lesser General Public License for more details.
    1.17 +
    1.18 +You should have received a copy of the GNU Lesser General Public License
    1.19 +along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.20 +*/
    1.21 +
    1.22 +#ifndef METASURF_H_
    1.23 +#define METASURF_H_
    1.24 +
    1.25 +#define MSURF_GREATER	1
    1.26 +#define MSURF_LESS		0
    1.27 +
    1.28 +struct metasurface;
    1.29 +
    1.30 +typedef float (*msurf_eval_func_t)(float, float, float);
    1.31 +typedef void (*msurf_vertex_func_t)(float, float, float);
    1.32 +typedef void (*msurf_normal_func_t)(float, float, float);
    1.33 +
    1.34 +#ifdef __cplusplus
    1.35 +extern "C" {
    1.36 +#endif
    1.37 +
    1.38 +struct metasurface *msurf_create(void);
    1.39 +void msurf_free(struct metasurface *ms);
    1.40 +
    1.41 +/* which is inside above or below the threshold */
    1.42 +void msurf_inside(struct metasurface *ms, int inside);
    1.43 +
    1.44 +/* set a scalar field evaluator function */
    1.45 +void msurf_eval_func(struct metasurface *ms, msurf_eval_func_t func);
    1.46 +
    1.47 +/* set a generated vertex callback function */
    1.48 +void msurf_vertex_func(struct metasurface *ms, msurf_vertex_func_t func);
    1.49 +
    1.50 +/* set a generated surface normal callback function (unused yet) */
    1.51 +void msurf_normal_func(struct metasurface *ms, msurf_normal_func_t func);
    1.52 +
    1.53 +/* set the bounding box (default: -1, -1, -1, 1, 1, 1)
    1.54 + * keep this as tight as possible to avoid wasting grid resolution
    1.55 + */
    1.56 +void msurf_bounds(struct metasurface *ms, float xmin, float ymin, float zmin, float xmax, float ymax, float zmax);
    1.57 +
    1.58 +/* resolution of the 3D evaluation grid, the bigger, the better, the slower
    1.59 + * (default: 40, 40, 40)
    1.60 + */
    1.61 +void msurf_resolution(struct metasurface *ms, int xres, int yres, int zres);
    1.62 +
    1.63 +/* isosurface threshold value (default: 0) */
    1.64 +void msurf_threshold(struct metasurface *ms, float thres);
    1.65 +
    1.66 +
    1.67 +/* finally call this to perform the polygonization */
    1.68 +int msurf_polygonize(struct metasurface *ms);
    1.69 +
    1.70 +
    1.71 +#ifdef __cplusplus
    1.72 +}
    1.73 +#endif
    1.74 +
    1.75 +#endif	/* METASURF_H_ */