Class TbtQuad

java.lang.Object
com.jme3.scene.Mesh
com.simsilica.lemur.geom.TbtQuad
All Implemented Interfaces:
Savable, JmeCloneable, Cloneable

public class TbtQuad extends Mesh implements Cloneable
A three-by-three quad that can stretch textures in useful ways. The vertexes are arranged with the 10 outer vertexes first and then the 4 inner vertexes.

The texture is split up into a three-by-three grid in this fashion:

    +---+--------------+-------+
    |   |    <----->   |       |
 y2 +---+--------------+-------+
    |   |              |       |
    | ^ |       ^      |   ^   |
    | | |       |      |   |   |
    | | |    <----->   |   |   |
    | | |       |      |   |   |
    | v |       v      |   v   |
    |   |              |       |
 y1 +---+--------------+-------+
    |   |    <----->   |       |
    +---+--------------+-------+
       x1             x2
 
Arrows indicate the direction in which each grid cell will stretch to fill the area given by the component.
All coordinates are relative to the lower-left border.

Common pitfalls

  • Placing controls on a fractional coordinate. This usually happens when centering controls.
  • Having a contrast at the border between stretched and unstretched texture zone (e.g. a black border and a white center). Stretching involves interpolating colors with the neighbouring pixels (i.e. you'll get a black-to-white color gradient).
    The easiest workaround is to make the border one pixel wider so that the contrast will be safely inside the unstretched area.
  • Using a texture that is larger than the quad.
  • Constructor Details

    • TbtQuad

      public TbtQuad(float width, float height)
    • TbtQuad

      public TbtQuad(float width, float height, int x1, int y1, int x2, int y2, int imageWidth, int imageHeight, float imageScale)
  • Method Details

    • clone

      public TbtQuad clone()
      Description copied from class: Mesh
      Create a shallow clone of this Mesh. The vertex buffers are shared between this and the clone mesh, the rest of the data is cloned.
      Overrides:
      clone in class Mesh
      Returns:
      A shallow clone of the mesh
    • getSize

      public Vector2f getSize()
    • updateSize

      public void updateSize(float width, float height)
    • refreshGeometry

      protected void refreshGeometry()