Code: Select all
IncludeFile "Screen3DRequester.pb"
Declare AddPath(No)
If InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
Add3DArchive("Data/" , #PB_3DArchive_FileSystem)
Add3DArchive("Data/Textures" , #PB_3DArchive_FileSystem)
Add3DArchive("Data/Models" , #PB_3DArchive_FileSystem)
Add3DArchive("Data/Scripts" , #PB_3DArchive_FileSystem)
Add3DArchive("Data/Packs/skybox.zip", #PB_3DArchive_Zip)
Parse3DScripts()
WorldShadows(#PB_Shadow_Additive)
;- Ground
CreateMaterial(0, LoadTexture(0, "Dirt.jpg"))
CreatePlane(0, 1200, 1200, 1, 1, 5, 5)
CreateEntity(0, MeshID(0), MaterialID(0), 500, 0, -500)
;- Door
CreateCube(1, 1)
CreateEntity(1, MeshID(1), #PB_Material_None)
ScaleEntity(1, 130, 200, 5)
;- Camera
;
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 500, 1150, 1450, #PB_Absolute)
CameraFOV(0, 25)
CameraBackColor(0,$846748)
CameraLookAt(0, 500, 0, -500)
;- Node
;
CreateNode(0)
AttachNodeObject(0, EntityID(1))
;- Light
;
AmbientColor(RGB(25, 25, 25))
CreateLight(0, RGB(215, 190, 40), -750, 750, -750)
;- NodeAnimation
;
AddPath(0)
Repeat
Screen3DEvents()
ExamineKeyboard()
AddNodeAnimationTime(0, TimeSinceLastFrame * 2)
TimeSinceLastFrame = RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
End
EndIf
Else
MessageRequester("Error","Can't initialize engine3D")
EndIf
Procedure AddPath(NodeAnimation)
Duration = 5000
Time.f = Duration / 4
CreateNodeAnimation(NodeAnimation, NodeID(0), Duration, #PB_NodeAnimation_Spline, #PB_NodeAnimation_SphericalRotation)
;Animation Cylinder
CreateNodeAnimationKeyFrame(NodeAnimation, Time * 0.00, 500, 100, -500)
CreateNodeAnimationKeyFrame(NodeAnimation, Time * 1.00, 500, 100, -500)
CreateNodeAnimationKeyFrame(NodeAnimation, Time * 2.00, 500, 100, -500)
CreateNodeAnimationKeyFrame(NodeAnimation, Time * 3.00, 500, 100, -500)
CreateNodeAnimationKeyFrame(NodeAnimation, Time * 4.00, 500, 100, -500)
SetNodeAnimationKeyFrameRotation(NodeAnimation, 0, 0, 0, 0)
SetNodeAnimationKeyFrameRotation(NodeAnimation, 1, 0, 80, 0)
SetNodeAnimationKeyFrameRotation(NodeAnimation, 2, 0, 0, 0)
SetNodeAnimationKeyFrameRotation(NodeAnimation, 3, 0, -80, 0)
SetNodeAnimationKeyFrameRotation(NodeAnimation, 4, 0, 0, 0)
StartNodeAnimation(NodeAnimation)
EndProcedure