Package com.simsilica.lemur.geom
Class TbtQuad
java.lang.Object
com.jme3.scene.Mesh
com.simsilica.lemur.geom.TbtQuad
- All Implemented Interfaces:
Savable
,JmeCloneable
,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.
All coordinates are relative to the lower-left border.
The texture is split up into a three-by-three grid in this fashion:
+---+--------------+-------+ | | <-----> | | y2 +---+--------------+-------+ | | | | | ^ | ^ | ^ | | | | | | | | | | | <-----> | | | | | | | | | | | v | v | v | | | | | y1 +---+--------------+-------+ | | <-----> | | +---+--------------+-------+ x1 x2Arrows 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.
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Create a shallow clone of this Mesh.getSize()
protected void
void
updateSize
(float width, float height) Methods inherited from class com.jme3.scene.Mesh
addMorphTarget, clearBuffer, clearCollisionData, 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
-
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
Description copied from class:Mesh
Create a shallow clone of this Mesh. Thevertex buffers
are shared between this and the clone mesh, the rest of the data is cloned. -
getSize
-
updateSize
public void updateSize(float width, float height) -
refreshGeometry
protected void refreshGeometry()
-