~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/bmesh/bmesh_class.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 * pointers. this is a requirement of mempool's method of
46
46
 * iteration.
47
47
 *
48
 
 * hrm. it doesn't but stull works ok, remove the comment above? - campbell.
 
48
 * hrm. it doesn't but still works ok, remove the comment above? - campbell.
49
49
 */
50
50
 
 
51
// #pragma GCC diagnostic error "-Wpadded"
 
52
 
51
53
/**
52
54
 * BMHeader
53
55
 *
69
71
                    *   this is abused by various tools which set it dirty.
70
72
                    * - For loops this is used for sorting during tessellation. */
71
73
 
72
 
        char htype; /* element geometric type (verts/edges/loops/faces) */
73
 
        char hflag; /* this would be a CD layer, see below */
 
74
        char htype;    /* element geometric type (verts/edges/loops/faces) */
 
75
        char hflag;    /* this would be a CD layer, see below */
 
76
 
 
77
        /* internal use only!
 
78
         * note,.we are very picky about not bloating this struct
 
79
         * but in this case its padded up to 16 bytes anyway,
 
80
         * so adding a flag here gives no increase in size */
 
81
        char api_flag;
 
82
//      char _pad;
74
83
} BMHeader;
75
84
 
 
85
BLI_STATIC_ASSERT((sizeof(BMHeader) <= 16), "BMHeader size has grown!");
 
86
 
76
87
/* note: need some way to specify custom locations for custom data layers.  so we can
77
88
 * make them point directly into structs.  and some way to make it only happen to the
78
89
 * active layer, and properly update when switching active layers.*/
122
133
/* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these don't have a flag layer */
123
134
typedef struct BMElemF {
124
135
        BMHeader head;
125
 
        struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
 
136
 
 
137
        /* keep directly after header,
 
138
         * optional array of flags, only used by the operator stack */
 
139
        struct BMFlagLayer *oflags;
126
140
} BMElemF;
127
141
 
128
142
/* can cast anything to this, including BMLoop */
142
156
        BMHeader head;
143
157
        struct BMFlagLayer *oflags; /* an array of flags, mostly used by the operator stack */
144
158
 
145
 
        int len; /*includes all boundary loops*/
146
159
#ifdef USE_BMESH_HOLES
147
160
        int totbounds; /*total boundaries, is one plus the number of holes in the face*/
148
161
        ListBase loops;
149
162
#else
150
163
        BMLoop *l_first;
151
164
#endif
152
 
        float no[3]; /*yes, we do store this here*/
 
165
        int   len;   /* includes all boundary loops */
 
166
        float no[3]; /* yes, we do store this here */
153
167
        short mat_nr;
 
168
//      short _pad[3];
154
169
} BMFace;
155
170
 
156
171
typedef struct BMFlagLayer {
157
 
        short f, pflag; /* flags */
 
172
        short f; /* flags */
158
173
} BMFlagLayer;
159
174
 
 
175
// #pragma GCC diagnostic ignored "-Wpadded"
 
176
 
160
177
typedef struct BMesh {
161
178
        int totvert, totedge, totloop, totface;
162
179
        int totvertsel, totedgesel, totfacesel;
166
183
         * valid flags are - BM_VERT | BM_EDGE | BM_FACE.
167
184
         * BM_LOOP isn't handled so far. */
168
185
        char elem_index_dirty;
169
 
        
170
 
        /*element pools*/
 
186
 
 
187
        /* element pools */
171
188
        struct BLI_mempool *vpool, *epool, *lpool, *fpool;
172
189
 
173
 
        /*operator api stuff*/
174
 
        struct BLI_mempool *toolflagpool;
 
190
        /* operator api stuff (must be all NULL or all alloc'd) */
 
191
        struct BLI_mempool *vtoolflagpool, *etoolflagpool, *ftoolflagpool;
 
192
 
175
193
        int stackdepth;
176
194
        struct BMOperator *currentop;
177
195
        
187
205
         * Only use when the edit mesh cant be accessed - campbell */
188
206
        short selectmode;
189
207
        
190
 
        /*ID of the shape key this bmesh came from*/
 
208
        /* ID of the shape key this bmesh came from */
191
209
        int shapenr;
192
210
        
193
211
        int walkers, totflags;
194
212
        ListBase selected, error_stack;
195
 
        
 
213
 
196
214
        BMFace *act_face;
197
215
 
198
216
        ListBase errorstack;
199
217
 
200
218
        void *py_handle;
201
 
 
202
 
        int opflag; /* current operator flag */
203
219
} BMesh;
204
220
 
205
221
/* BMHeader->htype (char) */
211
227
};
212
228
 
213
229
#define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
 
230
#define BM_ALL_NOLOOP (BM_VERT | BM_EDGE | BM_FACE)
214
231
 
215
232
/* BMHeader->hflag (char) */
216
233
enum {
225
242
                                 * when temp tagging is handy.
226
243
                                 * always assume dirty & clear before use. */
227
244
 
228
 
        /* we have 2 spare flags which is awesome but since we're limited to 8
229
 
         * only add new flags with care! - campbell */
230
 
        /* BM_ELEM_SPARE  = (1 << 5), */
231
 
        /* BM_ELEM_SPARE  = (1 << 6), */
 
245
        BM_ELEM_DRAW    = (1 << 5), /* edge display */
 
246
 
 
247
        /* spare tag, assumed dirty, use define in each function to name based on use */
 
248
        // _BM_ELEM_TAG_ALT = (1 << 6),  // UNUSED
232
249
 
233
250
        BM_ELEM_INTERNAL_TAG = (1 << 7) /* for low level internal API tagging,
234
251
                                     * since tools may want to tag verts and
236
253
};
237
254
 
238
255
/* defines */
 
256
#define BM_ELEM_CD_GET_VOID_P(ele, offset) \
 
257
        (assert(offset != -1), (void *)((char *)(ele)->head.data + (offset)))
 
258
 
 
259
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f) \
 
260
        { assert(offset != -1); *((float *)((char *)(ele)->head.data + (offset))) = (f); } (void)0
 
261
 
 
262
#define BM_ELEM_CD_GET_FLOAT(ele, offset) \
 
263
        (assert(offset != -1), *((float *)((char *)(ele)->head.data + (offset))))
 
264
 
 
265
#define BM_ELEM_CD_GET_FLOAT_AS_UCHAR(ele, offset) \
 
266
        (assert(offset != -1), (unsigned char)(BM_ELEM_CD_GET_FLOAT(ele, offset) * 255.0f))
239
267
 
240
268
/*forward declarations*/
241
269
 
245
273
#  define BM_FACE_FIRST_LOOP(p) ((p)->l_first)
246
274
#endif
247
275
 
248
 
/* size to use for static arrays when dealing with NGons,
 
276
/**
 
277
 * size to use for stack arrays when dealing with NGons,
249
278
 * alloc after this limit is reached.
250
279
 * this value is rather arbitrary */
251
 
#define BM_NGON_STACK_SIZE 32
 
280
#define BM_DEFAULT_NGON_STACK_SIZE 32
 
281
/**
 
282
 * size to use for stack arrays dealing with connected mesh data
 
283
 * verts of faces, edges of vert - etc.
 
284
 * often used with #BM_iter_as_arrayN() */
 
285
#define BM_DEFAULT_ITER_STACK_SIZE 16
252
286
 
253
287
/* avoid inf loop, this value is arbitrary
254
288
 * but should not error on valid cases */
255
289
#define BM_LOOP_RADIAL_MAX 10000
256
290
#define BM_NGON_MAX 100000
 
291
#define BM_OMP_LIMIT 10000  /* setting zero so we can catch bugs in OpenMP/BMesh */
257
292
 
258
293
#endif /* __BMESH_CLASS_H__ */