fixed some compile issue for Mac Dynamica plugin, see

http://code.google.com/p/bullet/issues/detail?id=221

added some missing file for autotools/Makefile.am

fix: btBulletWorldImporter::loadFileFromMemory always returned false, if it was succesful
This commit is contained in:
erwin.coumans
2010-01-31 16:46:06 +00:00
parent c71b968110
commit 4140a20552
8 changed files with 217 additions and 208 deletions

View File

@@ -23,7 +23,7 @@ subject to the following restrictions:
#include "LinearMath/btGeometryUtil.h" #include "LinearMath/btGeometryUtil.h"
#include "BulletCollision/CollisionShapes/btShapeHull.h" #include "BulletCollision/CollisionShapes/btShapeHull.h"
#define TEST_SERIALIZATION //#define TEST_SERIALIZATION
//#define NO_OBJ_TO_BULLET //#define NO_OBJ_TO_BULLET
#ifdef TEST_SERIALIZATION #ifdef TEST_SERIALIZATION

View File

@@ -1,6 +1,6 @@
#MayaPlugin Makefile #MayaPlugin Makefile
MAYA_LOCATION?=/Applications/Autodesk/maya2008/devkit MAYA_LOCATION?=/Applications/Autodesk/maya2009/devkit
## MAYA_LOCATION is the Maya installation directory. It should be already defined in your ## MAYA_LOCATION is the Maya installation directory. It should be already defined in your
# environment variables. If not, please change it to the appropriate directory # environment variables. If not, please change it to the appropriate directory
@@ -30,16 +30,22 @@ CPPFLAGS = -DMAC_PLUGIN -DOSMac_MachO_ -DBits32_ -m32 -DUNIX -D_BOOL -DOSMac_ -D
LDFLAGS = -ldl -shared LDFLAGS = -ldl -shared
BULLET_INCLUDE=-I$(BULLET)/src -I. BULLET_INCLUDE=-I$(BULLET)/src -I.
BULLET_LIB=-L$(BULLET)/out/macosxx86/optimize/libs -L$(BULLET)/src \ BULLET_LIB=-L$(BULLET)/out/macosxx86/optimize/libs -L$(BULLET)/src \
-lBulletColladaConverter -lcolladadom -llibxml -lGIMPACTUtils -lbulletdynamics \ -lGIMPACTUtils -lbulletdynamics \
-lbulletcollision -lbulletmath -lbulletcollision -lbulletmath
#BULLET_LIB=-L$(BULLET)/src/.libs \
# -lbulletdynamics \
# -lbulletcollision -lbulletmath
GL_LIB=-framework OpenGL GL_LIB=-framework OpenGL
MAYA_INCLUDE=-I$(MAYA)/include MAYA_INCLUDE=-I$(MAYA)/include
MAYA_LIB=-L/Applications/Autodesk/maya2008/Maya.app/Contents/MacOS -lOpenMaya -lFoundation -Wl,-executable_path,/Applications/Autodesk/maya2008/Maya.app/Contents/MacOS -lOpenMayaUI -lOpenMayaFX -lOpenMaya -lFoundation MAYA_LIB=-L/Applications/Autodesk/maya2009/Maya.app/Contents/MacOS -lOpenMaya -lFoundation -Wl,-executable_path,/Applications/Autodesk/maya2009/Maya.app/Contents/MacOS -lOpenMayaUI -lOpenMayaFX -lOpenMaya -lFoundation
SOURCES = pluginMain.cpp colladaExport.cpp rigidBodyNode.cpp rigidBodyArrayNode.cpp collisionShapeNode.cpp \ SOURCES = pluginMain.cpp bulletExport.cpp rigidBodyNode.cpp rigidBodyArrayNode.cpp collisionShapeNode.cpp \
solver.cpp bt_solver.cpp dSolverNode.cpp dSolverCmd.cpp dRigidBodyCmd.cpp dRigidBodyArrayCmd.cpp \ solver.cpp bt_solver.cpp dSolverNode.cpp dSolverCmd.cpp dRigidBodyCmd.cpp dRigidBodyArrayCmd.cpp \
pdbIO.cpp drawUtils.cpp constraint/dHingeConstraintCmd.cpp constraint/dSliderConstraintCmd.cpp \ pdbIO.cpp drawUtils.cpp constraint/dHingeConstraintCmd.cpp constraint/dSliderConstraintCmd.cpp \
constraint/hingeConstraintNode.cpp constraint/sixdofConstraintNode.cpp constraint/dNailConstraintCmd.cpp \ constraint/hingeConstraintNode.cpp constraint/sixdofConstraintNode.cpp constraint/dNailConstraintCmd.cpp \

View File

@@ -18,9 +18,9 @@ not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com> Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked 01/22/2010 : Constraints reworked
*/ */
//hingeConstraintNode.cpp //hingeConstraintNode.cpp
@@ -42,8 +42,8 @@ Modified by Roman Ponomarev <rponom@gmail.com>
#include "mayaUtils.h" #include "mayaUtils.h"
#include "solver.h" #include "solver.h"
#include "dSolverNode.h" #include "dSolverNode.h"
#include "constraint/bt_hinge_constraint.h" #include "constraint/bt_hinge_constraint.h"
MTypeId hingeConstraintNode::typeId(0x10033B); MTypeId hingeConstraintNode::typeId(0x10033B);
MString hingeConstraintNode::typeName("dHingeConstraint"); MString hingeConstraintNode::typeName("dHingeConstraint");
@@ -341,7 +341,8 @@ void hingeConstraintNode::draw( M3dView & view, const MDagPath &path,
rigid_bodyB->get_transform(pos, rot); rigid_bodyB->get_transform(pos, rot);
m_constraint->worldToA(pos, posB); m_constraint->worldToA(pos, posB);
} }
m_constraint->worldFromB(vec3f(0.f, 0.f, 0.f), pos); vec3f zeroVec(0.f,0.f,0.f);
m_constraint->worldFromB(zeroVec, pos);
m_constraint->worldToA(pos, pivB); m_constraint->worldToA(pos, pivB);
} }
@@ -369,22 +370,30 @@ void hingeConstraintNode::draw( M3dView & view, const MDagPath &path,
glVertex3f(0.0, 0.0, 1.0); glVertex3f(0.0, 0.0, 1.0);
vec3f posT, posP, posM; vec3f posT, posP, posM;
vec3f minusXVec(-1.f,0.f,0.f);
vec3f posXVec(1.f,0.f,0.f);
vec3f minusYVec (0.f,-1.f,0.f);
vec3f posYVec (0.f,1.f,0.f);
vec3f minusZVec (0.f,0.f,-1.f);
vec3f posZVec (0.f,0.f,1.f);
m_constraint->worldFromB(vec3f(-1.f, 0.f, 0.f), posT); m_constraint->worldFromB(minusXVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 1.f, 0.f, 0.f), posT); m_constraint->worldFromB(posXVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
m_constraint->worldFromB(vec3f( 0.f, -1.f, 0.f), posT); m_constraint->worldFromB(minusYVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 0.f, 1.f, 0.f), posT); m_constraint->worldFromB(posYVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
m_constraint->worldFromB(vec3f( 0.f, 0.f, -1.f), posT); m_constraint->worldFromB(minusZVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 0.f, 0.f, 1.f), posT); m_constraint->worldFromB(posZVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
@@ -469,13 +478,13 @@ void hingeConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data)
pivInB[i] = (float)mPivInB[i]; pivInB[i] = (float)mPivInB[i];
} }
float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3(); float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3();
MEulerRotation meulerA(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2])); MEulerRotation meulerA(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2]));
MQuaternion mquatA = meulerA.asQuaternion(); MQuaternion mquatA = meulerA.asQuaternion();
quatf rotA((float)mquatA.w, (float)mquatA.x, (float)mquatA.y, (float)mquatA.z); quatf rotA((float)mquatA.w, (float)mquatA.x, (float)mquatA.y, (float)mquatA.z);
float3& mRotInB = data.inputValue(ia_rotationInB).asFloat3(); float3& mRotInB = data.inputValue(ia_rotationInB).asFloat3();
MEulerRotation meulerB(deg2rad(mRotInB[0]), deg2rad(mRotInB[1]), deg2rad(mRotInB[2])); MEulerRotation meulerB(deg2rad(mRotInB[0]), deg2rad(mRotInB[1]), deg2rad(mRotInB[2]));
MQuaternion mquatB = meulerB.asQuaternion(); MQuaternion mquatB = meulerB.asQuaternion();
quatf rotB((float)mquatB.w, (float)mquatB.x, (float)mquatB.y, (float)mquatB.z); quatf rotB((float)mquatB.w, (float)mquatB.x, (float)mquatB.y, (float)mquatB.z);
m_constraint = solver_t::create_hinge_constraint(rigid_bodyA, pivInA, rotA, rigid_bodyB, pivInB, rotB); m_constraint = solver_t::create_hinge_constraint(rigid_bodyA, pivInA, rotA, rigid_bodyB, pivInB, rotB);
constraint = static_cast<constraint_t::pointer>(m_constraint); constraint = static_cast<constraint_t::pointer>(m_constraint);
solver_t::add_constraint(constraint); solver_t::add_constraint(constraint);
@@ -491,9 +500,9 @@ void hingeConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data)
pivInA[i] = (float)mPivInA[i]; pivInA[i] = (float)mPivInA[i];
} }
float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3(); float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3();
MEulerRotation meuler(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2])); MEulerRotation meuler(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2]));
MQuaternion mquat = meuler.asQuaternion(); MQuaternion mquat = meuler.asQuaternion();
quatf rotA((float)mquat.w, (float)mquat.x, (float)mquat.y, (float)mquat.z); quatf rotA((float)mquat.w, (float)mquat.x, (float)mquat.y, (float)mquat.z);
m_constraint = solver_t::create_hinge_constraint(rigid_bodyA, pivInA, rotA); m_constraint = solver_t::create_hinge_constraint(rigid_bodyA, pivInA, rotA);
constraint = static_cast<constraint_t::pointer>(m_constraint); constraint = static_cast<constraint_t::pointer>(m_constraint);
solver_t::add_constraint(constraint); solver_t::add_constraint(constraint);
@@ -518,8 +527,8 @@ void hingeConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data
fnParentTransform.setScale(fixScale); fnParentTransform.setScale(fixScale);
MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status);
if(dSolverNode::isStartTime) if(dSolverNode::isStartTime)
{ // allow to edit pivots { // allow to edit pivots
MPlug plgRigidBodyA(thisObject, ia_rigidBodyA); MPlug plgRigidBodyA(thisObject, ia_rigidBodyA);
MPlug plgRigidBodyB(thisObject, ia_rigidBodyB); MPlug plgRigidBodyB(thisObject, ia_rigidBodyB);
MObject update; MObject update;
@@ -558,8 +567,8 @@ void hingeConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data
} }
if(m_constraint) if(m_constraint)
{ {
MQuaternion mrotation; MQuaternion mrotation;
fnParentTransform.getRotation(mrotation, MSpace::kTransform); fnParentTransform.getRotation(mrotation, MSpace::kTransform);
bool doUpdatePivot = m_constraint->getPivotChanged(); bool doUpdatePivot = m_constraint->getPivotChanged();
if(!doUpdatePivot) if(!doUpdatePivot)
{ {
@@ -569,46 +578,46 @@ void hingeConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data
float deltaPX = worldP[0] - float(mtranslation.x); float deltaPX = worldP[0] - float(mtranslation.x);
float deltaPY = worldP[1] - float(mtranslation.y); float deltaPY = worldP[1] - float(mtranslation.y);
float deltaPZ = worldP[2] - float(mtranslation.z); float deltaPZ = worldP[2] - float(mtranslation.z);
float deltaRX = (float)mrotation.x - worldR[1]; float deltaRX = (float)mrotation.x - worldR[1];
float deltaRY = (float)mrotation.y - worldR[2]; float deltaRY = (float)mrotation.y - worldR[2];
float deltaRZ = (float)mrotation.z - worldR[3]; float deltaRZ = (float)mrotation.z - worldR[3];
float deltaRW = (float)mrotation.w - worldR[0]; float deltaRW = (float)mrotation.w - worldR[0];
float deltaSq = deltaPX * deltaPX + deltaPY * deltaPY + deltaPZ * deltaPZ float deltaSq = deltaPX * deltaPX + deltaPY * deltaPY + deltaPZ * deltaPZ
+ deltaRX * deltaRX + deltaRY * deltaRY + deltaRZ * deltaRZ + deltaRW * deltaRW; + deltaRX * deltaRX + deltaRY * deltaRY + deltaRZ * deltaRZ + deltaRW * deltaRW;
doUpdatePivot = (deltaSq > FLT_EPSILON); doUpdatePivot = (deltaSq > FLT_EPSILON);
} }
if(doUpdatePivot) if(doUpdatePivot)
{ {
m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]), m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]),
quatf((float)mrotation.w, (float)mrotation.x, (float)mrotation.y, (float)mrotation.z)); quatf((float)mrotation.w, (float)mrotation.x, (float)mrotation.y, (float)mrotation.z));
vec3f pivInA, pivInB; vec3f pivInA, pivInB;
quatf rotInA, rotInB; quatf rotInA, rotInB;
m_constraint->get_frameA(pivInA, rotInA); m_constraint->get_frameA(pivInA, rotInA);
m_constraint->get_frameB(pivInB, rotInB); m_constraint->get_frameB(pivInB, rotInB);
MDataHandle hPivInA = data.outputValue(ia_pivotInA); MDataHandle hPivInA = data.outputValue(ia_pivotInA);
float3 &ihPivInA = hPivInA.asFloat3(); float3 &ihPivInA = hPivInA.asFloat3();
MDataHandle hPivInB = data.outputValue(ia_pivotInB); MDataHandle hPivInB = data.outputValue(ia_pivotInB);
float3 &ihPivInB = hPivInB.asFloat3(); float3 &ihPivInB = hPivInB.asFloat3();
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
{ {
ihPivInA[i] = pivInA[i]; ihPivInA[i] = pivInA[i];
ihPivInB[i] = pivInB[i]; ihPivInB[i] = pivInB[i];
} }
MDataHandle hRotInA = data.outputValue(ia_rotationInA); MDataHandle hRotInA = data.outputValue(ia_rotationInA);
float3 &hrotInA = hRotInA.asFloat3(); float3 &hrotInA = hRotInA.asFloat3();
MQuaternion mrotA(rotInA[1], rotInA[2], rotInA[3], rotInA[0]); MQuaternion mrotA(rotInA[1], rotInA[2], rotInA[3], rotInA[0]);
MEulerRotation newrotA(mrotA.asEulerRotation()); MEulerRotation newrotA(mrotA.asEulerRotation());
hrotInA[0] = rad2deg((float)newrotA.x); hrotInA[0] = rad2deg((float)newrotA.x);
hrotInA[1] = rad2deg((float)newrotA.y); hrotInA[1] = rad2deg((float)newrotA.y);
hrotInA[2] = rad2deg((float)newrotA.z); hrotInA[2] = rad2deg((float)newrotA.z);
MDataHandle hRotInB = data.outputValue(ia_rotationInB); MDataHandle hRotInB = data.outputValue(ia_rotationInB);
float3 &hrotInB = hRotInB.asFloat3(); float3 &hrotInB = hRotInB.asFloat3();
MQuaternion mrotB(rotInB[1], rotInB[2], rotInB[3], rotInB[0]); MQuaternion mrotB(rotInB[1], rotInB[2], rotInB[3], rotInB[0]);
MEulerRotation newrotB(mrotB.asEulerRotation()); MEulerRotation newrotB(mrotB.asEulerRotation());
hrotInB[0] = rad2deg((float)newrotB.x); hrotInB[0] = rad2deg((float)newrotB.x);
hrotInB[1] = rad2deg((float)newrotB.y); hrotInB[1] = rad2deg((float)newrotB.y);
hrotInB[2] = rad2deg((float)newrotB.z); hrotInB[2] = rad2deg((float)newrotB.z);
m_constraint->setPivotChanged(false); m_constraint->setPivotChanged(false);
} }
} }
} }
@@ -619,8 +628,8 @@ void hingeConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data
vec3f worldP; vec3f worldP;
quatf worldR; quatf worldR;
m_constraint->get_world(worldP, worldR); m_constraint->get_world(worldP, worldR);
fnParentTransform.setTranslation(MVector(worldP[0], worldP[1], worldP[2]), MSpace::kTransform); fnParentTransform.setTranslation(MVector(worldP[0], worldP[1], worldP[2]), MSpace::kTransform);
fnParentTransform.setRotation(MQuaternion(worldR[1], worldR[2], worldR[3], worldR[0])); fnParentTransform.setRotation(MQuaternion(worldR[1], worldR[2], worldR[3], worldR[0]));
} }
} }
data.setClean(plug); data.setClean(plug);

View File

@@ -18,9 +18,9 @@ not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com> Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked 01/22/2010 : Constraints reworked
*/ */
//sixdofConstraintNode.cpp //sixdofConstraintNode.cpp
@@ -42,8 +42,8 @@ Modified by Roman Ponomarev <rponom@gmail.com>
#include "mayaUtils.h" #include "mayaUtils.h"
#include "solver.h" #include "solver.h"
#include "dSolverNode.h" #include "dSolverNode.h"
#include "constraint/bt_sixdof_constraint.h" #include "constraint/bt_sixdof_constraint.h"
MTypeId sixdofConstraintNode::typeId(0x100384); MTypeId sixdofConstraintNode::typeId(0x100384);
MString sixdofConstraintNode::typeName("dSixdofConstraint"); MString sixdofConstraintNode::typeName("dSixdofConstraint");
@@ -274,7 +274,14 @@ void sixdofConstraintNode::draw( M3dView & view, const MDagPath &path,
M3dView::DisplayStatus status ) M3dView::DisplayStatus status )
{ {
update(); update();
vec3f zeroVec(0.f,0.f,0.f);
vec3f minusXVec(-1.f,0.f,0.f);
vec3f posXVec(1.f,0.f,0.f);
vec3f minusYVec (0.f,-1.f,0.f);
vec3f posYVec (0.f,1.f,0.f);
vec3f minusZVec (0.f,0.f,-1.f);
vec3f posZVec (0.f,0.f,1.f);
view.beginGL(); view.beginGL();
glPushAttrib( GL_ALL_ATTRIB_BITS ); glPushAttrib( GL_ALL_ATTRIB_BITS );
@@ -301,7 +308,7 @@ void sixdofConstraintNode::draw( M3dView & view, const MDagPath &path,
rigid_bodyB->get_transform(pos, rot); rigid_bodyB->get_transform(pos, rot);
m_constraint->worldToA(pos, posB); m_constraint->worldToA(pos, posB);
} }
m_constraint->worldFromB(vec3f(0.f, 0.f, 0.f), pos); m_constraint->worldFromB(zeroVec, pos);
m_constraint->worldToA(pos, pivB); m_constraint->worldToA(pos, pivB);
} }
@@ -330,21 +337,21 @@ void sixdofConstraintNode::draw( M3dView & view, const MDagPath &path,
vec3f posT, posP, posM; vec3f posT, posP, posM;
m_constraint->worldFromB(vec3f(-1.f, 0.f, 0.f), posT); m_constraint->worldFromB(minusXVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 1.f, 0.f, 0.f), posT); m_constraint->worldFromB(posXVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
m_constraint->worldFromB(vec3f( 0.f, -1.f, 0.f), posT); m_constraint->worldFromB(minusYVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 0.f, 1.f, 0.f), posT); m_constraint->worldFromB(posYVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
m_constraint->worldFromB(vec3f( 0.f, 0.f, -1.f), posT); m_constraint->worldFromB(minusZVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 0.f, 0.f, 1.f), posT); m_constraint->worldFromB(posZVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
@@ -430,13 +437,13 @@ void sixdofConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data
pivInB[i] = (float)mPivInB[i]; pivInB[i] = (float)mPivInB[i];
} }
float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3(); float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3();
MEulerRotation meulerA(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2])); MEulerRotation meulerA(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2]));
MQuaternion mquatA = meulerA.asQuaternion(); MQuaternion mquatA = meulerA.asQuaternion();
quatf rotA((float)mquatA.w, (float)mquatA.x, (float)mquatA.y, (float)mquatA.z); quatf rotA((float)mquatA.w, (float)mquatA.x, (float)mquatA.y, (float)mquatA.z);
float3& mRotInB = data.inputValue(ia_rotationInB).asFloat3(); float3& mRotInB = data.inputValue(ia_rotationInB).asFloat3();
MEulerRotation meulerB(deg2rad(mRotInB[0]), deg2rad(mRotInB[1]), deg2rad(mRotInB[2])); MEulerRotation meulerB(deg2rad(mRotInB[0]), deg2rad(mRotInB[1]), deg2rad(mRotInB[2]));
MQuaternion mquatB = meulerB.asQuaternion(); MQuaternion mquatB = meulerB.asQuaternion();
quatf rotB((float)mquatB.w, (float)mquatB.x, (float)mquatB.y, (float)mquatB.z); quatf rotB((float)mquatB.w, (float)mquatB.x, (float)mquatB.y, (float)mquatB.z);
m_constraint = solver_t::create_sixdof_constraint(rigid_bodyA, pivInA, rotA, rigid_bodyB, pivInB, rotB); m_constraint = solver_t::create_sixdof_constraint(rigid_bodyA, pivInA, rotA, rigid_bodyB, pivInB, rotB);
constraint = static_cast<constraint_t::pointer>(m_constraint); constraint = static_cast<constraint_t::pointer>(m_constraint);
solver_t::add_constraint(constraint); solver_t::add_constraint(constraint);
@@ -452,9 +459,9 @@ void sixdofConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data
pivInA[i] = (float)mPivInA[i]; pivInA[i] = (float)mPivInA[i];
} }
float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3(); float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3();
MEulerRotation meuler(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2])); MEulerRotation meuler(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2]));
MQuaternion mquat = meuler.asQuaternion(); MQuaternion mquat = meuler.asQuaternion();
quatf rotA((float)mquat.w, (float)mquat.x, (float)mquat.y, (float)mquat.z); quatf rotA((float)mquat.w, (float)mquat.x, (float)mquat.y, (float)mquat.z);
m_constraint = solver_t::create_sixdof_constraint(rigid_bodyA, pivInA, rotA); m_constraint = solver_t::create_sixdof_constraint(rigid_bodyA, pivInA, rotA);
constraint = static_cast<constraint_t::pointer>(m_constraint); constraint = static_cast<constraint_t::pointer>(m_constraint);
solver_t::add_constraint(constraint); solver_t::add_constraint(constraint);
@@ -480,8 +487,8 @@ void sixdofConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
fnParentTransform.setScale(fixScale); fnParentTransform.setScale(fixScale);
MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status);
if(dSolverNode::isStartTime) if(dSolverNode::isStartTime)
{ // allow to edit pivots { // allow to edit pivots
MPlug plgRigidBodyA(thisObject, ia_rigidBodyA); MPlug plgRigidBodyA(thisObject, ia_rigidBodyA);
MPlug plgRigidBodyB(thisObject, ia_rigidBodyB); MPlug plgRigidBodyB(thisObject, ia_rigidBodyB);
MObject update; MObject update;
@@ -520,8 +527,8 @@ void sixdofConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
} }
if(m_constraint) if(m_constraint)
{ {
MQuaternion mrotation; MQuaternion mrotation;
fnParentTransform.getRotation(mrotation, MSpace::kTransform); fnParentTransform.getRotation(mrotation, MSpace::kTransform);
bool doUpdatePivot = m_constraint->getPivotChanged(); bool doUpdatePivot = m_constraint->getPivotChanged();
if(!doUpdatePivot) if(!doUpdatePivot)
{ {
@@ -531,46 +538,46 @@ void sixdofConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
float deltaPX = worldP[0] - float(mtranslation.x); float deltaPX = worldP[0] - float(mtranslation.x);
float deltaPY = worldP[1] - float(mtranslation.y); float deltaPY = worldP[1] - float(mtranslation.y);
float deltaPZ = worldP[2] - float(mtranslation.z); float deltaPZ = worldP[2] - float(mtranslation.z);
float deltaRX = (float)mrotation.x - worldR[1]; float deltaRX = (float)mrotation.x - worldR[1];
float deltaRY = (float)mrotation.y - worldR[2]; float deltaRY = (float)mrotation.y - worldR[2];
float deltaRZ = (float)mrotation.z - worldR[3]; float deltaRZ = (float)mrotation.z - worldR[3];
float deltaRW = (float)mrotation.w - worldR[0]; float deltaRW = (float)mrotation.w - worldR[0];
float deltaSq = deltaPX * deltaPX + deltaPY * deltaPY + deltaPZ * deltaPZ float deltaSq = deltaPX * deltaPX + deltaPY * deltaPY + deltaPZ * deltaPZ
+ deltaRX * deltaRX + deltaRY * deltaRY + deltaRZ * deltaRZ + deltaRW * deltaRW; + deltaRX * deltaRX + deltaRY * deltaRY + deltaRZ * deltaRZ + deltaRW * deltaRW;
doUpdatePivot = (deltaSq > FLT_EPSILON); doUpdatePivot = (deltaSq > FLT_EPSILON);
} }
if(doUpdatePivot) if(doUpdatePivot)
{ {
m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]), m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]),
quatf((float)mrotation.w, (float)mrotation.x, (float)mrotation.y, (float)mrotation.z)); quatf((float)mrotation.w, (float)mrotation.x, (float)mrotation.y, (float)mrotation.z));
vec3f pivInA, pivInB; vec3f pivInA, pivInB;
quatf rotInA, rotInB; quatf rotInA, rotInB;
m_constraint->get_frameA(pivInA, rotInA); m_constraint->get_frameA(pivInA, rotInA);
m_constraint->get_frameB(pivInB, rotInB); m_constraint->get_frameB(pivInB, rotInB);
MDataHandle hPivInA = data.outputValue(ia_pivotInA); MDataHandle hPivInA = data.outputValue(ia_pivotInA);
float3 &ihPivInA = hPivInA.asFloat3(); float3 &ihPivInA = hPivInA.asFloat3();
MDataHandle hPivInB = data.outputValue(ia_pivotInB); MDataHandle hPivInB = data.outputValue(ia_pivotInB);
float3 &ihPivInB = hPivInB.asFloat3(); float3 &ihPivInB = hPivInB.asFloat3();
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
{ {
ihPivInA[i] = pivInA[i]; ihPivInA[i] = pivInA[i];
ihPivInB[i] = pivInB[i]; ihPivInB[i] = pivInB[i];
} }
MDataHandle hRotInA = data.outputValue(ia_rotationInA); MDataHandle hRotInA = data.outputValue(ia_rotationInA);
float3 &hrotInA = hRotInA.asFloat3(); float3 &hrotInA = hRotInA.asFloat3();
MQuaternion mrotA(rotInA[1], rotInA[2], rotInA[3], rotInA[0]); MQuaternion mrotA(rotInA[1], rotInA[2], rotInA[3], rotInA[0]);
MEulerRotation newrotA(mrotA.asEulerRotation()); MEulerRotation newrotA(mrotA.asEulerRotation());
hrotInA[0] = rad2deg((float)newrotA.x); hrotInA[0] = rad2deg((float)newrotA.x);
hrotInA[1] = rad2deg((float)newrotA.y); hrotInA[1] = rad2deg((float)newrotA.y);
hrotInA[2] = rad2deg((float)newrotA.z); hrotInA[2] = rad2deg((float)newrotA.z);
MDataHandle hRotInB = data.outputValue(ia_rotationInB); MDataHandle hRotInB = data.outputValue(ia_rotationInB);
float3 &hrotInB = hRotInB.asFloat3(); float3 &hrotInB = hRotInB.asFloat3();
MQuaternion mrotB(rotInB[1], rotInB[2], rotInB[3], rotInB[0]); MQuaternion mrotB(rotInB[1], rotInB[2], rotInB[3], rotInB[0]);
MEulerRotation newrotB(mrotB.asEulerRotation()); MEulerRotation newrotB(mrotB.asEulerRotation());
hrotInB[0] = rad2deg((float)newrotB.x); hrotInB[0] = rad2deg((float)newrotB.x);
hrotInB[1] = rad2deg((float)newrotB.y); hrotInB[1] = rad2deg((float)newrotB.y);
hrotInB[2] = rad2deg((float)newrotB.z); hrotInB[2] = rad2deg((float)newrotB.z);
m_constraint->setPivotChanged(false); m_constraint->setPivotChanged(false);
} }
} }
} }
@@ -581,8 +588,8 @@ void sixdofConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
vec3f worldP; vec3f worldP;
quatf worldR; quatf worldR;
m_constraint->get_world(worldP, worldR); m_constraint->get_world(worldP, worldR);
fnParentTransform.setTranslation(MVector(worldP[0], worldP[1], worldP[2]), MSpace::kTransform); fnParentTransform.setTranslation(MVector(worldP[0], worldP[1], worldP[2]), MSpace::kTransform);
fnParentTransform.setRotation(MQuaternion(worldR[1], worldR[2], worldR[3], worldR[0])); fnParentTransform.setRotation(MQuaternion(worldR[1], worldR[2], worldR[3], worldR[0]));
} }
} }
data.setClean(plug); data.setClean(plug);

View File

@@ -18,9 +18,9 @@ not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
Written by: Herbert Law <Herbert.Law@gmail.com> Written by: Herbert Law <Herbert.Law@gmail.com>
Modified by Roman Ponomarev <rponom@gmail.com> Modified by Roman Ponomarev <rponom@gmail.com>
01/22/2010 : Constraints reworked 01/22/2010 : Constraints reworked
*/ */
//sliderConstraintNode.cpp //sliderConstraintNode.cpp
@@ -42,8 +42,8 @@ Modified by Roman Ponomarev <rponom@gmail.com>
#include "mayaUtils.h" #include "mayaUtils.h"
#include "solver.h" #include "solver.h"
#include "dSolverNode.h" #include "dSolverNode.h"
#include "constraint/bt_slider_constraint.h" #include "constraint/bt_slider_constraint.h"
MTypeId sliderConstraintNode::typeId(0x100385); MTypeId sliderConstraintNode::typeId(0x100385);
MString sliderConstraintNode::typeName("dSliderConstraint"); MString sliderConstraintNode::typeName("dSliderConstraint");
@@ -270,6 +270,13 @@ void sliderConstraintNode::draw( M3dView & view, const MDagPath &path,
M3dView::DisplayStatus status ) M3dView::DisplayStatus status )
{ {
update(); update();
vec3f zeroVec(0.f,0.f,0.f);
vec3f minusXVec(-1.f,0.f,0.f);
vec3f posXVec(1.f,0.f,0.f);
vec3f minusYVec (0.f,-1.f,0.f);
vec3f posYVec (0.f,1.f,0.f);
vec3f minusZVec (0.f,0.f,-1.f);
vec3f posZVec (0.f,0.f,1.f);
view.beginGL(); view.beginGL();
glPushAttrib( GL_ALL_ATTRIB_BITS ); glPushAttrib( GL_ALL_ATTRIB_BITS );
@@ -297,7 +304,7 @@ void sliderConstraintNode::draw( M3dView & view, const MDagPath &path,
rigid_bodyB->get_transform(pos, rot); rigid_bodyB->get_transform(pos, rot);
m_constraint->worldToA(pos, posB); m_constraint->worldToA(pos, posB);
} }
m_constraint->worldFromB(vec3f(0.f, 0.f, 0.f), pos); m_constraint->worldFromB(zeroVec, pos);
m_constraint->worldToA(pos, pivB); m_constraint->worldToA(pos, pivB);
} }
@@ -326,21 +333,21 @@ void sliderConstraintNode::draw( M3dView & view, const MDagPath &path,
vec3f posT, posP, posM; vec3f posT, posP, posM;
m_constraint->worldFromB(vec3f(-1.f, 0.f, 0.f), posT); m_constraint->worldFromB(minusXVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 1.f, 0.f, 0.f), posT); m_constraint->worldFromB(posXVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
m_constraint->worldFromB(vec3f( 0.f, -1.f, 0.f), posT); m_constraint->worldFromB(minusYVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 0.f, 1.f, 0.f), posT); m_constraint->worldFromB(posYVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
m_constraint->worldFromB(vec3f( 0.f, 0.f, -1.f), posT); m_constraint->worldFromB(minusZVec, posT);
m_constraint->worldToA(posT, posM); m_constraint->worldToA(posT, posM);
m_constraint->worldFromB(vec3f( 0.f, 0.f, 1.f), posT); m_constraint->worldFromB(posZVec, posT);
m_constraint->worldToA(posT, posP); m_constraint->worldToA(posT, posP);
glVertex3f(posM[0], posM[1], posM[2]); glVertex3f(posM[0], posM[1], posM[2]);
glVertex3f(posP[0], posP[1], posP[2]); glVertex3f(posP[0], posP[1], posP[2]);
@@ -426,13 +433,13 @@ void sliderConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data
pivInB[i] = (float)mPivInB[i]; pivInB[i] = (float)mPivInB[i];
} }
float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3(); float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3();
MEulerRotation meulerA(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2])); MEulerRotation meulerA(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2]));
MQuaternion mquatA = meulerA.asQuaternion(); MQuaternion mquatA = meulerA.asQuaternion();
quatf rotA((float)mquatA.w, (float)mquatA.x, (float)mquatA.y, (float)mquatA.z); quatf rotA((float)mquatA.w, (float)mquatA.x, (float)mquatA.y, (float)mquatA.z);
float3& mRotInB = data.inputValue(ia_rotationInB).asFloat3(); float3& mRotInB = data.inputValue(ia_rotationInB).asFloat3();
MEulerRotation meulerB(deg2rad(mRotInB[0]), deg2rad(mRotInB[1]), deg2rad(mRotInB[2])); MEulerRotation meulerB(deg2rad(mRotInB[0]), deg2rad(mRotInB[1]), deg2rad(mRotInB[2]));
MQuaternion mquatB = meulerB.asQuaternion(); MQuaternion mquatB = meulerB.asQuaternion();
quatf rotB((float)mquatB.w, (float)mquatB.x, (float)mquatB.y, (float)mquatB.z); quatf rotB((float)mquatB.w, (float)mquatB.x, (float)mquatB.y, (float)mquatB.z);
m_constraint = solver_t::create_slider_constraint(rigid_bodyA, pivInA, rotA, rigid_bodyB, pivInB, rotB); m_constraint = solver_t::create_slider_constraint(rigid_bodyA, pivInA, rotA, rigid_bodyB, pivInB, rotB);
constraint = static_cast<constraint_t::pointer>(m_constraint); constraint = static_cast<constraint_t::pointer>(m_constraint);
solver_t::add_constraint(constraint); solver_t::add_constraint(constraint);
@@ -448,9 +455,9 @@ void sliderConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data
pivInA[i] = (float)mPivInA[i]; pivInA[i] = (float)mPivInA[i];
} }
float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3(); float3& mRotInA = data.inputValue(ia_rotationInA).asFloat3();
MEulerRotation meuler(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2])); MEulerRotation meuler(deg2rad(mRotInA[0]), deg2rad(mRotInA[1]), deg2rad(mRotInA[2]));
MQuaternion mquat = meuler.asQuaternion(); MQuaternion mquat = meuler.asQuaternion();
quatf rotA((float)mquat.w, (float)mquat.x, (float)mquat.y, (float)mquat.z); quatf rotA((float)mquat.w, (float)mquat.x, (float)mquat.y, (float)mquat.z);
m_constraint = solver_t::create_slider_constraint(rigid_bodyA, pivInA, rotA); m_constraint = solver_t::create_slider_constraint(rigid_bodyA, pivInA, rotA);
constraint = static_cast<constraint_t::pointer>(m_constraint); constraint = static_cast<constraint_t::pointer>(m_constraint);
solver_t::add_constraint(constraint); solver_t::add_constraint(constraint);
@@ -475,8 +482,8 @@ void sliderConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
fnParentTransform.setScale(fixScale); fnParentTransform.setScale(fixScale);
MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status);
if(dSolverNode::isStartTime) if(dSolverNode::isStartTime)
{ // allow to edit pivots { // allow to edit pivots
MPlug plgRigidBodyA(thisObject, ia_rigidBodyA); MPlug plgRigidBodyA(thisObject, ia_rigidBodyA);
MPlug plgRigidBodyB(thisObject, ia_rigidBodyB); MPlug plgRigidBodyB(thisObject, ia_rigidBodyB);
MObject update; MObject update;
@@ -515,8 +522,8 @@ void sliderConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
} }
if(m_constraint) if(m_constraint)
{ {
MQuaternion mrotation; MQuaternion mrotation;
fnParentTransform.getRotation(mrotation, MSpace::kTransform); fnParentTransform.getRotation(mrotation, MSpace::kTransform);
bool doUpdatePivot = m_constraint->getPivotChanged(); bool doUpdatePivot = m_constraint->getPivotChanged();
if(!doUpdatePivot) if(!doUpdatePivot)
{ {
@@ -526,46 +533,46 @@ void sliderConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
float deltaPX = worldP[0] - float(mtranslation.x); float deltaPX = worldP[0] - float(mtranslation.x);
float deltaPY = worldP[1] - float(mtranslation.y); float deltaPY = worldP[1] - float(mtranslation.y);
float deltaPZ = worldP[2] - float(mtranslation.z); float deltaPZ = worldP[2] - float(mtranslation.z);
float deltaRX = (float)mrotation.x - worldR[1]; float deltaRX = (float)mrotation.x - worldR[1];
float deltaRY = (float)mrotation.y - worldR[2]; float deltaRY = (float)mrotation.y - worldR[2];
float deltaRZ = (float)mrotation.z - worldR[3]; float deltaRZ = (float)mrotation.z - worldR[3];
float deltaRW = (float)mrotation.w - worldR[0]; float deltaRW = (float)mrotation.w - worldR[0];
float deltaSq = deltaPX * deltaPX + deltaPY * deltaPY + deltaPZ * deltaPZ float deltaSq = deltaPX * deltaPX + deltaPY * deltaPY + deltaPZ * deltaPZ
+ deltaRX * deltaRX + deltaRY * deltaRY + deltaRZ * deltaRZ + deltaRW * deltaRW; + deltaRX * deltaRX + deltaRY * deltaRY + deltaRZ * deltaRZ + deltaRW * deltaRW;
doUpdatePivot = (deltaSq > FLT_EPSILON); doUpdatePivot = (deltaSq > FLT_EPSILON);
} }
if(doUpdatePivot) if(doUpdatePivot)
{ {
m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]), m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2]),
quatf((float)mrotation.w, (float)mrotation.x, (float)mrotation.y, (float)mrotation.z)); quatf((float)mrotation.w, (float)mrotation.x, (float)mrotation.y, (float)mrotation.z));
vec3f pivInA, pivInB; vec3f pivInA, pivInB;
quatf rotInA, rotInB; quatf rotInA, rotInB;
m_constraint->get_frameA(pivInA, rotInA); m_constraint->get_frameA(pivInA, rotInA);
m_constraint->get_frameB(pivInB, rotInB); m_constraint->get_frameB(pivInB, rotInB);
MDataHandle hPivInA = data.outputValue(ia_pivotInA); MDataHandle hPivInA = data.outputValue(ia_pivotInA);
float3 &ihPivInA = hPivInA.asFloat3(); float3 &ihPivInA = hPivInA.asFloat3();
MDataHandle hPivInB = data.outputValue(ia_pivotInB); MDataHandle hPivInB = data.outputValue(ia_pivotInB);
float3 &ihPivInB = hPivInB.asFloat3(); float3 &ihPivInB = hPivInB.asFloat3();
for(int i = 0; i < 3; i++) for(int i = 0; i < 3; i++)
{ {
ihPivInA[i] = pivInA[i]; ihPivInA[i] = pivInA[i];
ihPivInB[i] = pivInB[i]; ihPivInB[i] = pivInB[i];
} }
MDataHandle hRotInA = data.outputValue(ia_rotationInA); MDataHandle hRotInA = data.outputValue(ia_rotationInA);
float3 &hrotInA = hRotInA.asFloat3(); float3 &hrotInA = hRotInA.asFloat3();
MQuaternion mrotA(rotInA[1], rotInA[2], rotInA[3], rotInA[0]); MQuaternion mrotA(rotInA[1], rotInA[2], rotInA[3], rotInA[0]);
MEulerRotation newrotA(mrotA.asEulerRotation()); MEulerRotation newrotA(mrotA.asEulerRotation());
hrotInA[0] = rad2deg((float)newrotA.x); hrotInA[0] = rad2deg((float)newrotA.x);
hrotInA[1] = rad2deg((float)newrotA.y); hrotInA[1] = rad2deg((float)newrotA.y);
hrotInA[2] = rad2deg((float)newrotA.z); hrotInA[2] = rad2deg((float)newrotA.z);
MDataHandle hRotInB = data.outputValue(ia_rotationInB); MDataHandle hRotInB = data.outputValue(ia_rotationInB);
float3 &hrotInB = hRotInB.asFloat3(); float3 &hrotInB = hRotInB.asFloat3();
MQuaternion mrotB(rotInB[1], rotInB[2], rotInB[3], rotInB[0]); MQuaternion mrotB(rotInB[1], rotInB[2], rotInB[3], rotInB[0]);
MEulerRotation newrotB(mrotB.asEulerRotation()); MEulerRotation newrotB(mrotB.asEulerRotation());
hrotInB[0] = rad2deg((float)newrotB.x); hrotInB[0] = rad2deg((float)newrotB.x);
hrotInB[1] = rad2deg((float)newrotB.y); hrotInB[1] = rad2deg((float)newrotB.y);
hrotInB[2] = rad2deg((float)newrotB.z); hrotInB[2] = rad2deg((float)newrotB.z);
m_constraint->setPivotChanged(false); m_constraint->setPivotChanged(false);
} }
} }
} }
@@ -576,8 +583,8 @@ void sliderConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& dat
vec3f worldP; vec3f worldP;
quatf worldR; quatf worldR;
m_constraint->get_world(worldP, worldR); m_constraint->get_world(worldP, worldR);
fnParentTransform.setTranslation(MVector(worldP[0], worldP[1], worldP[2]), MSpace::kTransform); fnParentTransform.setTranslation(MVector(worldP[0], worldP[1], worldP[2]), MSpace::kTransform);
fnParentTransform.setRotation(MQuaternion(worldR[1], worldR[2], worldR[3], worldR[0])); fnParentTransform.setRotation(MQuaternion(worldR[1], worldR[2], worldR[3], worldR[0]));
} }
} }
data.setClean(plug); data.setClean(plug);

View File

@@ -614,7 +614,7 @@ bool btBulletWorldImporter::loadFileFromMemory( bParse::btBulletFile* bulletFil
} }
return false; return true;
} }
btTypedConstraint* btBulletWorldImporter::createUniversalD6Constraint(class btRigidBody* body0,class btRigidBody* otherBody, btTypedConstraint* btBulletWorldImporter::createUniversalD6Constraint(class btRigidBody* body0,class btRigidBody* otherBody,

View File

@@ -9,27 +9,12 @@
/* Architecture is x86-64 */ /* Architecture is x86-64 */
#undef ARCH_X86_64 #undef ARCH_X86_64
/* Define when compiling for MacOS/X */
#undef CS_PLATFORM_MACOSX
/* Define when compiling for Unix and Unix-like (i.e. MacOS/X) */
#undef CS_PLATFORM_UNIX
/* Define when compiling for Win32 */
#undef CS_PLATFORM_WIN32
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define to 1 if you have the `mx' library (-lmx). */
#undef HAVE_LIBMX
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
@@ -51,14 +36,12 @@
/* Define to 1 if you have the <sys/types.h> header file. */ /* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H #undef HAVE_SYS_TYPES_H
/* Whether the int32 type is available */
#undef HAVE_TYPE_INT32
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to 1 if you have the <windows.h> header file. */ /* Define to the sub-directory in which libtool stores uninstalled libraries.
#undef HAVE_WINDOWS_H */
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O #undef NO_MINUS_C_MINUS_O
@@ -99,9 +82,3 @@
/* Define to 1 if your processor stores words with the most significant byte /* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */ first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN #undef WORDS_BIGENDIAN
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Avoid problem caused by missing <Carbon/CarbonSound.h> */
#undef __CARBONSOUND__

View File

@@ -93,6 +93,7 @@ libbulletmath_la_SOURCES = \
LinearMath/btQuickprof.cpp \ LinearMath/btQuickprof.cpp \
LinearMath/btGeometryUtil.cpp \ LinearMath/btGeometryUtil.cpp \
LinearMath/btAlignedAllocator.cpp \ LinearMath/btAlignedAllocator.cpp \
LinearMath/btSerializer.cpp \
LinearMath/btConvexHull.cpp \ LinearMath/btConvexHull.cpp \
LinearMath/btHashMap.h \ LinearMath/btHashMap.h \
LinearMath/btConvexHull.h \ LinearMath/btConvexHull.h \
@@ -111,6 +112,7 @@ libbulletmath_la_SOURCES = \
LinearMath/btQuaternion.h \ LinearMath/btQuaternion.h \
LinearMath/btAlignedObjectArray.h \ LinearMath/btAlignedObjectArray.h \
LinearMath/btQuickprof.h \ LinearMath/btQuickprof.h \
LinearMath/btSerializer.h \
LinearMath/btTransformUtil.h \ LinearMath/btTransformUtil.h \
LinearMath/btTransform.h \ LinearMath/btTransform.h \
LinearMath/btDefaultMotionState.h \ LinearMath/btDefaultMotionState.h \
@@ -545,4 +547,5 @@ nobase_bullet_include_HEADERS += \
LinearMath/btStackAlloc.h \ LinearMath/btStackAlloc.h \
LinearMath/btAlignedObjectArray.h \ LinearMath/btAlignedObjectArray.h \
LinearMath/btHashMap.h \ LinearMath/btHashMap.h \
LinearMath/btQuickprof.h LinearMath/btQuickprof.h\
LinearMath/btSerializer.h