本文整理汇总了C++中Physics::update方法的典型用法代码示例。如果您正苦于以下问题:C++ Physics::update方法的具体用法?C++ Physics::update怎么用?C++ Physics::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Physics
的用法示例。
在下文中一共展示了Physics::update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testParticleCreation
void FlockingParticlesApp::testParticleCreation() {
printf("running testParticleCreation\n");
timer->stop();
timer->start();
BasicSpace* space = new BasicSpace(Vec3f::zero(), Vec3f(getWindowWidth(), getWindowHeight(), 0));
Physics* physics = new Physics(space);
Emitter* emitter = new Emitter(physics);
physics->emitter = emitter;
emitter->setPosition(space->getCenter());
emitter->setInterval(0.0001);
emitter->setRate(50000);
emitter->setMax(50 * 1000);
int numIterations = 10;
for(int i=0; i<numIterations; i++) {
physics->update(0.016f);
//physics->createParticle();
}
timer->stop();
printf("%f s \n", timer->getSeconds());
}
示例2: main
int main()
{
Physics p;
Achievements a;
p.update();
a.update();
return 0;
}
示例3: update
void HelloParticlesApp::update() {
// update physics
timer->stop();
double dt = timer->getSeconds();
timer->start();
float mouseX = getMousePos().x;
float mouseY = getMousePos().y;
attractor->setPosition(Vec3f(mouseX, mouseY, 0));
physics->update(dt);
}
示例4: main
int main()
{
Physics app;
// DIYmain app;
if (app.startup() == false)
{
return -1;
}
while (app.update() == true)
{
app.draw();
}
app.shutdown();
return 0;
}
示例5: update
void FlockingParticlesApp::update() {
// update physics
timer->stop();
double dt = timer->getSeconds();
timer->start();
float mouseX = (float)getMousePos().x;
float mouseY = (float)getMousePos().y;
attractor->setPosition(Vec3f(mouseX, mouseY, 0));
physics->update(dt);
// copy particle positions into vbo
gl::VboMesh::VertexIter iter = vboParticles.mapVertexBuffer();
for(vector<Particle*>::iterator p = physics->particles.begin(); p != physics->particles.end(); p++) {
if(!(*p)->isAlive) continue;
iter.setPosition((*p)->position.x, (*p)->position.y, (*p)->position.z);
++iter;
}
}
示例6: main
int main(int argc, char* args[])
{
SDL_Init(SDL_INIT_EVERYTHING);
Renderer scene;
Interface input;
Physics logic;
Resource *init_obj;
init_obj = new Resource;
scene.objects = init_obj;
input.objects = init_obj;
logic.objects = init_obj;
while(init_obj->game_on){
scene.update();
input.update();
logic.update();
}
delete init_obj;
SDL_Quit();
return 0;
}