void ConcaveConvexcastDemo::displayCallback(void) {

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	renderme();
	convexcastBatch.draw ();
    glFlush();
    glutSwapBuffers();
}
void ConcaveConvexcastDemo::clientMoveAndDisplay()
{
	 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	float dt = getDeltaTimeMicroseconds() * 0.000001f;

	if (m_animatedMesh)
	{
		static float offset=0.f;
		offset+=0.01f;

		
		
		int i;
		int j;
		btVector3 aabbMin(1e30,1e30,1e30);
		btVector3 aabbMax(-1e30,-1e30,-1e30);

		for ( i=NUM_VERTS_X/2-3;i<NUM_VERTS_X/2+2;i++)
		{
			for (j=NUM_VERTS_X/2-3;j<NUM_VERTS_Y/2+2;j++)
			{
			
			aabbMax.setMax(gVertices[i+j*NUM_VERTS_X]);
			aabbMin.setMin(gVertices[i+j*NUM_VERTS_X]);
			
				gVertices[i+j*NUM_VERTS_X].setValue((i-NUM_VERTS_X*0.5f)*TRIANGLE_SIZE,
					//0.f,
					waveheight*sinf((float)i+offset)*cosf((float)j+offset),
					(j-NUM_VERTS_Y*0.5f)*TRIANGLE_SIZE);
					
			aabbMin.setMin(gVertices[i+j*NUM_VERTS_X]);
			aabbMax.setMax(gVertices[i+j*NUM_VERTS_X]);

			}
		}

		trimeshShape->partialRefitTree(aabbMin,aabbMax);


		//clear all contact points involving mesh proxy. Note: this is a slow/unoptimized operation.
		m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(staticBody->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());
	}

	m_dynamicsWorld->stepSimulation(dt);
	
	//optional but useful: debug drawing
	m_dynamicsWorld->debugDrawWorld();

	convexcastBatch.move (dt);
	convexcastBatch.cast (m_dynamicsWorld);
	renderme();
	convexcastBatch.draw ();
    glFlush();
    glutSwapBuffers();

}
void BasicDemo::clientMoveAndDisplay() {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  //cdn->update();
  _app->processEvents();

  renderme();
  glFlush();
  swapBuffers();
}
Example #4
0
void DefracDemo::displayCallback(void) {

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 


	renderme();

	glFlush();
	glutSwapBuffers();
}
Example #5
0
void BasicDemo::displayCallback(void) {

	
	renderme();

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

	swapBuffers();
}
Example #6
0
void PendulumApplication::displayCallback()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	renderme();

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

	swapBuffers();
}
void RagdollDemo::displayCallback() {
#ifdef GRAPHICS
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
	renderme();
	//optional but useful: debug drawing
	if (m_dynamicsWorld) {
	    m_dynamicsWorld->debugDrawWorld();
	}
	glFlush();
	glutSwapBuffers();
#endif
}
Example #8
0
void ColladaDemo::clientMoveAndDisplay()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	m_physicsEnvironmentPtr->proceedDeltaTime(0.f,deltaTime);

	renderme();

	glFlush();
	glutSwapBuffers();

}
void MotorDemo::displayCallback()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	if (m_dynamicsWorld)
		m_dynamicsWorld->debugDrawWorld();

	renderme();

	glFlush();
	glutSwapBuffers();
}
Example #10
0
void clientDisplay(void) {

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 


	physicsEnvironmentPtr->UpdateAabbs(deltaTime);

	renderme();


	glFlush();
	glutSwapBuffers();
}
void ArtificialBirdsDemoApp::displayCallback()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	renderme();

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

	glFlush();
	glutSwapBuffers();
}
Example #12
0
void ConvexDecompositionDemo::displayCallback(void) {

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 


	m_physicsEnvironmentPtr->UpdateAabbs(deltaTime);

	renderme();


	glFlush();
	glutSwapBuffers();
}
Example #13
0
void BasicDemo::displayCallback(void) {

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
	
	renderme();

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

	glFlush();
	swapBuffers();
}
Example #14
0
void ForkLiftDemo::displayCallback(void) 
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	renderme();

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

	glFlush();
	glutSwapBuffers();
}
void SimulationVisual::displayCallback()
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

  renderme();

  //optional but useful: debug drawing
  if (Simulation::m_dynamicsWorld)
    Simulation::m_dynamicsWorld->debugDrawWorld();

  glFlush();
  glutSwapBuffers();
}
Example #16
0
void SliderConstraintDemo::displayCallback(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    if(m_dynamicsWorld)
    {
        m_dynamicsWorld->debugDrawWorld();
    }
    drawSlider(spSlider1);
    drawSlider(spSlider2);
    renderme();
    glFlush();
    glutSwapBuffers();
} // SliderConstraintDemo::displayCallback()
Example #17
0
    void BulletOpenGLViewer::displayCallback()
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        if (m_dynamicsWorld)
        {
            m_dynamicsWorld->debugDrawWorld();
        }

        renderme();

        glFlush();
        swapBuffers();
    }
Example #18
0
void ConvexDecompositionDemo::displayCallback(void) {

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


	if (m_dynamicsWorld)
		m_dynamicsWorld->debugDrawWorld();

	renderme();


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

	float deltaTime = 1.f/60.f;

	physicsEnvironmentPtr->proceedDeltaTime(0.f,deltaTime);
	
	renderme();

    glFlush();
    glutSwapBuffers();

}
void ConstraintDemo::displayCallback(void) {

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	if (m_dynamicsWorld)
		m_dynamicsWorld->debugDrawWorld();

//	drawLimit();

	renderme();

    glFlush();
    swapBuffers();
}
/** Main simulation function for a simulation that has to be rendered.
*	fixed:	value determining if the stepsize is fixed to the default or set depending on the current framerate
*	hDC:	frame buffer to switch the rendering buffer into
**/
bool Physics::clientMoveAndDisplay(boolean fixed, HDC hDC){
	unsigned long tmplast=m_clock.getTimeMicroseconds();
	unsigned long ms = tmplast-last;

	last=tmplast;
	time+=ms;

	timeBehind+=ms;
	//printf("time %lu\n",timeBehind);

	if(fixed){
		//printf("%f %f\n",timeBehind, ms);
		//printf("%f\n",timeBehind);
		if(timeBehind>1000){
			static int update=20;
			//printf("-");
			simulationLoopStep(1 / 1000.f);
			timeBehind-=1000;
			if(update<15){
				update++;

				return false;
			}

			update=0;
			//printf(".");
		}else{
			return false;
		}
	}else{
		simulationLoopStep(ms / 1000000.f); //normal speed
		//simulationLoopStep(ms / 100000000.f); //slow-mode
		timeBehind=0;
	}
	frameRate=1000000./((double)time)+0.5;
	time=0;

	pointCamera();

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	m_dynamicsWorld->debugDrawWorld();

	renderme();

	glFlush();
	SwapBuffers( hDC );
	return true;
}
Example #22
0
void tgSimViewGraphics::displayCallback()
{
    if (isInitialzed())
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
        renderme();
        // optional but useful: debug drawing to detect problems
        if (m_dynamicsWorld)
        {
            m_dynamicsWorld->debugDrawWorld();
        }
        glFlush();
        swapBuffers();
    }
}
Example #23
0
void BenchmarkDemo::displayCallback(void) 
{

#ifdef USE_GRAPHICAL_BENCHMARK
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
	
	renderme();

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

	glFlush();
	swapBuffers();
#endif //USE_GRAPHICAL_BENCHMARK
}
void SerializeDemo::clientMoveAndDisplay()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	//simple dynamics world doesn't handle fixed-time-stepping
	float ms = getDeltaTimeMicroseconds();
	
	///step the simulation
	if (m_dynamicsWorld)
	{
		m_dynamicsWorld->stepSimulation(ms / 1000000.f);

		
#ifdef DESERIALIZE_SOFT_BODIES
		if (fSoftBodySolver)
            fSoftBodySolver->copyBackToSoftBodies();
#endif

		m_dynamicsWorld->debugDrawWorld();

#ifdef DESERIALIZE_SOFT_BODIES
		if (m_dynamicsWorld->getWorldType()==BT_SOFT_RIGID_DYNAMICS_WORLD)
		{
			//optional but useful: debug drawing
			btSoftRigidDynamicsWorld* softWorld = (btSoftRigidDynamicsWorld*)m_dynamicsWorld;

			for (  int i=0;i<softWorld->getSoftBodyArray().size();i++)
			{
				btSoftBody*	psb=(btSoftBody*)softWorld->getSoftBodyArray()[i];
				if (softWorld->getDebugDrawer() && !(softWorld->getDebugDrawer()->getDebugMode() & (btIDebugDraw::DBG_DrawWireframe)))
				{
					btSoftBodyHelpers::DrawFrame(psb,softWorld->getDebugDrawer());
					btSoftBodyHelpers::Draw(psb,softWorld->getDebugDrawer(),softWorld->getDrawFlags());
				}
			}
		}
#endif //DESERIALIZE_SOFT_BODIES

	}
		
	renderme(); 

	glFlush();

	swapBuffers();

}
Example #25
0
void PendulumApplication::clientMoveAndDisplay()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //simple dynamics world doesn't handle fixed-time-stepping
    float dt = getDeltaTimeMicroseconds()/1000000.f;
    ///step the simulation
    if (m_dynamicsWorld)
    {
        m_dynamicsWorld->stepSimulation(dt);
        //optional but useful: debug drawing
        m_dynamicsWorld->debugDrawWorld();
    }

    renderme();
    swapBuffers();
}
Example #26
0
void ColladaDemo::clientMoveAndDisplay()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	float dt = getDeltaTimeMicroseconds() * 0.000001f;

	m_dynamicsWorld->stepSimulation(dt);

	//optional but useful: debug drawing
	m_dynamicsWorld->debugDrawWorld();

	renderme();

	glFlush();
	glutSwapBuffers();

}
Example #27
0
void ParticlesDemo::displayCallback(void) {

	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	renderme();

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

	//if (m_dialogDynamicsWorld)
	//	m_dialogDynamicsWorld->draw(gTimeStep);

	glFlush();
	glutSwapBuffers();
}
Example #28
0
void tgSimViewGraphics::clientMoveAndDisplay()
{
    if (isInitialzed()){
        m_pSimulation->step(m_stepSize);    
        m_renderTime += m_stepSize; 
        if (m_renderTime >= m_renderRate)
        {
            render();
            // Doesn't appear to do anything yet...
            m_dynamicsWorld->debugDrawWorld();
            renderme();     
            // Camera is updated in renderme
            glFlush();
            swapBuffers();      
            m_renderTime = 0;
        }
    }
}
Example #29
0
void BasicDemo::clientMoveAndDisplay()
{
//	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 

	//simple dynamics world doesn't handle fixed-time-stepping
	float dt = getDeltaTimeInSeconds();
	
	///step the simulation
	if (m_dynamicsWorld)
	{
		m_dynamicsWorld->stepSimulation(dt);
	}
		
	renderme(); 


	swapBuffers();

}
void BasicDemo::clientMoveAndDisplay()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
	
	// OpenGL calls	
	m_dynamicsWorld->debugDrawWorld();
	renderme(); 
	glFlush();
	glutSwapBuffers();
	
	float fTimeStep = 1.0/100;
	btTransform startTransform;
	startTransform.setIdentity();
	for (int i = 0; i < 2; i++)
	{
		

		//Cross Product forward vector with up vector
		m_vAngularVelocity[i] = btVector3(0,1,0).cross(m_vVelocity[i]);
		if(m_vAngularVelocity[i].length() != 0)
		{
			m_vAngularVelocity[i].normalize();
		
			
			float scale = m_vVelocity[i].length() / fRadius;
			m_vAngularVelocity[i] *= scale;

			m_qOrientation[i] = m_qOrientation[i] + ((btQuaternion(m_vAngularVelocity[i].getX(), m_vAngularVelocity[i].getY(), m_vAngularVelocity[i].getZ(), 0)* m_qOrientation[i])*(fTimeStep/2));
		}

		//m_qOrientation[i] = m_qOrientation[i] + (btQuaternion(m_vAngularVelocity[i].getX(),m_vAngularVelocity[i].getY(),m_vAngularVelocity[i].getZ(), 0) * m_qOrientation[i])*(fTimeStep/2);

		// Position Update
		m_vPosition[i] += m_vVelocity[i] * fTimeStep;
		
		startTransform.setOrigin(m_vPosition[i]);
		startTransform.setRotation(m_qOrientation[i]);
		m_rigidBody[i]->getMotionState()->setWorldTransform(startTransform);
	}
	


}