CameraViewport.bb 994 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ; CameraViewport Example
  2. ; ----------------------
  3. Graphics3D 640,480
  4. SetBuffer BackBuffer()
  5. ; Create first camera
  6. cam1=CreateCamera()
  7. ; Set the first camera's viewport so that it fills the top half of the camera
  8. CameraViewport cam1,0,0,GraphicsWidth(),GraphicsHeight()/2
  9. ; Create second camera
  10. cam2=CreateCamera()
  11. ; Set the second camera's viewport so that it fills the bottom half of the camera
  12. CameraViewport cam2,0,GraphicsHeight()/2,GraphicsWidth(),GraphicsHeight()/2
  13. light=CreateLight()
  14. RotateEntity light,90,0,0
  15. plane=CreatePlane()
  16. grass_tex=LoadTexture( "media/mossyground.bmp" )
  17. EntityTexture plane,grass_tex
  18. PositionEntity plane,0,-1,0
  19. While Not KeyDown( 1 )
  20. If KeyDown( 205 )=True Then TurnEntity cam1,0,-1,0
  21. If KeyDown( 203 )=True Then TurnEntity cam1,0,1,0
  22. If KeyDown( 208 )=True Then MoveEntity cam1,0,0,-0.05
  23. If KeyDown( 200 )=True Then MoveEntity cam1,0,0,0.05
  24. RenderWorld
  25. Text 0,0,"Use cursor keys to move the first camera about the infinite plane"
  26. Flip
  27. Wend
  28. End