Add btScalar fixes and correct M_PI to SIMD_PI.

This commit is contained in:
Benjamin Ellenberger
2016-06-06 23:47:33 +02:00
parent 9872d2b20f
commit e46a718807
3 changed files with 7 additions and 7 deletions

View File

@@ -89,7 +89,7 @@ void InclinedPlaneExample::initPhysics()
{ // create slider to change the ramp tilt { // create slider to change the ramp tilt
SliderParams slider("Ramp Tilt",&gTilt); SliderParams slider("Ramp Tilt",&gTilt);
slider.m_minVal=0; slider.m_minVal=0;
slider.m_maxVal=M_PI/2.0f; slider.m_maxVal=SIMD_PI/2.0f;
slider.m_clampToNotches = false; slider.m_clampToNotches = false;
slider.m_callback = onRampInclinationChanged; slider.m_callback = onRampInclinationChanged;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider); m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);

View File

@@ -355,7 +355,7 @@ bool MultiPendulumExample::keyboardCallback(int key, int state) {
case 49 /*ASCII for 1*/: { case 49 /*ASCII for 1*/: {
//assumption: Sphere are aligned in Z axis //assumption: Sphere are aligned in Z axis
btScalar newLimit = gCurrentPendulumLength + 0.1; btScalar newLimit = btScalar(gCurrentPendulumLength + 0.1);
changePendulaLength(newLimit); changePendulaLength(newLimit);
gCurrentPendulumLength = newLimit; gCurrentPendulumLength = newLimit;
@@ -366,7 +366,7 @@ bool MultiPendulumExample::keyboardCallback(int key, int state) {
case 50 /*ASCII for 2*/: { case 50 /*ASCII for 2*/: {
//assumption: Sphere are aligned in Z axis //assumption: Sphere are aligned in Z axis
btScalar newLimit = gCurrentPendulumLength - 0.1; btScalar newLimit = btScalar(gCurrentPendulumLength - 0.1);
//is being shortened beyond it's own length, we don't let the lower sphere to go over the upper one //is being shortened beyond it's own length, we don't let the lower sphere to go over the upper one
if (0 <= newLimit) { if (0 <= newLimit) {
@@ -378,7 +378,7 @@ bool MultiPendulumExample::keyboardCallback(int key, int state) {
return true; return true;
} }
case 51 /*ASCII for 3*/: { case 51 /*ASCII for 3*/: {
for (int i = gPendulaQty-1; i >= gPendulaQty-gDisplacedPendula; i--) { for (int i = floor(gPendulaQty)-1; i >= gPendulaQty-gDisplacedPendula; i--) {
if (gDisplacedPendula >= 0 && gDisplacedPendula < gPendulaQty) if (gDisplacedPendula >= 0 && gDisplacedPendula < gPendulaQty)
pendula[i]->applyCentralForce(btVector3(gDisplacementForce, 0, 0)); pendula[i]->applyCentralForce(btVector3(gDisplacementForce, 0, 0));
} }

View File

@@ -153,7 +153,7 @@ void NewtonsCradleExample::initPhysics() {
for (int i = 0; i < floor(gPendulaQty); i++) { for (int i = 0; i < floor(gPendulaQty); i++) {
// create pendulum // create pendulum
createPendulum(pendulumShape, xPosition, yPosition,zPosition, createPendulum(pendulumShape, xPosition, yPosition, zPosition,
gInitialPendulumLength, pendulumMass); gInitialPendulumLength, pendulumMass);
// displace the pendula 1.05 sphere size, so that they all nearly touch (small spacings in between // displace the pendula 1.05 sphere size, so that they all nearly touch (small spacings in between
@@ -289,7 +289,7 @@ bool NewtonsCradleExample::keyboardCallback(int key, int state) {
case 49 /*ASCII for 1*/: { case 49 /*ASCII for 1*/: {
//assumption: Sphere are aligned in Z axis //assumption: Sphere are aligned in Z axis
btScalar newLimit = gCurrentPendulumLength + 0.1; btScalar newLimit = btScalar(gCurrentPendulumLength + 0.1);
changePendulaLength(newLimit); changePendulaLength(newLimit);
gCurrentPendulumLength = newLimit; gCurrentPendulumLength = newLimit;
@@ -300,7 +300,7 @@ bool NewtonsCradleExample::keyboardCallback(int key, int state) {
case 50 /*ASCII for 2*/: { case 50 /*ASCII for 2*/: {
//assumption: Sphere are aligned in Z axis //assumption: Sphere are aligned in Z axis
btScalar newLimit = gCurrentPendulumLength - 0.1; btScalar newLimit = btScalar(gCurrentPendulumLength - 0.1);
//is being shortened beyond it's own length, we don't let the lower sphere to go over the upper one //is being shortened beyond it's own length, we don't let the lower sphere to go over the upper one
if (0 <= newLimit) { if (0 <= newLimit) {