Platform SDK: DirectX

IDirect3DDevice7::SetClipPlane

The IDirect3DDevice7::SetClipPlane method sets the coefficients of a user-defined clipping plane for the device.

HRESULT SetClipPlane( 
  DWORD dwIndex, 
  D3DVALUE* pPlaneEquation
); 

Parameters

dwIndex
Index of the clipping plane for which the plane equation coefficients are to be set.
pPlaneEquation
Address of a four-element array of values that represent the coefficients of the clipping plane, in the form of the general plane equation. See remarks.

Return Values

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value is DDERR_INVALIDPARAMS. This error indicates that the value in dwIndex exceeds the maximum clipping plane index supported by the device or that the array at pPlaneEquation is not large enough to contain four floating-point values.

Remarks

The coefficients that this method sets take the form of the general plane equation. If the values in the array at pPlaneEquation were labeled A, B, C, and D in the order that they appear in the array, they would fit into the general plane equation so that Ax + By + Cz + D = 0. A point with homogeneous coordinates (x, y, z, w) is visible in the half space of the plane if Ax + By + Cz + Dw >= 0. Points that exist on or behind the clipping plane are clipped from the scene.

The plane equation used by this method exists in world space.

This method does not enable the clipping plane equation being set. To enable a clipping plane, set the corresponding bit in the DWORD value applied to the D3DRENDERSTATE_CLIPPLANEENABLE render state.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Version: Requires DirectX 7.0.
  Header: Declared in d3d.h.

See Also

IDirect3DDevice7::GetClipPlane, D3DRENDERSTATE_CLIPPLANEENABLE, User-defined Clip Planes