sim: Remove "continue physics" code
[blender.git] / source / blender / blenkernel / intern / CCGSubSurf.h
1
2 /** \file blender/blenkernel/intern/CCGSubSurf.h
3  *  \ingroup bke
4  */
5
6 typedef void* CCGMeshHDL;
7 typedef void* CCGVertHDL;
8 typedef void* CCGEdgeHDL;
9 typedef void* CCGFaceHDL;
10
11 typedef struct CCGSubSurf CCGSubSurf;
12 typedef struct CCGVert CCGVert;
13 typedef struct CCGEdge CCGEdge;
14 typedef struct CCGFace CCGFace;
15
16 typedef struct CCGMeshIFC {
17         int                     vertUserSize, edgeUserSize, faceUserSize;
18         int                     numLayers;
19         int                     vertDataSize;
20         int                     simpleSubdiv;
21 } CCGMeshIFC;
22
23 /***/
24
25 typedef void* CCGAllocatorHDL;
26
27 typedef 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 } CCGAllocatorIFC;
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 CCGSubSurf*     ccgSubSurf_new  (CCGMeshIFC *ifc, int subdivisionLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator);
50 void            ccgSubSurf_free (CCGSubSurf *ss);
51
52 CCGError        ccgSubSurf_initFullSync         (CCGSubSurf *ss);
53 CCGError        ccgSubSurf_initPartialSync      (CCGSubSurf *ss);
54
55 CCGError        ccgSubSurf_syncVert             (CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertData, int seam, CCGVert **v_r);
56 CCGError        ccgSubSurf_syncEdge             (CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0, CCGVertHDL e_vHDL1, float crease, CCGEdge **e_r);
57 CCGError        ccgSubSurf_syncFace             (CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGVertHDL *vHDLs, CCGFace **f_r);
58
59 CCGError        ccgSubSurf_syncVertDel  (CCGSubSurf *ss, CCGVertHDL vHDL);
60 CCGError        ccgSubSurf_syncEdgeDel  (CCGSubSurf *ss, CCGEdgeHDL eHDL);
61 CCGError        ccgSubSurf_syncFaceDel  (CCGSubSurf *ss, CCGFaceHDL fHDL);
62
63 CCGError        ccgSubSurf_processSync  (CCGSubSurf *ss);
64
65 CCGError        ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
66 CCGError        ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
67 CCGError        ccgSubSurf_updateNormals(CCGSubSurf *ss, CCGFace **faces, int numFaces);
68 CCGError        ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
69 CCGError        ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
70
71 CCGError        ccgSubSurf_setSubdivisionLevels         (CCGSubSurf *ss, int subdivisionLevels);
72
73 CCGError        ccgSubSurf_setAllowEdgeCreation         (CCGSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData);
74 void            ccgSubSurf_getAllowEdgeCreation         (CCGSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r);
75
76 void            ccgSubSurf_getUseAgeCounts                      (CCGSubSurf *ss, int *useAgeCounts_r, int *vertUserOffset_r, int *edgeUserOffset_r, int *faceUserOffset_r);
77 CCGError        ccgSubSurf_setUseAgeCounts                      (CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset);
78
79 CCGError        ccgSubSurf_setCalcVertexNormals         (CCGSubSurf *ss, int useVertNormals, int normalDataOffset);
80 void            ccgSubSurf_setAllocMask                         (CCGSubSurf *ss, int allocMask, int maskOffset);
81
82 void            ccgSubSurf_setNumLayers                         (CCGSubSurf *ss, int numLayers);
83
84 /***/
85
86 int                     ccgSubSurf_getNumVerts                          (const CCGSubSurf *ss);
87 int                     ccgSubSurf_getNumEdges                          (const CCGSubSurf *ss);
88 int                     ccgSubSurf_getNumFaces                          (const CCGSubSurf *ss);
89
90 int                     ccgSubSurf_getSubdivisionLevels         (const CCGSubSurf *ss);
91 int                     ccgSubSurf_getEdgeSize                          (const CCGSubSurf *ss);
92 int                     ccgSubSurf_getEdgeLevelSize                     (const CCGSubSurf *ss, int level);
93 int                     ccgSubSurf_getGridSize                          (const CCGSubSurf *ss);
94 int                     ccgSubSurf_getGridLevelSize                     (const CCGSubSurf *ss, int level);
95 int                     ccgSubSurf_getSimpleSubdiv                      (const CCGSubSurf *ss);
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            (CCGFace *f);
125 int                     ccgSubSurf_getFaceNumVerts                      (CCGFace *f);
126 CCGVert*        ccgSubSurf_getFaceVert                          (CCGFace *f, int index);
127 CCGEdge*        ccgSubSurf_getFaceEdge                          (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             (const CCGSubSurf *ss);
139 int                     ccgSubSurf_getNumFinalEdges             (const CCGSubSurf *ss);
140 int                     ccgSubSurf_getNumFinalFaces             (const 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);