|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.util.frustum.ViewFrustum
public abstract class ViewFrustum
A utility for tracking the ViewFrustum planes and determining if a triangle or point is visible.
Because Java3D can have multiple canvases that view a single scenegraph, the view frustum must be a bit more complex than the traditional case. It must take into account that every canvas has its own viewplatform, and they may not be looking at the same thing. That means, for culling, they will need to assemble the union of all the spaces for each canvas.
The frustum is for the previous Java3D frame that has just been rendered.
Field Summary | |
---|---|
static int |
CLIPPED
The geometry has been clipped to the view frustum |
static int |
IN
The geometry is in the view frustum, either partially or completely |
protected int |
numCanvases
The number of different canvases provided |
static int |
OUT
The geometry is outside the view frustum |
Constructor Summary | |
---|---|
ViewFrustum(int numCanvases)
Create a new instance that on a given number of canvases that contribute to the total view frustum. |
Method Summary | |
---|---|
void |
getBounds(javax.vecmath.Point3d min,
javax.vecmath.Point3d max)
Convenience method to fetch the axis-aligned bounding box that the view frustum encloses. |
protected abstract void |
getInverseWorldProjection(int id,
javax.vecmath.Matrix4d matrix)
Request from the renderer-specific canvas the inverse projection matrix for the given canvasId. |
int |
isPointInFrustum(javax.vecmath.Point3d p1)
Checks if the point is inside the view frustum. |
int |
isTriangleInFrustum(float p1X,
float p1Y,
float p1Z,
float p2X,
float p2Y,
float p2Z,
float p3X,
float p3Y,
float p3Z)
Determines if the triangle defined by the 3 points is visible in the view frustum. |
int |
isTriangleInFrustum(javax.vecmath.Point3d p1,
javax.vecmath.Point3d p2,
javax.vecmath.Point3d p3)
Determines if the triangle defined by the 3 points is visible in the view frustum. |
void |
manualPlatformMove(javax.vecmath.Matrix4d tx)
Manually re-orient the view frustum by this given matrix. |
void |
viewingPlatformMoved()
This method must be called when the view platform transform group has been updated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int IN
public static final int OUT
public static final int CLIPPED
protected final int numCanvases
Constructor Detail |
---|
public ViewFrustum(int numCanvases)
numCanvases
- The number of canvases contributing to this frustumMethod Detail |
---|
public void viewingPlatformMoved()
public void manualPlatformMove(javax.vecmath.Matrix4d tx)
viewingPlatformMoved()
method first for this frame.
tx
- The transform used to modify the points withpublic int isTriangleInFrustum(float p1X, float p1Y, float p1Z, float p2X, float p2Y, float p2Z, float p3X, float p3Y, float p3Z)
IN is returned for any triangle which is partially or completely in the view frustum. OUT is returned if the triangle is outside the frustum.
In some cases triangles which are not visible will be reported as IN, however the converse is not true. All triangles which have any part in the frustum will be reported as IN.
p1X
- The x component of the first point of the trianglep1Y
- The y component of the first point of the trianglep1Z
- The z component of the first point of the trianglep2X
- The x component of the second point of the trianglep2Y
- The y component of the second point of the trianglep2Z
- The z component of the second point of the trianglep3X
- The x component of the third point of the trianglep3Y
- The y component of the third point of the trianglep3Z
- The z component of the third point of the triangle
public int isTriangleInFrustum(javax.vecmath.Point3d p1, javax.vecmath.Point3d p2, javax.vecmath.Point3d p3)
IN is returned for any triangle which is partially or completely in the view frustum. OUT is returned if the triangle is outside the frustum.
In some cases triangles which are not visible will be reported as IN, however the converse is not true. All triangles which have any part in the frustum will be reported as IN.
p1
- The first point of the trianglep2
- The first point of the trianglep3
- The first point of the triangle
public int isPointInFrustum(javax.vecmath.Point3d p1)
public void getBounds(javax.vecmath.Point3d min, javax.vecmath.Point3d max)
min
- The min corner vertex (+X, +Y and +Z values)max
- The max corner vertex (+X, +Y and +Z values)protected abstract void getInverseWorldProjection(int id, javax.vecmath.Matrix4d matrix)
id
- The ID of the canvasmatrix
- The matrix to copy the data into
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |