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.
public void addViewport(Direct3dViewport vport);
Adds the specified viewport to the list of viewport objects associated with the device.
Return Value:
No return value.
Parameter | Description |
vport
| The viewport object that should be associated with this Direct3dDevice object.
|
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
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.
Parameter | Description |
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.
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
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.
Parameter | Description |
hdl
| Matrix handle to be deleted.
|
See Also: createMatrix, setMatrix
public void deleteViewport(Direct3dViewport vport);
Removes the specified viewport from the list of viewport objects associated with the device.
Return Value:
No return value.
Parameter | Description |
vport
| A viewport object that should be disassociated with this Direct3dDevice object.
|
public void endScene();
Ends a scene that was begun by calling the beginScene method.
Return Value:
No return value.
See Also: beginScene
public void enumTextureFormats(IEnumTextureFormatsCallback fn,
IUnknown args);
Queries the current driver for a list of supported texture formats.
Return Value:
No return value.
Parameter | Description |
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.
|
public void execute(Direct3dExecuteBuffer eb, Direct3dViewport vp,
int flags);
Executes a buffer.
Return Value:
No return value.
Parameter | Description |
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.
|
public void getCaps(D3dDeviceDesc hwDesc, D3dDeviceDesc helDesc);
Retrieves the capabilities of the Direct3dDevice object.
Return Value:
No return value.
Parameter | Description |
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.
public Direct3d getDirect3D();
Retrieves the current Direct3d object.
Return Value:
Returns the Direct3d object if successful; otherwise, returns null.
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.
Parameter | Description |
hdl
| Handle of the matrix to be retrieved.
|
mat
| The D3dMatrix object that receives the matrix.
|
See Also: createMatrix, deleteMatrix, setMatrix
public void getPickRecords(int[] flags, D3dPickRecord val);
Retrieves the pick records for a device.
Return Value:
No return value.
Parameter | Description |
flags
| Valid flags for this method.
|
val
| The D3dPickRecord object that receives a pick record.
|
public void getStats(D3dStats stat);
Retrieves statistics about a device.
Return Value:
No return value.
Parameter | Description |
stat
| The D3dStats object that receives the statistics.
|
public void initialize(Direct3d dev, _Guid g, D3dDeviceDesc devDesc);
Initializes a Direct3dDevice object.
Return Value:
No return value.
Parameter | Description |
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.
|
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.
Parameter | Description |
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.
|
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.
Parameter | Description |
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
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.
Parameter | Description |
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
public void swapTextureHandles(Direct3dTexture tex1, Direct3dTexture tex2);
Swaps two texture handles.
Return Value:
No return value.
Parameter | Description |
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.