[4.60] camera orthograhique

Généralités sur la programmation 3D
Avatar de l’utilisateur
blendman
Messages : 2017
Inscription : sam. 19/févr./2011 12:46

[4.60] camera orthograhique

Message par blendman »

salut

Je me demandais s'il n'y avait pas un bug avec la camera orthographic(pb 4.60) :
avec pb 4.51, ça marche nickel

pb 4.60 : ça plante chez moi (bug ogre).

le code à tester :

Code : Tout sélectionner

;********************** declare *************************

Declare movePlayer(key,entity,speed,direction$)


;********************** Init ****************************

InitEngine3D()
InitSprite()
UsePNGImageEncoder()
AntialiasingMode(#PB_AntialiasingMode_x6)
Add3DArchive(#PB_Compiler_Home+"Examples\Sources\Data", #PB_3DArchive_FileSystem)

Global speedy = 4

;********************** window ***************************


OpenWindow(0,0,0,800,600,"camera",#PB_Window_SystemMenu|#PB_Window_MaximizeGadget|#PB_Window_WindowCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0, #PB_Screen_WaitSynchronization)



;********************** load/entity **********************


LoadMesh(0,"robot.mesh")
CreateEntity(0,MeshID(0),#PB_Material_None,0,0,0)
ScaleEntity(0,2,2,2)
;RotateEntity(0,0,135,0)

CreateCamera(0, 0, 0, 1000, 1000 )
MoveCamera(0, 0, 1000,1501)
CameraFOV(0,60)
RotateCamera(0,-30,0,0)
CameraProjectionMode(0, #PB_Camera_Orthographic)

CreateLight(0,RGB(255,220,120),0,1000,150)
WorldShadows(#PB_Shadow_Additive)


;********************** loop *******************************

Repeat
  
  movePlayer(#VK_RIGHT,0,speedy,"x")
  movePlayer(#VK_LEFT,0,-speedy,"x")  
  movePlayer(#VK_UP,0,speedy,"y")
  movePlayer(#VK_DOWN,0,-speedy,"y")
  
  If GetAsyncKeyState_(#VK_DOWN) Or GetAsyncKeyState_(#VK_RIGHT) Or GetAsyncKeyState_(#VK_UP) Or GetAsyncKeyState_(#VK_LEFT)   
    AnimateEntity(0, "Walk")
  EndIf
  
  
  
  RenderWorld()
  FlipBuffers()
Until GetAsyncKeyState_(#VK_ESCAPE)



;********************** procedure **************************



Procedure movePlayer(key,entity,speed,direction$)
  
  If GetAsyncKeyState_(#VK_DOWN) And GetAsyncKeyState_(#VK_RIGHT)
    double = 1
    RotateEntity(entity,0,315,0)    
  ElseIf GetAsyncKeyState_(#VK_DOWN) And GetAsyncKeyState_(#VK_LEFT)
    double = 1
    RotateEntity(entity,0,225,0)
  ElseIf GetAsyncKeyState_(#VK_UP) And GetAsyncKeyState_(#VK_LEFT)    
    double = 1
    RotateEntity(entity,0,135,0)
  ElseIf GetAsyncKeyState_(#VK_UP) And GetAsyncKeyState_(#VK_RIGHT)
    double = 1
    RotateEntity(entity,0,45,0)
  Else 
    double = 0    
  EndIf
  
  If GetAsyncKeyState_(key)    
    If direction$ = "x"    
      MoveEntity(entity,speed,0,0)
    ElseIf direction$ = "y"   
      MoveEntity(entity,0,speed,0)
    ElseIf direction$ = "z"
      MoveEntity(entity,0,0,speed)
    EndIf
    
    If double = 0   
      If key = #VK_LEFT
        RotateEntity(entity,0,180,0)
      ElseIf key = #VK_RIGHT
        RotateEntity(entity,0,0,0)
      ElseIf key = #VK_UP
        RotateEntity(entity,0,90,0)
      ElseIf key = #VK_DOWN
        RotateEntity(entity,0,270,0) 
      EndIf
    EndIf
  EndIf   
EndProcedure
 
vous pouvez me dire si c'est pareil chez vous ?

merci :)
panoramic
Messages : 18
Inscription : dim. 02/nov./2008 20:27

Re: [4.60] camera orthograhique

Message par panoramic »

Ca plante aussi chez moi: j'ai l'erreur
"invalid memory access (read error at adress 32)"
à la ligne 57 : RenderWorld()
Avatar de l’utilisateur
venom
Messages : 3128
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Re: [4.60] camera orthograhique

Message par venom »

chez moi c'est windows qui me met une erreur qui dit :
assertionfailed!
OgreAxisAlignedBox.h






@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Répondre