프레임 및 애니메이션 추가(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 템플릿을 참조하세요.
관련 항목