Blender V2.61 - r43446

dualcon.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Nicholas Bishop
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00023 #ifndef DUALCON_H
00024 #define DUALCON_H
00025 
00026 #ifdef __cplusplus
00027 extern "C" { 
00028 #endif
00029 
00030 typedef float (*DualConCo)[3];
00031 typedef unsigned int (*DualConFaces)[4];
00032 struct DerivedMesh;
00033 
00034 typedef struct DualConInput {
00035     DualConCo co;
00036     int co_stride;
00037     int totco;
00038     
00039     DualConFaces faces;
00040     int face_stride;
00041     int totface;
00042     
00043     float min[3], max[3];
00044 } DualConInput;
00045 
00046 /* callback for allocating memory for output */
00047 typedef void *(*DualConAllocOutput)(int totvert, int totquad);
00048 /* callback for adding a new vertex to the output */
00049 typedef void (*DualConAddVert)(void *output, const float co[3]);
00050 /* callback for adding a new quad to the output */
00051 typedef void (*DualConAddQuad)(void *output, const int vert_indices[4]);
00052 
00053 typedef enum {
00054     DUALCON_FLOOD_FILL = 1,
00055 } DualConFlags;
00056 
00057 typedef enum {
00058     /* blocky */
00059     DUALCON_CENTROID,
00060     /* smooth */
00061     DUALCON_MASS_POINT,
00062     /* keeps sharp edges */
00063     DUALCON_SHARP_FEATURES,
00064 } DualConMode;
00065 
00066 /* Usage:
00067    
00068    The three callback arguments are used for creating the output
00069    mesh. The alloc_output callback takes the total number of vertices
00070    and faces (quads) that will be in the output. It should allocate
00071    and return a structure to hold the output mesh. The add_vert and
00072    add_quad callbacks will then be called for each new vertex and
00073    quad, and the callback should add the new mesh elements to the
00074    structure.
00075 */
00076 void *dualcon(const DualConInput *input_mesh,
00077               /* callbacks for output */
00078               DualConAllocOutput alloc_output,
00079               DualConAddVert add_vert,
00080               DualConAddQuad add_quad,
00081 
00082               /* flags and settings to control the remeshing
00083                  algorithm */
00084               DualConFlags flags,
00085               DualConMode mode,
00086               float threshold,
00087               float hermite_num,
00088               float scale,
00089               int depth);
00090 
00091 #ifdef __cplusplus
00092 } 
00093 #endif
00094 
00095 #endif