CaptureWorld.bb 969 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ; CaptureWorld and RenderWorld with tween.
  2. ; Left/Right arrow keys change tween. Escape quits.
  3. Const width = 640, height = 480
  4. Const KEY_ESC = 1, KEY_LEFT = 203, KEY_RIGHT = 205
  5. Graphics3D 640, 480
  6. AmbientLight 50, 50, 50
  7. c1 = CreateCone( )
  8. PositionEntity c1, -5, 0, 0 ; on the left side of the screen
  9. ScaleEntity c1, 1, 3, 1
  10. EntityColor c1, 255, 0, 0
  11. cam = CreateCamera()
  12. PositionEntity cam, 0, 0, -50
  13. CameraZoom cam, 4
  14. lt = CreateLight() : TurnEntity lt, 30, 40, 0
  15. c2 = CopyEntity( c1 )
  16. CaptureWorld ; with c1 and c2 identically placed
  17. MoveEntity c2, 8, 0, 0 ; to the right side of the screen
  18. TurnEntity c2, 0, 0, 90 ; and tilted
  19. tw# = 100 ; 100 * tween
  20. ; Interpolate between the pre-CaptureWorld ( tween = 0 )
  21. ; arrangement and the current one ( tween = 1 ).
  22. While Not KeyDown( KEY_ESC )
  23. If KeyDown( KEY_LEFT ) Then tw = tw - 1
  24. If KeyDown( KEY_RIGHT ) Then tw = tw + 1
  25. RenderWorld tw / 100
  26. Text 250, 100, "tween = " + ( tw / 100 )
  27. Flip
  28. Wend
  29. End