Example usage for com.badlogic.gdx.graphics.g3d.attributes ColorAttribute ColorAttribute

List of usage examples for com.badlogic.gdx.graphics.g3d.attributes ColorAttribute ColorAttribute

Introduction

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

Prototype

public ColorAttribute(final ColorAttribute copyFrom) 

Source Link

Usage

From source file:com.github.fauu.helix.core.MapRegion.java

License:Open Source License

public void setObjectColor(Object object, Color color) {
    object.getModelInstance().materials.first().set(new ColorAttribute(ColorAttribute.createDiffuse(color)));
}

From source file:com.github.fauu.helix.core.Object.java

License:Open Source License

public Object(Vector2 position, String modelName, Model model, int elevation, Direction facing) {
    this.position = position;
    this.elevation = elevation;
    this.modelInstance = new ModelInstance(model);
    this.modelName = modelName;
    this.facing = facing;

    modelInstance.transform.setToTranslation(position.x, elevation, position.y + 1).rotate(new Vector3(0, 1, 0),
            -90);/*w  w w. ja va 2s  . co m*/

    final TextureAttribute textureAttribute = (TextureAttribute) modelInstance.materials.first()
            .get(TextureAttribute.Diffuse);
    textureAttribute.textureDescription.magFilter = Texture.TextureFilter.Nearest;
    textureAttribute.textureDescription.minFilter = Texture.TextureFilter.Nearest;
    modelInstance.materials.first().set(textureAttribute);

    modelInstance.materials.first().set(new ColorAttribute(ColorAttribute.createDiffuse(Color.WHITE)));
    modelInstance.materials.first().set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
    //modelInstance.materials.first().set(new FloatAttribute(FloatAttribute.AlphaTest, 0.14f));
}

From source file:com.github.fauu.helix.editor.displayable.TileHighlightDisplayable.java

License:Open Source License

public TileHighlightDisplayable() {
    ModelBuilder modelBuilder = new ModelBuilder();

    Model model = modelBuilder.createRect(0, 0, Z_OFFSET, 1, 0, Z_OFFSET, 1, 1, Z_OFFSET, 0, 1, Z_OFFSET, 0, 0,
            1, GL20.GL_TRIANGLES,//w  w  w. j ava2s. c  om
            new Material(new ColorAttribute(ColorAttribute.createDiffuse(color)),
                    new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)),
            VertexAttributes.Usage.Position | VertexAttributes.Usage.TextureCoordinates);

    instance = new ModelInstance(model);
}