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