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

Class d3drmViewport

Applications use the methods of the d3drmViewport class to work with viewport objects.

public class d3drmViewport implements Id3drmViewport
{
  public void InternalSetObject(IUnknown lpdd);
  public IUnknown InternalGetObject();
  public d3drmViewport Clone();
  public void AddDestroyCallback(Id3drmCallback fn, IUnknown Arg);
  public void DeleteDestroyCallback(Id3drmCallback fn, IUnknown args);
  public void SetAppData(int data);
  public int GetAppData();
  public void SetName(String name);
  public String GetName();
  public String GetClassName();
  public void Init(d3drmDevice dev, d3drmFrame camera, int xpos, int ypos, int width, int ht);
  public void Clear();
  public void Render(d3drmFrame f);
  public void SetFront(float v);
  public void SetBack(float v);
  public void SetField(float v);
  public void SetUniformScaling(int flag);
  public void SetCamera(d3drmFrame f);
  public void SetProjection(int val);
  public void Transform(d3drmvector4d d, d3dvector s);
  public void InverseTransform(d3dvector d, d3drmvector4d s);
  public void Configure(int x, int y, int width, int height);
  public void ForceUpdate(int x1, int y1, int x2, int y2);
  public void SetPlane(float Left, float Right, float Bottom, float Top);
  public d3drmFrame GetCamera();
  public d3drmDevice GetDevice();
  public void GetPlane(float[] l, float[] r, float[] b, float[] t);
  public d3drmPickedArray Pick(int x, int y);
  public int GetUniformScaling();
  public int GetX();
  public int GetY();
  public int GetHeight();
  public int GetWidth();
  public float GetField();
  public float GetBack();
  public float GetFront();
  public int GetProjection();
  public d3dViewport GetDirect3DViewport();
}

The methods can be organized into the following groups:
Camera GetCamera
SetCamera
Clipping planes GetBack
GetFront
GetPlane
SetBack
SetFront
SetPlane
Dimensions GetHeight
GetWidth
Field of view GetField
SetField
Initialization Init
Miscellaneous Clear
Configure
ForceUpdate
GetDevice
GetDirect3DViewport
Pick
Render
Offsets GetX
GetY
Projection types GetProjection
SetProjection
Scaling GetUniformScaling
SetUniformScaling
Transformations InverseTransform
Transform

In addition, the d3drmViewport class inherits the following methods from the d3drmObject class:
AddDestroyCallback
Clone
DeleteDestroyCallback
GetAppData
GetClassName
GetName
SetAppData
SetName

The d3drmViewport object is obtained by calling the CreateViewport method.

Clear

public void Clear();

Clears the given viewport to the current background color.

Return Value:

No return value.


Configure

public void Configure(int x, int y, int width, int height);

Reconfigures the origin and dimensions of a viewport.

Return Value:

No return value.

ParameterDescription
x and y New position of the viewport.
width and height New width and height of the viewport.

Remarks:

This method carries out no action if x + width or y + height are greater than the width or height of the device, or if any of x, y, width, or height is less than zero.


ForceUpdate

public void ForceUpdate(int x1, int y1, int x2, int y2);

Forces an area of the viewport to be updated. The specified area will be copied to the screen at the next call to the Update method.

Return Value:

No return value.

ParameterDescription
x1 and y1 Upper-left corner of area to be updated.
x2 and y2 Lower-right corner of area to be updated.

Remarks:

The system might update any region that is larger than the specified rectangle, including possibly the entire window.


GetBack

public float GetBack();

Retrieves the position of the back clipping plane for a viewport.

Return Value:

Returns a value describing the position.

See Also: SetBack


GetCamera

public d3drmFrame GetCamera();

Retrieves the camera for a viewport.

Return Value:

Returns the d3drmFrame object if successful; null otherwise.

See Also: SetCamera


GetDevice

public d3drmDevice GetDevice();

Retrieves the device associated with a viewport.

Return Value:

Returns the d3drmDevice object if successful; null otherwise.


GetDirect3DViewport

public d3dViewport GetDirect3DViewport();

Retrieves the Direct3D viewport corresponding to the current d3drmViewport object.

Return Value:

Returns the d3dViewport object if successful; null otherwise.


GetField

public float GetField();

Retrieves the field of view for a viewport.

Return Value:

Returns a value describing the field of view.

See Also: SetField


GetFront

public float GetFront();

Retrieves the position of the front clipping plane for a viewport.

Return Value:

Returns a value describing the position.

See Also: SetFront


GetHeight

public int GetHeight();

Retrieves the height, in pixels, of the viewport.

Return Value:

Returns the pixel height.


GetPlane

public void GetPlane(float[] l, float[] r, float[] b, float[] t);

Retrieves the dimensions of the viewport on the front clipping plane.

Return Value:

No return value.

ParameterDescription
l, r, b, and t Array variables that receive the dimensions of the viewport on the front clipping plane.

See Also: SetPlane


GetProjection

public int GetProjection();

Retrieves the projection type for the viewport. A viewport can use either orthographic or perspective projection.

Return Value:

Returns one value of projection type.

See Also: SetProjection


GetUniformScaling

public int GetUniformScaling();

Retrieves the scaling property used to scale the viewing volume into the larger dimension of the window.

Return Value:

Returns TRUE if the viewport scales uniformly, or FALSE otherwise.

See Also: SetUniformScaling


GetWidth

public int GetWidth();

Retrieves the width, in pixels, of the viewport.

Return Value:

Returns the pixel width.


GetX

public int GetX();

Retrieves the x-offset of the start of the viewport on a device.

Return Value:

Returns the x-offset.


GetY

public int GetY();

Retrieves the y-offset of the start of the viewport on a device.

Return Value:

Returns the y-offset.


Init

public void Init(d3drmDevice dev, d3drmFrame camera, int xpos, int ypos, int width, int ht);

Initializes a d3drmViewport object.

Return Value:

No return value.

ParameterDescription
dev The d3drmDevice object associated with this viewport.
camera The d3drmFrame object that serves as the camera associated with this viewport.
xpos and ypos The x- and y-coordinates of the upper-left corner of the viewport.
width and ht Width and height of the viewport.


InverseTransform

public void InverseTransform(d3dvector d, d3drmvector4d s);

Transforms the vector in the s parameter in screen coordinates to world coordinates, and returns the result in the d parameter.

Return Value:

No return value.

ParameterDescription
d A d3dvector object that receives the result of the operation.
s A d3drmvector4d object that contains the source of the operation.


Pick

public d3drmPickedArray Pick(int x, int y);

Finds a depth-sorted list of objects (and faces, if relevant) that includes the path taken in the hierarchy from the root down to the frame that contained the object.

Return Value:

Returns the d3drmPickedArray object if successful; null otherwise.

ParameterDescription
x and y Coordinates to be used for picking.


Render

public void Render(d3drmFrame f);

Renders a frame hierarchy to the given viewport. Only those visuals on the given frame and any frames below it in the hierarchy are rendered.

Return Value:

No return value.

ParameterDescription
f The d3drmFrame object that represents the frame hierarchy to be rendered.


SetBack

public void SetBack(float v);

Sets the position of the back clipping plane for a viewport.

Return Value:

No return value.

ParameterDescription
v New position of the back clipping plane.

See Also: GetBack, SetFront


SetCamera

public void SetCamera(d3drmFrame f);

Sets a camera for a viewport.

Return Value:

No return value.

ParameterDescription
f The d3drmFrame object that represents the camera.

Remarks:

This method sets a viewport's position, direction, and orientation to that of the given camera frame. The view is oriented along the positive z-axis of the camera frame, with the up direction being in the direction of the positive y-axis.

See Also: GetCamera


SetField

public void SetField(float v);

Sets the field of view for a viewport.

Return Value:

No return value.

ParameterDescription
v New field of view. If this value is less than or equal to zero, this method carries out no action.

Remarks:

By default, the initial field of view value is 0.5.

See Also: GetField


SetFront

public void SetFront(float v);

Sets the position of the front clipping plane for a viewport.

Return Value:

No return value.

ParameterDescription
v New position of the front clipping plane. If the value passed is less than or equal to zero, this method carries out no action.

Remarks:

By default, the initial position is 1.0.

See Also: GetFront


SetPlane

public void SetPlane(float Left, float Right, float Bottom, float Top);

Sets the dimensions of the viewport on the front clipping plane, relative to the camera's z-axis.

Return Value:

No return value.

ParameterDescription
Left, Right, Bottom, and rvTop Minimum x, maximum x, minimum y, and maximum y coordinates of the four sides of the viewport.

Remarks:

Unlike the SetField method, which specifies a centered proportional viewport, this method allows you to specify a viewport of arbitrary proportion and position. For example, this method could be used to construct a sheared viewing frustum to implement a right- or left-eye stereo view.

See Also: GetPlane, SetField


SetProjection

public void SetProjection(int val);

Sets the projection type for a viewport.

Return Value:

No return value.

ParameterDescription
val One value of projection type.

See Also: GetProjection


SetUniformScaling

public void SetUniformScaling(int flag);

Sets the scaling property used to scale the viewing volume into the larger dimension of the window.

Return Value:

No return value.

ParameterDescription
flag New scaling property. If this parameter is TRUE, the same horizontal and vertical scaling factor is used to scale the viewing volume. Otherwise, different scaling factors are used to scale the viewing volume exactly into the window.

Remarks:

This method is typically used with the SetPlane method to support banding.

By default, the initial scaling property is TRUE.

See Also: GetUniformScaling


Transform

public void Transform(d3drmvector4d d, d3dvector s);

Transforms the vector in the s parameter in world coordinates to screen coordinates, and returns the result in the d parameter.

Return Value:

No return value.

ParameterDescription
d A d3drmvector4d object that receives the result of the transformation operation.
s A d3dvector object that contains the source for the transformation operation.

Remarks:

The result of the transformation is a four-element homogeneous vector.

The point represented by the resulting vector is visible if the following equations are true:



Top© 1996 Microsoft Corporation. All rights reserved.