Packages
 In this topic

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.directX   Previous This
Package
Next

 


Class Direct3dRMViewport

public class Direct3dRMViewport implements IDirect3dRMViewport
{
  // Methods
  public void clear();
  public void configure(int x, int y, int width, int height);
  public void forceUpdate(int x1, int y1, int x2, int y2);
  public float getBack();
  public Direct3dRMFrame getCamera();
  public Direct3dRMDevice getDevice();
  public Direct3dViewport getDirect3DViewport();
  public float getField();
  public float getFront();
  public int getHeight();
  public void getPlane(float[] l, float[] r, float[] b, float[] t);
  public int getProjection();
  public int getUniformScaling();
  public int getWidth();
  public int getX();
  public int getY();
  public void inverseTransform(D3dVector d, D3dRMVector4d s);
  public Direct3dRMPickedArray pick(int x, int y);
  public void render(Direct3dRMFrame f);
  public void setBack(float v);
  public void setCamera(Direct3dRMFrame f);
  public void setField(float v);
  public void setFront(float v);
  public void setPlane(float left, float right, float bottom, float
        top);
  public void setProjection(int val);
  public void setUniformScaling(int flag);
  public void transform(D3dRMVector4d d, D3dVector s);
}

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

The Direct3dRMViewport class inherits the following methods from the Direct3dRMObject class:

addDestroyCallback
duplicate
deleteDestroyCallback
getAppData
getClassName
getName
setAppData
setName

Note This class does not provide an init method. Use the Direct3dRM.createViewport method to create and initialize Direct3dRMViewport objects.

Methods

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 viewport origin and dimensions.

Return Value:

No return value.

ParameterDescription
x The x coordinate of the new viewport position.
y The y coordinate of the new viewport position.
width The new width of the viewport (in pixels).
height The new height of the viewport (in pixels).

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 The updated area's upper-left x coordinate.
y1 The updated area's upper-left y coordinate.
x2 The updated area's lower-right y coordinate.
y2 The updated area's lower-right y coordinate.

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 viewport back clipping plane.

Return Value:

Returns a value describing the position of the plane.

See Also: setBack

getCamera

public Direct3dRMFrame getCamera();

Retrieves the camera for a viewport.

Return Value:

Returns the Direct3dRMFrame object if successful; otherwise, returns null.

See Also: setCamera

getDevice

public Direct3dRMDevice getDevice();

Retrieves the device associated with a viewport.

Return Value:

Returns the Direct3dRMDevice object if successful; otherwise, returns null.

getDirect3DViewport

public Direct3dViewport getDirect3DViewport();

Retrieves the Microsoft® Direct3D® viewport corresponding to the current Direct3dRMViewport object.

Return Value:

Returns the Direct3dViewport object if successful; otherwise, returns null.

getField

public float getField();

Retrieves the viewport's field of view.

Return Value:

Returns a value describing the viewport's field of view.

See Also: setField

getFront

public float getFront();

Retrieves the position of the viewport's front clipping plane.

Return Value:

Returns a value describing the position of the plane.

See Also: setFront

getHeight

public int getHeight();

Retrieves the height (measured in pixels) of the viewport.

Return Value:

Returns the height of the viewport (in pixels).

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 The array variables that receive the left dimensions of the viewport on the front clipping plane.
r The array variables that receive the right dimensions of the viewport on the front clipping plane.
b The array variables that receive the bottom dimensions of the viewport on the front clipping plane.
t The array variables that receive the top dimensions of the viewport on the front clipping plane.

See Also: setPlane

getProjection

public int getProjection();

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

Return Value:

Returns a projection type value.

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; otherwise, returns false.

See Also: setUniformScaling

getWidth

public int getWidth();

Retrieves the width (measured in pixels) of the viewport.

Return Value:

Returns the width of the viewport (in pixels).

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.

inverseTransform

public void inverseTransform(D3dVector d, D3dRMVector4d s);

Transforms the vector in the s parameter (measured 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 Direct3dRMPickedArray 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 Direct3dRMPickedArray object if successful; otherwise, returns null.

ParameterDescription
x The x coordinate used for picking.
y The y coordinate used for picking.

render

public void render(Direct3dRMFrame 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 Direct3dRMFrame 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 The new position of the back clipping plane.

See Also: getBack, setFront

setCamera

public void setCamera(Direct3dRMFrame f);

Sets a camera for a viewport.

Return Value:

No return value.

ParameterDescription
f The Direct3dRMFrame object that represents the camera.

Remarks:

This method sets viewport 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 that of the positive y-axis.

See Also: getCamera

setField

public void setField(float v);

Sets the viewport field of view.

Return Value:

No return value.

ParameterDescription
v The new field of view. If this value is less than or equal to zero, this method does not carry out an 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 The new position of the front clipping plane. If the value passed is less than or equal to zero, this method does not carry out an 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 The minimum x coordinate of the four sides of the viewport.
right The maximum x coordinate of the four sides of the viewport.
bottom The minimum y coordinate of the four sides of the viewport.
top The maximum y coordinate of the four sides of the viewport.

Remarks:

Unlike the setField method, which specifies a centered proportional viewport, this method enables 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 viewport projection.

Return Value:

No return value.

ParameterDescription
val A projection type value.

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 The 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 (measured 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.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.