[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11521] branches/soc-2007-red_fox: Merge from /trunk/blender

Levi Schooley redfox at hhofministries.org
Wed Aug 8 23:10:03 CEST 2007


Revision: 11521
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11521
Author:   red_fox
Date:     2007-08-08 23:10:03 +0200 (Wed, 08 Aug 2007)

Log Message:
-----------
Merge from /trunk/blender

Server error during last merge operation.
Must've missed this stuff.

Levi

Modified Paths:
--------------
    branches/soc-2007-red_fox/bin/.blender/locale/cs/LC_MESSAGES/blender.mo
    branches/soc-2007-red_fox/extern/bullet2/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp
    branches/soc-2007-red_fox/extern/bullet2/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h
    branches/soc-2007-red_fox/po/cs.po
    branches/soc-2007-red_fox/projectfiles_vc7/blender/ftfont/FTF_ftfont.vcproj
    branches/soc-2007-red_fox/projectfiles_vc7/blender/render/BRE_render.vcproj
    branches/soc-2007-red_fox/projectfiles_vc7/blender/src/BL_src.vcproj
    branches/soc-2007-red_fox/source/blender/blenlib/BLI_arithb.h
    branches/soc-2007-red_fox/source/blender/blenlib/intern/arithb.c
    branches/soc-2007-red_fox/source/blender/blenloader/intern/readfile.c
    branches/soc-2007-red_fox/source/blender/blenloader/intern/writefile.c
    branches/soc-2007-red_fox/source/blender/ftfont/CMakeLists.txt
    branches/soc-2007-red_fox/source/blender/ftfont/FTF_Api.h
    branches/soc-2007-red_fox/source/blender/ftfont/SConscript
    branches/soc-2007-red_fox/source/blender/ftfont/intern/FTF_Api.cpp
    branches/soc-2007-red_fox/source/blender/ftfont/intern/Makefile
    branches/soc-2007-red_fox/source/blender/src/blenderbuttons.c
    branches/soc-2007-red_fox/source/blender/src/buttons_object.c
    branches/soc-2007-red_fox/source/blender/src/drawarmature.c
    branches/soc-2007-red_fox/source/blender/src/drawimage.c
    branches/soc-2007-red_fox/source/blender/src/drawipo.c
    branches/soc-2007-red_fox/source/blender/src/drawscript.c
    branches/soc-2007-red_fox/source/blender/src/drawseq.c
    branches/soc-2007-red_fox/source/blender/src/drawview.c
    branches/soc-2007-red_fox/source/blender/src/edit.c
    branches/soc-2007-red_fox/source/blender/src/editconstraint.c
    branches/soc-2007-red_fox/source/blender/src/editface.c
    branches/soc-2007-red_fox/source/blender/src/editipo.c
    branches/soc-2007-red_fox/source/blender/src/editkey.c
    branches/soc-2007-red_fox/source/blender/src/editobject.c
    branches/soc-2007-red_fox/source/blender/src/editseq.c
    branches/soc-2007-red_fox/source/blender/src/edittime.c
    branches/soc-2007-red_fox/source/blender/src/filesel.c
    branches/soc-2007-red_fox/source/blender/src/header_filesel.c
    branches/soc-2007-red_fox/source/blender/src/header_view3d.c
    branches/soc-2007-red_fox/source/blender/src/multires.c
    branches/soc-2007-red_fox/source/blender/src/seqeffects.c
    branches/soc-2007-red_fox/source/blender/src/sequence.c
    branches/soc-2007-red_fox/source/blender/src/space.c
    branches/soc-2007-red_fox/source/blender/src/transform_conversions.c
    branches/soc-2007-red_fox/source/blender/src/transform_generics.c
    branches/soc-2007-red_fox/source/blender/src/vpaint.c

Added Paths:
-----------
    branches/soc-2007-red_fox/source/blender/src/meshlaplacian.c

Modified: branches/soc-2007-red_fox/bin/.blender/locale/cs/LC_MESSAGES/blender.mo
===================================================================
(Binary files differ)

Modified: branches/soc-2007-red_fox/extern/bullet2/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp
===================================================================
--- branches/soc-2007-red_fox/extern/bullet2/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp	2007-08-08 20:30:20 UTC (rev 11520)
+++ branches/soc-2007-red_fox/extern/bullet2/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp	2007-08-08 21:10:03 UTC (rev 11521)
@@ -17,176 +17,58 @@
 #include "btHingeConstraint.h"
 #include "BulletDynamics/Dynamics/btRigidBody.h"
 #include "LinearMath/btTransformUtil.h"
-#include "LinearMath/btSimdMinMax.h"
 #include <new>
 
-
 btHingeConstraint::btHingeConstraint():
 m_enableAngularMotor(false)
 {
 }
 
 btHingeConstraint::btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB,
-									 btVector3& axisInA,btVector3& axisInB)
-									 :btTypedConstraint(rbA,rbB),
-									 m_angularOnly(false),
-									 m_enableAngularMotor(false)
+								 btVector3& axisInA,btVector3& axisInB)
+:btTypedConstraint(rbA,rbB),m_pivotInA(pivotInA),m_pivotInB(pivotInB),
+m_axisInA(axisInA),
+m_axisInB(-axisInB),
+m_angularOnly(false),
+m_enableAngularMotor(false)
 {
-	m_rbAFrame.getOrigin() = pivotInA;
-	
-	// since no frame is given, assume this to be zero angle and just pick rb transform axis
-	btVector3 rbAxisA1 = rbA.getCenterOfMassTransform().getBasis().getColumn(0);
-	btScalar projection = rbAxisA1.dot(axisInA);
-	if (projection > SIMD_EPSILON)
-		rbAxisA1 = rbAxisA1*projection - axisInA;
-	 else
-		rbAxisA1 = rbA.getCenterOfMassTransform().getBasis().getColumn(1);
-	
-	btVector3 rbAxisA2 = rbAxisA1.cross(axisInA);
 
-	m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.getX(),axisInA.getX(),
-									rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(),
-									rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() );
-
-	btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB);
-	btVector3 rbAxisB1 =  quatRotate(rotationArc,rbAxisA1);
-	btVector3 rbAxisB2 =  rbAxisB1.cross(axisInB);
-	
-	
-	m_rbBFrame.getOrigin() = pivotInB;
-	m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.getX(),-axisInB.getX(),
-									rbAxisB1.getY(),rbAxisB2.getY(),-axisInB.getY(),
-									rbAxisB1.getZ(),rbAxisB2.getZ(),-axisInB.getZ() );
-	
-	//start with free
-	m_lowerLimit = btScalar(1e30);
-	m_upperLimit = btScalar(-1e30);
-	m_biasFactor = 0.3f;
-	m_relaxationFactor = 1.0f;
-	m_limitSoftness = 0.9f;
-	m_solveLimit = false;
-
 }
 
 
 btHingeConstraint::btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,btVector3& axisInA)
-:btTypedConstraint(rbA), m_angularOnly(false), m_enableAngularMotor(false)
-{
-
-	// since no frame is given, assume this to be zero angle and just pick rb transform axis
-	// fixed axis in worldspace
-	btVector3 rbAxisA1 = rbA.getCenterOfMassTransform().getBasis().getColumn(0);
-	btScalar projection = rbAxisA1.dot(axisInA);
-	if (projection > SIMD_EPSILON)
-		rbAxisA1 = rbAxisA1*projection - axisInA;
-	else
-		rbAxisA1 = rbA.getCenterOfMassTransform().getBasis().getColumn(1);
-
-	btVector3 rbAxisA2 = axisInA.cross(rbAxisA1);
-
-	m_rbAFrame.getOrigin() = pivotInA;
-	m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.getX(),axisInA.getX(),
-									rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(),
-									rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() );
-
-
-	btVector3 axisInB = rbA.getCenterOfMassTransform().getBasis() * -axisInA;
-
-	btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB);
-	btVector3 rbAxisB1 =  quatRotate(rotationArc,rbAxisA1);
-	btVector3 rbAxisB2 = axisInB.cross(rbAxisB1);
-
-
-	m_rbBFrame.getOrigin() = rbA.getCenterOfMassTransform()(pivotInA);
-	m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.getX(),axisInB.getX(),
-									rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(),
-									rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() );
-	
-	//start with free
-	m_lowerLimit = btScalar(1e30);
-	m_upperLimit = btScalar(-1e30);
-	m_biasFactor = 0.3f;
-	m_relaxationFactor = 1.0f;
-	m_limitSoftness = 0.9f;
-	m_solveLimit = false;
-}
-
-btHingeConstraint::btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, 
-								     const btTransform& rbAFrame, const btTransform& rbBFrame)
-:btTypedConstraint(rbA,rbB),m_rbAFrame(rbAFrame),m_rbBFrame(rbBFrame),
+:btTypedConstraint(rbA),m_pivotInA(pivotInA),m_pivotInB(rbA.getCenterOfMassTransform()(pivotInA)),
+m_axisInA(axisInA),
+//fixed axis in worldspace
+m_axisInB(rbA.getCenterOfMassTransform().getBasis() * -axisInA),
 m_angularOnly(false),
 m_enableAngularMotor(false)
 {
-	// flip axis
-	m_rbBFrame.getBasis()[2][0] *= btScalar(-1.);
-	m_rbBFrame.getBasis()[2][1] *= btScalar(-1.);
-	m_rbBFrame.getBasis()[2][2] *= btScalar(-1.);
-
-	//start with free
-	m_lowerLimit = btScalar(1e30);
-	m_upperLimit = btScalar(-1e30);
-	m_biasFactor = 0.3f;
-	m_relaxationFactor = 1.0f;
-	m_limitSoftness = 0.9f;
-	m_solveLimit = false;
-}			
-
-
-
-btHingeConstraint::btHingeConstraint(btRigidBody& rbA, const btTransform& rbAFrame)
-:btTypedConstraint(rbA),m_rbAFrame(rbAFrame),m_rbBFrame(rbAFrame),
-m_angularOnly(false),
-m_enableAngularMotor(false)
-{
-	// flip axis
-	m_rbBFrame.getBasis()[2][0] *= btScalar(-1.);
-	m_rbBFrame.getBasis()[2][1] *= btScalar(-1.);
-	m_rbBFrame.getBasis()[2][2] *= btScalar(-1.);
-
-
-	//start with free
-	m_lowerLimit = btScalar(1e30);
-	m_upperLimit = btScalar(-1e30);	
-	m_biasFactor = 0.3f;
-	m_relaxationFactor = 1.0f;
-	m_limitSoftness = 0.9f;
-	m_solveLimit = false;
+	
 }
 
 void	btHingeConstraint::buildJacobian()
 {
 	m_appliedImpulse = btScalar(0.);
 
+	btVector3	normal(0,0,0);
+
 	if (!m_angularOnly)
 	{
-		btVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_rbAFrame.getOrigin();
-		btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_rbBFrame.getOrigin();
-		btVector3 relPos = pivotBInW - pivotAInW;
-
-		btVector3 normal[3];
-		if (relPos.length2() > SIMD_EPSILON)
-		{
-			normal[0] = relPos.normalized();
-		}
-		else
-		{
-			normal[0].setValue(btScalar(1.0),0,0);
-		}
-
-		btPlaneSpace1(normal[0], normal[1], normal[2]);
-
 		for (int i=0;i<3;i++)
 		{
+			normal[i] = 1;
 			new (&m_jac[i]) btJacobianEntry(
 				m_rbA.getCenterOfMassTransform().getBasis().transpose(),
 				m_rbB.getCenterOfMassTransform().getBasis().transpose(),
-				pivotAInW - m_rbA.getCenterOfMassPosition(),
-				pivotBInW - m_rbB.getCenterOfMassPosition(),
-				normal[i],
+				m_rbA.getCenterOfMassTransform()*m_pivotInA - m_rbA.getCenterOfMassPosition(),
+				m_rbB.getCenterOfMassTransform()*m_pivotInB - m_rbB.getCenterOfMassPosition(),
+				normal,
 				m_rbA.getInvInertiaDiagLocal(),
 				m_rbA.getInvMass(),
 				m_rbB.getInvInertiaDiagLocal(),
 				m_rbB.getInvMass());
+			normal[i] = 0;
 		}
 	}
 
@@ -197,12 +79,12 @@
 	btVector3 jointAxis0local;
 	btVector3 jointAxis1local;
 	
-	btPlaneSpace1(m_rbAFrame.getBasis().getColumn(2),jointAxis0local,jointAxis1local);
+	btPlaneSpace1(m_axisInA,jointAxis0local,jointAxis1local);
 
-	getRigidBodyA().getCenterOfMassTransform().getBasis() * m_rbAFrame.getBasis().getColumn(2);
+	getRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
 	btVector3 jointAxis0 = getRigidBodyA().getCenterOfMassTransform().getBasis() * jointAxis0local;
 	btVector3 jointAxis1 = getRigidBodyA().getCenterOfMassTransform().getBasis() * jointAxis1local;
-	btVector3 hingeAxisWorld = getRigidBodyA().getCenterOfMassTransform().getBasis() * m_rbAFrame.getBasis().getColumn(2);
+	btVector3 hingeAxisWorld = getRigidBodyA().getCenterOfMassTransform().getBasis() * m_axisInA;
 		
 	new (&m_jacAng[0])	btJacobianEntry(jointAxis0,
 		m_rbA.getCenterOfMassTransform().getBasis().transpose(),
@@ -223,71 +105,44 @@
 		m_rbB.getInvInertiaDiagLocal());
 
 
-	// Compute limit information
-	btScalar hingeAngle = getHingeAngle();  
 
-	//set bias, sign, clear accumulator
-	m_correction = btScalar(0.);
-	m_limitSign = btScalar(0.);
-	m_solveLimit = false;
-	m_accLimitImpulse = btScalar(0.);
-
-	if (m_lowerLimit < m_upperLimit)
-	{
-		if (hingeAngle <= m_lowerLimit*m_limitSoftness)
-		{
-			m_correction = (m_lowerLimit - hingeAngle);
-			m_limitSign = 1.0f;
-			m_solveLimit = true;
-		} 
-		else if (hingeAngle >= m_upperLimit*m_limitSoftness)
-		{
-			m_correction = m_upperLimit - hingeAngle;
-			m_limitSign = -1.0f;
-			m_solveLimit = true;
-		}
-	}
-
-	//Compute K = J*W*J' for hinge axis
-	btVector3 axisA =  getRigidBodyA().getCenterOfMassTransform().getBasis() *  m_rbAFrame.getBasis().getColumn(2);
-	m_kHinge =   1.0f / (getRigidBodyA().computeAngularImpulseDenominator(axisA) +
-			             getRigidBodyB().computeAngularImpulseDenominator(axisA));
-
 }
 
 void	btHingeConstraint::solveConstraint(btScalar	timeStep)
 {
 
-	btVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_rbAFrame.getOrigin();
-	btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_rbBFrame.getOrigin();
+	btVector3 pivotAInW = m_rbA.getCenterOfMassTransform()*m_pivotInA;
+	btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_pivotInB;
 
+	btVector3 normal(0,0,0);
 	btScalar tau = btScalar(0.3);
 	btScalar damping = btScalar(1.);
 
 //linear part
 	if (!m_angularOnly)
 	{
-		btVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); 
-		btVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition();
-
-		btVector3 vel1 = m_rbA.getVelocityInLocalPoint(rel_pos1);
-		btVector3 vel2 = m_rbB.getVelocityInLocalPoint(rel_pos2);
-		btVector3 vel = vel1 - vel2;
-
 		for (int i=0;i<3;i++)
 		{		
-			const btVector3& normal = m_jac[i].m_linearJointAxis;
+			normal[i] = 1;
 			btScalar jacDiagABInv = btScalar(1.) / m_jac[i].getDiagonal();
 
+			btVector3 rel_pos1 = pivotAInW - m_rbA.getCenterOfMassPosition(); 
+			btVector3 rel_pos2 = pivotBInW - m_rbB.getCenterOfMassPosition();
+			
+			btVector3 vel1 = m_rbA.getVelocityInLocalPoint(rel_pos1);
+			btVector3 vel2 = m_rbB.getVelocityInLocalPoint(rel_pos2);
+			btVector3 vel = vel1 - vel2;
 			btScalar rel_vel;
 			rel_vel = normal.dot(vel);
 			//positional error (zeroth order error)
 			btScalar depth = -(pivotAInW - pivotBInW).dot(normal); //this is the error projected on the normal
-			btScalar impulse = depth*tau/timeStep  * jacDiagABInv -  rel_vel * jacDiagABInv;
+			btScalar impulse = depth*tau/timeStep  * jacDiagABInv -  damping * rel_vel * jacDiagABInv * damping;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list