Packages
 In this topic

*Methods

 

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

 


Class Direct3dDevice

public class Direct3dDevice implements IDirect3dDevice
{
  // Methods
  public void addViewport(Direct3dViewport vport);
  public void beginScene();
  public Direct3dExecuteBuffer createExecuteBuffer(
        D3dExecuteBufferDesc ebufDesc);
  public int createMatrix();
  public void deleteMatrix(int hdl);
  public void deleteViewport(Direct3dViewport vport);
  public void endScene();
  public void enumTextureFormats(IEnumTextureFormatsCallback fn,
        IUnknown args);
  public void execute(Direct3dExecuteBuffer eb,
        Direct3dViewport vp, int flags);
  public void getCaps(D3dDeviceDesc hwDesc, D3dDeviceDesc helDesc);
  public Direct3d getDirect3D();
  public void getMatrix(int hdl, D3dMatrix mat);
  public void getPickRecords(int[] flags, D3dPickRecord val);
  public void getStats(D3dStats stat);
  public void initialize(Direct3d dev, _Guid g,
        D3dDeviceDesc devDesc);
  public Direct3dViewport nextViewport(Direct3dViewport vp1,
        int flags);
  public void pick(Direct3dExecuteBuffer eb,
        Direct3dViewport vport, int flags, D3dRect rectangle);
  public void setMatrix(int hdl, D3dMatrix mat);
  public void swapTextureHandles(Direct3dTexture tex1,
        Direct3dTexture tex2);
}

Applications use the methods of the Direct3dDevice class to retrieve and set the capabilities of Microsoft® Direct3D® devices.

Methods

addViewport

public void addViewport(Direct3dViewport vport);

Adds the specified viewport to the list of viewport objects associated with the device.

Return Value:

No return value.

ParameterDescription
vport The viewport object that should be associated with this Direct3dDevice object.

beginScene

public void beginScene();

Begins a scene.

Return Value:

No return value.

Remarks:

Applications must call this method before performing any rendering, and must call endScene when rendering is complete.

See Also: endScene

createExecuteBuffer

public Direct3dExecuteBuffer createExecuteBuffer(
        D3dExecuteBufferDesc ebufDesc);

Allocates an execute buffer for a display list. The list may be read by hardware DMA into VRAM for processing. All display primitives in the buffer that have indices to vertices must also have those vertices in the same buffer.

Return Value:

Returns the Direct3dExecuteBuffer if successful; otherwise, null.

ParameterDescription
ebufDesc Describes the Direct3dExecuteBuffer object to be created. The call will fail if a buffer of at least the specified size cannot be created.

Remarks:

The D3dExecuteBufferDesc object describes the execute buffer to be created. At a minimum, the application must specify the size required. If the application specifies DEBCAPS_VIDEO_MEMORY in the capabilities field, Direct3D will attempt to keep the execute buffer in video memory.

The application can use the lock method to request that the memory be moved. When this method returns, it will adjust the contents of the D3dExecuteBufferDesc object to indicate whether the data resides in system or video memory.

createMatrix

public int createMatrix();

Creates a matrix.

Return Value:

Returns a handle to the matrix that is created. The call will fail if a buffer of at least the size of the matrix cannot be created.

See Also: deleteMatrix, setMatrix

deleteMatrix

public void deleteMatrix(int hdl);

Deletes a matrix handle. This matrix handle must have been created by using the createMatrix method.

Return Value:

No return value.

ParameterDescription
hdl Matrix handle to be deleted.

See Also: createMatrix, setMatrix

deleteViewport

public void deleteViewport(Direct3dViewport vport);

Removes the specified viewport from the list of viewport objects associated with the device.

Return Value:

No return value.

ParameterDescription
vport A viewport object that should be disassociated with this Direct3dDevice object.

endScene

public void endScene();

Ends a scene that was begun by calling the beginScene method.

Return Value:

No return value.

See Also: beginScene

enumTextureFormats

public void enumTextureFormats(IEnumTextureFormatsCallback fn,
        IUnknown args);

Queries the current driver for a list of supported texture formats.

Return Value:

No return value.

ParameterDescription
fn Callback interface containing the function that the enumeration procedure will call for each texture format.
args Application-defined data passed to the callback function.

execute

public void execute(Direct3dExecuteBuffer eb, Direct3dViewport vp,
        int flags);

Executes a buffer.

Return Value:

No return value.

ParameterDescription
eb The Direct3dExecute buffer to be executed.
vp The Direct3dViewport object that describes the transformation context, into which the execute buffer will be rendered.
flags A value of D3DEXECUTE_ type, specifying whether objects in the buffer should be clipped.

getCaps

public void getCaps(D3dDeviceDesc hwDesc, D3dDeviceDesc helDesc);

Retrieves the capabilities of the Direct3dDevice object.

Return Value:

No return value.

ParameterDescription
hwDesc The D3dDeviceDesc object that receives the hardware features of the device.
helDesc The D3dDeviceDesc object that receives the software emulation being provided.

Remarks:

This method does not retrieve the capabilities of the display device. To retrieve this information, use the getCaps method.

getDirect3D

public Direct3d getDirect3D();

Retrieves the current Direct3d object.

Return Value:

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

getMatrix

public void getMatrix(int hdl, D3dMatrix mat);

Retrieves a matrix from a matrix handle. This matrix handle must have been created by using the createMatrix method.

Return Value:

No return value.

ParameterDescription
hdl Handle of the matrix to be retrieved.
mat The D3dMatrix object that receives the matrix.

See Also: createMatrix, deleteMatrix, setMatrix

getPickRecords

public void getPickRecords(int[] flags, D3dPickRecord val);

Retrieves the pick records for a device.

Return Value:

No return value.

ParameterDescription
flags Valid flags for this method.
val The D3dPickRecord object that receives a pick record.

getStats

public void getStats(D3dStats stat);

Retrieves statistics about a device.

Return Value:

No return value.

ParameterDescription
stat The D3dStats object that receives the statistics.

initialize

public void initialize(Direct3d dev, _Guid g, D3dDeviceDesc devDesc);

Initializes a Direct3dDevice object.

Return Value:

No return value.

ParameterDescription
dev The Direct3D device to use as an initializer.
g The globally unique identifier (GUID) used as the interface identifier.
devDesc The D3dDeviceDesc object describing the Direct3dDevice object to be initialized.

nextViewport

public Direct3dViewport nextViewport(Direct3dViewport vp1, int flags);

Enumerates the viewports associated with the device.

Return Value:

Returns the next Direct3dViewport object in the list of viewports associated with this Direct3DDevice object if successful; otherwise, returns null.

ParameterDescription
vpl A viewport in the list of viewports associated with this Direct3dDevice object.
flags A value of D3DNEXT_ type, specifying which viewport to retrieve from the list of viewports. The default setting is D3DNEXT_NEXT.

pick

public void pick(Direct3dExecuteBuffer eb, Direct3dViewport vport,
        int flags, D3dRect rectangle);

Executes a buffer without performing any rendering, but returns a z-ordered list of offsets to the primitives that cover the rectangle specified by Rect.

This call fails if the Direct3dExecuteBuffer object is locked.

Return Value:

No return value.

ParameterDescription
eb An execute buffer from which the z-ordered list is retrieved.
vport A viewport in the list of viewports associated with this Direct3dDevice object.
flags No flags are currently defined for this method.
Rect The D3dRect object specifying the range of device coordinates to be picked.

Remarks:

If the x1 and x2 fields of the object specified in the Rect parameter are equal, and the y1 and y2 members are equal, a single pixel is used for picking. The coordinates are specified in device-pixel space.

All Direct3dExecuteBuffer objects must be attached to a Direct3dDevice object for this method to succeed.

See Also: getPickRecords

setMatrix

public void setMatrix(int hdl, D3dMatrix mat);

Applies a matrix to a matrix handle. This matrix handle must have been created by using the createMatrix method.

Return Value:

No return value.

ParameterDescription
hdl Matrix handle to be set.
mat The D3dMatrix object that describes the matrix to be set.

Remarks:

Transformations inside the execute buffer include a handle of a matrix. The setMatrix method enables an application to change this matrix without having to lock and unlock the execute buffer.

See Also: createMatrix, getMatrix, deleteMatrix

swapTextureHandles

public void swapTextureHandles(Direct3dTexture tex1, Direct3dTexture tex2);

Swaps two texture handles.

Return Value:

No return value.

ParameterDescription
tex1 The texture to be swapped.
tex2 The texture to be swapped.

Remarks:

This method is useful when an application is changing all the textures in a complicated object.

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