IDirect3DDevice3::ComputeSphereVisibility
The IDirect3DDevice3::ComputeSphereVisibility method calculates the visibility (complete, partial, or no visibility) of an array spheres within the current viewport for this device.
HRESULT ComputeSphereVisibility(
LPD3DVECTOR lpCenters,
LPD3DVALUE lpRadii,
DWORD dwNumSpheres,
DWORD dwFlags,
LPDWORD lpdwReturnValues
);
Parameters
- lpCenters
- Array of D3DVECTOR structures describing the center point for each sphere, in world-space coordinates.
- lpRadii
- Array of D3DVALUE variables that represent the radius for each sphere.
- dwNumSpheres
- Number of spheres. This value must be greater than zero.
- dwFlags
- Not currently used; set to zero.
- lpdwReturnValues
- Array of DWORD values. The array need not be initialized, but it must be large enough to contain a DWORD for each sphere being tested. When the method returns, each element in the array contains a combination of the following flags that describe the visibility of that sphere within the current viewport for this device:
- Inside flags
- D3DVIS_INSIDE_BOTTOM, D3DVIS_INSIDE_FAR, D3DVIS_INSIDE_FRUSTUM, D3DVIS_INSIDE_LEFT
- D3DVIS_INSIDE_NEAR, D3DVIS_INSIDE_RIGHT, D3DVIS_INSIDE_TOP
- The sphere is inside the viewing frustum of the current viewport.
- Intersection flags
- D3DVIS_INTERSECT_BOTTOM or D3DVIS_INTERSECT_TOP
- The sphere intersects the bottom or top plane of the viewing frustum for the current viewport, depending on which flag is present.
- D3DVIS_INTERSECT_FAR or D3DVIS_INTERSECT_NEAR
- The sphere intersects the far or near plane of the viewing frustum for the current viewport, depending on which flag is present.
- D3DVIS_INTERSECT_FRUSTUM
- The sphere intersects some part of the viewing frustum for the current viewport.
- D3DVIS_INTERSECT_LEFT or D3DVIS_INTERSECT_RIGHT
- The sphere intersects the left or right plane of the viewing frustum for the current viewport, depending on which flag is present.
- Outside flags
- D3DVIS_OUTSIDE_BOTTOM or D3DVIS_OUTSIDE_TOP
- The sphere is outside the bottom or top plane of the viewing frustum for the current viewport, depending on which flag is present.
- D3DVIS_OUTSIDE_FAR or D3DVIS_OUTSIDE_NEAR
- The sphere is outside the far or near plane of the viewing frustum for the current viewport, depending on which flag is present.
- D3DVIS_OUTSIDE_FRUSTUM
- The sphere is somewhere outside the viewing frustum for the current viewport.
- D3DVIS_OUTSIDE_LEFT or D3DVIS_OUTSIDE_RIGHT
- The sphere is outside the left or right plane of the viewing frustum for the current viewport, depending on which flag is present.
Return Values
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value may be one of the following values:
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 can not be inverted (if the determinant is zero), the method fails, returning D3DERR_INVALIDMATRIX.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in d3d.h.
Import Library: Use ddraw.lib.