Class RectangleMesh

java.lang.Object
com.jme3.scene.Mesh
jme3utilities.mesh.RectangleMesh
All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable

public class RectangleMesh extends com.jme3.scene.Mesh
A 2-D, static, TriangleFan-mode mesh that renders an axis-aligned rectangle in the X-Y plane.

In local space, the rectangle extends from (x1,y1,0) to (x2,y2,0) with normals set to (0,0,zNorm). In texture space, it extends from (s1,t1) to (s2,t2).

The key differences between this class and com.jme3.scene.shape.Quad are:

  1. the center and extent can be configured independently,
  2. TriangleFan mode is used to reduce the number of indices from 6 to 4,
  3. the normal direction is configurable, and
  4. the texture coordinates can be configured in greater detail.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.jme3.scene.Mesh

    com.jme3.scene.Mesh.Mode
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiate an axis-aligned unit square with right-handed normals and its first vertex at the mesh origin.
    RectangleMesh(float x1, float x2, float y1, float y2, float zNorm)
    Instantiate an axis-aligned rectangle with default texture coordinates.
    RectangleMesh(float s1, float s2, float t1, float t2, float x1, float x2, float y1, float y2, float zNorm)
    Instantiate an axis-aligned rectangle with the specified parameters.
    RectangleMesh(com.jme3.font.Rectangle rect, float zNorm)
    Instantiate an axis-aligned rectangle with default texture coordinates.
  • Method Summary

    Methods inherited from class com.jme3.scene.Mesh

    addMorphTarget, clearBuffer, clearCollisionData, clone, cloneFields, cloneForAnim, collideWith, createCollisionData, deepClone, extractVertexData, generateBindPose, generateBindPose, getBound, getBuffer, getBufferList, getBuffers, getElementLengths, getFloatBuffer, getId, getIndexBuffer, getIndicesAsList, getInstanceCount, getLineWidth, getLodLevel, getMaxNumWeights, getMode, getModeStart, getMorphIndex, getMorphTarget, getMorphTargetNames, getMorphTargets, getNumLodLevels, getPatchVertexCount, getPointSize, getShortBuffer, getTriangle, getTriangle, getTriangle, getTriangleCount, getTriangleCount, getVertexCount, hasMorphTargets, isAnimated, isAnimatedByBone, isAnimatedByJoint, jmeClone, prepareForAnim, read, removeMorphTarget, removeMorphTarget, scaleTextureCoordinates, setBound, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setDynamic, setElementLengths, setId, setInterleaved, setLineWidth, setLodLevels, setMaxNumWeights, setMode, setModeStart, setPatchVertexCount, setStatic, setStreamed, updateBound, updateCounts, write

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RectangleMesh

      public RectangleMesh()
      Instantiate an axis-aligned unit square with right-handed normals and its first vertex at the mesh origin.
    • RectangleMesh

      public RectangleMesh(com.jme3.font.Rectangle rect, float zNorm)
      Instantiate an axis-aligned rectangle with default texture coordinates.
      Parameters:
      rect - the location of the first vertex and the dimensions of the rectangle (not null, Z components are ignored, unaffected)
      zNorm - the Z component of the normal vector (must be +1 or -1)
    • RectangleMesh

      public RectangleMesh(float x1, float x2, float y1, float y2, float zNorm)
      Instantiate an axis-aligned rectangle with default texture coordinates.
      Parameters:
      x1 - the local X coordinate of the first and 2nd vertices
      x2 - the local X coordinate of the 3rd and 4th vertices
      y1 - the local Y coordinate of the first and 4th vertices
      y2 - the local Y coordinate of the 2nd and 3rd vertices
      zNorm - the Z component of the normal vector (must be +1 or -1)
    • RectangleMesh

      public RectangleMesh(float s1, float s2, float t1, float t2, float x1, float x2, float y1, float y2, float zNorm)
      Instantiate an axis-aligned rectangle with the specified parameters.
      Parameters:
      s1 - the first (U) texture coordinate of the first and 2nd vertices
      s2 - the first (U) texture coordinate of the 3rd and 4th vertices
      t1 - the 2nd (V) texture coordinate of the first and 4th vertices
      t2 - the 2nd (V) texture coordinate of the 2nd and 3rd vertices
      x1 - the local X coordinate of the first and 2nd vertices
      x2 - the local X coordinate of the 3rd and 4th vertices
      y1 - the local Y coordinate of the first and 4th vertices
      y2 - the local Y coordinate of the 2nd and 3rd vertices
      zNorm - the Z component of the normal vector (must be +1 or -1)