Android.Opengl.Visibility.FrustumCullSpheres Method
Given an OpenGL ES ModelView-Projection matrix (which implicitly describes a frustum) and a list of spheres, determine which spheres intersect the frustum.

Syntax

[Android.Runtime.Register("frustumCullSpheres", "([FI[FII[III)I", "")]
public static int FrustumCullSpheres (float[] mvp, int mvpOffset, float[] spheres, int spheresOffset, int spheresCount, int[] results, int resultsOffset, int resultsCapacity)

Parameters

mvp
a float array containing the mode-view-projection matrix
mvpOffset
The offset of the mvp data within the mvp array.
spheres
a float array containing the sphere data.
spheresOffset
an offset into the sphere array where the sphere data starts
spheresCount
the number of spheres to cull.
results
an integer array containing the indices of the spheres that are either contained entirely within or intersect the frustum.
resultsOffset
an offset into the results array where the results start.
resultsCapacity
the number of array elements available for storing results.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.IllegalArgumentExceptionif mvp is null, mvpOffset mvp.length - 16, spheres is null, spheresOffset spheres.length - sphereCount, results is null, resultsOffset results.length - resultsCapacity.

Remarks

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.

[Android Documentation]

Requirements

Namespace: Android.Opengl
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 3