Revision: 15116
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15116
Author:   campbellbarton
Date:     2008-06-04 14:32:47 +0200 (Wed, 04 Jun 2008)

Log Message:
-----------
 svn  merge  -r15095:HEAD 
https://svn.blender.org/svnroot/bf-blender/trunk/blender/

Modified Paths:
--------------
    branches/apricot/source/blender/blenkernel/BKE_cloth.h
    branches/apricot/source/blender/blenkernel/BKE_collision.h
    branches/apricot/source/blender/blenkernel/intern/BME_Customdata.c
    branches/apricot/source/blender/blenkernel/intern/cloth.c
    branches/apricot/source/blender/blenkernel/intern/collision.c
    branches/apricot/source/blender/blenkernel/intern/modifier.c
    branches/apricot/source/blender/blenloader/intern/readfile.c
    branches/apricot/source/blender/makesdna/DNA_modifier_types.h
    branches/apricot/source/blender/src/editaction.c
    branches/apricot/source/blender/src/editmesh_tools.c
    branches/apricot/source/gameengine/Converter/BL_ArmatureObject.cpp
    branches/apricot/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp

Added Paths:
-----------
    branches/apricot/source/blender/blenlib/BLI_kdopbvh.h
    branches/apricot/source/blender/blenlib/intern/BLI_kdopbvh.c

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

Modified: branches/apricot/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- branches/apricot/source/blender/blenkernel/BKE_cloth.h      2008-06-04 
12:32:06 UTC (rev 15115)
+++ branches/apricot/source/blender/blenkernel/BKE_cloth.h      2008-06-04 
12:32:47 UTC (rev 15116)
@@ -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"
@@ -102,7 +102,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 BVHTree          *bvhselftree;                   /* 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 +172,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 +202,7 @@
        CLOTH_SPRING_FLAG_NEEDED = ( 1 << 2 ), // springs has values to be 
applied
 } CLOTH_SPRINGS_FLAGS;
 
+
 /////////////////////////////////////////////////
 // collision.c
 ////////////////////////////////////////////////
@@ -246,7 +241,8 @@
 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 );
+void bvhselftree_update_from_cloth ( ClothModifierData *clmd, int moving );
 
 // needed for editmesh.c
 void cloth_write_cache ( Object *ob, ClothModifierData *clmd, float framenr );
@@ -261,11 +257,6 @@
 ////////////////////////////////////////////////
 
 
-/* Typedefs for function pointers we need for solvers and collision detection. 
*/
-typedef void ( *CM_COLLISION_SELF ) ( ClothModifierData *clmd, int step );
-typedef void ( *CM_COLLISION_OBJ ) ( ClothModifierData *clmd, int step, 
CM_COLLISION_RESPONSE collision_response );
-
-
 /* This enum provides the IDs for our solvers. */
 // only one available in the moment
 typedef enum
@@ -286,15 +277,6 @@
 }
 CM_SOLVER_DEF;
 
-/* used for caching in implicit.c */
-typedef struct Frame
-{
-       ClothVertex *verts;
-       ClothSpring *springs;
-       unsigned int numverts, numsprings;
-       float time; /* we need float since we want to support sub-frames */
-}
-Frame;
 
 #endif
 

Modified: branches/apricot/source/blender/blenkernel/BKE_collision.h
===================================================================
--- branches/apricot/source/blender/blenkernel/BKE_collision.h  2008-06-04 
12:32:06 UTC (rev 15115)
+++ branches/apricot/source/blender/blenkernel/BKE_collision.h  2008-06-04 
12:32:47 UTC (rev 15116)
@@ -24,7 +24,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Daniel Genrich
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -32,7 +32,7 @@
 #define BKE_COLLISIONS_H
 
 #include <math.h>
-#include "float.h"
+#include <float.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -47,69 +47,28 @@
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 
+#include "BLI_kdopbvh.h"
+
 struct Object;
 struct Cloth;
 struct MFace;
 struct DerivedMesh;
 struct ClothModifierData;
-struct CollisionTree;
 
-
 ////////////////////////////////////////
-// used in kdop.c and collision.c
+// used for collisions in collision.c
 ////////////////////////////////////////
-typedef struct CollisionTree
-{
-       struct CollisionTree *nodes[4]; // 4 children --> quad-tree
-       struct CollisionTree *parent;
-       struct CollisionTree *nextLeaf;
-       struct CollisionTree *prevLeaf;
-       float   bv[26]; // Bounding volume of all nodes / we have 7 axes on a 
14-DOP
-       unsigned int tri_index; // this saves the index of the face
-       // int point_index[4]; // supports up to 4 points in a leaf
-       int     count_nodes; // how many nodes are used
-       int     traversed;  // how many nodes already traversed until this 
level?
-       int     isleaf;
-       float alpha; /* for selfcollision */
-       float normal[3]; /* for selfcollision */
-}
-CollisionTree;
 
-typedef struct BVH
+/* COLLISION FLAGS */
+typedef enum
 {
-       unsigned int    numfaces;
-       unsigned int    numverts;
-       MVert           *current_x; // e.g. txold in clothvertex
-       MVert           *current_xold; // e.g. tx in clothvertex
-       MFace           *mfaces; // just a pointer to the original datastructure
-       struct LinkNode *tree;
-       CollisionTree   *root; // TODO: saving the root --> is this really 
needed? YES!
-       CollisionTree   *leaf_tree; /* Tail of the leaf linked list.    */
-       CollisionTree   *leaf_root;     /* Head of the leaf linked list.        
*/
-       float           epsilon; /* epslion is used for inflation of the k-dop  
   */
-       int             flags; /* bvhFlags */
-}
-BVH;
-////////////////////////////////////////
+       COLLISION_IN_FUTURE = ( 1 << 1 ),
+} COLLISION_FLAGS;
 
 
-
 ////////////////////////////////////////
-// kdop.c
+// used for collisions in collision.c
 ////////////////////////////////////////
-
-// needed for collision.c
-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);
-
-////////////////////////////////////////
-
-
-////////////////////////////////////////
-// used for collisions in kdop.c and also collision.c
-////////////////////////////////////////
 /* used for collisions in collision.c */
 typedef struct CollPair
 {
@@ -119,10 +78,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;
 
@@ -157,32 +116,22 @@
 // forward declarations
 /////////////////////////////////////////////////
 
-// NOTICE: mvert-routines for building + update the BVH are the most native 
ones
+/////////////////////////////////////////////////
+// used in modifier.c from collision.c
+/////////////////////////////////////////////////
+BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, 
MVert *x, unsigned int numverts, float epsilon );
+void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int 
numfaces, MVert *x, MVert *xnew, int numverts, int moving );
+/////////////////////////////////////////////////
 
-// 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);
-
-// frees the same
-void bvh_free ( BVH * bvh );
-
-// 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) 
-// 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);
-
 LinkNode *BLI_linklist_append_fast ( LinkNode **listp, void *ptr );
 
 // move Collision modifier object inter-frame with step = [0,1]
 // defined in collisions.c
-void collision_move_object(CollisionModifierData *collmd, float step, float 
prevstep);
+void collision_move_object ( CollisionModifierData *collmd, float step, float 
prevstep );
 
 // interface for collision functions
-void collisions_compute_barycentric (float pv[3], float p1[3], float p2[3], 
float p3[3], float *w1, float *w2, float *w3);
-void interpolateOnTriangle(float to[3], float v1[3], float v2[3], float v3[3], 
double w1, double w2, double w3);
+void collisions_compute_barycentric ( float pv[3], float p1[3], float p2[3], 
float p3[3], float *w1, float *w2, float *w3 );
+void interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float 
v3[3], double w1, double w2, double w3 );
 
 /////////////////////////////////////////////////
 

Modified: branches/apricot/source/blender/blenkernel/intern/BME_Customdata.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/BME_Customdata.c  
2008-06-04 12:32:06 UTC (rev 15115)
+++ branches/apricot/source/blender/blenkernel/intern/BME_Customdata.c  
2008-06-04 12:32:47 UTC (rev 15116)
@@ -39,6 +39,7 @@
 #include "BKE_bmeshCustomData.h"
 #include "bmesh_private.h"
 #include <string.h>
+#include "MEM_guardedalloc.h"
 
 /********************* Layer type information **********************/
 typedef struct BME_LayerTypeInfo {
@@ -88,7 +89,7 @@
                        if(init->layout[i]){
                                info = BME_layerType_getInfo(i);
                                for(j=0; j < init->layout[i]; j++){
-                                       if(j=0) data->layers[j+i].active = 
init->active[i];
+                                       if(j==0) data->layers[j+i].active = 
init->active[i];
                                        data->layers[j+i].type = i;
                                        data->layers[j+i].offset = offset;      

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to