Packages
 In this topic

*Methods

 

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

 


Class Direct3dRM

public class Direct3dRM implements IDirect3dRM
{
  // Methods
  public void addSearchPath(String name);
  public Direct3dRMAnimation createAnimation();
  public Direct3dRMAnimationSet createAnimationSet();
  public int createColorRGB(float red, float green, float blue);
  public Direct3dRMDevice createDevice(int v1, int v2);
  public Direct3dRMDevice createDeviceFromClipper(DirectDrawClipper
        lpDDClipper, _Guid g, int width, int height);
  public Direct3dRMDevice createDeviceFromD3D(Direct3d direct3d,
        Direct3dDevice direct3dDevice));
  public Direct3dRMDevice createDeviceFromSurface(_Guid g,
        DirectDraw dd, DirectDrawSurface DDsBack);
  public Direct3dRMFace createFace();
  public Direct3dRMFrame createFrame(Direct3dRMFrame parent);
  public Direct3dRMLight createLight(int t, int c);
  public Direct3dRMLight createLightRGB(int lt, float vred,
        float vgreen, float vblue);
  public Direct3dRMMaterial createMaterial(float d);
  public Direct3dRMMesh createMesh();
  public Direct3dRMMeshBuilder createMeshBuilder();
  public Direct3dRMVisual createShadow(Direct3dRMVisual v,
        Direct3dRMLight l, float px, float py, float pz,
        float nx, float ny, float nz);
  public Direct3dRMVisual createShadowFromFrame(
        Direct3dRMFrame frame, Direct3dRMLight direct3dRMLight,
        float px, float py, float pz, float nx, float ny,
        float nz);
  public Direct3dRMVisual createShadowFromMesh(Direct3dRMMesh mesh,
        Direct3dRMLight direct3dRMLight, float px, float py,
        float pz, float nx, float ny, float nz);
  public Direct3dRMVisual createShadowFromMeshBuilder(
        Direct3dRMMeshBuilder mb, Direct3dRMLight l, float px,
        float py, float pz, float nx, float ny, float nz);
  public Direct3dRMTexture createTexture(D3dRMImage image,
        byte[] buffer1, byte[] pal);
  public Direct3dRMTexture createTextureFromSurface(
        DirectDrawSurface ddS);
  public Direct3dRMUserVisual createUserVisual(
        IUserVisualCallback fn, IUnknown Arg);
  public Direct3dRMViewport createViewport(Direct3dRMDevice dev,
        Direct3dRMFrame fr, int l, int t, int w, int h);
  public Direct3dRMWrap createWrap(int t, Direct3dRMFrame 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 void enumerateObjects(IEnumerateObjectsCallback fn,
        IUnknown pArgs);
  public Direct3dRMDeviceArray getDevices();
  public Direct3dRMObject getNamedObject(String name);
  public String getSearchPath();
  public void loadFromFileByPos(String fnam, int[] id, _Guid g, int
        cnt, int options, ILoadCallback fn1, int[] arg1,
        ILoadTextureCallback fn2, int[] arg2, Direct3dRMFrame f);
  public Direct3dRMTexture loadTexture(String name);
  public Direct3dRMTexture loadTextureFromResource(int hnd);
  public void setDefaultTextureColors(int ds);
  public void setDefaultTextureShades(int ds);
  public void setSearchPath(String name);
  public void tick(float val);
  public void vectorAdd(D3dVector lpd, D3dVector lps1,
        D3dVector lps2);
  public void vectorCrossProduct(D3dvector lpd, D3dvector lps1,
        D3dvector lps2);
  public float vectorDotProduct(D3dVector lps1, D3dVector lps2);
  public float vectorModulus(D3dVector d);
  public void vectorNormalise(D3dvector d);
  public void vectorRandom(D3dVector d);
  public void vectorReflect(D3dVector lpd, D3dVector lpRay,
        D3dVector lpNorm);
  public void vectorRotate(D3dVector lpr, D3dVector lpv,
        D3dVector lpaxis, float theta);
  public void vectorScale(D3dVector lpd, D3dVector lps,
        float factor);
  public void vectorSubtract(D3dVector lpd, D3dVector lps1,
        D3dVector lps2);
}

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

Methods

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 Direct3dRMAnimation createAnimation();

Creates an empty Direct3dRMAnimation object.

Return Value:

Returns the Direct3dRMAnimation object if successful; otherwise, null.

createAnimationSet

public Direct3dRMAnimationSet createAnimationSet();

Creates an empty Direct3dRMAnimationSet object.

Return Value:

Returns the Direct3dRMAnimationSet object if successful; otherwise, null.

createColorRGB

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

Creates an RGB color value.

Return Value:

Returns a color value.

ParameterDescription
red The red component of the color.
green The green component of the color.
blue The blue component of the color.

createDevice

public Direct3dRMDevice createDevice(int v1, int v2);

Not implemented on the Windows platform.

createDeviceFromClipper

public Direct3dRMDevice createDeviceFromClipper(
        DirectDrawClipper lpDDClipper, _Guid g, int width, int height);

Creates a Microsoft® Direct3DRM windows device by using a specified DirectDrawClipper object.

Return Value:

Returns the Direct3dRMDevice object if successful; otherwise, null.

ParameterDescription
lpDDrawClipper A DirectDrawClipper object.
g A globally unique identifier (GUID). This parameter can be null.
width The width of the device to be created.
height The 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.

If you are having palette problems using this method, try using the createDeviceFromD3D as an alternative.

createDeviceFromD3D

public Direct3dRMDevice createDeviceFromD3D(Direct3d direct3d,
        Direct3dDevice direct3dDevice));

Creates a Microsoft ®Direct3dRM Windows® device by using specified Direct3d objects. It is important that all objects are derived from the same DirectDraw object. In DirectX for Java, it is also important to use create methods to construct objects, rather than using new. Using new to create certain DirectX for Java objects creates uninitialized objects that can be difficult or impossible to manipulate.

See the createDeviceFromSurface method for a sample using standard techniques to create a Retain Mode object.

Return Value:

Returns the Direct3dRMDevice object if successful; otherwise, null.

ParameterDescription
direct3d A Microsoft® Direct3D® object.
direct3dDevice A Direct3dDevice object.

createDeviceFromSurface

public Direct3dRMDevice createDeviceFromSurface(_Guid g, DirectDraw dd,
        DirectDrawSurface DDsBack);

Creates a Microsoft® Windows® device for rendering from the specified DirectDraw surfaces. It is important that all objects are derived from the same DirectDraw object. In DirectX for Java, it is also important to use create methods to construct objects, rather than using new. Using new to create certain DirectX for Java objects creates uninitialized objects that can be difficult or impossible to manipulate.

The following code example shows how to use the createDeviceFromSurface method and create appropriate objects without using new.

int hw =0;  //depends on hardware
dd = new DirectDraw();    
dd.setCooperativeLevel (this, DDSCL_NORMAL);

//Create a surface
ddsd = new DDSurfaceDesc();
ddsd.flags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;

if (hw==1){
ddsd.ddsCaps = DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN | CAPS_VIDEOMEMORY;
}
else{
ddsd.ddsCaps = DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
}
ddsd.width   = w;	
ddsd.height  = h; 
ddsOffscreen = dd.createSurface(ddsd);
d3d = dd.createD3D();

// Find the device's Guid for a device type specified by 
// application info object - can be RGB or MONO
//
_Guid g = d3d.findDeviceForColorModel(D3DCOLOR_RGB, hw );
rmDevice = d3drm.createDeviceFromSurface(g, dd,ddsOffscreen);

Return Value:

Returns the Direct3dRMDevice object if successful; otherwise, null.

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 DirectDraw object that is the source of the DirectDraw surface.
DDsBack The DirectDrawSurface object that represents the back buffer.

createFace

public Direct3dRMFace createFace();

Creates a Direct3dRMFace object.

Return Value:

Returns the Direct3dRMFace object if successful; otherwise, null.

createFrame

public Direct3dRMFrame createFrame(Direct3dRMFrame parent);

Creates a new child frame of the given parent frame.

Return Value:

Returns the Direct3dRMFrame object if successful; otherwise, null.

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: com.ms.directX.Direct3dRMFrame

createLight

public Direct3dRMLight createLight(int t, int c);

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

Return Value:

Returns the Direct3dRMLight object if successful; otherwise, null.

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

createLightRGB

public Direct3dRMLight createLightRGB(int lt, float vred, float vgreen,
        float vblue);

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

Return Value:

Returns the Direct3dRMLight object if successful; otherwise, null.

ParameterDescription
lt One value of D3DRMLIGHT_ type.
vred The red component of the color.
vgreen The green component of the color.
vblue The blue component of the color.

createMaterial

public Direct3dRMMaterial createMaterial(float d);

Creates a material with the given specular property.

Return Value:

Returns the Direct3dRMMaterial object if successful; otherwise, null.

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 Direct3dRMMesh 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 Direct3dRMMesh object if successful; otherwise, null.

createMeshBuilder

public Direct3dRMMeshBuilder createMeshBuilder();

Creates a new mesh builder object.

Return Value:

Returns the Direct3dRMMeshBuilder object if successful; otherwise, null.

createShadow

public Direct3dRMVisual createShadow(Direct3dRMVisual v, Direct3dRMLight 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 Direct3dRMVisual object if successful; otherwise, null.

ParameterDescription
v The Direct3dRMVisual object that is casting the shadow.
l The Direct3dRMLight object that is the light source.
px The x component of the plane that the shadow is to be projected on.
py The y component of the plane that the shadow is to be projected on.
pz The z component of the plane that the shadow is to be projected on.
nx The x component of the normal to the plane that the shadow is to be projected on.
ny The y component of the normal to the plane that the shadow is to be projected on.
nz The z component of the normal to the plane that the shadow is to be projected on.

createShadowFromFrame

public Direct3dRMVisual createShadowFromFrame(Direct3dRMFrame frame,
        Direct3dRMLight direct3dRMLight, float px, float py, float pz,
        float nx, float ny, float nz);

Creates a shadow by using the specified frame 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 Direct3dRMVisual object if successful; otherwise, null.

ParameterDescription
frame The Direct3dRMFrame object that is casting the shadow.
l The Direct3dRMLight object that is the light source.
px The x component of the plane that the shadow is to be projected on.
py The y component of the plane that the shadow is to be projected on.
pz The z component of the plane that the shadow is to be projected on.
nx The x component of the normal to the plane that the shadow is to be projected on.
ny The y component of the normal to the plane that the shadow is to be projected on.
nz The z component of the normal to the plane that the shadow is to be projected on.

createShadowFromMesh

public Direct3dRMVisual createShadowFromMesh(Direct3dRMMesh mesh,
        Direct3dRMLight direct3dRMLight, float px, float py, float pz,
        float nx, float ny, float nz);

Creates a shadow by using the specified mesh 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 Direct3dRMVisual object if successful; otherwise, null.

ParameterDescription
mesh The Direct3dRMMesh object that is casting the shadow.
l The Direct3dRMLight object that is the light source.
px The x component of the plane that the shadow is to be projected on.
py The y component of the plane that the shadow is to be projected on.
pz The z component of the plane that the shadow is to be projected on.
nx The x component of the normal to the plane that the shadow is to be projected on.
ny The y component of the normal to the plane that the shadow is to be projected on.
nz The z component of the normal to the plane that the shadow is to be projected on.

createShadowFromMeshBuilder

public Direct3dRMVisual createShadowFromMeshBuilder(
        Direct3dRMMeshBuilder mb, Direct3dRMLight l, float px, float py,
        float pz, float nx, float ny, float nz);

Creates a shadow by using the specified mesh builder 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 Direct3dRMVisual object if successful; otherwise, null.

ParameterDescription
v The Direct3dRMMeshBuilder object that is casting the shadow.
l The Direct3dRMLight object that is the light source.
px The x component of the plane that the shadow is to be projected on.
py The y component of the plane that the shadow is to be projected on.
pz The z component of the plane that the shadow is to be projected on.
nx The x component of the normal to the plane that the shadow is to be projected on.
ny The y component of the normal to the plane that the shadow is to be projected on.
nz The z component of the normal to the plane that the shadow is to be projected on.

createTexture

public Direct3dRMTexture createTexture(D3dRMImage image, byte[] buffer1,
        byte[] pal);

Creates a texture from an image in memory.

Return Value:

Returns the Direct3dRMTexture object if successful; otherwise, null.

ParameterDescription
image A Direct3dRMImage object describing the source for the texture.
buffer1 The image buffer.
pal The image palette.

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 Direct3dRMTexture createTextureFromSurface(DirectDrawSurface ddS);

Creates a texture from a specified DirectDraw surface.

Return Value:

Returns the Direct3dRMTexture object if successful; otherwise, null.

ParameterDescription
ddS The DirectDrawSurface object containing the texture.

createUserVisual

public Direct3dRMUserVisual 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 Direct3dRMUserVisual object if successful; otherwise, null.

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

createViewport

public Direct3dRMViewport createViewport(Direct3dRMDevice dev,
        Direct3dRMFrame fr, int l, int t, int w, int h);

Creates a viewport on a device with device coordinates (xPos, yPos) to (xPos + width, yPos + height).

Return Value:

Returns the Direct3dRMViewport object if successful; otherwise, null.

ParameterDescription
dev The device that the viewport is to be created on.
fr The frame that describes the position and direction of the view.
l The x coordinate of the upper-left corner of the viewport, in device coordinates.
t The y coordinate of the upper-left corner of the viewport, in device coordinates.
w Width of the viewport, in device coordinates.
h Height 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 Direct3dRMWrap createWrap(int t, Direct3dRMFrame 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 Direct3dRMWrap object if successful; otherwise, null.

ParameterDescription
t One value of the D3DRMWRAP_ type.
f The reference frame for the wrap.
ox The x component of the wrap's origin.
oy The y component of the wrap's origin.
oz The z component of the wrap's origin
dx The x component of the z-axis of the wrap.
dy The y component of the z-axis of the wrap.
dz The z component of the z-axis of the wrap.
ux The x component of the y-axis of the wrap.
uy The y component of the y-axis of the wrap.
uz The z component of the y-axis of the wrap.
ou Origin in the texture.
ov Origin in the texture.
su Scale factor in the texture.
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 A callback interface that contains an application-defined callback function to be called with each Direct3dRMObject object and the application-defined argument.
pArgs Application-defined data passed to the callback function.

getDevices

public Direct3dRMDeviceArray getDevices();

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

Return Value:

Returns the Direct3dRMDeviceArray object if successful; otherwise, null.

getNamedObject

public Direct3dRMObject getNamedObject(String name);

Retrieves a Direct3dRMObject object, given its name.

Return Value:

Returns the Direct3dRMObject object if successful; otherwise, null.

ParameterDescription
name The 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.

See Also: setSearchPath

loadFromFileByPos

public void loadFromFileByPos(String fnam, int[] id, _Guid g, int cnt,
        int options, ILoadCallback fn1, int[] arg1,
        ILoadTextureCallback fn2, int[] arg2, Direct3dRMFrame f);

Loads an object. This method enables you to inspect an X file and decide what object to load, using the ILoadCallback interface.

The following example shows how this method can be used.

//Indicate what type of objects will be sent to the callback.

IID_IDirect3DRMFrame.set(0xeb16cb03, (short)0xd271,(short) 0x11ce,
 (byte)0xac, (byte)0x48, (byte)0x0,(byte) 0x0,(byte) 0xc0, (byte)0x38,
 (byte)0x25, (byte)0xa1);
IID_IDirect3DRMMeshBuilder.set(0xa3a80d02, (short)0x6e12, (short)0x11cf,
 (byte)0xac, (byte)0x4a, (byte)0x0, (byte)0x0, (byte)0xc0, (byte)0x38,
 (byte)0x25, (byte)0xa1);
IID_IDirect3DRMAnimationSet.set(0xeb16cb0e, (short)0xd271,(short) 0x11ce,
 (byte)0xac, (byte)0x48, (byte)0x0, (byte)0x0, (byte)0xc0, (byte)0x38,
 (byte)0x25, (byte)0xa1);

// If you use 0, you will retrieve all objects.
d3drm.loadFromFileByPos(sFile, 
    null, IID_IDirect3DRMFrame, 1,
    D3DRM_LOADFROMFILE, this,
    null, this,
    null, f_env);

public void callbackLoad(Direct3dRMObject obj, _Guid id, IUnknown Arg)
{	
    String sType=obj.getClassName();
    if (sType.equals("Frame"))
    {
         Direct3dRMFrame f=obj.getd3drmFrame();		 
         f_env.addChild(f);
    }
    if (sType.equals("Builder"))
    {				
         Direct3dRMMeshBuilder m=obj.getd3drmMeshBuilder();
         System.out.println("OK to convert");
         f_env.addVisualMeshBuilder(m);
    }
}
// other callbacks ...

Return Value:

No return value.

ParameterDescription
fnam The name of the file that the object is loaded from.
id The object position. The value of the first variable in the array gives the object's order in the file.
g The interface identifier to be loaded.
cnt The number of identifiers specified in the g parameter.
options A load options type.
fn1 The 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 The 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 Direct3dRMAnimationSet or Direct3dRMFrame objects because otherwise, these objects would be created with a null parent. This value can be null.

loadTexture

public Direct3dRMTexture 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 Direct3dRMTexture object if successful; otherwise, null.

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

loadTextureFromResource

public Direct3dRMTexture loadTextureFromResource(int hnd);

Loads a texture from a specified resource. Because it is difficult to obtain resource handles, this method is rarely used in Java.

Return Value:

Returns the Direct3dRMTexture object if successful; otherwise, null.

ParameterDescription
hnd Handle of the resource.

setDefaultTextureColors

public void setDefaultTextureColors(int ds);

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

Return Value:

No return value.

ParameterDescription
ds Number of colors.

Remarks:

This method affects 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 Direct3dRMTexture object.

Return Value:

No return value.

ParameterDescription
ds The number of shades.

Remarks:

This method affects 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 The 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.

vectorAdd

public void vectorAdd(D3dVector lpd, D3dVector lps1, D3dVector lps2);

Calculates the sum of two vectors.

Return Value:

No return value.

ParameterDescription
lpd A D3dVector object that receives the sum of lps1 and lps2.
lps1 A D3dVector object that contains a vector.
lps2 A D3dVector object that contains a vector.

vectorCrossProduct

public void vectorCrossProduct(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.

vectorDotProduct

public float vectorDotProduct(D3dVector lps1, D3dVector lps2);

Calculates the dot-product of two vectors.

Return Value:

Returns the result of the operation.

ParameterDescription
lps1 A D3dVector object that contains a vector.
lps2 A D3dVector object that contains a vector.

vectorModulus

public float vectorModulus(D3dVector d);

Calculates the modulus of a vector.

Return Value:

Returns a float that is the remainder of the modulus operation.

ParameterDescription
d The vector to mod.

vectorNormalise

public void vectorNormalise(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.

vectorRandom

public void vectorRandom(D3dVector d);

Randomizes a vector.

Return Value:

No return value.

ParameterDescription
d A D3dVector object that contains the vector to randomize. This object also receives the randomized vector.

vectorReflect

public void vectorReflect(D3dVector lpd, D3dVector lpRay, D3dVector lpNorm);

Reflects a vector, given a vector ray and a vector normal.

Return Value:

No return value.

ParameterDescription
lpd The resulting D3dVector from the operation.
lpRay A D3dVector ray.
lpNorm A D3dVector normal.

vectorRotate

public void vectorRotate(D3dVector lpr, D3dVector lpv, D3dVector lpaxis,
        float theta);

Rotates a vector, given a ray, vector, axis, and amount to rotate.

Return Value:

No return value.

ParameterDescription
lpr A D3dVector ray.
lpv A D3dVector vector.
lpaxis A D3dVector axis.
theta The amount to rotate the vector (in radians).

vectorScale

public void vectorScale(D3dVector lpd, D3dVector lps, float factor);

Scales one vector to another by a specified factor.

ParameterDescription
lpd A D3dVector object that receives the result of the scaling operation.
lps A D3dVector object that contains the source vector.
The factor to scale lps by.

vectorSubtract

public void vectorSubtract(D3dVector lpd, D3dVector lps1, D3dVector lps2);

Subtracts one vector from another.

Return Value:

No return value.

ParameterDescription
lpd A D3dVector object that receives the result of the subtraction.
lps1 A D3dVector object that contains a vector.
lps2 A D3dVector object that contains a vector.

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