Package com.ms.com.directX |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
Applications use the methods of the d3dViewport class to retrieve and set the properties of viewports.
public class d3dViewport implements Id3dViewport { public void InternalSetObject(IUnknown lpdd); public IUnknown InternalGetObject(); public void Initialize(d3d dev); public void SetViewport(d3dViewportStruc vp); public void GetViewport(d3dViewportStruc vp); public void TransformVertices(int count, d3dTransformData data, int flags, int[] status); public void LightElements(int count, d3dLightData ld); public void SetBackground(int hdl); public void GetBackground(int[] hdl, int[] stat); public void SetBackgroundDepth(IddSurface surface); public ddSurface GetBackgroundDepth(int[] status); public void Clear(int count, d3dRect rec, int flags); public void AddLight(d3dLight light); public void DeleteLight(d3dLight light); public d3dLight NextLight(d3dLight l1, int flags); }
The methods can be organized into the following groups:
Backgrounds | GetBackground |
GetBackgroundDepth | |
SetBackground | |
SetBackgroundDepth | |
Initialization | Initialize |
Lights | AddLight |
DeleteLight | |
LightElements | |
NextLight | |
Materials and viewports | Clear |
GetViewport | |
SetViewport | |
Transformation | TransformVertices |
public void AddLight(d3dLight light);Adds the specified light to the list of d3dLight objects associated with this viewport.
Return Value:
No return value.
Parameter Description light The d3dLight object that should be associated with this d3dDevice object.
public void Clear(int count, d3dRect rec, int flags);Clears the viewport or a set of rectangles in the viewport to the current background material.
Return Value:
No return value.
Parameter Description count Number of rectangles pointed to by rec. rec A d3dRect object. flags One or more values of D3DCLEAR_ type, indicating what to clear: the rendering target, the z-buffer, or both.
public void DeleteLight(d3dLight light);Removes the specified light from the list of d3dLight objects associated with this viewport.
Return Value:
No return value.
Parameter Description light The d3dLight object that should be disassociated with this d3dDevice object.
public void GetBackground(int[] hdl, int[] stat);Retrieves the handle of a material that represents the current background associated with the viewport.
Return Value:
No return value.
Parameter Description hdl Array variable that receives the handle of the material being used as the background. stat Array variable that receives a value indicating whether a background is associated with the viewport. If this value is FALSE, no background is associated with the viewport. See Also: SetBackground
public ddSurface GetBackgroundDepth(int[] status);Retrieves a DirectDraw surface that represents the current background-depth field associated with the viewport.
Return Value:
Returns the ddSurface object if successful; null otherwise.
Parameter Description status Array variable that receives the value FALSE if no background depth is associated with the viewport. See Also: SetBackgroundDepth
public void GetViewport(d3dViewportStruc vp);Retrieves the viewport registers of the viewport.
Return Value:
No return value.
Parameter Description vp A d3dViewportStruc object that receives values for the viewport. See Also: SetViewport
public void Initialize(d3d dev);Initializes the d3dViewport object.
Return Value:
No return value.
Parameter Description dev The d3d object.
public void LightElements(int count, d3dLightData ld);Not currently implemented.
public d3dLight NextLight(d3dLight l1, int flags);Enumerates the d3dLight objects associated with the viewport.
Return Value:
Returns the d3dLight object if successful; null otherwise.
Parameter Description l1 A light in the list of lights associated with this d3dDevice object. flags One value of D3DNEXT_ type, specifying which light to retrieve from the list of lights.
public void SetBackground(int hdl);Sets the background associated with the viewport.
Return Value:
No return value.
Parameter Description hdl Material handle that will be used as the background. See Also: GetBackground
public void SetBackgroundDepth(IddSurface surface);Sets the background-depth field for the viewport.
Return Value:
No return value.
Parameter Description surface The ddSurface object representing the background depth. Remarks:
The z-buffer is filled with the specified depth field when the Clear method is called and the D3DCLEAR_ZBUFFER flag is specified. The bit depth must be 16 bits.
See Also: GetBackgroundDepth
public void SetViewport(d3dViewportStruc vp);Sets the viewport registers of the viewport.
Return Value:
No return value.
Parameter Description vp A d3dViewportStruc object that contains the new viewport. See Also: GetViewport
public void TransformVertices(int count, d3dTransformData data, int flags, int[] status);Transforms a set of vertices by the transformation matrix.
Return Value:
No return value.
Parameter Description count Number of vertices in the data parameter to be transformed. data A d3dTransformData object that contains the vertices to be transformed. flags One value of D3DTRANSFORM_ type. status Array variable that is set to a nonzero value if the resulting vertices are all off-screen. Remarks:
If flags is D3DTRANSFORM_CLIPPED, the clip intersection of all the vertices transformed is returned in the status parameter. That is, if status is nonzero, all the vertices were off-screen and not straddling the viewport.
The dwClip field 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.