[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12048] branches/cloth/blender: Initial checkin of cloth files + changes
Daniel Genrich
dgenrich at axlo.de
Sun Sep 16 18:23:22 CEST 2007
Revision: 12048
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12048
Author: genscher
Date: 2007-09-16 18:23:21 +0200 (Sun, 16 Sep 2007)
Log Message:
-----------
Initial checkin of cloth files + changes
Modified Paths:
--------------
branches/cloth/blender/extern/bullet2/src/BulletDynamics/CMakeLists.txt
branches/cloth/blender/extern/bullet2/src/SConscript
branches/cloth/blender/source/blender/blenkernel/SConscript
branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
branches/cloth/blender/source/blender/blenloader/intern/readfile.c
branches/cloth/blender/source/blender/blenloader/intern/writefile.c
branches/cloth/blender/source/blender/include/butspace.h
branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h
branches/cloth/blender/source/blender/makesdna/intern/makesdna.c
branches/cloth/blender/source/blender/src/buttons_object.c
Added Paths:
-----------
branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h
branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp
branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
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/implicit.c
branches/cloth/blender/source/blender/blenkernel/intern/kdop.c
branches/cloth/blender/source/blender/makesdna/DNA_cloth_types.h
Added: branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h
===================================================================
--- branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h (rev 0)
+++ branches/cloth/blender/extern/bullet2/src/Bullet-C-Api.h 2007-09-16 16:23:21 UTC (rev 12048)
@@ -0,0 +1,15 @@
+#ifndef Bullet_C_API_H
+#define Bullet_C_API_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+double plNearestPoints(float p[3][3], float q[3][3], float *pa, float *pb, float normal[3]);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif
+
Modified: branches/cloth/blender/extern/bullet2/src/BulletDynamics/CMakeLists.txt
===================================================================
--- branches/cloth/blender/extern/bullet2/src/BulletDynamics/CMakeLists.txt 2007-09-16 15:11:21 UTC (rev 12047)
+++ branches/cloth/blender/extern/bullet2/src/BulletDynamics/CMakeLists.txt 2007-09-16 16:23:21 UTC (rev 12048)
@@ -14,6 +14,7 @@
Dynamics/btDiscreteDynamicsWorld.cpp
Dynamics/btSimpleDynamicsWorld.cpp
Dynamics/btRigidBody.cpp
+ Dynamics/Bullet-C-Api.cpp
Vehicle/btRaycastVehicle.cpp
Vehicle/btWheelInfo.cpp
)
Added: branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp
===================================================================
--- branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp (rev 0)
+++ branches/cloth/blender/extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-Api.cpp 2007-09-16 16:23:21 UTC (rev 12048)
@@ -0,0 +1,92 @@
+#include "LinearMath/btVector3.h"
+#include "LinearMath/btScalar.h"
+#include "LinearMath/btMatrix3x3.h"
+#include "LinearMath/btTransform.h"
+#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
+#include "BulletCollision/CollisionShapes/btTriangleShape.h"
+
+#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
+#include "BulletCollision/NarrowPhaseCollision/btPointCollector.h"
+#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
+#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkEpa.h"
+#include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
+#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
+#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
+
+#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
+#include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h"
+#include "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
+#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
+#include "LinearMath/btStackAlloc.h"
+
+
+extern "C"
+double plNearestPoints(float p[3][3], float q[3][3], float *pa, float *pb, float normal[3])
+{
+ btTriangleShape trishapeA(btVector3(p[0][0], p[0][1], p[0][2]), btVector3(p[1][0], p[1][1], p[1][2]), btVector3(p[2][0], p[2][1], p[2][2]));
+ trishapeA.setMargin(0.001f);
+
+ btTriangleShape trishapeB(btVector3(q[0][0], q[0][1], q[0][2]), btVector3(q[1][0], q[1][1], q[1][2]), btVector3(q[2][0], q[2][1], q[2][2]));
+ trishapeB.setMargin(0.001f);
+
+ // btVoronoiSimplexSolver sGjkSimplexSolver;
+ // btGjkEpaPenetrationDepthSolver penSolverPtr;
+
+ static btSimplexSolverInterface sGjkSimplexSolver;
+ sGjkSimplexSolver.reset();
+
+ static btGjkEpaPenetrationDepthSolver Solver0;
+ static btMinkowskiPenetrationDepthSolver Solver1;
+
+ btConvexPenetrationDepthSolver* Solver = NULL;
+
+ Solver = &Solver1;
+
+
+ btGjkPairDetector convexConvex(&trishapeA ,&trishapeB,&sGjkSimplexSolver,Solver);
+
+ convexConvex.m_catchDegeneracies = 1;
+
+ // btGjkPairDetector convexConvex(&trishapeA ,&trishapeB,&sGjkSimplexSolver,0);
+
+ btPointCollector gjkOutput;
+ btGjkPairDetector::ClosestPointInput input;
+
+ btStackAlloc gStackAlloc(1024*1024*2);
+
+ input.m_stackAlloc = &gStackAlloc;
+
+ btTransform tr;
+ tr.setIdentity();
+
+ input.m_transformA = tr;
+ input.m_transformB = tr;
+
+ convexConvex.getClosestPoints(input, gjkOutput, 0);
+
+
+ if (gjkOutput.m_hasResult)
+ {
+
+ pb[0] = pa[0] = gjkOutput.m_pointInWorld[0];
+ pb[1] = pa[1] = gjkOutput.m_pointInWorld[1];
+ pb[2] = pa[2] = gjkOutput.m_pointInWorld[2];
+
+ pb[0]+= gjkOutput.m_normalOnBInWorld[0] * gjkOutput.m_distance;
+ pb[1]+= gjkOutput.m_normalOnBInWorld[1] * gjkOutput.m_distance;
+ pb[2]+= gjkOutput.m_normalOnBInWorld[2] * gjkOutput.m_distance;
+
+ normal[0] = gjkOutput.m_normalOnBInWorld[0];
+ normal[1] = gjkOutput.m_normalOnBInWorld[1];
+ normal[2] = gjkOutput.m_normalOnBInWorld[2];
+
+ return gjkOutput.m_distance;
+ }
+ return -1.0f;
+}
+
+
Modified: branches/cloth/blender/extern/bullet2/src/SConscript
===================================================================
--- branches/cloth/blender/extern/bullet2/src/SConscript 2007-09-16 15:11:21 UTC (rev 12047)
+++ branches/cloth/blender/extern/bullet2/src/SConscript 2007-09-16 16:23:21 UTC (rev 12048)
@@ -33,6 +33,7 @@
"BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp",
"BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp",
"BulletDynamics/Dynamics/btRigidBody.cpp",
+ "BulletDynamics/Dynamics/Bullet-C-Api.cpp",
"BulletDynamics/Vehicle/btRaycastVehicle.cpp",
"BulletDynamics/Vehicle/btWheelInfo.cpp"]
collision_src = ["BulletCollision/BroadphaseCollision/btAxisSweep3.cpp",
Added: branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h
===================================================================
--- branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h (rev 0)
+++ branches/cloth/blender/source/blender/blenkernel/BKE_cloth.h 2007-09-16 16:23:21 UTC (rev 12048)
@@ -0,0 +1,243 @@
+/**
+* BKE_cloth.h
+*
+* $Id: BKE_cloth.h,v 1.1 2007/08/01 02:07:27 daniel Exp $
+*
+* ***** 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): none yet.
+*
+* ***** END GPL/BL DUAL LICENSE BLOCK *****
+*/
+#ifndef BKE_CLOTH_H
+#define BKE_CLOTH_H
+
+#include "BKE_DerivedMesh.h"
+#include "DNA_customdata_types.h"
+#include "BKE_customdata.h"
+#include "DNA_meshdata_types.h"
+
+struct Object;
+struct Cloth;
+struct MFace;
+struct DerivedMesh;
+
+// this is needed for inlining behaviour
+#ifndef _WIN32
+ #define LINUX
+ #define DO_INLINE inline
+#else
+ #define DO_INLINE
+#endif
+
+
+/* goal defines */
+#define SOFTGOALSNAP 0.999f
+
+/* This is approximately the smallest number that can be
+* represented by a float, given its precision. */
+#define ALMOST_ZERO 0.0000001
+
+/* Bits to or into the ClothVertex.flags. */
+#define CVERT_FLAG_PINNED 1
+#define CVERT_FLAG_COLLISION 2
+
+
+// some macro enhancements for vector treatment
+#define VECADDADD(v1,v2,v3) {*(v1)+= *(v2) + *(v3); *(v1+1)+= *(v2+1) + *(v3+1); *(v1+2)+= *(v2+2) + *(v3+2);}
+#define VECSUBADD(v1,v2,v3) {*(v1)-= *(v2) + *(v3); *(v1+1)-= *(v2+1) + *(v3+1); *(v1+2)-= *(v2+2) + *(v3+2);}
+#define VECADDSUB(v1,v2,v3) {*(v1)+= *(v2) - *(v3); *(v1+1)+= *(v2+1) - *(v3+1); *(v1+2)+= *(v2+2) - *(v3+2);}
+#define VECSUBADDSS(v1,v2,aS,v3,bS) {*(v1)-= *(v2)*aS + *(v3)*bS; *(v1+1)-= *(v2+1)*aS + *(v3+1)*bS; *(v1+2)-= *(v2+2)*aS + *(v3+2)*bS;}
+#define VECADDSUBSS(v1,v2,aS,v3,bS) {*(v1)+= *(v2)*aS - *(v3)*bS; *(v1+1)+= *(v2+1)*aS - *(v3+1)*bS; *(v1+2)+= *(v2+2)*aS - *(v3+2)*bS;}
+#define VECADDSS(v1,v2,aS,v3,bS) {*(v1)= *(v2)*aS + *(v3)*bS; *(v1+1)= *(v2+1)*aS + *(v3+1)*bS; *(v1+2)= *(v2+2)*aS + *(v3+2)*bS;}
+#define VECADDS(v1,v2,v3,bS) {*(v1)= *(v2) + *(v3)*bS; *(v1+1)= *(v2+1) + *(v3+1)*bS; *(v1+2)= *(v2+2) + *(v3+2)*bS;}
+#define VECSUBMUL(v1,v2,aS) {*(v1)-= *(v2) * aS; *(v1+1)-= *(v2+1) * aS; *(v1+2)-= *(v2+2) * aS;}
+#define VECSUBS(v1,v2,v3,bS) {*(v1)= *(v2) - *(v3)*bS; *(v1+1)= *(v2+1) - *(v3+1)*bS; *(v1+2)= *(v2+2) - *(v3+2)*bS;}
+#define VECSUBSB(v1,v2, v3,bS) {*(v1)= (*(v2)- *(v3))*bS; *(v1+1)= (*(v2+1) - *(v3+1))*bS; *(v1+2)= (*(v2+2) - *(v3+2))*bS;}
+#define VECMULS(v1,aS) {*(v1)*= aS; *(v1+1)*= aS; *(v1+2)*= *aS;}
+#define VECADDMUL(v1,v2,aS) {*(v1)+= *(v2) * aS; *(v1+1)+= *(v2+1) * aS; *(v1+2)+= *(v2+2) * aS;}
+
+/* SIMULATION FLAGS: goal flags,.. */
+/* These are the bits used in SimSettings.flags. */
+typedef enum
+{
+ CSIMSETT_FLAG_RESET = (1 << 1), // The CM object requires a reinitializaiton.
+ CSIMSETT_FLAG_COLLOBJ = (1 << 2), // object is only collision object, no cloth simulation is done
+ CSIMSETT_FLAG_GOAL = (1 << 3), // we have goals enabled
+ CSIMSETT_FLAG_CCACHE_FREE_ALL = (1 << 4), // delete all from cache
+ CSIMSETT_FLAG_CCACHE_FREE_PART = (1 << 5), // delete some part of cache
+ CSIMSETT_FLAG_TEARING_ENABLED = (1 << 6), // true if tearing is enabled
+} CSIMSETT_FLAGS;
+
+/* Spring types as defined in the paper.*/
+typedef enum
+{
+ STRUCTURAL = 0,
+ SHEAR,
+ BENDING,
+} springType;
+
+/* SPRING FLAGS */
+typedef enum
+{
+ CSPRING_FLAG_DEACTIVATE = (1 << 1),
+} CSPRINGS_FLAGS;
+
+// needed for buttons_object.c
+void cloth_cache_free(ClothModifierData *clmd, float time);
+
+// needed for cloth.c
+void implicit_set_positions (ClothModifierData *clmd);
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list