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

Class d3drm

Applications use the methods of the d3drm class to create Direct3DRM objects and work with system-level variables.

public class d3drm implements Id3drm
{
  public void InternalSetObject(IUnknown lpdd);
  public IUnknown InternalGetObject();
  public d3drmDevice CreateDeviceFromClipper(ddClipper lpDDClipper, GuidData g, int width, int height);
  public d3drmFrame CreateFrame(d3drmFrame parent);
  public d3drmLight CreateLightRGB(int lt, float vred, float vgreen, float vblue);
  public d3drm CreateObject(GuidData rclsid, IUnknown p, GuidData rid);
  public d3drmMesh CreateMesh();
  public d3drmMeshBuilder CreateMeshBuilder();
  public d3drmFace CreateFace();
  public d3drmAnimation CreateAnimation();
  public d3drmAnimationSet CreateAnimationSet();
  public d3drmTexture CreateTexture(d3drmImage image);
  public d3drmLight CreateLight(int t, int c);
  public d3drmMaterial CreateMaterial(float d);
  public d3drmDevice CreateDevice(int v1, int v2);
  public d3drmDevice CreateDeviceFromSurface(GuidData g, dDraw dd, ddSurface DDsBack);
  public d3drmDevice CreateDeviceFromD3D(d3d d3d, d3dDevice dev);
  public d3drmTexture CreateTextureFromSurface(ddSurface ddS);
  public d3drmVisual CreateShadow(d3drmVisual v, d3drmLight l, float px, float py, float pz, float nx, float ny, float nz);
  public d3drmViewport CreateViewport(d3drmDevice dev, d3drmFrame fr, int l, int t, int w, int h);
  public d3drmWrap CreateWrap(int t, d3drmFrame f, float ox, float oy, float oz, float dx, float dy, float dz, float ux, float uy, float uz, float ou, float ov, float su, float sv);
  public d3drmUserVisual CreateUserVisual(IUserVisualCallback fn, IUnknown Arg);
  public d3drmTexture LoadTexture(String name);
  public d3drmTexture LoadTextureFromResource(int hnd);
  public void SetSearchPath(String name);
  public void AddSearchPath(String name);
  public String GetSearchPath();
  public void SetDefaultTextureColors(int ds);
  public void SetDefaultTextureShades(int ds);
  public d3drmDeviceArray GetDevices();
  public d3drmObject GetNamedObject(String name);
  public void EnumerateObjects(IEnumerateObjectsCallback fn, IUnknown pArgs);
  public void LoadFromFileByPos(String fnam, int[] id, GuidData g, int cnt, int options, ILoadCallback fn1, int[] arg1, ILoadTextureCallback fn2, int[] arg2, d3drmFrame f);
  public void Tick(float val);
  public int d3drmCreateColorRGB(float red, float green, float blue);
  public void d3drmVectorCrossProduct(d3dvector lpd, d3dvector lps1, d3dvector lps2);
  public void d3drmVectorNormalise(d3dvector d);
}

The methods can be organized into the following groups:
Animation CreateAnimation
CreateAnimationSet
Devices CreateDevice
CreateDeviceFromClipper
CreateDeviceFromD3D
CreateDeviceFromSurface
GetDevices
Enumeration EnumerateObjects
Faces CreateFace
Frames CreateFrame
Lights CreateLight
CreateLightRGB
Materials CreateMaterial
Meshes CreateMesh
CreateMeshBuilder
Miscellaneous CreateObject
CreateUserVisual
GetNamedObject
Load
Tick
Search paths AddSearchPath
GetSearchPath
SetSearchPath
Shadows CreateShadow
Textures CreateTexture
CreateTextureFromSurface
LoadTexture
LoadTextureFromResource
SetDefaultTextureColors
SetDefaultTextureShades
Viewports CreateViewport
Wraps CreateWrap

AddSearchPath

public void AddSearchPath(String name);

Adds a list of directories to the end of the current file search path.

Return Value:

No return value.

ParameterDescription
name A string specifying the path to add to the current search path.

Remarks:

For Windows, the path should be a list of directories separated by semicolons (;).

See Also: SetSearchPath


CreateAnimation

public d3drmAnimation CreateAnimation();

Creates an empty Direct3DRMAnimation object.

Return Value:

Returns the d3drmAnimation object if successful; null otherwise.


CreateAnimationSet

public d3drmAnimationSet CreateAnimationSet();

Creates an empty d3drmAnimationSet object.

Return Value:

Returns the d3drmAnimationSet object if successful; null otherwise.


CreateDevice

public d3drmDevice CreateDevice(int v1, int v2);

Not implemented on the Windows platform.


CreateDeviceFromClipper

public d3drmDevice CreateDeviceFromClipper(ddClipper lpDDClipper, GuidData g, int width, int height);

Creates a Direct3DRM Windows device by using a specified ddClipper object.

Return Value:

Returns the d3drmDevice object if successful; null otherwise.

ParameterDescription
lpDDClipper A ddClipper object.
g A globally unique identifier (GUID). This parameter can be null.
width and height Width and height of the device to be created.

Remarks:

If the g parameter is null, the system searches for a device with a default set of device capabilities. This is the recommended way to create a Retained-Mode device because it always works, even if the user installs new hardware.

If a hardware device is not found, the monochromatic (ramp) software driver is loaded. An application should enumerate devices instead of specifying null for g if it has special needs that are not met by default settings.


CreateDeviceFromD3D

public d3drmDevice CreateDeviceFromD3D(d3d d3d, d3dDevice dev);

Creates a Direct3DRM Windows device by using specified d3d objects.

Return Value:

Returns the d3drmDevice object if successful; null otherwise.

ParameterDescription
d3d A Direct3D object.
dev A d3dDevice object.


CreateDeviceFromSurface

public d3drmDevice CreateDeviceFromSurface(GuidData g, dDraw dd, ddSurface DDsBack);

Creates a Windows device for rendering from the specified DirectDraw surfaces.

Return Value:

Returns the d3drmDevice object if successful; null otherwise.

ParameterDescription
g The globally unique identifier (GUID) used as the required device driver. If this parameter is null, the default device driver is used.
dd The dDraw object that is the source of the DirectDraw surface.
DDsBack The ddSurface object that represents the back buffer.


CreateFace

public d3drmFace CreateFace();

Creates a d3drmFace object.

Return Value:

Returns the d3drmFace object if successful; null otherwise.


CreateFrame

public d3drmFrame CreateFrame(d3drmFrame parent);

Creates a new child frame of the given parent frame.

Return Value:

Returns the d3drmFrame object if successful; null otherwise.

ParameterDescription
parent A frame object that is to be the parent of the new frame.

Remarks:

The child frame inherits the motion attributes of its parent. For example, if the parent is moving with a given velocity, the child frame will also move with that velocity. Furthermore, if the parent is set rotating, the child frame will rotate about the origin of the parent. Frames that have no parent are called scenes. To create a scene, specify null as the parent. An application can create a frame with no parent and then associate it with a parent frame later by using the AddChild method.

See Also: AddChild


CreateLight

public d3drmLight CreateLight(int t, int c);

Creates a new light source with the given type and color.

Return Value:

Returns the d3drmLight object if successful; null otherwise.

ParameterDescription
t One value of D3DRMLIGHT_ type.
c Color of the light.


CreateLightRGB

public d3drmLight CreateLightRGB(int lt, float vred, float vgreen, float vblue);

Creates a new light source with the given type and color.

Return Value:

Returns the d3drmLight object if successful; null otherwise.

ParameterDescription
lt One value of D3DRMLIGHT_ type.
vRed, vGreen, and vBlue Color of the light.


CreateMaterial

public d3drmMaterial CreateMaterial(float d);

Creates a material with the given specular property.

Return Value:

Returns the d3drmMaterial object if successful; null otherwise.

ParameterDescription
vPower Sharpness of the reflected highlights, with a value of 5 giving a metallic look and higher values giving a more plastic look to the rendered surface.


CreateMesh

public d3drmMesh CreateMesh();

Creates a new mesh object with no faces. The mesh is not visible until it is added to a frame.

Return Value:

Returns the d3drmMesh object if successful; null otherwise.


CreateMeshBuilder

public d3drmMeshBuilder CreateMeshBuilder();

Creates a new mesh builder object.

Return Value:

Returns the d3drmMeshBuilder object if successful; null otherwise.


CreateObject

public d3drm CreateObject(GuidData rclsid, IUnknown p, GuidData rid);

Creates a new object without initializing the object.

Return Value:

Returns the d3drm object if successful; null otherwise.

ParameterDescription
rclsid Class identifier for the new object.
p Reserved.
rid Interface identifier of the object to be created.

Remarks:

An application that calls this method must initialize the object that has been created. (The other creation methods of the d3drm class initialize the object automatically.) To initialize the new object, you should use the Init method for that object. An application should call the Init method only once to initialize any given object.


CreateShadow

public d3drmVisual CreateShadow(d3drmVisual v, d3drmLight l, float px, float py, float pz, float nx, float ny, float nz);

Creates a shadow by using the specified visual and light, projecting the shadow onto the specified plane. The shadow is a visual that should be added to the frame that contains the visual.

Return Value:

Returns the d3drmVisual object if successful; null otherwise.

ParameterDescription
v The d3drmVisual object that is casting the shadow.
l The d3drmLight object that is the light source.
px, py, and pz Plane that the shadow is to be projected on.
nx, ny, and nz Normal to the plane that the shadow is to be projected on.


CreateTexture

public d3drmTexture CreateTexture(d3drmImage image);

Creates a texture from an image in memory.

Return Value:

Returns the d3drmTexture object if successful; null otherwise.

ParameterDescription
image A d3drmImage object describing the source for the texture.

Remarks:

The memory associated with the image is used each time the texture is rendered, rather than the memory being copied into Direct3DRM's buffers. This allows the image to be used both as a rendering target and as a texture.


CreateTextureFromSurface

public d3drmTexture CreateTextureFromSurface(ddSurface ddS);

Creates a texture from a specified DirectDraw surface.

Return Value:

Returns the d3drmTexture object if successful; null otherwise.

ParameterDescription
ddS The ddSurface object containing the texture.


CreateUserVisual

public d3drmUserVisual CreateUserVisual(IUserVisualCallback fn, IUnknown Arg);

Creates an application-defined visual object, which can then be added to a scene and rendered by using an application-defined handler.

Return Value:

Returns the d3drmUserVisual object if successful; null otherwise.

ParameterDescription
fn Callback interface containing the application-defined callback function.
Arg Application-defined data passed to the callback function.


CreateViewport

public d3drmViewport CreateViewport(d3drmDevice dev, d3drmFrame fr, int l, int t, int w, int h);

Creates a viewport on a device with device coordinates (dwXPos, dwYPos) to (dwXPos + dwWidth, dwYPos + dwHeight).

Return Value:

Returns the d3drmViewport object if successful; null otherwise.

ParameterDescription
dev Device on which the viewport is to be created.
fr Frame that describes the position and direction of the view.
l, t, w, and h Position and size of the viewport, in device coordinates.

Remarks:

The viewport displays objects in the scene that contains the camera, with the view direction and up vector taken from the camera.


CreateWrap

public d3drmWrap CreateWrap(int t, d3drmFrame f, float ox, float oy, float oz, float dx, float dy, float dz, float ux, float uy, float uz, float ou, float ov, float su, float sv);

Creates a wrapping function that can be used to assign texture coordinates to faces and meshes. The vector [ox oy oz] gives the origin of the wrap, [dx dy dz] gives its z-axis, and [ux uy uz] gives its y-axis. The 2D vectors [ou ov] and [su sv] give an origin and scale factor in the texture applied to the result of the wrapping function.

Return Value:

Returns the d3drmWrap object if successful; null otherwise.

ParameterDescription
t One value of D3DRMWRAP_ type.
f Reference frame for the wrap.
ox, oy, and oz Origin of the wrap.
dx, dy, and dz The z-axis of the wrap.
ux, uy, and uz The y-axis of the wrap.
ou and ov Origin in the texture.
su and sv Scale factor in the texture.


EnumerateObjects

public void EnumerateObjects(IEnumerateObjectsCallback fn, IUnknown pArgs);

Calls the callback function specified by the fn parameter on each of the active Direct3DRM objects.

Return Value:

No return value.

ParameterDescription
fn Callback interface that contains an application-defined callback function to be called with each d3drmObject object and the application-defined argument.
pArgs Application-defined data passed to the callback function.


GetDevices

public d3drmDeviceArray GetDevices();

Returns all the Direct3DRM devices that have been created in the system.

Return Value:

Returns the d3drmDeviceArray object if successful; null otherwise.


GetNamedObject

public d3drmObject GetNamedObject(String name);

Finds a d3drmObject object, given its name.

Return Value:

Returns the d3drmObject object if successful; null otherwise.

ParameterDescription
name Name of the object to be searched for.


GetSearchPath

public String GetSearchPath();

Returns the current file search path.

Return Value:

Returns a string specifying the search path.

ParameterDescription
lpdwSize Address of the number of returned path elements. This parameter cannot be NULL.

See Also: SetSearchPath


LoadTexture

public d3drmTexture LoadTexture(String name);

Loads a texture from the specified file. This texture can have 8, 24, or 32 bits-per-pixel, and it should be in either the Windows bitmap (.bmp) or Portable Pixmap (.ppm) P6 format.

Return Value:

Returns the d3drmTexture object if successful; null otherwise.

ParameterDescription
name Name of the required .bmp or .ppm file.


LoadTextureFromResource

public d3drmTexture LoadTextureFromResource(int hnd);

Loads a texture from a specified resource.

Return Value:

Returns the d3drmTexture object if successful; null otherwise.

ParameterDescription
hnd Handle of the resource.


SetDefaultTextureColors

public void SetDefaultTextureColors(int ds);

Sets the default colors to be used for a d3drmTexture object.

Return Value:

No return value.

ParameterDescription
ds Number of colors.

Remarks:

This method affects the texture colors only when it is called before the CreateTexture method; it has no effect on textures that have already been created.


SetDefaultTextureShades

public void SetDefaultTextureShades(int ds);

Sets the default shades to be used for an d3drmTexture object.

Return Value:

No return value.

ParameterDescription
ds Number of shades.

Remarks:

This method affects the texture shades only when it is called before the CreateTexture method; it has no effect on textures that have already been created.


SetSearchPath

public void SetSearchPath(String name);

Sets the current file search path from a list of directories.

Return Value:

No return value.

ParameterDescription
name A string specifying the path to set as the current search path.

Remarks:

The default search path is taken from the value of the D3DPATH environment variable. If this is not set, the search path will be empty. When opening a file, the system first looks for the file in the current working directory and then checks every directory in the search path.

See Also: GetSearchPath


Tick

public void Tick(float val);

Performs the Direct3DRM system heartbeat. When this method is called, the positions of all moving frames are updated according to their current motion attributes, the scene is rendered to the current device, and relevant callback functions are called at their appropriate times. Control is returned when the rendering cycle is complete.

Return Value:

No return value.

ParameterDescription
val Velocity and rotation step for the SetRotation and SetVelocity methods.

Remarks:

You can implement this method by using other Retained-Mode methods to allow more flexibility in rendering a scene.


LoadFromFileByPos

public void LoadFromFileByPos(String fnam, int[] id, GuidData g, int cnt, int options,
ILoadCallback fn1, int[] arg1, ILoadTextureCallback fn2, int[] arg2, d3drmFrame f);

Loads an object.

Return Value:

No return value.

ParameterDescription
fnam Name of the file from which to load the object.
id Object position. The value of the first variable in the array gives the object's order in the file.
g Interface identifier to be loaded.
cnt Number of identifiers specified in the g parameter.
options A load options type.
fn1 Callback interface that contains a load callback function called when the system reads the specified object.
arg1 Application-defined data passed to the load callback function.
fn2 Callback interface that contains a load texture callback function called to load any textures used by an object that require special formatting. This parameter can be null.
arg2 Application-defined data passed to the load texture callback function.
f A parent frame. This information is useful when loading d3drmAnimationSet or d3drmFrame objects because these objects would be created with a null parent otherwise. This value can be null.


d3drmCreateColorRGB

public int d3drmCreateColorRGB(float red, float green, float blue);

Creates an RGB color value.

Return Value:

Returns a color value.

ParameterDescription
red, green, and blue Color values.


d3drmVectorCrossProduct

public void d3drmVectorCrossProduct(d3dvector lpd, d3dvector lps1, d3dvector lps2);

Calculates the cross product of two vectors.

Return Value:

No return value.

ParameterDescription
lpd A d3dvector object that receives the cross product.
lps1 A d3dvector object that contains a vector.
lps2 A d3dvector object that contains a vector.


d3drmVectorNormalise

public void d3drmVectorNormalise(d3dvector d);

Normalizes a vector.

Return Value:

No return value.

ParameterDescription
d A d3dvector object that contains the vector to normalize. This object also receives the normalized vector.



Top© 1996 Microsoft Corporation. All rights reserved.