Clipping
A version of this page is also available for
4/8/2010
Microsoft® Direct3D® Mobile is capable of clipping all primitives to the view frustum. Clipping is enabled via the D3DMRS_CLIPPING render state (see D3DMRENDERSTATETYPE).
Point primitives can only be clipped by entirely discarding them. Line primitives can be clipped by trimming them into shorter lines or by discarding them entirely. When a triangle is clipped, the result can either be the creation of more triangles, or the result can be to discard the triangle entirely.
The D3DMRS_CLIPPING render state has no effect on vertices that have already been transformed and lit.
All drivers must support scissoring to the screen. Scissoring is the operation where rasterized pixel locations are tested against the dimensions of the render target. The pixel is discarded if it falls outside the viewport.
Clipping Status
If the D3DMVTXPCAPS_CLIPSTATUS capability bit (see D3DMVTXPCAPS Values), is set then it is possible for the application to query the clipping status of the previous primitive processing operation made though a call to either the IDirect3DMobileDevice::DrawPrimitive method or the IDirect3DMobileDevice::ProcessVertices method. To determine the result of the clipping operation, applications call the IDirect3DMobileDevice::GetClipStatus method. This method takes a pointer to a D3DMCLIPSTATUS structure that is filled out from the driver's internal data structures.
The application may also reset the driver's internal data structures using the IDirect3DMobileDevice::SetClipStatus method. This allows the driver to start processing with a known starting value. The driver will then AND and OR the appropriate bits into the structure as primitives are processed.