Example usage for com.badlogic.gdx.graphics.g3d.decals DecalBatch DecalBatch

List of usage examples for com.badlogic.gdx.graphics.g3d.decals DecalBatch DecalBatch

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d.decals DecalBatch DecalBatch.

Prototype

DecalBatch

Source Link

Usage

From source file:com.badlogic.gdx.tests.DecalTransform.java

License:Apache License

@Override
public void create() {
    image = new Texture(Gdx.files.internal("data/badges/128/badge0.png"));
    image.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
    image.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);

    float w = 100;// Gdx.graphics.getWidth()/2;
    float h = 80;// Gdx.graphics.getHeight()/2;

    for (int i = 0; i < DECAL_COUNT; i++) {
        sprites[i] = Decal.newDecal(20, 20, new TextureRegion(image), false);
        sprites[i].setX(20 * i);//from   w  ww  .  ja v a2s .  c  om
    }

    batch = new DecalBatch();
    Gdx.gl.glClearColor(1, 1, 0, 1);

    float move = 100f;
    float scale = 1;
    float rotate = 50;
    keyActions.put(Input.Keys.W, new TransY(move));
    keyActions.put(Input.Keys.S, new TransY(-move));
    keyActions.put(Input.Keys.A, new TransX(-move));
    keyActions.put(Input.Keys.D, new TransX(move));
    keyActions.put(Input.Keys.Q, new Scale(scale));
    keyActions.put(Input.Keys.E, new Scale(-scale));
    keyActions.put(Input.Keys.J, new RotateZ(rotate));
    keyActions.put(Input.Keys.U, new RotateY(rotate));
    keyActions.put(Input.Keys.K, new RotateX(rotate));
    keyActions.put(Input.Keys.Z, new TransZ(-move));
    keyActions.put(Input.Keys.X, new TransZ(move));
    Gdx.input.setInputProcessor(this);
    Gdx.gl.glDisable(GL10.GL_CULL_FACE);
}