IDirect3DDevice7::ComputeSphereVisibility
The IDirect3DDevice7::ComputeSphereVisibility method calculates the visibility (complete, partial, or no visibility) of an array of 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 0.
- dwFlags
- Not currently used; set to 0.
- 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 flags that describe the visibility of that sphere within the current viewport for this device. If a sphere is completely visible, the corresponding entry in lpdwReturnValues is 0. The following flags can be combined and present in the array:
Basic Clipping Flags
- D3DCLIP_BACK
- All vertices are clipped by the back plane of the viewing frustum.
- D3DCLIP_BOTTOM
- All vertices are clipped by the bottom plane of the viewing frustum.
- D3DCLIP_FRONT
- All vertices are clipped by the front plane of the viewing frustum.
- D3DCLIP_LEFT
- All vertices are clipped by the left plane of the viewing frustum.
- D3DCLIP_RIGHT
- All vertices are clipped by the right plane of the viewing frustum.
- D3DCLIP_TOP
- All vertices are clipped by the top plane of the viewing frustum.
- D3DCLIP_GEN0 through D3DCLIP_GEN5
- All vertices are clipped by a corresponding application-defined clipping plane.
Combination and General Flags
- D3DSTATUS_CLIPINTERSECTIONALL
- Combination of all CLIPINTERSECTION flags.
- D3DSTATUS_CLIPUNIONALL
- Combination of all CLIPUNION flags.
- D3DSTATUS_DEFAULT
- Combination of D3DSTATUS_CLIPINTERSECTIONALL and D3DSTATUS_ZNOTVISIBLE flags. This value is the default.
- D3DSTATUS_ZNOTVISIBLE
- Indicates that the rendered primitive is not visible. This flag is set or cleared by the system when rendering with z-checking enabled (see D3DRENDERSTATE_ZVISIBLE).
Clip Intersection Flags
- D3DSTATUS_CLIPINTERSECTIONBACK
- Logical And of the clip flags for the vertices compared to the back clipping plane of the viewing frustum.
- D3DSTATUS_CLIPINTERSECTIONBOTTOM
- Logical And of the clip flags for the vertices compared to the bottom of the viewing frustum.
- D3DSTATUS_CLIPINTERSECTIONFRONT
- Logical And of the clip flags for the vertices compared to the front clipping plane of the viewing frustum.
- D3DSTATUS_CLIPINTERSECTIONGEN0 through D3DSTATUS_CLIPINTERSECTIONGEN5
- Logical And of the clip flags for application-defined clipping planes.
- D3DSTATUS_CLIPINTERSECTIONLEFT
- Logical And of the clip flags for the vertices compared to the left side of the viewing frustum.
- D3DSTATUS_CLIPINTERSECTIONRIGHT
- Logical And of the clip flags for the vertices compared to the right side of the viewing frustum.
- D3DSTATUS_CLIPINTERSECTIONTOP
- Logical And of the clip flags for the vertices compared to the top of the viewing frustum.
Clip Union Flags
- D3DSTATUS_CLIPUNIONBACK
- Equal to D3DCLIP_BACK.
- D3DSTATUS_CLIPUNIONBOTTOM
- Equal to D3DCLIP_BOTTOM.
- D3DSTATUS_CLIPUNIONFRONT
- Equal to D3DCLIP_FRONT.
- D3DSTATUS_CLIPUNIONGEN0 through D3DSTATUS_CLIPUNIONGEN5
- Equal to D3DCLIP_GEN0 through D3DCLIP_GEN5.
- D3DSTATUS_CLIPUNIONLEFT
- Equal to D3DCLIP_LEFT.
- D3DSTATUS_CLIPUNIONRIGHT
- Equal to D3DCLIP_RIGHT.
- D3DSTATUS_CLIPUNIONTOP
- Equal to D3DCLIP_TOP.
Return Values
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value can 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 cannot be inverted (if the determinant is 0), 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.
Windows CE: Unsupported.
Version: Requires DirectX 7.0.
Header: Declared in d3d.h.