metasurf

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