Blender  V2.93
dualcon.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #ifndef __DUALCON_H__
18 #define __DUALCON_H__
19 
20 #ifdef WITH_CXX_GUARDEDALLOC
21 # include "MEM_guardedalloc.h"
22 #endif
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef float (*DualConCo)[3];
29 
30 typedef unsigned int (*DualConTri)[3];
31 
32 typedef unsigned int *DualConLoop;
33 
34 typedef struct DualConInput {
36 
38  int co_stride;
39  int totco;
40 
43  int tottri;
44 
46 
47  float min[3], max[3];
49 
50 /* callback for allocating memory for output */
51 typedef void *(*DualConAllocOutput)(int totvert, int totquad);
52 /* callback for adding a new vertex to the output */
53 typedef void (*DualConAddVert)(void *output, const float co[3]);
54 /* callback for adding a new quad to the output */
55 typedef void (*DualConAddQuad)(void *output, const int vert_indices[4]);
56 
57 typedef enum {
59 } DualConFlags;
60 
61 typedef enum {
62  /* blocky */
64  /* smooth */
66  /* keeps sharp edges */
68 } DualConMode;
69 
70 /* Usage:
71  *
72  * The three callback arguments are used for creating the output
73  * mesh. The alloc_output callback takes the total number of vertices
74  * and faces (quads) that will be in the output. It should allocate
75  * and return a structure to hold the output mesh. The add_vert and
76  * add_quad callbacks will then be called for each new vertex and
77  * quad, and the callback should add the new mesh elements to the
78  * structure.
79  */
80 void *dualcon(const DualConInput *input_mesh,
81  /* callbacks for output */
82  DualConAllocOutput alloc_output,
83  DualConAddVert add_vert,
84  DualConAddQuad add_quad,
85 
86  /* flags and settings to control the remeshing
87  * algorithm */
88  DualConFlags flags,
89  DualConMode mode,
90  float threshold,
91  float hermite_num,
92  float scale,
93  int depth);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* __DUALCON_H__ */
typedef float(TangentPoint)[2]
Read Guarded memory(de)allocation.
#define output
DualConMode
Definition: dualcon.h:61
@ DUALCON_SHARP_FEATURES
Definition: dualcon.h:67
@ DUALCON_CENTROID
Definition: dualcon.h:63
@ DUALCON_MASS_POINT
Definition: dualcon.h:65
unsigned int * DualConLoop
Definition: dualcon.h:32
struct DualConInput DualConInput
void(* DualConAddQuad)(void *output, const int vert_indices[4])
Definition: dualcon.h:55
void * dualcon(const DualConInput *input_mesh, DualConAllocOutput alloc_output, DualConAddVert add_vert, DualConAddQuad add_quad, DualConFlags flags, DualConMode mode, float threshold, float hermite_num, float scale, int depth)
unsigned int(* DualConTri)[3]
Definition: dualcon.h:30
float(* DualConCo)[3]
Definition: dualcon.h:28
void(* DualConAddVert)(void *output, const float co[3])
Definition: dualcon.h:53
DualConFlags
Definition: dualcon.h:57
@ DUALCON_FLOOD_FILL
Definition: dualcon.h:58
void *(* DualConAllocOutput)(int totvert, int totquad)
Definition: dualcon.h:51
int co_stride
Definition: dualcon.h:38
DualConTri looptri
Definition: dualcon.h:41
int tri_stride
Definition: dualcon.h:42
int loop_stride
Definition: dualcon.h:45
DualConCo co
Definition: dualcon.h:37
int totco
Definition: dualcon.h:39
int tottri
Definition: dualcon.h:43
float min[3]
Definition: dualcon.h:47
float max[3]
Definition: dualcon.h:47
DualConLoop mloop
Definition: dualcon.h:35