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