public UITextureContainer(String name, int sizeX, int sizeY, int posX, int posY, int zOrder) { super(name, posX, posY, zOrder, sizeX, sizeY); visibleQuad = new Quad(name + "UIQuad", sizeX, sizeY); visibleQuad.setRenderQueueMode(Renderer.QUEUE_ORTHO); visibleQuad.setZOrder(zPos); visibleQuad.setLocalTranslation((sizeX / 2.0f), (sizeY / 2.0f), 0); if (as == null) { as = DisplaySystem.getDisplaySystem() .getRenderer() .createBlendState(); // FIXME: Remove the hidden OpenGL call. as.setBlendEnabled(true); as.setSourceFunction(BlendState.SourceFunction.SourceAlpha); as.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); as.setTestEnabled(true); as.setTestFunction(BlendState.TestFunction.GreaterThan); } visibleQuad.setRenderState(as); visibleQuad.updateRenderState(); getDisplayNode().attachChild(visibleQuad); }
public UITextureContainer( String name, ColorRGBA color, int sizeX, int sizeY, int posX, int posY, int zOrder, UIContainer parentContainer) { this(name, sizeX, sizeY, posX, posY, zOrder, parentContainer); visibleQuad.setSolidColor(color); visibleQuad.updateRenderState(); }
public void setTextureState(TextureState ts) { visibleQuad.setRenderState(ts); visibleQuad.updateRenderState(); }
public void setTransparency(float t) { visibleQuad.setSolidColor(new ColorRGBA(1.0f, 1.0f, 1.0f, t)); }
/** Rotates the quad on which the texture is displayed. Does not change the texture itself. */ public void rotateTexture(float angleInDegrees) { Quaternion q = new Quaternion(); q.fromAngleAxis(angleInDegrees * FastMath.DEG_TO_RAD, Vector3f.UNIT_Z); visibleQuad.setLocalRotation(q); }