Example usage for com.badlogic.gdx.graphics.g3d.decals Decal setTextureRegion

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

Introduction

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

Prototype

public void setTextureRegion(TextureRegion textureRegion) 

Source Link

Document

Sets the texture region

Usage

From source file:com.github.fauu.helix.displayable.CharacterDisplayable.java

License:Open Source License

public CharacterDisplayable(IntVector3 logicalPosition, String animationSetName, TextureRegion shadowTexture) {
    super(logicalPosition.toVector3().add(DEFAULT_DISPLACEMENT));

    animations = new AnimationSet(animationSetName);

    AnimatedDecal decal = AnimatedDecal.newAnimatedDecal(DEFAULT_DIMENSIONS.x, DEFAULT_DIMENSIONS.y,
            animations.getDefault(), true);

    decal.setKeepSize(true);/*from ww  w.j ava 2 s  . c o m*/
    decal.setPosition(position);
    decal.rotateX(DEFAULT_ROTATION);

    setMainDecal(decal);

    Decal shadow = new Decal();

    shadow.setPosition(position);
    shadow.translate(DEFAULT_SHADOW_DISPLACEMENT);
    shadow.setDimensions(DEFAULT_SHADOW_DIMENSIONS.x, DEFAULT_SHADOW_DIMENSIONS.y);
    shadow.setColor(1, 1, 1, .35f);
    shadow.setTextureRegion(shadowTexture);
    shadow.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    setShadowDecal(shadow);
}