Pouvez vous lancer ce code et me dire combien de temps il vous faut pour charger ces quelques éléments.
J'aurais besoin aussi de savoir si ce code fonctionne sous Mac OS et Linux.
Code : Tout sélectionner
; Credit : https://www.musicscreen.be/musique-libre-de-droit-ambiances1.html
EnableExplicit
Global camera
Global Texture, Material, Mesh
Global Ground, Player, PlayerSpeed, CurrentAnimation.s
Global SoundLoop
Global Bottom
Global Assets.s = GetUserDirectory(#PB_Directory_Downloads)
Global Url.s = "http://falsam.com/Download/"
Global StartTime.q
; Sommaire
Declare Start()
Declare DownLoad(Url.s)
Declare Exit()
; Download des assets
StartTime = ElapsedMilliseconds()
DownLoad(Url + "sound/fluid.ogg")
DownLoad(Url + "textures/terrain/gras2_512.png")
Download(Url + "textures/sky/Evening.zip")
DownLoad(Url + "packs/Sinbad.zip")
Debug "Délai de download " + Str(ElapsedMilliseconds() - StartTime) + " Milliseconde(s)"
Start()
Procedure Start()
; Initialisation de l'environnemet 3D
If Not (InitEngine3D(#PB_Engine3D_DebugLog) And InitKeyboard() And InitSprite())
MessageRequester("Information", "Impossible d'initialiser l'environnement 3D")
Exit()
EndIf
; Window & Screen 3D
ExamineDesktops()
OpenScreen(DesktopWidth(0), DesktopHeight(0), 32, "")
KeyboardMode(#PB_Keyboard_International | #PB_Keyboard_AllowSystemKeys)
EnableWorldPhysics(#True)
; Localisation des elements 3D
Add3DArchive(Assets, #PB_3DArchive_FileSystem)
Add3DArchive(Assets + "Sinbad.zip", #PB_3DArchive_Zip)
Add3DArchive(Assets + "Evening.zip", #PB_3DArchive_Zip)
Parse3DScripts()
EnableWorldPhysics(#True)
WorldGravity(-20)
KeyboardMode(#PB_Keyboard_International | #PB_Keyboard_AllowSystemKeys)
Bottom = CreateSprite(-1, ScreenWidth(), 150, #PB_Sprite_AlphaBlending)
; Light
SkyBox("evening.jpg"); , RGB(255, 255, 255), 1, 900, 6000)
CreateLight(#PB_Any,RGB(255, 218, 185), -10000, 1000, 10000)
WorldShadows(#PB_Shadow_Additive)
; Camera
camera = CreateCamera(#PB_Any, 0, 0, 100, 100)
MoveCamera(camera, 0, 10, 40)
CameraLookAt(camera, 0, 0, 0)
SoundLoop = LoadSound3D(#PB_Any, "fluid.ogg")
PlaySound3D(SoundLoop, #PB_Sound3D_Loop)
;- Entités
Texture = LoadTexture(-1, "gras2_512.png")
Material = CreateMaterial(-1, TextureID(Texture))
Mesh = CreatePlane(-1, 10000, 10000, 100, 100, 30, 30)
Ground = CreateEntity(-1, MeshID(Mesh), MaterialID(Material))
CreateEntityBody(Ground, #PB_Entity_StaticBody, 1, 0, 1)
Mesh = LoadMesh(#PB_Any, "sinbad.mesh")
Player = CreateEntity(-1, MeshID(Mesh), #PB_Material_None, 0, 170, 0)
ScaleEntity(Player, 25, 25, 25)
CreateEntityBody(Player, #PB_Entity_ConvexHullBody, 200, 1, 500)
EntityAngularFactor(Player, 0, 1, 0)
; Render
Repeat
ExamineKeyboard()
;-keyboard events : Distance and move
If KeyboardPushed (#PB_Key_Up)
PlayerSpeed = 300
CurrentAnimation = "RunBase"
ElseIf KeyboardPushed (#PB_Key_Down)
PlayerSpeed = -300
CurrentAnimation = "RunBase"
Else
CurrentAnimation = "IdleTop"
PlayerSpeed = 0
EndIf
;-keyboard events : Rotation around player and turn
If KeyboardPushed (#PB_Key_Left)
RotateEntity(Player, 0, 3, 0, #PB_Relative)
CurrentAnimation = "RunBase"
ElseIf KeyboardPushed (#PB_Key_Right)
RotateEntity(Player, 0, -3, 0, #PB_Relative)
CurrentAnimation = "RunBase"
EndIf
If PlayerSpeed
DisableEntityBody(Player, #False) ; Wake up entity (BugWare)
MoveEntity(Player, 0, 0, PlayerSpeed, #PB_Absolute|#PB_Local)
EndIf
;Play animation
If EntityAnimationStatus(Player, CurrentAnimation) = #PB_EntityAnimation_Stopped
StartEntityAnimation(Player, CurrentAnimation)
EndIf
CameraFollow(Camera, EntityID(Player), 180, EntityY(Player) + 100, 500, 1, #True)
RenderWorld(60)
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
EndProcedure
Procedure DownLoad(Url.s)
Protected FileName.s = GetFilePart(Url)
Protected StartTime = ElapsedMilliseconds()
Protected Result
Debug "Chargement de " + FileName + " en cours ..."
Result = ReceiveHTTPFile(Url, Assets + GetFilePart(Url))
If Result
Debug "Temps de chargement " + Str(ElapsedMilliseconds() - StartTime) + " milliseconde(s) " + #CRLF$
Else
Debug url + " is not download"
Exit()
EndIf
EndProcedure
Procedure Exit()
End
EndProcedure