Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
  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();
  }
Ejemplo n.º 3
0
 public void setTextureState(TextureState ts) {
   visibleQuad.setRenderState(ts);
   visibleQuad.updateRenderState();
 }
Ejemplo n.º 4
0
 public void setTransparency(float t) {
   visibleQuad.setSolidColor(new ColorRGBA(1.0f, 1.0f, 1.0f, t));
 }
Ejemplo n.º 5
0
  /** 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);
  }