Package com.ms.com.directX Previous
Previous
Microsoft Packages
Microsoft Packages
Index
Index
Next
Next

Class d3dViewport

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

AddLight

public void AddLight(d3dLight light);

Adds the specified light to the list of d3dLight objects associated with this viewport.

Return Value:

No return value.

ParameterDescription
light The d3dLight object that should be associated with this d3dDevice object.


Clear

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.

ParameterDescription
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.


DeleteLight

public void DeleteLight(d3dLight light);

Removes the specified light from the list of d3dLight objects associated with this viewport.

Return Value:

No return value.

ParameterDescription
light The d3dLight object that should be disassociated with this d3dDevice object.


GetBackground

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.

ParameterDescription
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


GetBackgroundDepth

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.

ParameterDescription
status Array variable that receives the value FALSE if no background depth is associated with the viewport.

See Also: SetBackgroundDepth


GetViewport

public void GetViewport(d3dViewportStruc vp);

Retrieves the viewport registers of the viewport.

Return Value:

No return value.

ParameterDescription
vp A d3dViewportStruc object that receives values for the viewport.

See Also: SetViewport


Initialize

public void Initialize(d3d dev);

Initializes the d3dViewport object.

Return Value:

No return value.

ParameterDescription
dev The d3d object.


LightElements

public void LightElements(int count, d3dLightData ld);

Not currently implemented.


NextLight

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.

ParameterDescription
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.


SetBackground

public void SetBackground(int hdl);

Sets the background associated with the viewport.

Return Value:

No return value.

ParameterDescription
hdl Material handle that will be used as the background.

See Also: GetBackground


SetBackgroundDepth

public void SetBackgroundDepth(IddSurface surface);

Sets the background-depth field for the viewport.

Return Value:

No return value.

ParameterDescription
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


SetViewport

public void SetViewport(d3dViewportStruc vp);

Sets the viewport registers of the viewport.

Return Value:

No return value.

ParameterDescription
vp A d3dViewportStruc object that contains the new viewport.

See Also: GetViewport


TransformVertices

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.

ParameterDescription
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.



Top© 1996 Microsoft Corporation. All rights reserved.