BasicShapesTest.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:eamaster 作者:
@Override
public void create () {
    super.create();

    final Texture texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
    disposables.add(texture);
    final Material material = new Material(TextureAttribute.createDiffuse(texture), ColorAttribute.createSpecular(1, 1, 1, 1),
        FloatAttribute.createShininess(8f));
    final long attributes = Usage.Position | Usage.Normal | Usage.TextureCoordinates;

    final Model sphere = modelBuilder.createSphere(4f, 4f, 4f, 24, 24, material, attributes);
    disposables.add(sphere);
    world.addConstructor("sphere", new BulletConstructor(sphere, 10f, new btSphereShape(2f)));

    final Model cylinder = modelBuilder.createCylinder(4f, 6f, 4f, 16, material, attributes);
    disposables.add(cylinder);
    world.addConstructor("cylinder", new BulletConstructor(cylinder, 10f, new btCylinderShape(tmpV1.set(2f, 3f, 2f))));

    final Model capsule = modelBuilder.createCapsule(2f, 6f, 16, material, attributes);
    disposables.add(capsule);
    world.addConstructor("capsule", new BulletConstructor(capsule, 10f, new btCapsuleShape(2f, 2f)));

    final Model box = modelBuilder.createBox(4f, 4f, 2f, material, attributes);
    disposables.add(box);
    world.addConstructor("box2", new BulletConstructor(box, 10f, new btBoxShape(tmpV1.set(2f, 2f, 1f))));

    final Model cone = modelBuilder.createCone(4f, 6f, 4f, 16, material, attributes);
    disposables.add(cone);
    world.addConstructor("cone", new BulletConstructor(cone, 10f, new btConeShape(2f, 6f)));

    // Create the entities
    world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(),
        0.25f + 0.5f * (float)Math.random(), 1f);
    world.add("sphere", 0, 5, 5);
    world.add("cylinder", 5, 5, 0);
    world.add("box2", 0, 5, 0);
    world.add("capsule", 5, 5, 5);
    world.add("cone", 10, 5, 0);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号