Example usage for com.badlogic.gdx.graphics.g3d.attributes IntAttribute CullFace

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

Introduction

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

Prototype

long CullFace

To view the source code for com.badlogic.gdx.graphics.g3d.attributes IntAttribute CullFace.

Click Source Link

Usage

From source file:com.mygdx.game.utilities.ModelFactory.java

License:Apache License

public static void createOutlineModel(Model model, Color outlineColor, float fattenAmount) {
    fatten(model, fattenAmount);// w  w w . j ava  2 s  .co  m
    for (Material m : model.materials) {
        m.clear();
        m.set(new IntAttribute(IntAttribute.CullFace, Gdx.gl.GL_FRONT));
        m.set(ColorAttribute.createDiffuse(outlineColor));
    }
}

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 a 2  s  . c  o 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);
    }
}

From source file:gaia.cu9.ari.gaiaorbit.util.override.AtmosphereShader.java

License:Apache License

protected void bindMaterial(final Renderable renderable) {
    if (currentMaterial == renderable.material)
        return;/*from  w w  w. j  a  va 2  s .  c  o m*/

    int cullFace = config.defaultCullFace == -1 ? defaultCullFace : config.defaultCullFace;
    int depthFunc = config.defaultDepthFunc == -1 ? defaultDepthFunc : config.defaultDepthFunc;
    float depthRangeNear = 0f;
    float depthRangeFar = 1f;
    boolean depthMask = true;

    currentMaterial = renderable.material;
    for (final Attribute attr : currentMaterial) {
        final long t = attr.type;
        if (BlendingAttribute.is(t)) {
            context.setBlending(true, ((BlendingAttribute) attr).sourceFunction,
                    ((BlendingAttribute) attr).destFunction);
        } else if ((t & IntAttribute.CullFace) == IntAttribute.CullFace)
            cullFace = ((IntAttribute) attr).value;
        else if ((t & DepthTestAttribute.Type) == DepthTestAttribute.Type) {
            DepthTestAttribute dta = (DepthTestAttribute) attr;
            depthFunc = dta.depthFunc;
            depthRangeNear = dta.depthRangeNear;
            depthRangeFar = dta.depthRangeFar;
            depthMask = dta.depthMask;
        } else if (!config.ignoreUnimplemented)
            throw new GdxRuntimeException("Unknown material attribute: " + attr.toString());
    }

    context.setCullFace(cullFace);
    context.setDepthTest(depthFunc, depthRangeNear, depthRangeFar);
    context.setDepthMask(depthMask);
}