Java 类com.badlogic.gdx.physics.bullet.DebugDrawer 实例源码

项目:eamaster    文件:WheelWorld.java   
private void createWorld(boolean visualized) {
        collisionConfiguration = new btDefaultCollisionConfiguration();
        dispatcher = new btCollisionDispatcher(collisionConfiguration);
        broadPhase = new btDbvtBroadphase();
        constraintSolver = new btSequentialImpulseConstraintSolver();
        bulletWorld = new btDiscreteDynamicsWorld(dispatcher, broadPhase, constraintSolver, collisionConfiguration);

        if (visualized) {
            debugDrawer = new DebugDrawer();
            bulletWorld.setDebugDrawer(debugDrawer);
            rayCallback = new ClosestRayResultCallback(new Vector3(), new Vector3());
        }

//        btGImpactCollisionAlgorithm.registerAlgorithm(dispatcher); // TODO: Collision between GImpact not needed?

        bulletWorld.setGravity(new Vector3(0, 0f, 0));


    }
项目:eamaster    文件:World.java   
public World(String name) {
        collisionConfiguration = new btDefaultCollisionConfiguration();
        dispatcher = new btCollisionDispatcher(collisionConfiguration);
        broadPhase = new btDbvtBroadphase();
        constraintSolver = new btSequentialImpulseConstraintSolver();
        bulletWorld = new btDiscreteDynamicsWorld(dispatcher, broadPhase, constraintSolver, collisionConfiguration);

        debugDrawer = new DebugDrawer();


        btGImpactCollisionAlgorithm.registerAlgorithm(dispatcher);

        bulletWorld.setDebugDrawer(debugDrawer);
        bulletWorld.setGravity(new Vector3(0, -10f, 0));

        worldCounter = CounterUtil.getCounter("worldTick" + name);
        this.name = name;

        rayCallback = new ClosestRayResultCallback(new Vector3(), new Vector3());

        logger.info("Iterations: {}", bulletWorld.getSolverInfo().getNumIterations());
        logger.info("Erp: {}", bulletWorld.getSolverInfo().getErp());
//
//        bulletWorld.getSolverInfo().setNumIterations(20);
//        bulletWorld.getSolverInfo().setErp(0.01f);
    }
项目:Alien-Ark    文件:ControllerPhysic.java   
public ControllerPhysic(float gravity, PhysicsListener listener) {
    this.listener = listener;
    collisionConfig = new btDefaultCollisionConfiguration();
    dispatcher = new btCollisionDispatcher(collisionConfig);
    broadphase = new btDbvtBroadphase();
    constraintSolver = new btSequentialImpulseConstraintSolver();
    dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, constraintSolver, collisionConfig);
    dynamicsWorld.setGravity(new Vector3(0, 0, gravity * 2.5f));

    if (Config.DEBUG_RENDERER) {
        debugDrawer = new DebugDrawer();
        debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_MAX_DEBUG_DRAW_MODE);
        dynamicsWorld.setDebugDrawer(debugDrawer);
    }

    tickCallback = new TickCallback(dynamicsWorld, listener);

}
项目:GdxDemo3D    文件:GameEngine.java   
public GameEngine() {
    collisionConfig = new btDefaultCollisionConfiguration();
    dispatcher = new btCollisionDispatcher(collisionConfig);
    broadphase = new btDbvtBroadphase();
    constraintSolver = new btSequentialImpulseConstraintSolver();
    dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase,
            constraintSolver, collisionConfig);
    dynamicsWorld.setGravity(GameSettings.GRAVITY);

    debugDrawer = new DebugDrawer();
    dynamicsWorld.setDebugDrawer(debugDrawer);
    debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_DrawWireframe);
    contactListener = new CollisionContactListener();
}
项目:ForgE    文件:PhysicsSystem.java   
private void createWorld() {
  debugDrawer      = new DebugDrawer();
  collisionConfig  = new btDefaultCollisionConfiguration();
  dispatcher       = new btCollisionDispatcher(collisionConfig);
  constraintSolver = new btSequentialImpulseConstraintSolver();
  sweep            = new btAxisSweep3(new Vector3(-1000, -1000, -1000), new Vector3(1000, 1000, 1000));
  ghostCallback    = new btGhostPairCallback();
  sweep.getOverlappingPairCache().setInternalGhostPairCallback(ghostCallback);
  bulletWorld      = new btDiscreteDynamicsWorld(dispatcher, sweep, constraintSolver, collisionConfig);

  bulletWorld.setGravity(new Vector3(0, -9f, 0));
  debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_MAX_DEBUG_DRAW_MODE);
}
项目:gdx-proto    文件:Physics.java   
public Physics() {
    Bullet.init();
    shapes = new Array<>();
    objects = new Array<>();
    disposables = new Array<>();
    if (Main.isClient()) {
        debugDrawer = new DebugDrawer();
        debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_MAX_DEBUG_DRAW_MODE);
    }
    inst = this;
    collisionConfig = new btDefaultCollisionConfiguration();
    dispatcher = new btCollisionDispatcher(collisionConfig);
    broadphaseInterface = new btDbvtBroadphase();
    // TODO is it worth comparing performance with other broadphase types?
    //broadphaseInterface = new btSimpleBroadphase();
    //broadphaseInterface = new btAxisSweep3(tmp.set(0f, -10, 0f), tmp2.set(GameWorld.WORLD_WIDTH, 200f, GameWorld.WORLD_DEPTH));
    world = new btCollisionWorld(dispatcher, broadphaseInterface, collisionConfig);
    if (Main.isClient()) {
        world.setDebugDrawer(debugDrawer);
    }
    contactListener = new MyContactListener();

    disposables.add(world);
    if (debugDrawer != null) {
        disposables.add(debugDrawer);
    }
    disposables.add(collisionConfig);
    disposables.add(dispatcher);
    disposables.add(broadphaseInterface);
    disposables.add(contactListener);
}
项目:nhglib    文件:PhysicsSystem.java   
public void setDebugDrawer(DebugDrawer debugDrawer) {
    dynamicsWorld.setDebugDrawer(debugDrawer);
}
项目:nhglib    文件:DebugRenderingSystem.java   
public DebugDrawer getDebugDrawer() {
    return debugDrawer;
}
项目:Argent    文件:DebugRenderer.java   
public DebugRenderer(btCollisionWorld world) {
    this.world = world;
    this.drawer = new DebugDrawer();
    this.drawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_DrawNormals);
    this.world.setDebugDrawer(this.drawer);
}
项目:eamaster    文件:BulletWorld.java   
public void setDebugMode (final int mode) {
    if (mode == btIDebugDraw.DebugDrawModes.DBG_NoDebug && debugDrawer == null) return;
    if (debugDrawer == null) collisionWorld.setDebugDrawer(debugDrawer = new DebugDrawer());
    debugDrawer.setDebugMode(mode);
}
项目:libgdxcn    文件:BulletWorld.java   
public void setDebugMode (final int mode) {
    if (mode == btIDebugDraw.DebugDrawModes.DBG_NoDebug && debugDrawer == null) return;
    if (debugDrawer == null) collisionWorld.setDebugDrawer(debugDrawer = new DebugDrawer());
    debugDrawer.setDebugMode(mode);
}
项目:gdx-ai    文件:BulletWorld.java   
public void setDebugMode (final int mode) {
    if (mode == btIDebugDraw.DebugDrawModes.DBG_NoDebug && debugDrawer == null) return;
    if (debugDrawer == null) collisionWorld.setDebugDrawer(debugDrawer = new DebugDrawer());
    debugDrawer.setDebugMode(mode);
}