Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00033 #ifndef CSG_BOOLEANOPS_H 00034 #define CSG_BOOLEANOPS_H 00035 00036 00059 #ifdef __cplusplus 00060 extern "C" { 00061 #endif 00062 00063 typedef struct { 00064 int vertex_index[4]; 00065 int vertex_number; 00066 int orig_face; 00067 } CSG_IFace; 00068 00074 typedef struct { 00075 float position[3]; 00076 } CSG_IVertex; 00077 00117 typedef void* CSG_IteratorPtr; 00118 00119 typedef int (*CSG_FaceItDoneFunc)(CSG_IteratorPtr it); 00120 typedef void (*CSG_FaceItFillFunc)(CSG_IteratorPtr it,CSG_IFace *face); 00121 typedef void (*CSG_FaceItStepFunc)(CSG_IteratorPtr it); 00122 typedef void (*CSG_FaceItResetFunc)(CSG_IteratorPtr it); 00123 00124 typedef struct CSG_FaceIteratorDescriptor { 00125 CSG_IteratorPtr it; 00126 CSG_FaceItDoneFunc Done; 00127 CSG_FaceItFillFunc Fill; 00128 CSG_FaceItStepFunc Step; 00129 CSG_FaceItResetFunc Reset; 00130 unsigned int num_elements; 00131 } CSG_FaceIteratorDescriptor; 00132 00136 typedef int (*CSG_VertexItDoneFunc)(CSG_IteratorPtr it); 00137 typedef void (*CSG_VertexItFillFunc)(CSG_IteratorPtr it,CSG_IVertex *face); 00138 typedef void (*CSG_VertexItStepFunc)(CSG_IteratorPtr it); 00139 typedef void (*CSG_VertexItResetFunc)(CSG_IteratorPtr it); 00140 00141 typedef struct CSG_VertexIteratorDescriptor { 00142 CSG_IteratorPtr it; 00143 CSG_VertexItDoneFunc Done; 00144 CSG_VertexItFillFunc Fill; 00145 CSG_VertexItStepFunc Step; 00146 CSG_VertexItResetFunc Reset; 00147 unsigned int num_elements; 00148 } CSG_VertexIteratorDescriptor; 00149 00246 typedef enum { 00247 e_csg_union, 00248 e_csg_intersection, 00249 e_csg_difference, 00250 e_csg_classify 00251 } CSG_OperationType; 00252 00259 typedef struct { 00260 void *CSG_info; 00261 } CSG_BooleanOperation; 00262 00268 CSG_BooleanOperation * 00269 CSG_NewBooleanFunction( 00270 void 00271 ); 00272 00288 int 00289 CSG_PerformBooleanOperation( 00290 CSG_BooleanOperation * operation, 00291 CSG_OperationType op_type, 00292 CSG_FaceIteratorDescriptor obAFaces, 00293 CSG_VertexIteratorDescriptor obAVertices, 00294 CSG_FaceIteratorDescriptor obBFaces, 00295 CSG_VertexIteratorDescriptor obBVertices 00296 ); 00297 00316 int 00317 CSG_OutputFaceDescriptor( 00318 CSG_BooleanOperation * operation, 00319 CSG_FaceIteratorDescriptor * output 00320 ); 00321 00322 int 00323 CSG_OutputVertexDescriptor( 00324 CSG_BooleanOperation * operation, 00325 CSG_VertexIteratorDescriptor *output 00326 ); 00327 00334 void 00335 CSG_FreeVertexDescriptor( 00336 CSG_VertexIteratorDescriptor * v_descriptor 00337 ); 00338 00339 void 00340 CSG_FreeFaceDescriptor( 00341 CSG_FaceIteratorDescriptor * f_descriptor 00342 ); 00343 00349 void 00350 CSG_FreeBooleanOperation( 00351 CSG_BooleanOperation *operation 00352 ); 00353 00354 #ifdef __cplusplus 00355 } 00356 #endif 00357 00358 00359 00360 #endif 00361