List of usage examples for com.badlogic.gdx.graphics.g3d.attributes FloatAttribute AlphaTest
long AlphaTest
To view the source code for com.badlogic.gdx.graphics.g3d.attributes FloatAttribute AlphaTest.
Click Source Link
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 ww . j a v a 2 s . co 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.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;/* w ww.j a va2s .c o m*/ 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.uos.mortaldestiny.rendering.FrontShader.java
License:Apache License
@Override public void render(Renderable renderable, Attributes combinedAttributes) { if (combinedAttributes.has(BlendingAttribute.Type)) { final BlendingAttribute blending = (BlendingAttribute) combinedAttributes.get(BlendingAttribute.Type); combinedAttributes.remove(BlendingAttribute.Type); final boolean hasAlphaTest = combinedAttributes.has(FloatAttribute.AlphaTest); if (!hasAlphaTest) combinedAttributes.set(alphaTestAttribute); if (blending.opacity >= ((FloatAttribute) combinedAttributes.get(FloatAttribute.AlphaTest)).value) super.render(renderable, combinedAttributes); if (!hasAlphaTest) combinedAttributes.remove(FloatAttribute.AlphaTest); combinedAttributes.set(blending); } else/*from w w w.j a va 2s . c om*/ super.render(renderable, combinedAttributes); }
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)); }/*from ww w . ja va2 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); } }