sim: Remove "continue physics" code
[blender.git] / source / blender / blenkernel / intern / booleanops_mesh.c
index 14e32873dbd3350b57ea4d959e2dafe8db8a579e..f53a89fccfdd6ac04658b71126d23487d27f0e02 100644 (file)
@@ -1,8 +1,5 @@
 #if 0
-
-/**
- * $Id$
- *
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -17,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  *
  * ***** END GPL LICENSE BLOCK *****
  */
+
+/** \file blender/blenkernel/intern/booleanops_mesh.c
+ *  \ingroup bke
+ */
+
 #include "CSG_BooleanOps.h"
 
-#include "BKE_booleanops.h"
-#include "BKE_booleanops_mesh.h"
-#include "MEM_guardedalloc.h"
 
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
 
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-#include "BKE_displist.h"
-#include "BKE_object.h"
-#include "BKE_utildefines.h"
-#include "BKE_library.h"
-#include "BKE_material.h"
 
-#include "BLI_arithb.h"
 
 /**
  * Implementation of boolean ops mesh interface.
        void
 CSG_DestroyMeshDescriptor(
        CSG_MeshDescriptor *mesh
-){
-       // Call mesh descriptors destroy function....
+) {
+       /* Call mesh descriptors destroy function.... */
        mesh->m_destroy_func(mesh);
 }
-       
-// Destroy function for blender mesh internals.
+
+/* Destroy function for blender mesh internals. */
 
 static
        void
 CSG_DestroyBlenderMeshInternals(
        CSG_MeshDescriptor *mesh
 ) {
-       // Free face and vertex iterators.
-       FreeMeshDescriptors(&(mesh->m_face_iterator),&(mesh->m_vertex_iterator));               
+       /* Free face and vertex iterators. */
+       FreeMeshDescriptors(&(mesh->m_face_iterator), &(mesh->m_vertex_iterator));
 }
 
 
@@ -77,7 +64,7 @@ static
        void
 CSG_DestroyCSGMeshInternals(
        CSG_MeshDescriptor *mesh
-){
+) {
        CSG_FreeVertexDescriptor(&(mesh->m_vertex_iterator));
        CSG_FreeFaceDescriptor(&(mesh->m_face_iterator));
 }
@@ -91,7 +78,7 @@ MakeCSGMeshFromBlenderBase(
        Mesh *me;
        if (output == NULL || base == NULL) return 0;
 
-       me = get_mesh(base->object);
+       me = BKE_mesh_from_object(base->object);
                
        output->m_descriptor.user_face_vertex_data_size = 0;
        output->m_descriptor.user_data_size = sizeof(FaceData);
@@ -113,12 +100,12 @@ MakeCSGMeshFromBlenderBase(
 CSG_LoadBlenderMesh(
        Object * obj,
        CSG_MeshDescriptor *output
-){
+) {
 
        Mesh *me;
        if (output == NULL || obj == NULL) return 0;
 
-       me = get_mesh(obj);
+       me = BKE_mesh_from_object(obj);
                
        output->m_descriptor.user_face_vertex_data_size = 0;
        output->m_descriptor.user_data_size = sizeof(FaceData);
@@ -143,7 +130,7 @@ CSG_LoadBlenderMesh(
        int
 CSG_AddMeshToBlender(
        CSG_MeshDescriptor *mesh
-){
+) {
        Mesh *me_new = NULL;
        Object *ob_new = NULL;
        float inv_mat[4][4];
@@ -151,20 +138,20 @@ CSG_AddMeshToBlender(
        if (mesh == NULL) return 0;
        if (mesh->base == NULL) return 0;
 
-       Mat4Invert(inv_mat,mesh->base->object->obmat);
+       invert_m4_m4(inv_mat, mesh->base->object->obmat);
 
-       // Create a new blender mesh object - using 'base' as 
-       // a template for the new object.
-       ob_new=  AddNewBlenderMesh(mesh->base);
+       /* Create a new blender mesh object - using 'base' as
+        * a template for the new object. */
+       ob_new =  AddNewBlenderMesh(mesh->base);
 
        me_new = ob_new->data;
 
-       // make sure the iterators are reset.
+       /* make sure the iterators are reset. */
        mesh->m_face_iterator.Reset(mesh->m_face_iterator.it);
        mesh->m_vertex_iterator.Reset(mesh->m_vertex_iterator.it);
 
-       // iterate through results of operation and insert into new object
-       // see subsurf.c 
+       /* iterate through results of operation and insert into new object
+        * see subsurf.c */
 
        ConvertCSGDescriptorsToMeshObject(
                ob_new,
@@ -183,7 +170,7 @@ CSG_PerformOp(
        CSG_MeshDescriptor *mesh2,
        int int_op_type,
        CSG_MeshDescriptor *output
-){
+) {
 
        CSG_OperationType op_type;
        CSG_BooleanOperation * bool_op = CSG_NewBooleanFunction();
@@ -193,7 +180,7 @@ CSG_PerformOp(
 
        if ((mesh1 == NULL) || (mesh2 == NULL) || (output == NULL)) {
                return 0;
-       }       
+       }
        if ((int_op_type < 1) || (int_op_type > 3)) return 0;
 
        switch (int_op_type) {
@@ -204,22 +191,23 @@ CSG_PerformOp(
                default : op_type = e_csg_intersection;
        }
        
-       output->m_descriptor = CSG_DescibeOperands(bool_op,mesh1->m_descriptor,mesh2->m_descriptor);
+       output->m_descriptor = CSG_DescibeOperands(bool_op, mesh1->m_descriptor, mesh2->m_descriptor);
        output->base = mesh1->base;
 
        if (output->m_descriptor.user_face_vertex_data_size) {
-               // Then use the only interp function supported 
-               success = 
+               /* Then use the only interp function supported */
+               success =
                CSG_PerformBooleanOperation(
                        bool_op,
                        op_type,
                        mesh1->m_face_iterator,
                        mesh1->m_vertex_iterator,
                        mesh2->m_face_iterator,
-                       mesh2->m_vertex_iterator,               
-                       InterpFaceVertexData    
+                       mesh2->m_vertex_iterator,
+                       InterpFaceVertexData
                );
-       } else {
+       }
+       else {
                success = 
                CSG_PerformBooleanOperation(
                        bool_op,
@@ -227,8 +215,8 @@ CSG_PerformOp(
                        mesh1->m_face_iterator,
                        mesh1->m_vertex_iterator,
                        mesh2->m_face_iterator,
-                       mesh2->m_vertex_iterator,               
-                       InterpNoUserData        
+                       mesh2->m_vertex_iterator,
+                       InterpNoUserData
                );
        }
 
@@ -237,11 +225,11 @@ CSG_PerformOp(
                bool_op = NULL;
                return 0;
        }
-               
-       // get the ouput mesh descriptors.
 
-       CSG_OutputFaceDescriptor(bool_op,&(output->m_face_iterator));
-       CSG_OutputVertexDescriptor(bool_op,&(output->m_vertex_iterator));
+       /* get the ouput mesh descriptors. */
+
+       CSG_OutputFaceDescriptor(bool_op, &(output->m_face_iterator));
+       CSG_OutputVertexDescriptor(bool_op, &(output->m_vertex_iterator));
        output->m_destroy_func = CSG_DestroyCSGMeshInternals;
 
        return 1;
@@ -252,22 +240,22 @@ NewBooleanMeshTest(
        struct Base * base,
        struct Base * base_select,
        int op_type
-){
+) {
 
-       CSG_MeshDescriptor m1,m2,output;
-       CSG_MeshDescriptor output2,output3;
+       CSG_MeshDescriptor m1, m2, output;
+       CSG_MeshDescriptor output2, output3;
        
-       if (!MakeCSGMeshFromBlenderBase(base,&m1)) {
+       if (!MakeCSGMeshFromBlenderBase(base, &m1)) {
                return 0;
        }
        
-       if (!MakeCSGMeshFromBlenderBase(base_select,&m2)) {
+       if (!MakeCSGMeshFromBlenderBase(base_select, &m2)) {
                return 0;
        }
        
-       CSG_PerformOp(&m1,&m2,1,&output);
-       CSG_PerformOp(&m1,&m2,2,&output2);
-       CSG_PerformOp(&m1,&m2,3,&output3);
+       CSG_PerformOp(&m1, &m2, 1, &output);
+       CSG_PerformOp(&m1, &m2, 2, &output2);
+       CSG_PerformOp(&m1, &m2, 3, &output3);
 
        if (!CSG_AddMeshToBlender(&output)) {
                return 0;