; ; ------------------------------------------------------------ ; ; PureBasic - NodeAnimation ; ; (c) Fantaisie Software ; ; ------------------------------------------------------------ ; ; Пример использования AnimationTracks для плавного создания узла ; следуйте по заранее заданному пути со сплайн-интерполяцией. IncludeFile #PB_Compiler_Home + "examples/3d/Screen3DRequester.pb" Declare AddPath(NodeAnimation) Define.f Duration = 10000, Time = Duration / 4 If InitEngine3D() InitSprite() InitKeyboard() InitMouse() If Screen3DRequester() Add3DArchive(#PB_Compiler_Home + "examples/3d/Data" , #PB_3DArchive_FileSystem) Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures" , #PB_3DArchive_FileSystem) Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models" , #PB_3DArchive_FileSystem) Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts" , #PB_3DArchive_FileSystem) Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/desert.zip", #PB_3DArchive_Zip) Parse3DScripts() ;- Бочка (Barrel) CreateEntity(1, LoadMesh(1, "Barrel.mesh"), #PB_Material_None) ScaleEntity(1, 9, 9, 9) ; - Камера (Camera) CreateCamera(0, 0, 0, 100, 100) ;- Узел (Node) CreateNode(0) AttachNodeObject(0, CameraID(0)) ; - Свет (Light) AmbientColor(RGB(75, 75, 75)) CreateLight(0, RGB(235, 253, 126), -750, 750, -750) ; Скайбокс (SkyBox) SkyBox("desert07.jpg") ;- Анимация Узла (NodeAnimation) NodeAnimation = CreateNodeAnimation(#PB_Any, NodeID(0), Duration, #PB_NodeAnimation_Spline, #PB_NodeAnimation_LinearRotation) CreateNodeAnimationKeyFrame(NodeAnimation, Time * 0, 200, 0, 0); кадр 0 CreateNodeAnimationKeyFrame(NodeAnimation, Time * 1, 0, -50, 100); кадр 1 CreateNodeAnimationKeyFrame(NodeAnimation, Time * 2, -500, 100, 0); кадр 2 CreateNodeAnimationKeyFrame(NodeAnimation, Time * 3, 0, 200, -300); кадр 3 CreateNodeAnimationKeyFrame(NodeAnimation, Time * 4, 200, 0, 0); кадр 4 StartNodeAnimation(NodeAnimation) Repeat Screen3DEvents() ExamineKeyboard() AddNodeAnimationTime(NodeAnimation, TimeSinceLastFrame) CameraLookAt(0, EntityX(1), EntityY(1), EntityZ(1)) TimeSinceLastFrame = RenderWorld() FlipBuffers() Until KeyboardPushed(#PB_Key_Escape) End EndIf Else MessageRequester("Ошибка","Не удается инициализировать engine3D") EndIf