MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / clientMoveAndDisplay

Method clientMoveAndDisplay

examples/SoftDemo/SoftDemo.cpp:1587–1682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1585
1586#if 0
1587void SoftDemo::clientMoveAndDisplay()
1588{
1589 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
1590
1591
1592
1593
1594 float ms = getDeltaTimeMicroseconds();
1595 float dt = ms / 1000000.f;//1.0/60.;
1596
1597
1598
1599 if (m_dynamicsWorld)
1600 {
1601
1602 if (sDemoMode)
1603 {
1604 static float demoCounter = DEMO_MODE_TIMEOUT;
1605 demoCounter-= dt;
1606 if (demoCounter<0)
1607 {
1608
1609 demoCounter=DEMO_MODE_TIMEOUT;
1610 current_demo++;
1611 current_demo=current_demo%(sizeof(demofncs)/sizeof(demofncs[0]));
1612 clientResetScene();
1613 }
1614 }
1615
1616
1617//#define FIXED_STEP
1618#ifdef FIXED_STEP
1619 m_dynamicsWorld->stepSimulation(dt=1.0f/60.f,0);
1620
1621#else
1622 //during idle mode, just run 1 simulation step maximum, otherwise 4 at max
1623 // int maxSimSubSteps = m_idle ? 1 : 4;
1624 //if (m_idle)
1625 // dt = 1.0/420.f;
1626
1627 int numSimSteps;
1628 numSimSteps = m_dynamicsWorld->stepSimulation(dt);
1629 //numSimSteps = m_dynamicsWorld->stepSimulation(dt,10,1./240.f);
1630
1631#ifdef VERBOSE_TIMESTEPPING_CONSOLEOUTPUT
1632 if (!numSimSteps)
1633 printf("Interpolated transforms\n");
1634 else
1635 {
1636 if (numSimSteps > maxSimSubSteps)
1637 {
1638 //detect dropping frames
1639 printf("Dropped (%i) simulation steps out of %i\n",numSimSteps - maxSimSubSteps,numSimSteps);
1640 } else
1641 {
1642 printf("Simulated (%i) steps\n",numSimSteps);
1643 }
1644 }

Callers

nothing calls this directly

Calls 3

GarbageCollectMethod · 0.80
stepSimulationMethod · 0.45
copyBackToSoftBodiesMethod · 0.45

Tested by

no test coverage detected