doxygen: blender/blenkernel tagged.
[blender.git] / source / blender / blenkernel / intern / CCGSubSurf.h
1 /** \file blender/blenkernel/intern/CCGSubSurf.h
2  *  \ingroup bke
3  */
4 /* $Id$ */
5
6 typedef void* CCGMeshHDL;
7 typedef void* CCGVertHDL;
8 typedef void* CCGEdgeHDL;
9 typedef void* CCGFaceHDL;
10
11 typedef struct _CCGVert CCGVert;
12 typedef struct _CCGEdge CCGEdge;
13 typedef struct _CCGFace CCGFace;
14
15 typedef struct _CCGMeshIFC CCGMeshIFC;
16 struct _CCGMeshIFC {
17         int                     vertUserSize, edgeUserSize, faceUserSize;
18
19         int                     vertDataSize;
20 };
21
22 /***/
23
24 typedef void* CCGAllocatorHDL;
25
26 typedef struct _CCGAllocatorIFC CCGAllocatorIFC;
27 struct _CCGAllocatorIFC {
28         void*           (*alloc)                        (CCGAllocatorHDL a, int numBytes);
29         void*           (*realloc)                      (CCGAllocatorHDL a, void *ptr, int newSize, int oldSize);
30         void            (*free)                         (CCGAllocatorHDL a, void *ptr);
31         void            (*release)                      (CCGAllocatorHDL a);
32 };
33
34 /***/
35
36 typedef enum {
37         eCCGError_None = 0,
38
39         eCCGError_InvalidSyncState,
40         eCCGError_InvalidValue,
41 } CCGError;
42
43 /***/
44
45 #define CCG_OMP_LIMIT   1000000
46
47 /***/
48
49 typedef struct _CCGSubSurf CCGSubSurf;
50
51 CCGSubSurf*     ccgSubSurf_new  (CCGMeshIFC *ifc, int subdivisionLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator);
52 void            ccgSubSurf_free (CCGSubSurf *ss);
53
54 CCGError        ccgSubSurf_sync (CCGSubSurf *ss);
55
56 CCGError        ccgSubSurf_initFullSync         (CCGSubSurf *ss);
57 CCGError        ccgSubSurf_initPartialSync      (CCGSubSurf *ss);
58
59 CCGError        ccgSubSurf_syncVert             (CCGSubSurf *ss, CCGVertHDL vHDL, void *vertData, int seam, CCGVert **v_r);
60 CCGError        ccgSubSurf_syncEdge             (CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0, CCGVertHDL e_vHDL1, float crease, CCGEdge **e_r);
61 CCGError        ccgSubSurf_syncFace             (CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGVertHDL *vHDLs, CCGFace **f_r);
62
63 CCGError        ccgSubSurf_syncVertDel  (CCGSubSurf *ss, CCGVertHDL vHDL);
64 CCGError        ccgSubSurf_syncEdgeDel  (CCGSubSurf *ss, CCGEdgeHDL eHDL);
65 CCGError        ccgSubSurf_syncFaceDel  (CCGSubSurf *ss, CCGFaceHDL fHDL);
66
67 CCGError        ccgSubSurf_processSync  (CCGSubSurf *ss);
68
69 CCGError        ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
70 CCGError        ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
71 CCGError        ccgSubSurf_updateNormals(CCGSubSurf *ss, CCGFace **faces, int numFaces);
72 CCGError        ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
73 CCGError        ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
74
75 CCGError        ccgSubSurf_setSubdivisionLevels         (CCGSubSurf *ss, int subdivisionLevels);
76
77 CCGError        ccgSubSurf_setAllowEdgeCreation         (CCGSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData);
78 void            ccgSubSurf_getAllowEdgeCreation         (CCGSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r);
79
80 void            ccgSubSurf_getUseAgeCounts                      (CCGSubSurf *ss, int *useAgeCounts_r, int *vertUserOffset_r, int *edgeUserOffset_r, int *faceUserOffset_r);
81 CCGError        ccgSubSurf_setUseAgeCounts                      (CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset);
82
83 CCGError        ccgSubSurf_setCalcVertexNormals         (CCGSubSurf *ss, int useVertNormals, int normalDataOffset);
84
85 /***/
86
87 int                     ccgSubSurf_getNumVerts                          (CCGSubSurf *ss);
88 int                     ccgSubSurf_getNumEdges                          (CCGSubSurf *ss);
89 int                     ccgSubSurf_getNumFaces                          (CCGSubSurf *ss);
90
91 int                     ccgSubSurf_getSubdivisionLevels         (CCGSubSurf *ss);
92 int                     ccgSubSurf_getEdgeSize                          (CCGSubSurf *ss);
93 int                     ccgSubSurf_getEdgeLevelSize                     (CCGSubSurf *ss, int level);
94 int                     ccgSubSurf_getGridSize                          (CCGSubSurf *ss);
95 int                     ccgSubSurf_getGridLevelSize                     (CCGSubSurf *ss, int level);
96
97 CCGVert*        ccgSubSurf_getVert                                      (CCGSubSurf *ss, CCGVertHDL v);
98 CCGVertHDL      ccgSubSurf_getVertVertHandle            (CCGVert *v);
99 int                     ccgSubSurf_getVertNumFaces                      (CCGVert *v);
100 CCGFace*        ccgSubSurf_getVertFace                          (CCGVert *v, int index);
101 int                     ccgSubSurf_getVertNumEdges                      (CCGVert *v);
102 CCGEdge*        ccgSubSurf_getVertEdge                          (CCGVert *v, int index);
103
104 int                     ccgSubSurf_getVertAge                           (CCGSubSurf *ss, CCGVert *v);
105 void*           ccgSubSurf_getVertUserData                      (CCGSubSurf *ss, CCGVert *v);
106 void*           ccgSubSurf_getVertData                          (CCGSubSurf *ss, CCGVert *v);
107 void*           ccgSubSurf_getVertLevelData                     (CCGSubSurf *ss, CCGVert *v, int level);
108
109 CCGEdge*        ccgSubSurf_getEdge                                      (CCGSubSurf *ss, CCGEdgeHDL e);
110 CCGEdgeHDL      ccgSubSurf_getEdgeEdgeHandle            (CCGEdge *e);
111 int                     ccgSubSurf_getEdgeNumFaces                      (CCGEdge *e);
112 CCGFace*        ccgSubSurf_getEdgeFace                          (CCGEdge *e, int index);
113 CCGVert*        ccgSubSurf_getEdgeVert0                         (CCGEdge *e);
114 CCGVert*        ccgSubSurf_getEdgeVert1                         (CCGEdge *e);
115 float           ccgSubSurf_getEdgeCrease                        (CCGEdge *e);
116
117 int                     ccgSubSurf_getEdgeAge                           (CCGSubSurf *ss, CCGEdge *e);
118 void*           ccgSubSurf_getEdgeUserData                      (CCGSubSurf *ss, CCGEdge *e);
119 void*           ccgSubSurf_getEdgeDataArray                     (CCGSubSurf *ss, CCGEdge *e);
120 void*           ccgSubSurf_getEdgeData                          (CCGSubSurf *ss, CCGEdge *e, int x);
121 void*           ccgSubSurf_getEdgeLevelData                     (CCGSubSurf *ss, CCGEdge *e, int x, int level);
122
123 CCGFace*        ccgSubSurf_getFace                                      (CCGSubSurf *ss, CCGFaceHDL f);
124 CCGFaceHDL      ccgSubSurf_getFaceFaceHandle            (CCGSubSurf *ss, CCGFace *f);
125 int                     ccgSubSurf_getFaceNumVerts                      (CCGFace *f);
126 CCGVert*        ccgSubSurf_getFaceVert                          (CCGSubSurf *ss, CCGFace *f, int index);
127 CCGEdge*        ccgSubSurf_getFaceEdge                          (CCGSubSurf *ss, CCGFace *f, int index);
128 int                     ccgSubSurf_getFaceEdgeIndex                     (CCGFace *f, CCGEdge *e);
129
130 int                     ccgSubSurf_getFaceAge                           (CCGSubSurf *ss, CCGFace *f);
131 void*           ccgSubSurf_getFaceUserData                      (CCGSubSurf *ss, CCGFace *f);
132 void*           ccgSubSurf_getFaceCenterData            (CCGFace *f);
133 void*           ccgSubSurf_getFaceGridEdgeDataArray     (CCGSubSurf *ss, CCGFace *f, int gridIndex);
134 void*           ccgSubSurf_getFaceGridEdgeData          (CCGSubSurf *ss, CCGFace *f, int gridIndex, int x);
135 void*           ccgSubSurf_getFaceGridDataArray         (CCGSubSurf *ss, CCGFace *f, int gridIndex);
136 void*           ccgSubSurf_getFaceGridData                      (CCGSubSurf *ss, CCGFace *f, int gridIndex, int x, int y);
137
138 int                     ccgSubSurf_getNumFinalVerts             (CCGSubSurf *ss);
139 int                     ccgSubSurf_getNumFinalEdges             (CCGSubSurf *ss);
140 int                     ccgSubSurf_getNumFinalFaces             (CCGSubSurf *ss);
141
142 /***/
143
144 typedef struct _CCGVertIterator CCGVertIterator;
145 typedef struct _CCGEdgeIterator CCGEdgeIterator;
146 typedef struct _CCGFaceIterator CCGFaceIterator;
147
148 CCGVertIterator*        ccgSubSurf_getVertIterator      (CCGSubSurf *ss);
149 CCGEdgeIterator*        ccgSubSurf_getEdgeIterator      (CCGSubSurf *ss);
150 CCGFaceIterator*        ccgSubSurf_getFaceIterator      (CCGSubSurf *ss);
151
152 CCGVert*                        ccgVertIterator_getCurrent      (CCGVertIterator *vi);
153 int                                     ccgVertIterator_isStopped       (CCGVertIterator *vi);
154 void                            ccgVertIterator_next            (CCGVertIterator *vi);
155 void                            ccgVertIterator_free            (CCGVertIterator *vi);
156
157 CCGEdge*                        ccgEdgeIterator_getCurrent      (CCGEdgeIterator *ei);
158 int                                     ccgEdgeIterator_isStopped       (CCGEdgeIterator *ei);
159 void                            ccgEdgeIterator_next            (CCGEdgeIterator *ei);
160 void                            ccgEdgeIterator_free            (CCGEdgeIterator *ei);
161
162 CCGFace*                        ccgFaceIterator_getCurrent      (CCGFaceIterator *fi);
163 int                                     ccgFaceIterator_isStopped       (CCGFaceIterator *fi);
164 void                            ccgFaceIterator_next            (CCGFaceIterator *fi);
165 void                            ccgFaceIterator_free            (CCGFaceIterator *fi);