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