The IDirect3DViewport3::TransformVertices method transforms a set of vertices by the transformation matrix.
HRESULT TransformVertices(
DWORD dwVertexCount,
LPD3DTRANSFORMDATA lpData,
DWORD dwFlags,
LPDWORD lpOffscreen
);
D3DTRANSFORM_CLIPPED
D3DTRANSFORM_UNCLIPPED
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value may be one of the following values:
DDERR_INVALIDOBJECT |
DDERR_INVALIDPARAMS |
This method has often be used to perform visibility checking, as it returns clipping information in the D3DTRANSFORMDATA structure after the call completes. Although the clipping information is accurate, visibility checking is best performed by calling the IDirect3DDevice3::ComputeSphereVisibility method, which was specially designed and optimized for this purpose.
If the dwFlags parameter is set to D3DTRANSFORM_CLIPPED, this method uses the current transformation matrix to transform a set of vertices, checking the resulting vertices to see if they are within the viewing frustum. The homogeneous part of the D3DTLVERTEX structure within lpData will be set if the vertex is clipped; otherwise only the screen coordinates will be set. The clip intersection of all the vertices transformed is returned in lpOffscreen. That is, if lpOffscreen is nonzero, all the vertices were off-screen and not straddling the viewport.
Initialize the drExtent member of the D3DTRANSFORMDATA structure to a D3DRECT structure that describes a 2-D bounding rectangle (extents) that the method will "grow" if the transformed vertices do not fit within it. If the transformed vertices are outside the provided extents, the method adjusts the extents to fit the vertices, otherwise no changes are made. If the dwFlags parameter is set to D3DTRANSFORM_UNCLIPPED, this method transforms the vertices assuming that the resulting coordinates will be within the viewing frustum. If clipping is requested by setting the dwFlags parameter to D3DTRANSFORM_CLIPPED, the method adjusts the extents to fit only the transformed vertices that are within the viewing area.
The dwClip member of D3DTRANSFORMDATA can help the transformation module determine whether the geometry will need clipping against the viewing volume. Before transforming a geometry, high-level software often can test whether bounding boxes or bounding spheres are wholly within the viewing volume, allowing clipping tests to be skipped, or wholly outside the viewing volume, allowing the geometry to be skipped entirely.
This method is unchanged from its implementation in the IDirect3DViewport2 interface.
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.