example browser: slider widget improvements

This commit is contained in:
Lunkhound
2016-11-20 16:38:11 -08:00
parent 936a104fb2
commit 49b27f30bd
10 changed files with 86 additions and 91 deletions

View File

@@ -552,10 +552,6 @@ struct WalkerFilterCallback : public btOverlapFilterCallback
}
};
void floorNNSliderValue(float notUsed) {
gParallelEvaluations = floor(gParallelEvaluations);
}
void NN3DWalkersExample::initPhysics()
{
@@ -657,8 +653,7 @@ void NN3DWalkersExample::initPhysics()
SliderParams slider("Parallel evaluations", &gParallelEvaluations);
slider.m_minVal = 1;
slider.m_maxVal = NUM_WALKERS;
slider.m_clampToNotches = false;
slider.m_callback = floorNNSliderValue; // hack to get integer values
slider.m_clampToIntegers = true;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
slider);
}

View File

@@ -138,19 +138,15 @@ static btScalar gCFMSingularityAvoidance = 0;
//GUI related parameter changing helpers
inline void floorSliderValues(float notUsed) { // floor values that should be ints
gSolverIterations = floor(gSolverIterations);
}
inline void twxChangePhysicsStepsPerSecond(float physicsStepsPerSecond) { // function to change simulation physics steps per second
inline void twxChangePhysicsStepsPerSecond(float physicsStepsPerSecond, void*) { // function to change simulation physics steps per second
gPhysicsStepsPerSecond = physicsStepsPerSecond;
}
inline void twxChangeFPS(float framesPerSecond) {
inline void twxChangeFPS(float framesPerSecond, void*) {
gFramesPerSecond = framesPerSecond;
}
inline void twxChangeERPCFM(float notUsed) { // function to change ERP/CFM appropriately
inline void twxChangeERPCFM(float notUsed, void*) { // function to change ERP/CFM appropriately
gChangeErpCfm = true;
}
@@ -166,13 +162,12 @@ inline void changeSolver(int comboboxId, const char* item, void* userPointer) {
}
inline void twxChangeSolverIterations(float notUsed){ // change the solver iterations
inline void twxChangeSolverIterations(float notUsed, void* userPtr) { // change the solver iterations
floorSliderValues(0); // floor the values set by slider
}
inline void clampToCustomSpeedNotches(float speed) { // function to clamp to custom speed notches
inline void clampToCustomSpeedNotches(float speed, void*) { // function to clamp to custom speed notches
double minSpeed = 0;
double minSpeedDist = SimulationSpeeds::MAX_SPEED;
for (int i = 0; i < SimulationSpeeds::NUM_SPEEDS; i++) {
@@ -200,7 +195,7 @@ inline void switchMaximumSpeed(int buttonId, bool buttonState, void* userPointer
// b3Printf("Run maximum speed %s", gMaximumSpeed?"on":"off");
}
inline void setApplicationTick(float frequency){ // set internal application tick
inline void setApplicationTick(float frequency, void*){ // set internal application tick
gApplicationTick = 1000.0f/frequency;
}
@@ -383,7 +378,7 @@ struct NN3DWalkersTimeWarpBase: public CommonRigidBodyBase {
slider.m_minVal = 0;
slider.m_maxVal = 1000;
slider.m_callback = twxChangePhysicsStepsPerSecond;
slider.m_clampToNotches = false;
slider.m_clampToIntegers = true;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(
slider);
}