List of usage examples for com.badlogic.gdx.graphics.g3d Attributes has
public final boolean has(final long type)
From source file:com.uos.mortaldestiny.rendering.FrontShader.java
License:Apache License
@Override public boolean canRender(Renderable renderable) { final Attributes attributes = combineAttributes(renderable); if (attributes.has(BlendingAttribute.Type)) { if ((attributesMask & BlendingAttribute.Type) != BlendingAttribute.Type) return false; if (attributes.has(TextureAttribute.Diffuse) != ((attributesMask & TextureAttribute.Diffuse) == TextureAttribute.Diffuse)) return false; }/* w w w. ja va 2 s. com*/ final boolean skinned = ((renderable.meshPart.mesh.getVertexAttributes().getMask() & Usage.BoneWeight) == Usage.BoneWeight); if (skinned != (numBones > 0)) return false; if (!skinned) return true; int w = 0; 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); } return w == weights; }
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/* ww w .ja va2 s . c om*/ super.render(renderable, combinedAttributes); }