public abstract class AbstractBox extends Mesh
A Box
is defined by a minimal point and a maximal point. The eight
vertices that make the box are then computed, they are computed in such
a way as to generate an axis-aligned box.
This class does not control how the geometry data is generated, see Box
for that.
Modifier and Type | Field and Description |
---|---|
Vector3f |
center |
float |
xExtent |
float |
yExtent |
float |
zExtent |
Constructor and Description |
---|
AbstractBox() |
Modifier and Type | Method and Description |
---|---|
protected Vector3f[] |
computeVertices()
Gets the array or vectors representing the 8 vertices of the box.
|
protected abstract void |
doUpdateGeometryIndices()
Convert the indices into the list of vertices that define the box's geometry.
|
protected abstract void |
doUpdateGeometryNormals()
Update the normals of each of the box's planes.
|
protected abstract void |
doUpdateGeometryTextures()
Update the points that define the texture of the box.
|
protected abstract void |
doUpdateGeometryVertices()
Update the position of the vertices that define the box.
|
Vector3f |
getCenter()
Get the center point of this box.
|
float |
getXExtent()
Get the x-axis size (extent) of this box.
|
float |
getYExtent()
Get the y-axis size (extent) of this box.
|
float |
getZExtent()
Get the z-axis size (extent) of this box.
|
void |
read(JmeImporter e) |
void |
updateGeometry()
Rebuilds the box after a property has been directly altered.
|
void |
updateGeometry(Vector3f center,
float x,
float y,
float z)
Rebuilds this box based on a new set of parameters.
|
void |
updateGeometry(Vector3f minPoint,
Vector3f maxPoint)
Rebuilds this box based on a new set of parameters.
|
void |
write(JmeExporter e) |
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, getMorphTargetNames, getMorphTargets, getNumLodLevels, getPatchVertexCount, getPointSize, getShortBuffer, getTriangle, getTriangle, getTriangle, getTriangleCount, getTriangleCount, getVertexCount, hasMorphTargets, isAnimated, isAnimatedByBone, isAnimatedByJoint, jmeClone, prepareForAnim, scaleTextureCoordinates, setBound, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setBuffer, setDynamic, setElementLengths, setId, setInterleaved, setLineWidth, setLodLevels, setMaxNumWeights, setMode, setModeStart, setPatchVertexCount, setPointSize, setStatic, setStreamed, updateBound, updateCounts
public final Vector3f center
public float xExtent
public float yExtent
public float zExtent
protected final Vector3f[] computeVertices()
protected abstract void doUpdateGeometryIndices()
protected abstract void doUpdateGeometryNormals()
protected abstract void doUpdateGeometryTextures()
It's a one-to-one ratio, where each plane of the box has its own copy of the texture. That is, the texture is repeated one time for each face.
protected abstract void doUpdateGeometryVertices()
These eight points are determined from the minimum and maximum point.
public final Vector3f getCenter()
public final float getXExtent()
public final float getYExtent()
public final float getZExtent()
public final void updateGeometry()
For example, if you call getXExtent().x = 5.0f
then you will
need to call this method afterwards in order to update the box.
public final void updateGeometry(Vector3f center, float x, float y, float z)
Note that the actual sides will be twice the given extent values because the box extends in both directions from the center for each extent.
center
- the center of the box.x
- the x extent of the box, in each directions.y
- the y extent of the box, in each directions.z
- the z extent of the box, in each directions.public final void updateGeometry(Vector3f minPoint, Vector3f maxPoint)
The box is updated so that the two opposite corners are minPoint
and maxPoint
, the other corners are created from those two positions.
minPoint
- the new minimum point of the box.maxPoint
- the new maximum point of the box.public void read(JmeImporter e) throws java.io.IOException
public void write(JmeExporter e) throws java.io.IOException