Microsoft DirectX 8.0 (Visual Basic) |
You can use the following methods to draw patches in Microsoft® Direct3D® for Microsoft DirectX® 8.0.
DrawRectPatch draws a rectangular high-order patch specified by the Surface parameter using the currently set streams. The Handle parameter is used to associate the patch with a handle, so that the next time the patch is drawn, there is no need to respecify Surface. This makes it possible to precompute and cache forward difference coefficients or other information, which in turn enables subsequent calls to DrawRectPatch using the same handle to execute efficiently.
It is intended that for static patches, an application would set the vertex shader and appropriate streams, supply patch information in the Surface parameter, and specify a handle so that Direct3D can capture and cache information. The application can then call DrawRectPatch with Surface set to ByVal 0 to efficiently draw the patch. When drawing a cached patch, the currently set streams are ignored. However, you can override the cached NumSegments by specifying new values for NumSegments. Also, it is required to set the same vertex shader when rendering a cached patch as was set when it was captured.
For dynamic patches, the patch data changes for every rendering of the patch, so it is not efficient to cache information. The application can convey this to Direct3D by setting Handle to 0. In this case, Direct3D draws the patch using the currently set streams and the NumSegments values and does not cache any information. It is not valid to simultaneously set Handle to 0 and Surface to ByVal 0.
By respecifying Surface for the same handle, the application can overwrite the previously cached information.
If NumSegments is set to ByVal 0, then the tessellator uses D3DRS_PATCHSEGMENTS to control the amount of tessellation. In this case, obviously, the same tessellation is used for all sides. There are no special methods for N-patches. Tessellation is simply controlled by D3DRS_PATCHSEGMENTS. It is necessary to supply normals.
DrawTriPatch is similar to DrawRectPatch, except that it draws a triangular high-order patch.