[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14732] branches/cloth/blender: Reason of all this work: Commiting my work-in-progress on reviewed collision system ( better + general access to kdop, uses less memory, put it into BLI_* namespace and usage defined like existing BLI_kdtree_*).

Daniel Genrich daniel.genrich at gmx.net
Wed May 7 22:42:16 CEST 2008


Revision: 14732
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14732
Author:   genscher
Date:     2008-05-07 22:42:16 +0200 (Wed, 07 May 2008)

Log Message:
-----------
Reason of all this work: Commiting my work-in-progress on reviewed collision system (better + general access to kdop, uses less memory, put it into BLI_* namespace and usage defined like existing BLI_kdtree_*). Deleted old kdop.c

Modified Paths:
--------------
    branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
    branches/cloth/blender/source/blender/blenkernel/BKE_collision.h
    branches/cloth/blender/source/blender/blenkernel/BKE_effect.h
    branches/cloth/blender/source/blender/blenkernel/SConscript
    branches/cloth/blender/source/blender/blenkernel/intern/cloth.c
    branches/cloth/blender/source/blender/blenkernel/intern/collision.c
    branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
    branches/cloth/blender/source/blender/blenloader/intern/readfile.c
    branches/cloth/blender/source/blender/include/butspace.h
    branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h
    branches/cloth/blender/source/blender/src/buttons_editing.c
    branches/cloth/blender/source/blender/src/buttons_object.c
    branches/cloth/blender/source/blender/src/drawobject.c

Added Paths:
-----------
    branches/cloth/blender/intern/sph/
    branches/cloth/blender/intern/sph/SConscript
    branches/cloth/blender/intern/sph/extern/
    branches/cloth/blender/intern/sph/extern/sph_extern.h
    branches/cloth/blender/intern/sph/intern/
    branches/cloth/blender/intern/sph/intern/sph.cpp
    branches/cloth/blender/source/blender/blenkernel/BKE_sph.h
    branches/cloth/blender/source/blender/blenkernel/CCGSubSurf.h
    branches/cloth/blender/source/blender/blenkernel/bmesh_private.h
    branches/cloth/blender/source/blender/blenkernel/intern/sph.c
    branches/cloth/blender/source/blender/blenlib/BLI_kdopbvh.h
    branches/cloth/blender/source/blender/blenlib/intern/BLI_kdopbvh.c
    branches/cloth/blender/source/blender/makesdna/DNA_sph_types.h

Removed Paths:
-------------
    branches/cloth/blender/source/blender/blenkernel/intern/kdop.c

Added: branches/cloth/blender/intern/sph/SConscript
===================================================================
--- branches/cloth/blender/intern/sph/SConscript	                        (rev 0)
+++ branches/cloth/blender/intern/sph/SConscript	2008-05-07 20:42:16 UTC (rev 14732)
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+import sys
+import os
+Import('env')
+
+sources = env.Glob('intern/*.cpp')
+
+incs = ' . extern intern' 
+defs = ''
+
+env.BlenderLib ('bf_sph', sources, Split(incs), Split(defs), libtype='blender', priority=0 )

Added: branches/cloth/blender/intern/sph/extern/sph_extern.h
===================================================================
--- branches/cloth/blender/intern/sph/extern/sph_extern.h	                        (rev 0)
+++ branches/cloth/blender/intern/sph/extern/sph_extern.h	2008-05-07 20:42:16 UTC (rev 14732)
@@ -0,0 +1,51 @@
+/**
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License.  See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Daniel Genrich.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef PW_EXTERN_H
+#define PW_EXTERN_H
+
+
+
+#ifdef __cplusplus
+extern "C" { 
+#endif
+/*
+void sph_init_cpp(struct SphModifierData *sphmd);
+void sph_free_cpp(struct SphModifierData *sphmd);
+int sph_simulate_cpp(struct Object *ob, struct SphModifierData *sphmd, float frame, struct ListBase *effectors);
+*/
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //PW_EXTERN_H	
+
+

Added: branches/cloth/blender/intern/sph/intern/sph.cpp
===================================================================
--- branches/cloth/blender/intern/sph/intern/sph.cpp	                        (rev 0)
+++ branches/cloth/blender/intern/sph/intern/sph.cpp	2008-05-07 20:42:16 UTC (rev 14732)
@@ -0,0 +1,51 @@
+/*  pw.c
+*
+*
+* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version. The Blender
+* Foundation also sells licenses for use in proprietary software under
+* the Blender License.  See http://www.blender.org/BL/ for information
+* about this.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* 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.
+*
+* The Original Code is Copyright (C) Blender Foundation
+* All rights reserved.
+*
+* Contributor(s): Daniel Genrich
+*
+* ***** END GPL/BL DUAL LICENSE BLOCK *****
+*/
+
+#include <iostream>
+
+#include "sph_extern.h"
+/*
+extern "C" void sph_init_cpp(struct SphModifierData *sphmd)
+{
+
+}
+/*
+extern "C" void sph_free_cpp(struct SphModifierData *sphmd)
+{
+
+	
+}
+
+extern "C" int sph_simulate_cpp(struct Object *ob, struct SphModifierData *sphmd, float frame, struct ListBase *effectors)
+{
+	
+	return 1;
+}
+*/

Modified: branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h	2008-05-07 20:34:34 UTC (rev 14731)
+++ branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h	2008-05-07 20:42:16 UTC (rev 14732)
@@ -24,14 +24,14 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Daniel Genrich.
  *
  * ***** END GPL LICENSE BLOCK *****
  */
 #ifndef BKE_CLOTH_H
 #define BKE_CLOTH_H
 
-#include "float.h"
+#include <float.h>
 
 #include "BLI_linklist.h"
 #include "BKE_customdata.h"
@@ -49,6 +49,9 @@
 
 #include "BKE_collision.h"
 
+#include "RE_raytrace.h"
+
+
 struct Object;
 
 struct MFace;
@@ -102,7 +105,8 @@
 	unsigned char 		old_solver_type;	/* unused, only 1 solver here */
 	unsigned char 		pad2;
 	short 			pad3;
-	struct BVH		*tree;			/* collision tree for this cloth object */
+	struct BVHTree		*bvhtree;			/* collision tree for this cloth object */
+	struct RayTree 		*selftree;			/* collision tree for this cloth object */
 	struct MFace 		*mfaces;
 	struct Implicit_Data	*implicit; 		/* our implicit solver connects to this pointer */
 	struct Implicit_Data	*implicitEM; 		/* our implicit solver connects to this pointer */
@@ -171,17 +175,10 @@
 /* These are the bits used in SimSettings.flags. */
 typedef enum
 {
-	//CLOTH_SIMSETTINGS_FLAG_RESET = ( 1 << 1 ),	// The CM object requires a reinitializaiton.
 	CLOTH_SIMSETTINGS_FLAG_COLLOBJ = ( 1 << 2 ),// object is only collision object, no cloth simulation is done
 	CLOTH_SIMSETTINGS_FLAG_GOAL = ( 1 << 3 ), 	// we have goals enabled
 	CLOTH_SIMSETTINGS_FLAG_TEARING = ( 1 << 4 ),// true if tearing is enabled
-	//CLOTH_SIMSETTINGS_FLAG_CCACHE_PROTECT = ( 1 << 5 ), // true if tearing is enabled
-	//CLOTH_SIMSETTINGS_FLAG_EDITMODE = ( 1 << 6 ), // are we in editmode? -several things disabled
-	//CLOTH_SIMSETTINGS_FLAG_CCACHE_FFREE = ( 1 << 7 ), /* force cache freeing */
 	CLOTH_SIMSETTINGS_FLAG_SCALING = ( 1 << 8 ), /* is advanced scaling active? */
-	//CLOTH_SIMSETTINGS_FLAG_LOADED = ( 1 << 9 ), /* did we just got load? */
-	//CLOTH_SIMSETTINGS_FLAG_AUTOPROTECT = ( 1 << 10 ), /* is autoprotect enabled? */
-	//CLOTH_SIMSETTINGS_FLAG_CCACHE_OUTDATED = (1 << 11),	/* while protected, did cache get outdated? */
 	CLOTH_SIMSETTINGS_FLAG_CCACHE_EDIT = (1 << 12)	/* edit cache in editmode */
 } CLOTH_SIMSETTINGS_FLAGS;
 
@@ -208,6 +205,7 @@
 	CLOTH_SPRING_FLAG_NEEDED = ( 1 << 2 ), // springs has values to be applied
 } CLOTH_SPRINGS_FLAGS;
 
+
 /////////////////////////////////////////////////
 // collision.c
 ////////////////////////////////////////////////
@@ -246,7 +244,7 @@
 void cloth_update_normals ( ClothVertex *verts, int nVerts, MFace *face, int totface );
 
 // needed for collision.c
-void bvh_update_from_cloth ( ClothModifierData *clmd, int moving );
+void bvhtree_update_from_cloth ( ClothModifierData *clmd, int moving );
 
 // needed for editmesh.c
 void cloth_write_cache ( Object *ob, ClothModifierData *clmd, float framenr );

Modified: branches/cloth/blender/source/blender/blenkernel/BKE_collision.h
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/BKE_collision.h	2008-05-07 20:34:34 UTC (rev 14731)
+++ branches/cloth/blender/source/blender/blenkernel/BKE_collision.h	2008-05-07 20:42:16 UTC (rev 14732)
@@ -32,7 +32,7 @@
 #define BKE_COLLISIONS_H
 
 #include <math.h>
-#include "float.h"
+#include <float.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -47,6 +47,8 @@
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 
+#include "BLI_kdopbvh.h"
+
 struct Object;
 struct Cloth;
 struct MFace;
@@ -102,11 +104,17 @@
 typedef void ( *CM_COLLISION_RESPONSE ) ( ModifierData *md1, ModifierData *md2, CollisionTree *tree1, CollisionTree *tree2 );
 
 // needed for collision.c
-int bvh_traverse ( ModifierData * md1, ModifierData * md2, CollisionTree * tree1, CollisionTree * tree2, float step, CM_COLLISION_RESPONSE collision_response, int selfcollision);
+int bvh_traverse ( ModifierData * md1, ModifierData * md2, CollisionTree * tree1, CollisionTree * tree2, float step, CM_COLLISION_RESPONSE collision_response, int selfcollision );
 
 ////////////////////////////////////////
 
+/* COLLISION FLAGS */
+typedef enum
+{
+	COLLISION_IN_FUTURE = ( 1 << 1 ),
+} COLLISION_FLAGS;
 
+
 ////////////////////////////////////////
 // used for collisions in kdop.c and also collision.c
 ////////////////////////////////////////
@@ -119,10 +127,10 @@
 	float normal[3];
 	float vector[3]; // unnormalized collision vector: p2-p1
 	float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
-	int lastsign; // indicates if the distance sign has changed, unused itm
+	int flag;
 	float time; // collision time, from 0 up to 1
-	unsigned int ap1, ap2, ap3, bp1, bp2, bp3;
-	unsigned int pointsb[4];
+	int ap1, ap2, ap3, bp1, bp2, bp3;
+	int pointsb[4];
 }
 CollPair;
 
@@ -160,8 +168,9 @@
 // NOTICE: mvert-routines for building + update the BVH are the most native ones
 
 // builds bounding volume hierarchy
-void bvh_build (BVH *bvh);
-BVH *bvh_build_from_mvert (MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon);
+void bvh_build ( BVH *bvh );
+BVH *bvh_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon );
+BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon );
 
 // frees the same
 void bvh_free ( BVH * bvh );
@@ -169,20 +178,21 @@
 // checks two bounding volume hierarchies for potential collisions and returns some list with those
 
 
-// update bounding volumes, needs updated positions in  bvh->current_xold (static) 
+// update bounding volumes, needs updated positions in  bvh->current_xold (static)
 // and also bvh->current_x if moving==1
-void bvh_update_from_mvert(BVH * bvh, MVert *x, unsigned int numverts, MVert *xnew, int moving);
-void bvh_update(BVH * bvh, int moving);
+void bvh_update_from_mvert ( BVH * bvh, MVert *x, unsigned int numverts, MVert *xnew, int moving );
+void bvh_update ( BVH * bvh, int moving );

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list