DirectX SDK |
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
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.
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.
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.