@Override public void update () { super.update(); // Not using dynamics, so update the collision world manually if (world.performanceCounter != null) world.performanceCounter.start(); world.collisionWorld.performDiscreteCollisionDetection(); if (world.performanceCounter != null) world.performanceCounter.stop(); }
@Override public void update () { super.update(); // Not using dynamics, so update the collision world manually if (USE_BULLET_FRUSTUM_CULLING) { if (world.performanceCounter != null) world.performanceCounter.start(); world.collisionWorld.performDiscreteCollisionDetection(); if (world.performanceCounter != null) world.performanceCounter.stop(); } }
public Dummy getKthNearestEnemy (int k) { perf.start(); originDummy = this; Dummy found = enemy.selectRanked(distComp, k); // print(this + " found enemy: " + found); perf.stop(); perf.tick(); if (verify) { verifyCorrectness(found, k); } return found; }
public static void getKthNearestEnemy (boolean silent, int k) { Dummy kthDummy = null; perf.reset(); allPerf.start(); for (Dummy d : player) { Dummy found = d.getKthNearestEnemy(k); } allPerf.stop(); allPerf.tick(); if (silent) return; print(String.format("found nearest. min: %.4f, max: %.4f, avg: %.4f, total: %.3f ms", perf.time.min * 1000, perf.time.max * 1000, perf.time.average * 1000, perf.time.total * 1000)); }
@Override public void update () { if (performanceCounter != null) { performanceCounter.tick(); performanceCounter.start(); } if (collisionWorld instanceof btDynamicsWorld) ((btDynamicsWorld)collisionWorld).stepSimulation(Gdx.graphics.getDeltaTime(), maxSubSteps, fixedTimeStep); if (performanceCounter != null) performanceCounter.stop(); }
@Override public void render () { Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); fpsCounter.put(Gdx.graphics.getFramesPerSecond()); performanceCounter.tick(); performanceCounter.start(); ((btDynamicsWorld)collisionWorld).stepSimulation(Gdx.graphics.getDeltaTime(), 5); performanceCounter.stop(); int c = motionStates.size; for (int i = 0; i < c; i++) { motionStates.get(i).getWorldTransform(instances.get(i).transform); } modelBatch.begin(camera); modelBatch.render(instances, lights); modelBatch.end(); performance.setLength(0); performance.append("FPS: ").append(fpsCounter.value).append(", Bullet: ") .append((int)(performanceCounter.load.value * 100f)).append("%"); }
@Override protected void renderWorld () { if (world.performanceCounter != null) world.performanceCounter.start(); if (USE_BULLET_FRUSTUM_CULLING) getEntitiesCollidingWithObject(world, frustumObject, visibleEntities, tempManifoldArr); else { visibleEntities.clear(); for (int i = 0; i < world.entities.size; i++) { final BulletEntity e = world.entities.get(i); if (e == frustumEntity) continue; e.modelInstance.transform.getTranslation(tmpV); if (frustumCam.frustum.sphereInFrustum(tmpV, 1)) visibleEntities.add(e); } } if (world.performanceCounter != null) world.performanceCounter.stop(); for (int i = 0; i < visibleEntities.size; i++) visibleEntities.get(i).setColor(Color.RED); modelBatch.begin(camera); if ((state & CULL_FRUSTUM) == CULL_FRUSTUM) { world.render(modelBatch, environment, visibleEntities); world.render(modelBatch, environment, frustumEntity); } else world.render(modelBatch, environment); modelBatch.end(); for (int i = 0; i < visibleEntities.size; i++) visibleEntities.get(i).setColor(Color.GRAY); }
@Override protected void renderWorld () { visibleEntities.clear(); if (world.performanceCounter != null) world.performanceCounter.start(); if (cullingPolicy == CullingPolicy.NONE) { visibleEntities.addAll(world.entities); } else if (cullingPolicy == CullingPolicy.SIMPLE) { for (BulletEntity entity : world.entities) if (entityInFrustum(entity)) visibleEntities.add(entity); } else if (cullingPolicy == CullingPolicy.OCCLUSION) { oclBuffer.clear(); occlusionCuller.performOcclusionCulling(broadphase, oclBuffer, frustumCam); } else if (cullingPolicy == CullingPolicy.KDOP) { occlusionCuller.performKDOPCulling(broadphase, frustumCam); } if (world.performanceCounter != null) world.performanceCounter.stop(); if (shadows) renderShadows(); modelBatch.begin(camera); world.render(modelBatch, environment, visibleEntities); if ((state & USE_FRUSTUM_CAM) != USE_FRUSTUM_CAM) modelBatch.render(frustumInstance); modelBatch.end(); }