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

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

Introduction

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

Prototype

public FloatAttribute(long type, float value) 

Source Link

Usage

From source file:com.github.fauu.helix.manager.AreaManager.java

License:Open Source License

public void loadFromFile(FileHandle file, String name) {
    Json json = new Json();
    json.setIgnoreUnknownFields(true);/*from  w  w w. ja  v a 2 s .c o m*/

    AreaWrapper areaWrapper = json.fromJson(AreaWrapper.class, file);

    Tile[][] tiles = new Tile[areaWrapper.length][areaWrapper.width];
    int i = 0;
    for (TileWrapper wrapper : areaWrapper.tiles) {
        Tile tile = new Tile();

        tile.setPermissions(wrapper.permissions);

        if (wrapper.passage != null) {
            TileAreaPassage areaPassage = new TileAreaPassage();

            areaPassage.setTargetAreaName(wrapper.passage.area);
            areaPassage.setTargetCoords(new IntVector2(wrapper.passage.position.x, wrapper.passage.position.y));

            tile.setAreaPassage(areaPassage);
        }

        tiles[i / areaWrapper.width][i % areaWrapper.width] = tile;

        i++;
    }

    String modelPath = "model/" + name + ".g3db";

    assetManager.load(modelPath, Model.class);
    assetManager.finishLoading();

    Model model = assetManager.get(modelPath, Model.class);
    for (Material m : model.materials) {
        m.set(new FloatAttribute(FloatAttribute.AlphaTest, 0.1f));
    }

    Entity area = world.createEntity().edit().add(new AreaTypeComponent(areaWrapper.type))
            .add(new TilesComponent(tiles))
            .add(new DimensionsComponent(new IntVector2(areaWrapper.width, areaWrapper.length)))
            .add(new NameComponent(name)).add(new DisplayableComponent(new AreaDisplayable(model)))
            .add(new VisibilityComponent()).getEntity();
    world.getManager(TagManager.class).register("area", area);

    this.area = area;
}

From source file:com.mbrlabs.mundus.commons.assets.MaterialAsset.java

License:Apache License

/**
 * Applies this material asset to the libGDX material.
 *
 * @param material/*www .jav a  2 s.c om*/
 * @return
 */
public Material applyToMaterial(Material material) {
    if (diffuseColor != null) {
        material.set(new ColorAttribute(ColorAttribute.Diffuse, diffuseColor));
    }
    if (diffuseTexture != null) {
        material.set(new TextureAttribute(TextureAttribute.Diffuse, diffuseTexture.getTexture()));
    } else {
        material.remove(TextureAttribute.Diffuse);
    }
    material.set(new FloatAttribute(FloatAttribute.Shininess, shininess));

    return material;
}

From source file:com.uos.mortaldestiny.rendering.FrontShader.java

License:Apache License

public FrontShader(final Renderable renderable, final Config config, final ShaderProgram shaderProgram) {
    super(renderable, config, shaderProgram);
    final Attributes attributes = combineAttributes(renderable);
    this.numBones = renderable.bones == null ? 0 : config.numBones;
    int w = 0;/*from www. jav a  2s. com*/
    final int n = renderable.meshPart.mesh.getVertexAttributes().size();
    for (int i = 0; i < n; i++) {
        final VertexAttribute attr = renderable.meshPart.mesh.getVertexAttributes().get(i);
        if (attr.usage == Usage.BoneWeight)
            w |= (1 << attr.unit);
    }
    weights = w;
    alphaTestAttribute = new FloatAttribute(FloatAttribute.AlphaTest, config.defaultAlphaTest);
}

From source file:com.zombie.game.actors.SteeringActor.java

License:Apache License

public void setModelInstance(ModelInstance modelInstance) {
    this.modelInstance = modelInstance;
    this.transform = modelInstance.transform.val;
    for (Material m : modelInstance.materials) {
        m.set(new IntAttribute(IntAttribute.CullFace, GL20.GL_NONE));
        m.set(new FloatAttribute(FloatAttribute.AlphaTest, 0.5f));
        m.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
    }/* w w w. j  av  a2  s. co  m*/
    //Get animations if any
    if (modelInstance.animations.size > 0) {
        animationController = new AnimationController(modelInstance);
        animationController.allowSameAnimation = true;
        animationController.animate(modelInstance.animations.get(0).id, -1, 1f, this, 1f);
    }
}