Code : Tout sélectionner
EnableExplicit
Enumeration
#MainForm
EndEnumeration
Define.l Event
Global Camera.i, Mesh.i, Entity.i
InitEngine3D()
InitKeyboard()
InitSprite()
InitMouse()
Add3DArchive(#PB_Compiler_Home+"Examples\3D\Data\models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home+"Examples\3D\Data\scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()
OpenWindow(#Mainform,0,0,1024,768, "M", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Mainform),0,0,1024,768,0, 0, 0)
KeyboardMode(#PB_Keyboard_International)
;
; Une camera
Camera = CreateCamera(#PB_Any,0,0,100,100)
;
; Lumiere et ombre
AmbientColor(RGB(127, 127, 127))
CreateLight(#PB_Any,RGB(151, 251, 151), -1.8, 10, 5)
WorldShadows(#PB_Shadow_Additive)
;
; Mesh
Mesh = LoadMesh(#PB_Any, #PB_Compiler_Home+"Examples\3D\Data\Models\robot.mesh")
Entity = CreateEntity(#PB_Any, MeshID(Mesh), #PB_Material_None)
StartEntityAnimation(Entity, "Walk")
;MeshPoseCount(); nombres de paramètres incorrect
If Mesh
Debug MeshPoseCount(Mesh)
EndIf
While #True
Event = WindowEvent()
If ExamineKeyboard()
; Touche Escape pour fermer l'application
If Event = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
Break
EndIf
EndIf
CameraLookAt(Camera, 0, 0, 0)
MoveCamera(Camera, 0, 50, 300, #PB_Absolute)
; Affiche le rendu de la scène
ClearScreen(RGB(0, 0, 0))
RenderWorld()
FlipBuffers()
Wend