Class TAnimatedMeshSceneNode

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TAnimatedMeshSceneNode = class(TSceneNode)

Description

Scene node capable of displaying an animated mesh and its shadow.
The shadow is optional: If a shadow should be displayed too, just invoke the TAnimatedMeshSceneNode.CreateShadowVolumeSceneNode.

Hierarchy

Overview

Methods

Public function AddShadowVolumeSceneNode(Mesh: TMesh=nil; ID: LongInt=-1; ZFailMethod: Boolean=True; Infinity: Single=10000): TShadowVolumeSceneNode; inline;
Public function GetJointNode(const JointName: AnsiString): TBoneSceneNode; overload; inline;
Public function GetJointNode(JointID: LongWord): TBoneSceneNode; overload; inline;
Public function GetMD3TagTransformation(const TagName: AnsiString): TMD3QuaternionTag; inline;
Public function GetMesh: TMesh; inline;
Public function SetFrameLoop(First, Last: LongInt): Boolean; inline;
Public procedure AnimateJoints(CalculateAbsPositions: Boolean=True); inline;
Public procedure SetAnimationEndCallback(Callback: TAnimationEndCallback); inline;
Public procedure SetJointMode(Mode: TJointUpdateMode); inline;
Public procedure SetLoopMode(Loop: Boolean); inline;
Public procedure SetMD2Animation(const Name: AnsiString); overload; inline;
Public procedure SetMD2Animation(Anim: TMD2Animation); overload; inline;
Public procedure SetMesh(NMesh: TMesh); inline;
Public procedure SetRenderFromIdentity(Enable: Boolean); inline;
Public procedure SetTransitionTime(Time: Single); inline;

Properties

Public property AnimationSpeed: Single read GetAnimationSpeed write SetAnimationSpeed;
Public property CurrentFrame: Single read GetCurrentFrame write SetCurrentFrame;
Public property EndFrame: LongInt read GetEndFrame;
Public property JointCount: LongWord read GetJointCount;
Public property ReadOnlyMaterials: Boolean read IsReadOnlyMaterials write SetReadOnlyMaterials;
Public property StartFrame: LongInt read GetStartFrame;

Description

Methods

Public function AddShadowVolumeSceneNode(Mesh: TMesh=nil; ID: LongInt=-1; ZFailMethod: Boolean=True; Infinity: Single=10000): TShadowVolumeSceneNode; inline;

Creates shadow volume scene node as child of this node.
The shadow can be rendered using the ZPass or the zfail method. ZPass is a little bit faster because the shadow volume creation is easier, but with this method there occur ugly looking artifacs when the camera is inside the shadow volume. These error do not occur with the ZFail method.

Parameters
ShadowMesh
Optional custom mesh for shadow volume.
ID
Id of the shadow scene node. This id can be used to identify the node later.
ZFailMethod
If set to true, the shadow will use the zfail method, if not, zpass is used.
Infinity
Value used by the shadow volume algorithm to scale the shadow volume.
Returns

The created shadow scene node. This reference should not be dropped. See TReferenceCounted.Drop for more information.

Public function GetJointNode(const JointName: AnsiString): TBoneSceneNode; overload; inline;

Like GetJointNode(JointID: LongWord), but based on the joint name

Public function GetJointNode(JointID: LongWord): TBoneSceneNode; overload; inline;

Get a pointer to a joint in the mesh (if the mesh is a bone based mesh).
With this method it is possible to attach scene nodes to joints for example possible to attach a weapon to the left hand of an animated model. This example shows how:

    var Hand: TSceneNode;
    ....
    Hand := YourAnimatedMeshSceneNode.GetJointNode('LeftHand');
    Hand.AddChild(WeaponSceneNode);
                

Please note that the joint returned by this method may not exist before this call and the joints in the node were created by it.

Parameters
JointID
ID of the joint.
Returns

The scene node which represents the joint with the specified ID. Nil if the contained mesh is not an skinned mesh or the name of the joint could not be found.

Public function GetMD3TagTransformation(const TagName: AnsiString): TMD3QuaternionTag; inline;

Get the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, or the absolutetransformation if it's a normal scene node.

Public function GetMesh: TMesh; inline;

Returns the current mesh.

Public function SetFrameLoop(First, Last: LongInt): Boolean; inline;

Sets the frame numbers between the animation is looped.
The default is 0 - MaximalFrameCount of the mesh.

Parameters
First
Start frame number of the loop.
End
End frame number of the loop.
Returns

True if successful, false if not.

Public procedure AnimateJoints(CalculateAbsPositions: Boolean=True); inline;

Animates the joints in the mesh based on the current frame.
Also takes in to account transitions.

Public procedure SetAnimationEndCallback(Callback: TAnimationEndCallback); inline;

Sets a callback interface which will be called if an animation playback has ended. Set this to nil to disable the callback again. Please note that this will only be called when in non looped mode, see TAnimatedMeshSceneNode.SetLoopMode.

Public procedure SetJointMode(Mode: TJointUpdateMode); inline;

Set how the joints should be updated on render.

Public procedure SetLoopMode(Loop: Boolean); inline;

Sets the looping mode which is on by default. If set to false, animations will not be played looped.

Public procedure SetMD2Animation(const Name: AnsiString); overload; inline;

Starts a special MD2 animation.
With this method it is easily possible to start a Run, Attack, Die or whatever animation, if the mesh contained in this scene node is an md2 mesh. Otherwise, nothing happens. This method uses a character string to identify the animation. If the animation is a standard md2 animation, you might want to start this animation with the TMD2Animation enumeration instead.

Parameters
Name
of the animation which should be played.
Returns

true if successful, and false if not, for example if the mesh in the scene node is not an md2 mesh, or no animation with this name could be found.

Public procedure SetMD2Animation(Anim: TMD2Animation); overload; inline;

Starts a default MD2 animation.
With this method it is easily possible to start a Run, Attack, Die or whatever animation, if the mesh contained in this scene node is an md2 mesh. Otherwise, nothing happens.

Parameters
Anim
An MD2 animation type, which should be played, for example maStand for the standing animation.
Returns

True if successful, and false if not, for example if the mesh in the scene node is not a md2 mesh.

Public procedure SetMesh(NMesh: TMesh); inline;

Sets a new mesh.

Public procedure SetRenderFromIdentity(Enable: Boolean); inline;

Render mesh ignoring its transformation.
Used with ragdolls. Culling is unaffected.

Public procedure SetTransitionTime(Time: Single); inline;

Sets the transition time in seconds.
Note: This needs to enable joints, and setJointmode set to jmControlJoints. You must call AnimateJoints, or the mesh will not animate.

Properties

Public property AnimationSpeed: Single read GetAnimationSpeed write SetAnimationSpeed;

Specifies the speed at which the animation is played in frames per second.

Public property CurrentFrame: Single read GetCurrentFrame write SetCurrentFrame;

The currently displayed frame number.

Public property EndFrame: LongInt read GetEndFrame;

The current end frame number.

Public property JointCount: LongWord read GetJointCount;

The amount of joints in the mesh.

Public property ReadOnlyMaterials: Boolean read IsReadOnlyMaterials write SetReadOnlyMaterials;

Determines if the scene node should not copy the materials of the mesh but use them in a read only style.

Public property StartFrame: LongInt read GetStartFrame;

The current start frame.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22