Platform SDK: DirectX

Direct3DDevice7.ComputeSphereVisibility

The Direct3DDevice7.ComputeSphereVisibility method calculates the visibility (complete, partial, or no visibility) of a sphere within the current viewport for this device.

object.ComputeSphereVisibility( _ 
    center As D3DVECTOR, _ 
    radius As Single) As Long

Parameters

object
Object expression that resolves to a Direct3DDevice7 object.
center
A D3DVECTOR type describing the center point for the sphere, in world-space coordinates.
radius
The radius for the sphere.

Return Values

If the method succeeds, the return value is a combination of flags from the CONST_D3DCLIPFLAGS enumeration that describe the visibility of that sphere within the current viewport for this device. If the return value is zero (some combination of the "inside" flags) the sphere is completely visible.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following values:

DDERR_GENERIC
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS

For information on trapping errors, see the Visual Basic Error Trapping topic.

Remarks

Sphere visibility is computed by back transforming the viewing frustum to the model space, using the inverse of the combined world, view or projection matrices. If the combined matrix cannot be inverted (if the determinant is zero), the method fails, returning DDERR_GENERIC.