C++ Nonmember Functions

The Microsoft® Direct3D® Retained Mode nonmember functions for C++ are:

D3DRMColorGetAlpha

Retrieves the alpha component of a color.

Syntax

D3DVALUE D3DRMColorGetAlpha(
  D3DCOLOR d3drmc
  );

Parameters

d3drmc
Color from which the alpha component is retrieved. A value between 0 and 255.

Return Value

Returns the alpha value if successful, or zero otherwise.

See Also

D3DRMColorGetBlue, D3DRMColorGetGreen, D3DRMColorGetRed

D3DRMColorGetBlue

Retrieves the blue component of a color.

Syntax

D3DVALUE D3DRMColorGetBlue(
  D3DCOLOR d3drmc
  );

Parameters

d3drmc
Color from which the blue component is retrieved. A value between 0 and 255.

Return Value

Returns the blue value if successful, or zero otherwise.

See Also

D3DRMColorGetAlpha, D3DRMColorGetGreen, D3DRMColorGetRed

D3DRMColorGetGreen

Retrieves the green component of a color.

Syntax

D3DVALUE D3DRMColorGetGreen(
  D3DCOLOR d3drmc
  );

Parameters

d3drmc
Color from which the green component is retrieved. A value between 0 and 255.

Return Value

Returns the green value if successful, or zero otherwise.

See Also

D3DRMColorGetAlpha, D3DRMColorGetBlue, D3DRMColorGetRed

D3DRMColorGetRed

Retrieves the red component of a color.

Syntax

D3DVALUE D3DRMColorGetRed(
  D3DCOLOR d3drmc
  );

Parameters

d3drmc
Color from which the red component is retrieved.

Return Value

Returns the red value if successful, or zero otherwise.

See Also

D3DRMColorGetAlpha, D3DRMColorGetBlue, D3DRMColorGetGreen

D3DRMCreateColorRGB

Creates an RGB color from supplied red, green, and blue components.

Syntax

D3DCOLOR D3DRMCreateColorRGB(
  D3DVALUE red,
  D3DVALUE green,
  D3DVALUE blue
  );

Parameters

red, green, and blue
Components of the RGB color.

Return Value

Returns the new RGB value if successful, or zero otherwise.

See Also

D3DRMCreateColorRGBA

D3DRMCreateColorRGBA

Creates an RGBA color from supplied red, green, blue, and alpha components.

Syntax

D3DCOLOR D3DRMCreateColorRGBA(
  D3DVALUE red,
  D3DVALUE green,
  D3DVALUE blue,
  D3DVALUE alpha
  );

Parameters

red, green, blue, and alpha
Components of the RGBA color. Values between 0 and 1.

Return Value

Returns the new RGBA value if successful, or zero otherwise.

See Also

D3DRMCreateColorRGB

D3DRMMatrixFromQuaternion

Calculates the matrix for the rotation that a unit quaternion represents.

Syntax

void D3DRMMatrixFromQuaternion (
  D3DRMMATRIX4D mat,
  LPD3DRMQUATERNION lpquat
  );

Parameters

mat
Address that will contain the calculated matrix when the function returns. (The D3DRMMATRIX4D type is an array.)
lpquat
Address of the D3DRMQUATERNION structure.

Return Value

No return value.

D3DRMQuaternionFromRotation

Retrieves a unit quaternion that represents a rotation of a specified number of radians around the given axis.

Syntax

LPD3DRMQUATERNION D3DRMQuaternionFromRotation(
  LPD3DRMQUATERNION lpquat,
  LPD3DVECTOR lpv,
  D3DVALUE theta
  );

Parameters

lpquat
Address of a D3DRMQUATERNION structure that will contain the result of the operation.
lpv
Address of a D3DVECTOR structure specifying the axis of rotation.
theta
Number of radians to rotate around the axis specified by the lpv parameter.

Return Value

Returns the address of the unit quaternion that was passed as the first parameter if successful, or zero otherwise.

D3DRMQuaternionMultiply

Calculates the product of two quaternion structures.

Syntax

LPD3DRMQUATERNION D3DRMQuaternionMultiply(
  LPD3DRMQUATERNION lpq,
  LPD3DRMQUATERNION lpa,
  LPD3DRMQUATERNION lpb
  );

Parameters

lpq
Address of the D3DRMQUATERNION structure that will contain the product of the multiplication.
lpa and lpb
Addresses of the D3DRMQUATERNION structures that will be multiplied together.

Return Value

Returns the address of the quaternion that was passed as the first parameter if successful, or zero otherwise.

D3DRMQuaternionSlerp

Interpolates between two quaternion structures, using spherical linear interpolation.

Syntax

LPD3DRMQUATERNION D3DRMQuaternionSlerp(
  LPD3DRMQUATERNION lpq,
  LPD3DRMQUATERNION lpa,
  LPD3DRMQUATERNION lpb,
  D3DVALUE alpha
  );

Parameters

lpq
Address of the D3DRMQUATERNION structure that will contain the interpolation.
lpa and lpb
Addresses of the D3DRMQUATERNION structures that are used as the starting and ending points for the interpolation, respectively.
alpha
Value between 0 and 1 that specifies how far to interpolate between lpa and lpb.

Return Value

Returns the address of the quaternion that was passed as the first parameter if successful, or zero otherwise.

D3DRMVectorAdd

Adds two vectors.

Syntax

LPD3DVECTOR D3DRMVectorAdd(
  LPD3DVECTOR lpd,
  LPD3DVECTOR lps1,
  LPD3DVECTOR lps2
  );

Parameters

lpd
Address of a D3DVECTOR structure that will contain the result of the addition.
lps1 and lps2
Addresses of the D3DVECTOR structures that will be added together.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero otherwise.

D3DRMVectorCrossProduct

Calculates the cross product of the two vector arguments.

Syntax

LPD3DVECTOR D3DRMVectorCrossProduct(
  LPD3DVECTOR lpd,
  LPD3DVECTOR lps1,
  LPD3DVECTOR lps2
  );

Parameters

lpd
Address of a D3DVECTOR structure that will contain the result of the cross product.
lps1 and lps2
Addresses of the D3DVECTOR structures from which the cross product is produced.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero otherwise.

D3DRMVectorDotProduct

Returns the vector dot product.

Syntax

D3DVALUE D3DRMVectorDotProduct(
  LPD3DVECTOR lps1,
  LPD3DVECTOR lps2
  );

Parameters

lps1 and lps2
Addresses of the D3DVECTOR structures from which the dot product is produced.

Return Value

Returns the result of the dot product if successful, or zero otherwise.

D3DRMVectorModulus

Returns the length of a vector according to the following formula:

Square root of x squared plus y squared plus z squared

Syntax

D3DVALUE D3DRMVectorModulus(
  LPD3DVECTOR lpv
  );

Parameters

lpv
Address of the D3DVECTOR structure whose length is returned.

Return Value

Returns the length of the D3DVECTOR structure if successful, or zero otherwise.

D3DRMVectorNormalize

Scales a vector so that its modulus is 1.

Syntax

LPD3DVECTOR D3DRMVectorNormalize(
  LPD3DVECTOR lpv
  );

Parameters

lpv
Address of a D3DVECTOR structure that will contain the result of the scaling operation.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero if an error occurs. An example of an error is if a zero vector were passed.

D3DRMVectorRandom

Returns a random unit vector.

Syntax

LPD3DVECTOR D3DRMVectorRandom(
  LPD3DVECTOR lpd
  );

Parameters

lpd
Address of a D3DVECTOR structure that will contain a random unit vector.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero otherwise.

D3DRMVectorReflect

Reflects a ray about a given normal.

Syntax

LPD3DVECTOR D3DRMVectorReflect(
  LPD3DVECTOR lpd,
  LPD3DVECTOR lpRay,
  LPD3DVECTOR lpNorm
  );

Parameters

lpd
Address of a D3DVECTOR structure that will contain the result of the operation.
lpRay
Address of a D3DVECTOR structure that will be reflected about a normal.
lpNorm
Address of a D3DVECTOR structure specifying the normal about which the vector specified in lpRay is reflected.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero otherwise.

D3DRMVectorRotate

Rotates a vector around a given axis. Returns a normalized vector if successful.

Syntax

LPD3DVECTOR D3DRMVectorRotate(
  LPD3DVECTOR lpr,
  LPD3DVECTOR lpv,
  LPD3DVECTOR lpaxis,
  D3DVALUE theta
  );

Parameters

lpr
Address of a D3DVECTOR structure that will contain the normalized result of the operation.
lpv
Address of a D3DVECTOR structure that will be rotated around the given axis.
lpaxis
Address of a D3DVECTOR structure that is the axis of rotation.
theta
The amount of rotation in radians.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero otherwise. This vector is normalized.

D3DRMVectorScale

Scales a vector uniformly in all three axes.

Syntax

LPD3DVECTOR D3DRMVectorScale(
  LPD3DVECTOR lpd,
  LPD3DVECTOR lps,
  D3DVALUE factor
  );

Parameters

lpd
Address of a D3DVECTOR structure that will contain the result of the operation.
lps
Address of a D3DVECTOR structure that this function scales.
factor
Scaling factor. A value of 1 does not change the scaling; a value of 2 doubles it, and so on.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero otherwise.

D3DRMVectorSubtract

Subtracts two vectors.

Syntax

LPD3DVECTOR D3DRMVectorSubtract(
  LPD3DVECTOR lpd,
  LPD3DVECTOR lps1,
  LPD3DVECTOR lps2
  );

Parameters

lpd
Address of a D3DVECTOR structure that will contain the result of the operation.
lps1
Address of the D3DVECTOR structure from which lps2 is subtracted.
lps2
Address of the D3DVECTOR structure that is subtracted from lps1.

Return Value

Returns the address of the vector that was passed as the first parameter if successful, or zero otherwise.

Direct3DRMCreate

Creates an instance of a Direct3DRM object.

Syntax

HRESULT Direct3DRMCreate(
  LPDIRECT3DRM FAR *lplpD3DRM
  );

Parameters

lplpD3DRM
Address of a pointer that will be initialized with a valid Direct3DRM pointer if the call succeeds.

Return Value

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

See Also

IDirect3DRMObject


Top of Page Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.