Package com.jme3.scene.debug
Class WireFrustum
java.lang.Object
com.jme3.scene.Mesh
com.jme3.scene.debug.WireFrustum
- All Implemented Interfaces:
Savable
,JmeCloneable
,Cloneable
A specialized Mesh that renders a camera frustum as a wireframe.
This class extends jME3's Mesh and is designed to visually represent
the viewing volume of a camera, which can be useful for debugging
or visualization purposes.
The frustum is defined by eight points: four for the near plane and four for the far plane. These points are connected by lines to form a wireframe cube-like structure.
-
Nested Class Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
For Serialization only.WireFrustum
(Vector3f[] points) Constructs a new `WireFrustum` mesh using the specified frustum corner points. -
Method Summary
Modifier and TypeMethodDescriptionstatic Mesh
makeFrustum
(Vector3f[] points) A static factory method to create a new `WireFrustum` mesh.static Geometry
makeGeometry
(Camera camera) Creates a `Geometry` object representing the wireframe frustum of a given camera.void
Updates the vertex positions of the existing `WireFrustum` mesh.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
-
Constructor Details
-
WireFrustum
protected WireFrustum()For Serialization only. Do not use. -
WireFrustum
Constructs a new `WireFrustum` mesh using the specified frustum corner points. The points should represent the 8 corners of the frustum. The expected order of points is typically: 0-3: Near plane (e.g., bottom-left, bottom-right, top-right, top-left) 4-7: Far plane (e.g., bottom-left, bottom-right, top-right, top-left)- Parameters:
points
- An array of 8 `Vector3f` objects representing the frustum's corners. If the array is null or does not contain 8 points, an `IllegalArgumentException` will be thrown.
-
-
Method Details
-
update
Updates the vertex positions of the existing `WireFrustum` mesh. This is more efficient than creating a new `WireFrustum` instance if only the frustum's position or orientation changes.- Parameters:
points
- An array of 8 `Vector3f` objects representing the new frustum's corners. If the array is null or does not contain 8 points, an `IllegalArgumentException` will be thrown.
-
makeFrustum
A static factory method to create a new `WireFrustum` mesh. This method provides a cleaner way to instantiate a `WireFrustum`.- Parameters:
points
- An array of 8 `Vector3f` objects representing the frustum's corners.- Returns:
- A new `WireFrustum` instance.
-
makeGeometry
Creates a `Geometry` object representing the wireframe frustum of a given camera. The frustum points are calculated based on the camera's current view settings. The returned `Geometry` can be directly attached to a scene graph.- Parameters:
camera
- The `Camera` whose frustum is to be visualized.- Returns:
- A `Geometry` object containing the `WireFrustum` mesh.
-