
je suis partit du programme d'exemple "Physicsmaterial"
une question, que faut t-il comme fichier pour faire tourner l'exe ?
j'ai mis la dll dreamotion3D.dll avec l'exe mais j'ai toujours un message d'erreur...
Code : Tout sélectionner
; Include files
IncludePath "C:\Program Files\PureBasic\Dreamotion3D\SamplesDM3D\include\"
IncludeFile "dreamotion3d.pbi"
; Globales
Global Quit.b
#nbCubes = 2000
Global *camera.CEntity
Global Dim *mesh.CEntity(#nbCubes)
Global *light.CEntity
Global *font.CFont
Global Dim rx(#nbCubes)
Global Dim ry(#nbCubes)
Global Dim rz(#nbCubes)
; Init PB modules
If InitSprite() = 0 Or InitKeyboard() = 0 ;Or InitMouse() = 0
End
EndIf
; set graphic window 3D
DM_Graphics3D(800, 600, 32, 1, 1)
; load font
*font = DM_LoadFont( "Tahoma",9 , 0)
DM_TextColor(*font, 198,198,198,255)
; Set ambient color
DM_AmbiantLight(80,80,110)
;--------------------------------------------------------------
; little light...
;--------------------------------------------------------------
;*light = DM_CreateLight(3)
e = 2000
; create 5 random cubes
For i=0 To #nbCubes
*mesh(i) = DM_CreateCube()
DM_ScaleMesh(*mesh(i), 10,10,10)
;DM_PositionEntity(*mesh, 10, 10 ,-8+8*i)
DM_PositionEntity(*mesh(i), Random (e)-e/2, Random (e)-e/2 ,Random (e*2)-e)
;DM_PositionEntity(*mesh, 0,0,0)
DM_EntityColor(*mesh(i), Random(255),Random(255),Random(255),255)
rx(i) = Random (10) - 5
ry(i) = Random (10) - 5
rz(i) = Random (10) - 5
Next
; ---------------------------------------
; create camera
; ---------------------------------------
*camera = DM_CreateCamera()
; DM_MoveEntity(*camera, 0,50,-100)
DM_MoveEntity(*camera, 0,0,0)
DM_RotateEntity(*camera, 0,0,0)
DM_CameraClsColor(*camera, 0, 0, 0)
*light.CEntity = DM_CreateLight(#D3DLIGHT_directional)
DM_LightColor(*light, 255,0,0, 255)
DM_LightRange(*light, 1000)
DM_MoveEntity(*light, 0,0,1000)
Repeat
ExamineKeyboard()
;ExamineMouse()
;ShowCursor_(1)
; if Escape Key, exit
If KeyboardReleased(#PB_Key_Escape) Or WindowEvent()=#PB_Event_CloseWindow
Quit=1
EndIf
DM_TurnEntity(*camera, 0,0,2)
DM_MoveEntity(*camera, 0,0,40)
DM_MoveEntity(*light, 0,0,40)
For i=0 To #nbCubes
DM_TurnEntity(*mesh(i), rx(i), ry(i), rz(i))
If Abs(DM_EntityZ(*camera, #True) - DM_EntityZ(*mesh(i), #True)) > e
;If dist > e
cameraz = DM_EntityZ(*camera, #False)
DM_PositionEntity(*mesh(i), Random (e)-e/2, Random (e)-e/2 ,cameraz + e-5)
EndIf
Next
; ---------------
; Render pass
; ---------------
DM_BeginScene()
DM_RenderWorld()
; draw text
DM_DrawText(*font, 10, 15, "FPS : "+Str(DM_FPS()))
DM_EndScene()
Until Quit=1
DM_ClearGraphics()
End