Package com.ms.com.directX |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
Applications use the methods of the d3drmFrame class to interact with frames—an object's frame of reference.
public class d3drmFrame implements Id3drmFrame { public void InternalSetObject(IUnknown lpdd); public IUnknown InternalGetObject(); public d3drmFrame Clone(); public void AddDestroyCallback(Id3drmCallback fn, IUnknown Arg); public void DeleteDestroyCallback(Id3drmCallback fn, IUnknown args); public void SetAppData(int data); public int GetAppData(); public void SetName(String name); public String GetName(); public String GetClassName(); public void AddVisual(d3drmVisual v); public void AddVisualFrame(d3drmFrame v); public void AddVisualMesh(d3drmMesh v); public void AddVisualUserVisual(d3drmUserVisual v); public void AddVisualMeshBuilder(d3drmMeshBuilder v); public void AddVisualTexture(d3drmTexture v); public void AddVisualShadow(d3drmShadow v); public void DeleteVisual(d3drmVisual v); public void DeleteVisualFrame(d3drmFrame v); public void DeleteVisualMesh(d3drmMesh v); public void DeleteVisualUserVisual(d3drmUserVisual v); public void DeleteVisualMeshBuilder(d3drmMeshBuilder v); public void DeleteVisualTexture(d3drmTexture v); public void DeleteVisualShadow(d3drmShadow v); public void AddChild(d3drmFrame child); public void AddLight(d3drmLight val); public void AddMoveCallback(IFrameMoveCallback fmC, IUnknown args); public void AddTranslation(int t, float x, float y, float z); public void AddScale(int typ, float sx, float sy, float Sz); public void AddRotation(int typ, float x, float y, float z, float theta); public d3drmFrameArray GetChildren(); public int GetColor(); public d3drmLightArray GetLights(); public int GetMaterialMode(); public d3drmFrame GetParent(); public void GetPosition(d3drmFrame ref, d3dvector position); public void GetRotation(d3drmFrame ref, d3dvector axis, float[] theta); public d3drmFrame GetScene(); public int GetSortMode(); public d3drmTexture GetTexture(); public void GetVelocity(d3drmFrame ref, d3dvector vel, int rotation); public void GetOrientation(d3drmFrame ref, d3dvector dir, d3dvector up); public d3drmVisualArray GetVisuals(); public void GetTextureTopology(int[] u, int[] v); public void InverseTransform(d3dvector d, d3dvector s); public void LoadFromFileByPos(String filename, int position, int flags, ILoadTextureCallback c, IUnknown pUser); public void LookAt(d3drmFrame tgt, d3drmFrame ref, int val); public void Move(float delta); public void DeleteChild(d3drmFrame c); public void DeleteLight(d3drmLight l); public void DeleteMoveCallback(IFrameMoveCallback fn, IUnknown args); public int GetSceneBackground(); public ddSurface GetSceneBackgroundDepth(); public int GetSceneFogColor(); public int GetSceneFogEnable(); public int GetSceneFogMode(); public void GetSceneFogParams(float[] start, float[] end, float[] density); public void SetSceneBackground(int c); public void SetSceneBackgroundRGB(float r, float g, float b); public void SetSceneBackgroundDepth(ddSurface s); public void SetSceneBackgroundImage(d3drmTexture i); public void SetSceneFogEnable(int enable); public void SetSceneFogColor(int c); public void SetSceneFogMode(int c); public void SetSceneFogParams(float s, float e, float d); public void SetColor(int c); public void SetColorRGB(float r, float g, float b); public int GetZbufferMode(); public void SetMaterialMode(int val); public void SetOrientation(d3drmFrame reference, float dx, float dy, float dz, float ux, float uy, float uz); public void SetPosition(d3drmFrame reference, float x, float y, float z); public void SetRotation(d3drmFrame reference, float x, float y, float z, float theta); public void SetSortMode(int val); public void SetTexture(d3drmTexture t); public void SetTextureTopology(int wrap_u, int wrap_v); public void SetVelocity(d3drmFrame reference, float x, float y, float z, int with_rotation); public void SetZbufferMode(int val); public void Transform(d3dvector d, d3dvector s); public void GetTransform(float[] val); public void AddTransform(int t, float[] val); }
The methods can be organized into the following groups:
In addition, the d3drmFrame class inherits the following methods from the d3drmObject class:
AddDestroyCallback |
Clone |
DeleteDestroyCallback |
GetAppData |
GetClassName |
GetName |
SetAppData |
SetName |
The d3drmFrame object is obtained by calling the CreateFrame method.
public void AddChild(d3drmFrame child);Adds a child frame to a frame hierarchy.
Return Value:
No return value.
Parameter Description child The d3drmFrame object that will be added as a child. Remarks:
If the frame being added as a child already has a parent, this method removes it from its previous parent before adding it to the new parent.
To preserve an object's transformation, use the GetTransform method to retrieve the object's transformation before using the AddChild method. Then reapply the transformation after the frame is added.
public void AddLight(d3drmLight val);Adds a light to a frame.
Return Value:
No return value.
Parameter Description val The d3drmLight object to be added to the frame.
public void AddMoveCallback(IFrameMoveCallback fmC, IUnknown args);Adds a callback function for special movement processing.
Return Value:
No return value.
Parameter Description fmC Callback interface that contains an application-defined callback function. args Application-defined data to be passed to the callback function. See Also: Move, DeleteMoveCallback
public void AddRotation(int typ, float x, float y, float z, float theta);Adds a rotation about (x, y, z) by the number of radians specified in theta.
Return Value:
No return value.
Parameter Description typ A value of combine type that specifies how to combine the new rotation with any current frame transformation. x, y, and z Axis about which to rotate. theta Angle of rotation, in radians. Remarks:
The specified rotation changes the matrix only for the frame identified by this object. This method changes the objects in the frame only once, unlike SetRotation, which changes the matrix with every render tick.
public void AddScale(int typ, float sx, float sy, float Sz);Scales a frame's local transformation by (sx, sy, Sz).
Return Value:
No return value.
Parameter Description typ Value of combine type that specifies how to combine the new scale with any current frame transformation. sz, sy, Sz Define the scale factors in the x, y, and z directions. Remarks:
The specified transformation changes the matrix only for the frame identified by this object.
public void AddTransform(int t, float[] val);Transforms the local coordinates of the frame by the given affine transformation according to the value of the t parameter.
Return Value:
No return value.
Parameter Description t Value of combine type that specifies how to combine the new transformation with any current transformation. val Array variable that defines the transformation matrix to be combined. Remarks:
Although a 4-by-4 matrix is given, the last column must be the transpose of [0 0 0 1] for the transformation to be affine.
The specified transformation changes the matrix only for the frame identified by this object.
public void AddTranslation(int t, float x, float y, float z);Adds a translation by (x, y, z) to a frame's local coordinate system.
Return Value:
No return value.
Parameter Description t Value of combine type that specifies how to combine the new translation with any current translation. x, y, and z Define the position changes in the x, y, and z directions. Remarks:
The specified translation changes the matrix only for the frame identified by this object.
public void AddVisual(d3drmVisual v);Adds a visual object to a frame.
Return Value:
No return value.
Parameter Description v The d3drmVisual object to be added to the frame. Remarks:
Visual objects include meshes and textures. When a visual object is added to a frame, it becomes visible if the frame is in view. The visual object is referenced by the frame.
public void DeleteChild(d3drmFrame c);Removes a frame from the hierarchy. If the frame is not referenced, it is destroyed along with any child frames, lights, and meshes.
Return Value:
No return value.
Parameter Description c The d3drmFrame object to be used as the child.
public void DeleteLight(d3drmLight l);Removes a light from a frame, destroying it if it is no longer referenced. When a light is removed from a frame, it no longer affects meshes in the scene its frame was in.
Return Value:
No return value.
Parameter Description l The d3drmLight object to be removed.
public void DeleteMoveCallback(IFrameMoveCallback fn, IUnknown args);Removes a callback function that performed special movement processing.
Return Value:
No return value.
Parameter Description fn Callback interface that contains an application-defined callback function. args Application-defined data that was passed to the callback function. See Also: AddMoveCallback, Move
public void DeleteVisual(d3drmVisual v);Removes a visual object from a frame, destroying it if it is no longer referenced.
Return Value:
No return value.
Parameter Description v The d3drmVisual object to be removed.
public d3drmFrameArray GetChildren();Retrieves a list of child frames in the form of a d3drmFrameArray object.
Return Value:
Returns the d3drmFrameArray object if successful; null otherwise.
See Also: d3drmFrameArray
public int GetColor();Retrieves the color of the frame.
Return Value:
Returns the color of the d3drmFrame object.
See Also: SetColor
public d3drmLightArray GetLights();Retrieves a list of lights in the frame in the form of a d3drmLightArray object.
Return Value:
Returns the d3drmLightArray object if successful; null otherwise.
See Also: d3drmLightArray
public int GetMaterialMode();Retrieves the material mode of the frame.
Return Value:
Returns a value of material mode type that specifies the current material mode.
See Also: SetMaterialMode
public void GetOrientation(d3drmFrame ref, d3dvector dir, d3dvector up);Retrieves the orientation of a frame relative to the given reference frame.
Return Value:
No return value.
Parameter Description ref The d3drmFrame object to be used as the reference. dir and up The d3dvector objects that receive the directions of the frame's z-axis and y-axis, respectively. See Also: SetOrientation
public d3drmFrame GetParent();Retrieves the parent frame of the current frame.
Return Value:
Returns the d3drmFrame object if successful; null otherwise.
Remarks:
If the current frame is the root, this method returns null.
public void GetPosition(d3drmFrame ref, d3dvector position);Retrieves the position of a frame relative to the given reference frame (for example, this method retrieves the distance of the frame from the reference). The distance is stored in the position parameter as a vector rather than as a linear measure.
Return Value:
No return value.
Parameter Description ref The d3drmFrame object to be used as the reference. position The d3dvector object that receives the frame's position. See Also: SetPosition
public void GetRotation(d3drmFrame ref, d3dvector axis, float[] theta);Retrieves the rotation of the frame relative to the given reference frame.
Return Value:
No return value.
Parameter Description ref The d3drmFrame object to be used as the reference. axis The d3dvector object that receives the frame's axis of rotation. theta Array variable that receives the frame's rotation, in radians. See Also: SetRotation
public d3drmFrame GetScene();Retrieves the root frame of the hierarchy containing the given frame.
Return Value:
Returns the d3drmFrame object if successful; null otherwise.
public int GetSceneBackground();Retrieves the background color of a scene.
Return Value:
Returns the color.
public ddSurface GetSceneBackgroundDepth();Retrieves the current background-depth buffer for the scene.
Return Value:
Returns the ddSurface object if successful; null otherwise.
See Also: SetSceneBackgroundDepth
public int GetSceneFogColor();Retrieves the fog color of a scene.
Return Value:
Returns the fog color.
public int GetSceneFogEnable();Returns whether fog is currently enabled for this scene.
Return Value:
Returns TRUE if fog is enabled, and FALSE otherwise.
public int GetSceneFogMode();Returns the current fog mode for this scene.
Return Value:
Returns a value of fog mode type that specifies the current fog mode.
public void GetSceneFogParams(float[] start, float[] end, float[] density);Retrieves the current fog parameters for this scene.
Return Value:
No return value.
Parameter Description start, end, and lprvDensity Array variables that receive the fog start, end, and density values.
public int GetSortMode();Retrieves the sorting mode used to process child frames.
Return Value:
Returns a value of D3DRMSORT_ type that specifies the sorting mode.
See Also: SetSortMode
public d3drmTexture GetTexture();Retrieves the texture of the given frame.
Return Value:
Returns the d3drmTexture object if successful; null otherwise.
See Also: SetTexture
public void GetTextureTopology(int[] u, int[] v);Retrieves the topological properties of a texture when mapped onto objects in the given frame.
Return Value:
No return value.
Parameter Description u and v Array variables that are set to TRUE if the texture is mapped in the u and v directions, respectively. See Also: SetTextureTopology
public void GetTransform(float[] val);Retrieves the local transformation of the frame as a 4-by-4 affine matrix.
Return Value:
No return value.
Parameter Description val Array variable that receives the frame's transformation.
public void GetVelocity(d3drmFrame ref, d3dvector vel, int rotation);Retrieves the velocity of the frame relative to the given reference frame.
Return Value:
No return value.
Parameter Description ref The d3drmFrame object to be used as the reference. vel A d3dvector object that receives the frame's velocity. rotation Flag specifying whether the rotational velocity of the object is taken into account when retrieving the linear velocity. If this parameter is TRUE, the object's rotational velocity is included in the calculation. See Also: SetVelocity
public d3drmVisualArray GetVisuals();Retrieves a list of visuals in the frame.
Return Value:
Returns the d3drmVisualArray object if successful; null otherwise.
public int GetZbufferMode();Retrieves the z-buffer mode; that is, whether z-buffering is enabled or disabled.
Return Value:
Returns one value of D3DRMZBUFFER_ type.
See Also: SetZbufferMode
public void InverseTransform(d3dvector d, d3dvector s);Transforms the vector in the s parameter in world coordinates to model coordinates, and returns the result in the d parameter.
Return Value:
No return value.
Parameter Description d A d3dvector object that receives the result of the transformation. s The d3dvector object that is the source of the transformation. See Also: Transform
public void LoadFromFileByPos(String filename, int position, int flags, ILoadTextureCallback c, IUnknown pUser);Loads a d3drmFrame object.
Return Value:
No return value.
Parameter Description filename Name of the file containing the object to be loaded. position Position of object to be loaded. This is a value that gives the object's order in the file. This parameter can be null. flags Value of load options type. c Callback interface that contains a load texture callback function called to load any textures used by the object that require special formatting. This parameter can be null. pUser Application-defined data passed to the load texture callback function. Remarks:
By default, this method loads the first frame hierarchy in the file specified by the filename parameter. The frame that calls this method is used as the parent of the new frame hierarchy.
public void LookAt(d3drmFrame tgt, d3drmFrame ref, int val);Faces the frame toward the target frame, relative to the given reference frame, locking the rotation by the given constraints.
Return Value:
No return value.
Parameter Description tgt and ref The d3drmFrame objects to be used as the target and reference, respectively. val Value of frame constraint type that specifies the axis of rotation to constrain.
public void Move(float delta);Applies the rotations and velocities for all frames in the given hierarchy.
Return Value:
No return value.
Parameter Description delta Amount to change the velocity and rotation.
public void SetColor(int c);Sets the color of the frame. This color is used for meshes in the frame when the material mode is D3DRMMATERIAL_FROMFRAME.
Return Value:
No return value.
Parameter Description c New color for the frame. See Also: GetColor, SetMaterialMode
public void SetColorRGB(float r, float g, float b);Sets the color of the frame. This color is used for meshes in the frame when the material mode is D3DRMMATERIAL_FROMFRAME.
Return Value:
No return value.
Parameter Description r, g, and b New color for the frame. Each component of the color should be in the range 0 to 1. See Also: SetMaterialMode
public void SetMaterialMode(int val);Sets the material mode for a frame. The material mode determines the source of material information for visuals rendered with the frame.
Return Value:
No return value.
Parameter Description val One value of the material mode type. See Also: GetMaterialMode
public void SetOrientation(d3drmFrame reference, float dx, float dy, float dz, float ux, float uy, float uz);Aligns a frame so that its z-direction points along the direction vector [dx, dy, dz] and its y-direction aligns with the vector [ux, uy, uz].
Return Value:
No return value.
Parameter Description reference The d3drmFrame object to be used as the reference. dx, dy, and dz New z-axis for the frame. ux, uy, and uz New y-axis for the frame. Remarks:
The default orientation of a frame has a direction vector of [0, 0, 1] and an up vector of [0, 1, 0].
If [ux, uy, uz] is parallel to [dx, dy, dz], no action is taken; otherwise, the [ux, uy, uz] vector passed is projected onto the plane that is perpendicular to [dx, dy, dz].
See Also: GetOrientation
public void SetPosition(d3drmFrame reference, float x, float y, float z);Sets the position of a frame relative to the frame of reference. It places the frame a distance of [x, y, z] from the reference. When a child frame is created within a parent, it is placed at [0, 0, 0] in the parent frame.
Return Value:
No return value.
Parameter Description reference The d3drmFrame object to be used as the reference. x, y, and z New position for the frame. See Also: GetPosition
public void SetRotation(d3drmFrame reference, float x, float y, float z, float theta);Sets a frame rotating by the given angle around the given vector at each call to the Tick or Move method. The direction vector [x, y, z] is defined in the reference frame.
Return Value:
No return value.
Parameter Description reference The d3drmFrame object to be used as the reference. x, y, and z Vector about which rotation occurs. theta Rotation angle, in radians. Remarks:
The specified rotation changes the matrix with every render tick, unlike the AddRotation method, which changes the objects in the frame only once.
See Also: AddRotation, GetRotation
public void SetSceneBackground(int c);Sets the background color of a scene.
Return Value:
No return value.
Parameter Description c New color for the background.
public void SetSceneBackgroundDepth(ddSurface s);Specifies a background-depth buffer for a scene.
Return Value:
No return value.
Parameter Description s A ddSurface object that will store the new background depth for the scene. Remarks:
The image must have a depth of 16. If the image and viewport sizes are different, the image is scaled first. For best performance when animating the background-depth buffer, the image should be the same size as the viewport. This enables the depth buffer to be updated directly from the image memory without incurring extra overhead.
See Also: GetSceneBackgroundDepth
public void SetSceneBackgroundImage(d3drmTexture i);Specifies a background image for a scene.
Return Value:
No return value.
Parameter Description i A d3drmTexture object that will contain the new background scene. Remarks:
If the image is a different size or color depth than the viewport, the image will first be scaled or converted to the correct depth. For best performance when animating the background, the image should be the same size and color depth. This enables the background to be rendered directly from the image memory without incurring any extra overhead.
public void SetSceneBackgroundRGB(float r, float g, float b);Sets the background color of a scene.
Return Value:
No return value.
Parameter Description r, g, and b New color for the background.
public void SetSceneFogColor(int c);Sets the fog color of a scene.
Return Value:
No return value.
Parameter Description c New color for the fog.
public void SetSceneFogEnable(int enable);Sets the fog enable state.
Return Value:
No return value.
Parameter Description enable New fog enable state.
public void SetSceneFogMode(int c);Sets the fog mode.
Return Value:
No return value.
Parameter Description c One value of fog mode type, specifying the new fog mode. See Also: SetSceneFogParams
public void SetSceneFogParams(float s, float e, float d);Sets the current fog parameters for this scene.
Return Value:
No return value.
Parameter Description s and e Fog start and end points for linear fog mode. These settings determine the distance from the camera at which fog effects first become visible and the distance at which fog reaches its maximum density. d Fog density for the exponential fog modes. This value should be in the range 0 through 1. See Also: SetSceneFogMode
public void SetSortMode(int val);Sets the sorting mode used to process child frames. You can use this method to change the properties of hidden-surface-removal algorithms.
Return Value:
No return value.
Parameter Description val One value of D3DRMSORT_ type, specifying the sorting mode. Remarks:
By default, a frame's initial sort mode is D3DRMSORT_FROMPARENT.
See Also: GetSortMode
public void SetTexture(d3drmTexture t);Sets the texture of the frame.
Return Value:
No return value.
Parameter Description t The d3drmTexture object to be used. Remarks:
The texture is used for meshes in the frame when the material mode is D3DRMMATERIAL_FROMFRAME. To disable the frame's texture, use a null texture.
See Also: GetTexture, SetMaterialMode
public void SetTextureTopology(int wrap_u, int wrap_v);Defines the topological properties of the texture coordinates across objects in the frame.
Return Value:
No return value.
Parameter Description wrap_u and wrap_v Variables that are set to TRUE to map the texture in the u- and v-directions, respectively. See Also: GetTextureTopology
public void SetVelocity(d3drmFrame reference, float x, float y, float z, int with_rotation);Sets the velocity of the given frame relative to the reference frame. The frame will be moved by the vector [x, y, z] with respect to the reference frame at each successive call to the Tick or Move method.
Return Value:
No return value.
Parameter Description reference The d3drmFrame object to be used as the reference. x, y, and z New velocity for the frame. with_rotation Flag specifying whether the rotational velocity of the object is taken into account when setting the linear velocity. If TRUE, the object's rotational velocity is included in the calculation. See Also: GetVelocity
public void SetZbufferMode(int val);Sets the z-buffer mode; that is, whether z-buffering is enabled or disabled.
Return Value:
No return value.
Parameter Description val One value of D3DRMZBUFFER_ type, specifying the z-buffer mode. Remarks:
By default, a frame's initial z-buffer mode is D3DRMZBUFFER_FROMPARENT.
See Also: GetZbufferMode
public void Transform(d3dvector d, d3dvector s);Transforms the vector in the s parameter in model coordinates to world coordinates, returning the result in the d parameter.
Return Value:
No return value.
Parameter Description d A d3dvector object that receives the result of the transformation operation. s The d3dvector object that is the source of the transformation operation. See Also: InverseTransform
public void AddVisualFrame(d3drmFrame v);Adds a visual frame to the frame object.
Return Value:
No return value.
Parameter Description v The d3drmFrame object to be added.
public void AddVisualMesh(d3drmMesh v);Adds a visual mesh to the frame object.
Return Value:
No return value.
Parameter Description v The d3drmMesh object to be added.
public void AddVisualUserVisual(d3drmUserVisual v);Adds a user visual object to the frame object.
Return Value:
No return value.
Parameter Description v The d3drmUserVisual object to be added.
public void AddVisualMeshBuilder(d3drmMeshBuilder v);Adds a mesh builder object to the frame object.
Return Value:
No return value.
Parameter Description v The d3drmMeshBuilder object to be added.
public void AddVisualTexture(d3drmTexture v);Adds a texture object to the frame object.
Return Value:
No return value.
Parameter Description v The d3drmTexture object to be added.
public void AddVisualShadow(d3drmShadow v);Adds a shadow object to the frame object.
Return Value:
No return value.
Parameter Description v The d3drmShadow object to be added.
public void DeleteVisualFrame(d3drmFrame v);Deletes a visual frame from the frame object.
Return Value:
No return value.
Parameter Description v The d3drmFrame object to be deleted.
public void DeleteVisualMesh(d3drmMesh v);Deletes a mesh object from the frame object.
Return Value:
No return value.
Parameter Description v The d3drmMesh object to be deleted.
public void DeleteVisualUserVisual(d3drmUserVisual v);Deletes a user visual object from the frame object.
Return Value:
No return value.
Parameter Description v The d3drmUserVisual object to be deleted.
public void DeleteVisualMeshBuilder(d3drmMeshBuilder v);Deletes a mesh builder object from the frame object.
Return Value:
No return value.
Parameter Description v The d3drmMeshBuilder object to be deleted.
public void DeleteVisualTexture(d3drmTexture v);Deletes a texture object from the frame object.
Return Value:
No return value.
Parameter Description v The d3drmTexture object to be deleted.
public void DeleteVisualShadow(d3drmShadow v);Deletes a shadow object from the frame object.
Return Value:
No return value.
Parameter Description v The d3drmShadow object to be deleted.