Visibilitypublic class Visibility extends Object A collection of utility methods for computing the visibility of triangle
meshes. |
Methods Summary |
---|
public static native void | computeBoundingSphere(float[] positions, int positionsOffset, int positionsCount, float[] sphere, int sphereOffset)Compute a bounding sphere for a set of points. It is approximately the
minimal bounding sphere of an axis-aligned box that bounds the points.
| public static native int | frustumCullSpheres(float[] mvp, int mvpOffset, float[] spheres, int spheresOffset, int spheresCount, int[] results, int resultsOffset, int resultsCapacity)Given an OpenGL ES ModelView-Projection matrix (which implicitly
describes a frustum) and a list of spheres, determine which spheres
intersect the frustum.
A ModelView-Projection matrix can be computed by multiplying the
a Projection matrix by the a ModelView matrix (in that order.). There
are several possible ways to obtain the current ModelView and
Projection matrices. The most generally applicable way is to keep
track of the current matrices in application code. If that is not
convenient, there are two optional OpenGL ES extensions which may
be used to read the current matrices from OpenGL ES:
- GL10Ext.glQueryMatrixxOES
- GL11.GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES and
GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES
The problem with reading back the matrices is that your application
will only work with devices that support the extension(s) that
it uses.
A frustum is a six-sided truncated pyramid that defines the portion of
world space that is visible in the view.
Spheres are described as four floating point values: x, y, z, and r, in
world-space coordinates. R is the radius of the sphere.
| public static native int | visibilityTest(float[] ws, int wsOffset, float[] positions, int positionsOffset, char[] indices, int indicesOffset, int indexCount)Test whether a given triangle mesh is visible on the screen. The mesh
is specified as an indexed triangle list.
|
|