example browser: slider widget improvements
This commit is contained in:
@@ -69,19 +69,19 @@ struct InclinedPlaneExample : public CommonRigidBodyBase
|
||||
|
||||
};
|
||||
|
||||
void onBoxFrictionChanged(float friction);
|
||||
void onBoxFrictionChanged(float friction, void* userPtr);
|
||||
|
||||
void onBoxRestitutionChanged(float restitution);
|
||||
void onBoxRestitutionChanged(float restitution, void* userPtr);
|
||||
|
||||
void onSphereFrictionChanged(float friction);
|
||||
void onSphereFrictionChanged(float friction, void* userPtr);
|
||||
|
||||
void onSphereRestitutionChanged(float restitution);
|
||||
void onSphereRestitutionChanged(float restitution, void* userPtr);
|
||||
|
||||
void onRampInclinationChanged(float inclination);
|
||||
void onRampInclinationChanged(float inclination, void* userPtr);
|
||||
|
||||
void onRampFrictionChanged(float friction);
|
||||
void onRampFrictionChanged(float friction, void* userPtr);
|
||||
|
||||
void onRampRestitutionChanged(float restitution);
|
||||
void onRampRestitutionChanged(float restitution, void* userPtr);
|
||||
|
||||
void InclinedPlaneExample::initPhysics()
|
||||
{
|
||||
@@ -306,35 +306,35 @@ bool InclinedPlaneExample::keyboardCallback(int key, int state) {
|
||||
|
||||
|
||||
// GUI parameter modifiers
|
||||
void onBoxFrictionChanged(float friction){
|
||||
void onBoxFrictionChanged(float friction, void*){
|
||||
if(gBox){
|
||||
gBox->setFriction(friction);
|
||||
// b3Printf("Friction of box changed to %f",friction );
|
||||
}
|
||||
}
|
||||
|
||||
void onBoxRestitutionChanged(float restitution){
|
||||
void onBoxRestitutionChanged(float restitution, void*){
|
||||
if(gBox){
|
||||
gBox->setRestitution(restitution);
|
||||
//b3Printf("Restitution of box changed to %f",restitution);
|
||||
}
|
||||
}
|
||||
|
||||
void onSphereFrictionChanged(float friction){
|
||||
void onSphereFrictionChanged(float friction, void*){
|
||||
if(gSphere){
|
||||
gSphere->setFriction(friction);
|
||||
//b3Printf("Friction of sphere changed to %f",friction );
|
||||
}
|
||||
}
|
||||
|
||||
void onSphereRestitutionChanged(float restitution){
|
||||
void onSphereRestitutionChanged(float restitution, void*){
|
||||
if(gSphere){
|
||||
gSphere->setRestitution(restitution);
|
||||
//b3Printf("Restitution of sphere changed to %f",restitution);
|
||||
}
|
||||
}
|
||||
|
||||
void onRampInclinationChanged(float inclination){
|
||||
void onRampInclinationChanged(float inclination, void*){
|
||||
if(ramp){
|
||||
btTransform startTransform;
|
||||
startTransform.setIdentity();
|
||||
@@ -351,14 +351,14 @@ void onRampInclinationChanged(float inclination){
|
||||
}
|
||||
}
|
||||
|
||||
void onRampFrictionChanged(float friction){
|
||||
void onRampFrictionChanged(float friction, void*){
|
||||
if(ramp){
|
||||
ramp->setFriction(friction);
|
||||
//b3Printf("Friction of ramp changed to %f \n",friction );
|
||||
}
|
||||
}
|
||||
|
||||
void onRampRestitutionChanged(float restitution){
|
||||
void onRampRestitutionChanged(float restitution, void*){
|
||||
if(ramp){
|
||||
ramp->setRestitution(restitution);
|
||||
//b3Printf("Restitution of ramp changed to %f \n",restitution);
|
||||
|
||||
@@ -71,11 +71,9 @@ struct MultiPendulumExample: public CommonRigidBodyBase {
|
||||
|
||||
static MultiPendulumExample* mex = NULL; // Handle to the example to access it via functions. Do not use this in your simulation!
|
||||
|
||||
void onMultiPendulaLengthChanged(float pendulaLength); // Change the pendula length
|
||||
void onMultiPendulaLengthChanged(float pendulaLength, void*); // Change the pendula length
|
||||
|
||||
void onMultiPendulaRestitutionChanged(float pendulaRestitution); // change the pendula restitution
|
||||
|
||||
void floorMSliderValue(float notUsed); // floor the slider values which should be integers
|
||||
void onMultiPendulaRestitutionChanged(float pendulaRestitution, void*); // change the pendula restitution
|
||||
|
||||
void applyMForceWithForceScalar(float forceScalar);
|
||||
|
||||
@@ -85,8 +83,7 @@ void MultiPendulumExample::initPhysics() { // Setup your physics scene
|
||||
SliderParams slider("Number of Pendula", &gPendulaQty);
|
||||
slider.m_minVal = 1;
|
||||
slider.m_maxVal = 50;
|
||||
slider.m_callback = floorMSliderValue; // hack to get integer values
|
||||
slider.m_clampToNotches = false;
|
||||
slider.m_clampToIntegers = true;
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
|
||||
slider);
|
||||
}
|
||||
@@ -95,8 +92,7 @@ void MultiPendulumExample::initPhysics() { // Setup your physics scene
|
||||
SliderParams slider("Number of Displaced Pendula", &gDisplacedPendula);
|
||||
slider.m_minVal = 0;
|
||||
slider.m_maxVal = 49;
|
||||
slider.m_callback = floorMSliderValue; // hack to get integer values
|
||||
slider.m_clampToNotches = false;
|
||||
slider.m_clampToIntegers = true;
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
|
||||
slider);
|
||||
}
|
||||
@@ -397,7 +393,7 @@ void MultiPendulumExample::applyPendulumForce(btScalar pendulumForce){
|
||||
|
||||
// GUI parameter modifiers
|
||||
|
||||
void onMultiPendulaLengthChanged(float pendulaLength) { // Change the pendula length
|
||||
void onMultiPendulaLengthChanged(float pendulaLength, void*) { // Change the pendula length
|
||||
if (mex){
|
||||
mex->changePendulaLength(pendulaLength);
|
||||
}
|
||||
@@ -405,18 +401,13 @@ void onMultiPendulaLengthChanged(float pendulaLength) { // Change the pendula le
|
||||
|
||||
}
|
||||
|
||||
void onMultiPendulaRestitutionChanged(float pendulaRestitution) { // change the pendula restitution
|
||||
void onMultiPendulaRestitutionChanged(float pendulaRestitution, void*) { // change the pendula restitution
|
||||
if (mex){
|
||||
mex->changePendulaRestitution(pendulaRestitution);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void floorMSliderValue(float notUsed) { // floor the slider values which should be integers
|
||||
gPendulaQty = floor(gPendulaQty);
|
||||
gDisplacedPendula = floor(gDisplacedPendula);
|
||||
}
|
||||
|
||||
void applyMForceWithForceScalar(float forceScalar) {
|
||||
if(mex){
|
||||
btScalar appliedForce = forceScalar * gDisplacementForce;
|
||||
|
||||
@@ -71,11 +71,9 @@ struct NewtonsCradleExample: public CommonRigidBodyBase {
|
||||
|
||||
static NewtonsCradleExample* nex = NULL;
|
||||
|
||||
void onPendulaLengthChanged(float pendulaLength); // Change the pendula length
|
||||
void onPendulaLengthChanged(float pendulaLength, void* userPtr); // Change the pendula length
|
||||
|
||||
void onPendulaRestitutionChanged(float pendulaRestitution); // change the pendula restitution
|
||||
|
||||
void floorSliderValue(float notUsed); // floor the slider values which should be integers
|
||||
void onPendulaRestitutionChanged(float pendulaRestitution, void* userPtr); // change the pendula restitution
|
||||
|
||||
void applyForceWithForceScalar(float forceScalar);
|
||||
|
||||
@@ -85,8 +83,7 @@ void NewtonsCradleExample::initPhysics() {
|
||||
SliderParams slider("Number of Pendula", &gPendulaQty);
|
||||
slider.m_minVal = 1;
|
||||
slider.m_maxVal = 50;
|
||||
slider.m_callback = floorSliderValue; // hack to get integer values
|
||||
slider.m_clampToNotches = false;
|
||||
slider.m_clampToIntegers = true;
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
|
||||
slider);
|
||||
}
|
||||
@@ -95,8 +92,7 @@ void NewtonsCradleExample::initPhysics() {
|
||||
SliderParams slider("Number of Displaced Pendula", &gDisplacedPendula);
|
||||
slider.m_minVal = 0;
|
||||
slider.m_maxVal = 49;
|
||||
slider.m_callback = floorSliderValue; // hack to get integer values
|
||||
slider.m_clampToNotches = false;
|
||||
slider.m_clampToIntegers = true;
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
|
||||
slider);
|
||||
}
|
||||
@@ -343,25 +339,19 @@ void NewtonsCradleExample::applyPendulumForce(btScalar pendulumForce){
|
||||
|
||||
// GUI parameter modifiers
|
||||
|
||||
void onPendulaLengthChanged(float pendulaLength) {
|
||||
void onPendulaLengthChanged(float pendulaLength, void*) {
|
||||
if (nex){
|
||||
nex->changePendulaLength(pendulaLength);
|
||||
//b3Printf("Pendula length changed to %f \n",sliderValue );
|
||||
}
|
||||
}
|
||||
|
||||
void onPendulaRestitutionChanged(float pendulaRestitution) {
|
||||
void onPendulaRestitutionChanged(float pendulaRestitution, void*) {
|
||||
if (nex){
|
||||
nex->changePendulaRestitution(pendulaRestitution);
|
||||
}
|
||||
}
|
||||
|
||||
void floorSliderValue(float notUsed) {
|
||||
gPendulaQty = floor(gPendulaQty);
|
||||
gDisplacedPendula = floor(gDisplacedPendula);
|
||||
|
||||
}
|
||||
|
||||
void applyForceWithForceScalar(float forceScalar) {
|
||||
if(nex){
|
||||
btScalar appliedForce = forceScalar * gDisplacementForce;
|
||||
|
||||
@@ -105,9 +105,7 @@ struct NewtonsRopeCradleExample : public CommonRigidBodyBase {
|
||||
|
||||
static NewtonsRopeCradleExample* nex = NULL;
|
||||
|
||||
void onRopePendulaRestitutionChanged(float pendulaRestitution);
|
||||
|
||||
void floorRSliderValue(float notUsed);
|
||||
void onRopePendulaRestitutionChanged(float pendulaRestitution, void*);
|
||||
|
||||
void applyRForceWithForceScalar(float forceScalar);
|
||||
|
||||
@@ -118,8 +116,7 @@ void NewtonsRopeCradleExample::initPhysics()
|
||||
SliderParams slider("Number of Pendula", &gPendulaQty);
|
||||
slider.m_minVal = 1;
|
||||
slider.m_maxVal = 50;
|
||||
slider.m_callback = floorRSliderValue; // hack to get integer values
|
||||
slider.m_clampToNotches = false;
|
||||
slider.m_clampToIntegers = true;
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
|
||||
slider);
|
||||
}
|
||||
@@ -128,8 +125,7 @@ void NewtonsRopeCradleExample::initPhysics()
|
||||
SliderParams slider("Number of Displaced Pendula", &gDisplacedPendula);
|
||||
slider.m_minVal = 0;
|
||||
slider.m_maxVal = 49;
|
||||
slider.m_callback = floorRSliderValue; // hack to get integer values
|
||||
slider.m_clampToNotches = false;
|
||||
slider.m_clampToIntegers = true;
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
|
||||
slider);
|
||||
}
|
||||
@@ -148,8 +144,7 @@ void NewtonsRopeCradleExample::initPhysics()
|
||||
SliderParams slider("Rope Resolution", &gRopeResolution);
|
||||
slider.m_minVal = 1;
|
||||
slider.m_maxVal = 20;
|
||||
slider.m_clampToNotches = false;
|
||||
slider.m_callback = floorRSliderValue;
|
||||
slider.m_clampToIntegers = true;
|
||||
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
|
||||
slider);
|
||||
}
|
||||
@@ -357,18 +352,12 @@ void NewtonsRopeCradleExample::applyPendulumForce(btScalar pendulumForce){
|
||||
|
||||
// GUI parameter modifiers
|
||||
|
||||
void onRopePendulaRestitutionChanged(float pendulaRestitution) {
|
||||
void onRopePendulaRestitutionChanged(float pendulaRestitution, void*) {
|
||||
if (nex){
|
||||
nex->changePendulaRestitution(pendulaRestitution);
|
||||
}
|
||||
}
|
||||
|
||||
void floorRSliderValue(float notUsed) {
|
||||
gPendulaQty = floor(gPendulaQty);
|
||||
gDisplacedPendula = floor(gDisplacedPendula);
|
||||
gRopeResolution = floor(gRopeResolution);
|
||||
}
|
||||
|
||||
void applyRForceWithForceScalar(float forceScalar) {
|
||||
if(nex){
|
||||
btScalar appliedForce = forceScalar * gDisplacementForce;
|
||||
|
||||
Reference in New Issue
Block a user