フレームとアニメーションの追加 (Direct3D 9)
このセクションでは、単純なキューブにフレームとアニメーションを追加する方法について説明します。
フレームの操作
フレームには次の構造が必要です。
Frame Aframe { // The frame name is chosen for convenience.
FrameTransformMatrix {
...transform data...
}
[ Meshes ] and/or [ More frames]
}
ID 変換を使用して、定義されたキューブ メッシュをフレーム内に配置します。 次に、このフレームにアニメーションを適用します。
Frame CubeFrame {
FrameTransformMatrix {
1.000000, 0.000000, 0.000000, 0.000000,
0.000000, 1.000000, 0.000000, 0.000000,
0.000000, 0.000000, 1.000000, 0.000000,
0.000000, 0.000000, 0.000000, 1.000000;;
}
{CubeMesh} // You could have the mesh inline, but this
// uses an object reference instead.
}
アニメーションの操作
アニメーションは、キーのセットによって定義されます。 キーは、スケーリング操作、向き、または位置に関連付けられた時間値です。
Animation Animation0 { // The name is chosen for convenience.
{ Frame that it applies to - normally a reference }
AnimationKey {
...animation key data...
}
{ ...more animation keys... }
}
その後、アニメーションは AnimationSets にグループ化されます。
AnimationSet AnimationSet0 { // The name is chosen for convenience.
{ an animation - could be inline or a reference }
{ ... more animations ... }
}
次に、アニメーションを通してキューブを取得します。
AnimationSet AnimationSet0 {
Animation Animation0 {
{CubeFrame} // Use the frame containing the cube.
AnimationKey {
2; // Position keys
9; // 9 keys
10; 3; -100.000000, 0.000000, 0.000000;;,
20; 3; -75.000000, 0.000000, 0.000000;;,
30; 3; -50.000000, 0.000000, 0.000000;;,
40; 3; -25.500000, 0.000000, 0.000000;;,
50; 3; 0.000000, 0.000000, 0.000000;;,
60; 3; 25.500000, 0.000000, 0.000000;;,
70; 3; 50.000000, 0.000000, 0.000000;;,
80; 3; 75.500000, 0.000000, 0.000000;;,
90; 3; 100.000000, 0.000000, 0.000000;;;
}
}
}
詳細については、Animation テンプレートと AnimationSet テンプレートに関するページを参照してください。
関連トピック