Example #1
0
void BenchmarkDemo::clientMoveAndDisplay()
{
#ifdef USE_GRAPHICAL_BENCHMARK
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
#endif //USE_GRAPHICAL_BENCHMARK

	//simple dynamics world doesn't handle fixed-time-stepping
	//float ms = getDeltaTimeMicroseconds();
	
	///step the simulation
	if (m_dynamicsWorld)
	{
		m_dynamicsWorld->stepSimulation(btScalar(1./60.));
		//optional but useful: debug drawing
		m_dynamicsWorld->debugDrawWorld();
	}
		
	if (m_benchmark==7)
	{
		castRays();

		raycastBar.draw();
	
	}

	renderme(); 

#ifdef USE_GRAPHICAL_BENCHMARK
	glFlush();

	swapBuffers();
#endif //USE_GRAPHICAL_BENCHMARK

}
Example #2
0
void duCharacter::updateAction(btCollisionWorld* collisionWorld, btScalar deltaTimeStep)
{
    castRays(collisionWorld);
    if (m_moveType == CM_WALKING || m_moveType == CM_RUNNING) {
        handleVerticalVeloctity(deltaTimeStep);
    }
    move(deltaTimeStep);
}
Example #3
0
void physics_simulate()
{
	PfxPerfCounter pc;

	for(int i=1;i<numRigidBodies;i++) {
		pfxApplyExternalForce(states[i],bodies[i],bodies[i].getMass()*PfxVector3(0.0f,-9.8f,0.0f),PfxVector3(0.0f),timeStep);
	}
	
	perf_push_marker("broadphase");
	pc.countBegin("broadphase");
	broadphase();
	pc.countEnd();
	perf_pop_marker();
	
	perf_push_marker("collision");
	pc.countBegin("collision");
	collision();
	pc.countEnd();
	perf_pop_marker();
	
	perf_push_marker("solver");
	pc.countBegin("solver");
	constraintSolver();
	pc.countEnd();
	perf_pop_marker();
	
	perf_push_marker("sleepCheck");
	pc.countBegin("sleepCheck");
	sleepOrWakeup();
	pc.countEnd();
	perf_pop_marker();
	
	perf_push_marker("integrate");
	pc.countBegin("integrate");
	integrate();
	pc.countEnd();
	perf_pop_marker();

	perf_push_marker("castRays");
	pc.countBegin("castRays");
	castRays();
	pc.countEnd();
	perf_pop_marker();
	
	frame++;
	
	if(frame%100 == 0) {
		float broadphaseTime  = pc.getCountTime(0);
		float collisionTime   = pc.getCountTime(2);
		float solverTime      = pc.getCountTime(4);
		float sleepTime		  = pc.getCountTime(6);
		float integrateTime   = pc.getCountTime(8);
		float raycastTime     = pc.getCountTime(10);
		SCE_PFX_PRINTF("frame %3d broadphase %.2f collision %.2f solver %.2f sleepCheck %.2f integrate %.2f raycast %.2f | total %.2f\n",frame,
			broadphaseTime,collisionTime,solverTime,sleepTime,integrateTime,raycastTime,
			broadphaseTime+collisionTime+solverTime+sleepTime+integrateTime+raycastTime);
	}
}
Example #4
0
void RaytestDemo::displayCallback(void) {

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
	
	castRays();

	renderme();

	//optional but useful: debug drawing to detect problems
	if (m_dynamicsWorld)
		m_dynamicsWorld->debugDrawWorld();

	glFlush();
	swapBuffers();
}
Example #5
0
void RaytestDemo::clientMoveAndDisplay()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	castRays();
	
	if (m_dynamicsWorld)
	{
		float ms = getDeltaTimeMicroseconds();
		m_dynamicsWorld->stepSimulation(ms / 1000000.f);

		m_dynamicsWorld->debugDrawWorld();
	}


		
	renderme(); 

	glFlush();

	swapBuffers();

}
Example #6
0
 void RaytestDemo::stepSimulation(float deltaTime)
{
	castRays();
	CommonRigidBodyBase::stepSimulation(deltaTime);
}