Ogre 1.0.3 Beta available for testing

Developed or developing a new product in PureBasic? Tell the world about it.
jacobmp92
User
User
Posts: 26
Joined: Mon May 16, 2005 2:30 am
Location: Ohio > USA
Contact:

Post by jacobmp92 »

Will there be collison detection or a physics engine in this version of OGRE? I heard somewhere that ODE was in OGRE.
PB 3.94
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Bug confirmed on a nvidia 6800gt. no shadows in fullscreen.
jacobmp92
User
User
Posts: 26
Joined: Mon May 16, 2005 2:30 am
Location: Ohio > USA
Contact:

Post by jacobmp92 »

dracflamloc wrote:Bug confirmed on a nvidia 6800gt. no shadows in fullscreen.
Confirmed on an ATI Radeon 9250.
PB 3.94
User avatar
oakvalley
User
User
Posts: 77
Joined: Sun Aug 08, 2004 6:34 pm
Location: Norway
Contact:

Post by oakvalley »

Hello Fred,

I get error 2555, 2557 or 2558 in a own messagerequester when trying
my source that worked with the previous 3dengine.dll (not the v1.0.03 or the one that is now included into 3.94 update)

Never seen such error requesters before when dealing with 3dengine.dll

The error occurs when:

"CreateTexture(0,256,256)"
This happens AFTER a texture was already created before.

It should only replace the existing one, as it says in the manual :)

Are the new error codes something you recently have put in, and what
does they mean?
Regards Stone Oakvalley
Currently @ PB 5.70
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Hi
Installed the new beta here, and the purelibraries.
Just run Shadow.pb example, and again i get a Visual C++ runlib error message.
For more details it happens on a laptop called Dell Latitude D610, WinXPproSP2
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

Same here. The shadows works only in WindowedMode() ( WinXP SP2 )
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

In fact the shadow seems to work only in 32 bits mode, so be sure than the fullscreen is set to 32 bits (and your desktop is running 32 bits if you trying in Windowed mode).
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

YeahhHHH, thats ist ... works fine here :-D
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Of course, 32 bit mode. C++ runtime lib error here in both windowed and full screen modes.

And this:

Code: Select all

;*******************************************
;** Comtois ** 15/11/03 ** Matrice / Vagues  **
;*******************************************
;Modifications and additions by Psychophanta

;-Initialisation
bitplanes.b=32:RX.w=1024:RY.w=768
If InitEngine3D()=0 Or InitSprite()=0 Or InitKeyboard()=0
  MessageRequester("Error","Something fails to open Screen for 3D. This requires Engine3D.dll",0)
  End
EndIf
While OpenScreen(RX.w,RY.w,bitplanes.b,"DemoMatrice")=0
  If bitplanes.b>16:bitplanes.b-8
  ElseIf RY.w>600:RX.w=800:RY.w=600
  ElseIf RY.w>480:RX.w=640:RY.w=480
  ElseIf RY.w>400:RX.w=640:RY.w=400
  ElseIf RY.w>240:RX.w=320:RY.w=240
  ElseIf RY.w>200:RX.w=320:RY.w=200
  Else:MessageRequester("VGA limitation","Can't open Screen!",0):End
  EndIf
Wend
;-Constantes
#NbX=30 ; nombre de facettes
#NbZ=30 ; nombre de facettes
#DegConv=3.14159265/180
DataSection
Image:IncludeBinary "purebasiclogoNew.png"
EndDataSection

;-Variables Globales
Global AngleVague.f,WaveFrequency.f,WavePeriodX.f,WavePeriodZ.f,WaveAmplitude.f
Global xrot.f,yrot.f,zrot.f,*PointID,*TriangleID,*TextureID
Global CamLocateX.l,CamLocateY.l,CamLocateZ.l,CamLookAtX.l,CamLookAtY.l,CamLookAtZ.l
Global Mode.b
circle.l=360
AngleVague=Random(circle)
WaveFrequency=3;=waves/second
WavePeriodX=5;=1/Wave lenght
WavePeriodZ=9;=1/Wave lenght
WaveAmplitude=2
xrot=-0.3:yrot=-0.4:zrot=0.2
CamLocateX.l=0:CamLocateY.l=0:CamLocateZ.l=50
CamLookAtX.l=0:CamLookAtY.l=0:CamLookAtZ.l=0

;-Procédures
Procedure Matrice(FX.l,FZ.l)
  adresse=*PointID
  For b=0 To FZ
    For a=0 To FX
      PokeF(adresse,a-FX/2):PokeF(adresse+4,0):PokeF(adresse+8,b-FZ/2)
      adresse+12
    Next
  Next

  adresse=*TriangleID
  Nb=FX+1
  For b=0 To FZ-1
    For a=0 To FX-1
      P1=a+(b*Nb)
      P2=P1+1
      P3=a+(b+1)*Nb
      P4=P3+1
      PokeW(adresse,P3):PokeW(adresse+2,P2):PokeW(adresse+4,P1)
      PokeW(adresse+6,P2):PokeW(adresse+8,P3):PokeW(adresse+10,P4)
      PokeW(adresse+12,P1):PokeW(adresse+14,P2):PokeW(adresse+16,P3)
      PokeW(adresse+18,P4):PokeW(adresse+20,P3):PokeW(adresse+22,P2)        
      adresse+24
    Next
  Next

  adresse=*TextureID
  For b=0 To FZ
    For a=0 To FX
      PokeF(adresse,a/FX):PokeF(adresse+4,b/FZ) 
      adresse+8
    Next
  Next
EndProcedure

Procedure vagues()
  ; Modification sur l'axe des Y
  adresse=*PointID+4
  For z=0 To #NbZ
    For x=0 To #NbX
      PokeF(adresse,Sin(#DegConv*(AngleVague+x*WavePeriodX+z*WavePeriodZ))*WaveAmplitude)
      adresse+12
    Next
  Next
  SetMeshData(0,0,*PointID,(#NbX+1)*(#NbZ+1))
EndProcedure

Procedure.b ShowTextAndKeyTest(hidetext.b)
  If hidetext.b=0
    StartDrawing(ScreenOutput())
    DrawingMode(1)
    FrontColor(20,180,115)
    Locate(0,0)
    DrawText("[F1] => Toggle Mode affichage")
    Locate(0,20)
    DrawText("[PageUp] / [PageDown] => Wave Amplitude : "+StrF(WaveAmplitude))
    Locate(0,40)
    DrawText("[Up Arrow] / [Down Arrow] => Wave Period on Z axis : "+Str(WavePeriodZ))
    Locate(0,60)
    DrawText("[Right Arrow] / [Left Arrow] => Wave Period on X axis : "+Str(WavePeriodX))
    Locate(0,80)
    DrawText("[Home key] / [End key] => Wave speed : "+Str(WaveFrequency))
    Locate(0,100)
    DrawText("[F2] / [Shift+F2] => X rotation speed : "+StrF(xrot))
    Locate(0,120)
    DrawText("[F3] / [Shift+F3] => Y rotation speed : "+StrF(yrot))
    Locate(0,140)
    DrawText("[F4] / [Shift+F4] => Z rotation speed : "+StrF(zrot))
    Locate(0,160)
    DrawText("[F5] / [Shift+F5] => X Camera location : "+Str(CamLocateX))
    Locate(0,180)
    DrawText("[F6] / [Shift+F6] => Y Camera location : "+Str(CamLocateY))
    Locate(0,200)
    DrawText("[F7] / [Shift+F7] => Z Camera location : "+Str(CamLocateZ))
    Locate(0,220)
    DrawText("[F8] / [Shift+F8] => X Camera look at : "+Str(CamLookAtX))
    Locate(0,240)
    DrawText("[F9] / [Shift+F9] => Y Camera look at : "+Str(CamLookAtY))
    Locate(0,260)
    DrawText("[F10] / [Shift+F10] => Z Camera look at : "+Str(CamLookAtZ))
    Locate(0,280)
    DrawText("[F11] => Show or hide text")
    Locate(0,300)
    DrawText("[Space] => Halt")
    StopDrawing()
  EndIf
  If KeyboardReleased(#PB_Key_F1)
    If Mode.b:Mode=0:CameraRenderMode(0,#PB_Camera_Textured):Else:Mode=1:CameraRenderMode(0,#PB_Camera_Wireframe):EndIf
  EndIf
  If KeyboardReleased(#PB_Key_PageUp):WaveAmplitude+0.1:EndIf
  If KeyboardReleased(#PB_Key_PageDown):WaveAmplitude-0.1:EndIf
  If KeyboardReleased(#PB_Key_Up):WavePeriodZ+1:EndIf
  If KeyboardReleased(#PB_Key_Down):WavePeriodZ-1:EndIf
  If KeyboardReleased(#PB_Key_Left):WavePeriodX-1:EndIf
  If KeyboardReleased(#PB_Key_Right):WavePeriodX+1:EndIf
  If KeyboardReleased(#PB_Key_Home):WaveFrequency+1:EndIf
  If KeyboardReleased(#PB_Key_End):WaveFrequency-1:EndIf
  
  If KeyboardReleased(#PB_Key_F2)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):xrot-0.1:Else:xrot+0.1:EndIf
  EndIf
  If KeyboardReleased(#PB_Key_F3)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):yrot-0.1:Else:yrot+0.1:EndIf
  EndIf
  If KeyboardReleased(#PB_Key_F4)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):zrot-0.1:Else:zrot+0.1:EndIf
  EndIf

  If KeyboardPushed(#PB_Key_F5)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLocateX-1:Else:CamLocateX+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F6)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLocateY-1:Else:CamLocateY+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F7)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLocateZ-1:Else:CamLocateZ+1:EndIf
  EndIf

  If KeyboardPushed(#PB_Key_F8)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLookAtX-1:Else:CamLookAtX+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F9)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLookAtY-1:Else:CamLookAtY+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F10)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLookAtZ-1:Else:CamLookAtZ+1:EndIf
  EndIf
  If KeyboardReleased(#PB_Key_F11):hidetext.b!1:EndIf
  While KeyboardPushed(#PB_Key_Space):ExamineKeyboard():Wend
  ProcedureReturn hidetext.b
EndProcedure

;-Mémoires Mesh
*PointID=AllocateMemory(12*(#NbX+1)*(#NbZ+1))
*TriangleID=AllocateMemory(12*#NbX*#NbZ*4)
*TextureID=AllocateMemory(12*(#NbX+1)*(#NbZ+1))

Matrice(#NbX,#NbZ)

;-Mesh
CreateMesh(0)
SetMeshData(0,#PB_Mesh_Vertices,*PointID,(#NbX+1)*(#NbZ+1))
SetMeshData(0,#PB_Mesh_Triangles,*TriangleID,(#NbX)*(#NbZ)*4)
SetMeshData(0,#PB_Mesh_UVCoordinates,*TextureID,(#NbX+1)*(#NbZ+1))

;-Texture
UsePNGImageDecoder()
;LoadTexture(0,"purebasiclogoNew.png")
CatchImage(0,?Image)
CreateTexture(0,256,256)
StartDrawing(TextureOutput(0))
DrawImage(UseImage(0),0,0)
DrawingMode(4)
Box(1,1,254,254,$FFFFFF)
StopDrawing()

;- MAterial
CreateMaterial(0,TextureID(0))
MaterialFilteringMode(0,#PB_Material_Trilinear)

;-Entity
 CreateEntity(0,MeshID(0),MaterialID(0))

;-Camera
CreateCamera(0,0,0,100,100)
AmbientColor($FFFFFF);<- Essential for clarity

;-Boucle principale
Repeat
  ClearScreen(0,0,0)
  ExamineKeyboard()
  
  CameraLocate(0,CamLocateX,CamLocateY,CamLocateZ)
  CameraLookAt(0,CamLookAtX,CamLookAtY,CamLookAtZ)

  ;Calculate (AngleVague+WaveFrequency)%360: (coz % operand doesn't accept floats)
  !fild dword[v_circle]
  !fld dword[v_AngleVague]
  !fadd dword[v_WaveFrequency]
  !fprem
  !fstp dword[v_AngleVague]
  !fstp st1
  
  vagues()
  RotateEntity(0,xrot,yrot,zrot)
  RenderWorld()
  hidetext.b=ShowTextAndKeyTest(hidetext.b)
  FlipBuffers():Delay(7)
Until KeyboardPushed(#PB_Key_Escape)
crashes here :( . It crashes when the function: "CreateEntity(0,MeshID(0),MaterialID(0))" is reached.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

Okay shadows work in fullscreen now. 32bit all the way!
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

The mesh format has changed, so it's logical than your CreateMesh() + SetMeshData() fails. Just look in the included MeshManual.pb sample to see how the new format works (and the order to respect !).
venom
User
User
Posts: 56
Joined: Fri Jul 25, 2003 1:54 pm
Location: Australia

Post by venom »

MeshManual is giving an error that TextureID is null.
THCM
Enthusiast
Enthusiast
Posts: 276
Joined: Fri Apr 25, 2003 5:06 pm
Location: Gummersbach - Germany
Contact:

Post by THCM »

@Fred: Billboard example crashes with a runtime error. My game also crashes. I'm currently trying to figure out why. I don't use mesh-creation or billboard commands. Did you change anything else?

What about antialiasing and filterquality? I don't think it would be too hard to implement, so why not give it a try?
The Human Code Machine / Masters' Design Group
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

Post by dontmailme »

Thought I'd give this a try with 3.94 and the robot.mesh cannot be loaded

RC=0

running shadow.pb

Did I miss something ?
Paid up PB User !
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post by Comtois »

Fred , can you add example for UVCoordinate ?
or tell me how to do ?

i change nothing in the code except

Code: Select all

#PB_Mesh_Vertex  = 1 << 0
#PB_Mesh_Color        = 1 << 1
#PB_Mesh_Normal       = 1 << 2
#PB_Mesh_UVCoordinate = 1 << 3

 ;Additionnnal flag To specify the faces

CreateMesh(0)
SetMeshData(0,#PB_Mesh_Vertex,*PointID,(#NbX+1)*(#NbZ+1))
SetMeshData(0,#PB_Mesh_face,*TriangleID,(#NbX)*(#NbZ)*4)
SetMeshData(0,#PB_Mesh_UVCoordinates,*TextureID,(#NbX+1)*(#NbZ+1))
Now , it work , but not textures .

Code: Select all

;*******************************************
;** Comtois ** 15/11/03 ** Matrice / Vagues  **
;*******************************************
;Modifications and additions by Psychophanta

;-Initialisation
bitplanes.b=32:RX.w=1024:RY.w=768
If InitEngine3D()=0 Or InitSprite()=0 Or InitKeyboard()=0
  MessageRequester("Error","Something fails to open Screen for 3D. This requires Engine3D.dll",0)
  End
EndIf
While OpenScreen(RX.w,RY.w,bitplanes.b,"DemoMatrice")=0
  If bitplanes.b>16:bitplanes.b-8
  ElseIf RY.w>600:RX.w=800:RY.w=600
  ElseIf RY.w>480:RX.w=640:RY.w=480
  ElseIf RY.w>400:RX.w=640:RY.w=400
  ElseIf RY.w>240:RX.w=320:RY.w=240
  ElseIf RY.w>200:RX.w=320:RY.w=200
  Else:MessageRequester("VGA limitation","Can't open Screen!",0):End
  EndIf
Wend
;-Constantes
#NbX=30 ; nombre de facettes
#NbZ=30 ; nombre de facettes
#DegConv=3.14159265/180

#PB_Mesh_Vertex       = 1 << 0
#PB_Mesh_Color        = 1 << 1
#PB_Mesh_Normal       = 1 << 2
#PB_Mesh_UVCoordinate = 1 << 3

 ;Additionnnal flag To specify the faces

#PB_Mesh_Face         = 1 << 4
    
DataSection
Image:IncludeBinary "purebasiclogoNew.png"
EndDataSection

;-Variables Globales
Global AngleVague.f,WaveFrequency.f,WavePeriodX.f,WavePeriodZ.f,WaveAmplitude.f
Global xrot.f,yrot.f,zrot.f,*PointID,*TriangleID,*TextureID
Global CamLocateX.l,CamLocateY.l,CamLocateZ.l,CamLookAtX.l,CamLookAtY.l,CamLookAtZ.l
Global Mode.b
circle.l=360
AngleVague=Random(circle)
WaveFrequency=3;=waves/second
WavePeriodX=5;=1/Wave lenght
WavePeriodZ=9;=1/Wave lenght
WaveAmplitude=2
xrot=-0.3:yrot=-0.4:zrot=0.2
CamLocateX.l=0:CamLocateY.l=0:CamLocateZ.l=50
CamLookAtX.l=0:CamLookAtY.l=0:CamLookAtZ.l=0

;-Procédures
Procedure Matrice(FX.l,FZ.l)
  adresse=*PointID
  For b=0 To FZ
    For a=0 To FX
      PokeF(adresse,a-FX/2):PokeF(adresse+4,0):PokeF(adresse+8,b-FZ/2)
      adresse+12
    Next
  Next

  adresse=*TriangleID
  Nb=FX+1
  For b=0 To FZ-1
    For a=0 To FX-1
      P1=a+(b*Nb)
      P2=P1+1
      P3=a+(b+1)*Nb
      P4=P3+1
      PokeW(adresse,P3):PokeW(adresse+2,P2):PokeW(adresse+4,P1)
      PokeW(adresse+6,P2):PokeW(adresse+8,P3):PokeW(adresse+10,P4)
      PokeW(adresse+12,P1):PokeW(adresse+14,P2):PokeW(adresse+16,P3)
      PokeW(adresse+18,P4):PokeW(adresse+20,P3):PokeW(adresse+22,P2)       
      adresse+24
    Next
  Next

  adresse=*TextureID
  For b=0 To FZ
    For a=0 To FX
      PokeF(adresse,a/FX):PokeF(adresse+4,b/FZ)
      adresse+8
    Next
  Next
EndProcedure

Procedure vagues()
  ; Modification sur l'axe des Y
  adresse=*PointID+4
  For z=0 To #NbZ
    For x=0 To #NbX
      PokeF(adresse,Sin(#DegConv*(AngleVague+x*WavePeriodX+z*WavePeriodZ))*WaveAmplitude)
      adresse+12
    Next
  Next
  SetMeshData(0,#PB_Mesh_Vertex ,*PointID,(#NbX+1)*(#NbZ+1))
EndProcedure

Procedure.b ShowTextAndKeyTest(hidetext.b)
  If hidetext.b=0
    StartDrawing(ScreenOutput())
    DrawingMode(1)
    FrontColor(20,180,115)
    Locate(0,0)
    DrawText("[F1] => Toggle Mode affichage")
    Locate(0,20)
    DrawText("[PageUp] / [PageDown] => Wave Amplitude : "+StrF(WaveAmplitude))
    Locate(0,40)
    DrawText("[Up Arrow] / [Down Arrow] => Wave Period on Z axis : "+Str(WavePeriodZ))
    Locate(0,60)
    DrawText("[Right Arrow] / [Left Arrow] => Wave Period on X axis : "+Str(WavePeriodX))
    Locate(0,80)
    DrawText("[Home key] / [End key] => Wave speed : "+Str(WaveFrequency))
    Locate(0,100)
    DrawText("[F2] / [Shift+F2] => X rotation speed : "+StrF(xrot))
    Locate(0,120)
    DrawText("[F3] / [Shift+F3] => Y rotation speed : "+StrF(yrot))
    Locate(0,140)
    DrawText("[F4] / [Shift+F4] => Z rotation speed : "+StrF(zrot))
    Locate(0,160)
    DrawText("[F5] / [Shift+F5] => X Camera location : "+Str(CamLocateX))
    Locate(0,180)
    DrawText("[F6] / [Shift+F6] => Y Camera location : "+Str(CamLocateY))
    Locate(0,200)
    DrawText("[F7] / [Shift+F7] => Z Camera location : "+Str(CamLocateZ))
    Locate(0,220)
    DrawText("[F8] / [Shift+F8] => X Camera look at : "+Str(CamLookAtX))
    Locate(0,240)
    DrawText("[F9] / [Shift+F9] => Y Camera look at : "+Str(CamLookAtY))
    Locate(0,260)
    DrawText("[F10] / [Shift+F10] => Z Camera look at : "+Str(CamLookAtZ))
    Locate(0,280)
    DrawText("[F11] => Show or hide text")
    Locate(0,300)
    DrawText("[Space] => Halt")
    StopDrawing()
  EndIf
  If KeyboardReleased(#PB_Key_F1)
    If Mode.b:Mode=0:CameraRenderMode(0,#PB_Camera_Textured):Else:Mode=1:CameraRenderMode(0,#PB_Camera_Wireframe):EndIf
  EndIf
  If KeyboardReleased(#PB_Key_PageUp):WaveAmplitude+0.1:EndIf
  If KeyboardReleased(#PB_Key_PageDown):WaveAmplitude-0.1:EndIf
  If KeyboardReleased(#PB_Key_Up):WavePeriodZ+1:EndIf
  If KeyboardReleased(#PB_Key_Down):WavePeriodZ-1:EndIf
  If KeyboardReleased(#PB_Key_Left):WavePeriodX-1:EndIf
  If KeyboardReleased(#PB_Key_Right):WavePeriodX+1:EndIf
  If KeyboardReleased(#PB_Key_Home):WaveFrequency+1:EndIf
  If KeyboardReleased(#PB_Key_End):WaveFrequency-1:EndIf
 
  If KeyboardReleased(#PB_Key_F2)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):xrot-0.1:Else:xrot+0.1:EndIf
  EndIf
  If KeyboardReleased(#PB_Key_F3)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):yrot-0.1:Else:yrot+0.1:EndIf
  EndIf
  If KeyboardReleased(#PB_Key_F4)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):zrot-0.1:Else:zrot+0.1:EndIf
  EndIf

  If KeyboardPushed(#PB_Key_F5)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLocateX-1:Else:CamLocateX+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F6)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLocateY-1:Else:CamLocateY+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F7)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLocateZ-1:Else:CamLocateZ+1:EndIf
  EndIf

  If KeyboardPushed(#PB_Key_F8)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLookAtX-1:Else:CamLookAtX+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F9)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLookAtY-1:Else:CamLookAtY+1:EndIf
  EndIf
  If KeyboardPushed(#PB_Key_F10)
    If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift):CamLookAtZ-1:Else:CamLookAtZ+1:EndIf
  EndIf
  If KeyboardReleased(#PB_Key_F11):hidetext.b!1:EndIf
  While KeyboardPushed(#PB_Key_Space):ExamineKeyboard():Wend
  ProcedureReturn hidetext.b
EndProcedure

;-Mémoires Mesh
*PointID=AllocateMemory(12*(#NbX+1)*(#NbZ+1))
*TriangleID=AllocateMemory(12*#NbX*#NbZ*4)
*TextureID=AllocateMemory(12*(#NbX+1)*(#NbZ+1))

Matrice(#NbX,#NbZ)

;-Mesh

CreateMesh(0)
SetMeshData(0,#PB_Mesh_Vertex,*PointID,(#NbX+1)*(#NbZ+1))
SetMeshData(0,#PB_Mesh_face,*TriangleID,(#NbX)*(#NbZ)*4)
SetMeshData(0,#PB_Mesh_UVCoordinates,*TextureID,(#NbX+1)*(#NbZ+1))

;-Texture
UsePNGImageDecoder()
;LoadTexture(0,"purebasiclogoNew.png")
CatchImage(0,?Image)
CreateTexture(0,256,256)
StartDrawing(TextureOutput(0))
DrawImage(UseImage(0),0,0)
DrawingMode(4)
Box(1,1,254,254,$FFFFFF)
StopDrawing()

;- MAterial
CreateMaterial(0,TextureID(0))
MaterialFilteringMode(0,#PB_Material_Trilinear)

;-Entity
 CreateEntity(0,MeshID(0),MaterialID(0))

;-Camera
CreateCamera(0,0,0,100,100)
AmbientColor($FFFFFF);<- Essential for clarity

;-Boucle principale
Repeat
  ClearScreen(0,0,0)
  ExamineKeyboard()
 
  CameraLocate(0,CamLocateX,CamLocateY,CamLocateZ)
  CameraLookAt(0,CamLookAtX,CamLookAtY,CamLookAtZ)

  ;Calculate (AngleVague+WaveFrequency)%360: (coz % operand doesn't accept floats)
  !fild dword[v_circle]
  !fld dword[v_AngleVague]
  !fadd dword[v_WaveFrequency]
  !fprem
  !fstp dword[v_AngleVague]
  !fstp st1
 
  vagues()
  RotateEntity(0,xrot,yrot,zrot)
  RenderWorld()
  hidetext.b=ShowTextAndKeyTest(hidetext.b)
  FlipBuffers():Delay(7)
Until KeyboardPushed(#PB_Key_Escape) 
Please correct my english
http://purebasic.developpez.com/
Post Reply