CameraZoom.htm 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>CameraZoom camera,zoom#</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. camera - camera handle <br />
  13. zoom# - zoom factor of camera
  14. </td>
  15. </tr>
  16. </table>
  17. <h1>Description</h1>
  18. <table>
  19. <tr>
  20. <td>
  21. Sets zoom factor for a camera. Defaults to 1.
  22. </td>
  23. </tr>
  24. </table>
  25. <h1><a href=../3d_examples/CameraZoom.bb>Example</a></h1>
  26. <table>
  27. <tr>
  28. <td>
  29. ; CreateZoom Example <br />
  30. ; ------------------ <br />
  31. <br />
  32. Graphics3D 640,480 <br />
  33. SetBuffer BackBuffer() <br />
  34. <br />
  35. camera=CreateCamera() <br />
  36. PositionEntity camera,0,1,0 <br />
  37. <br />
  38. light=CreateLight() <br />
  39. RotateEntity light,90,0,0 <br />
  40. <br />
  41. ground=CreatePlane() <br />
  42. sand_tex=LoadTexture("media/sand.bmp") <br />
  43. ScaleTexture sand_tex,10,10 <br />
  44. EntityTexture ground,sand_tex <br />
  45. EntityColor ground,168,133,55 <br />
  46. <br />
  47. cactus1=LoadMesh("media/CACTUS2.x") <br />
  48. cactus2=LoadMesh("media/CACTUS2.x") <br />
  49. camel=LoadMesh("media/camel.x") <br />
  50. PositionEntity cactus1,-1,2,10 <br />
  51. PositionEntity cactus2,1,2,10 <br />
  52. PositionEntity camel,0,1,1000 <br />
  53. <br />
  54. ; Set initial zoom value <br />
  55. zoom#=1 <br />
  56. <br />
  57. While Not KeyDown( 1 ) <br />
  58. <br />
  59. If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0 <br />
  60. If KeyDown( 203 )=True Then TurnEntity camera,0,1,0 <br />
  61. <br />
  62. ; Change zoom value depending on key pressed <br />
  63. If KeyDown( 208 )=True Then zoom#=zoom#-0.1 <br />
  64. If KeyDown( 200 )=True Then zoom#=zoom#+0.1 <br />
  65. <br />
  66. ; Put a minimum and maximum cap on zoom value <br />
  67. If zoom#<1 Then zoom#=1 <br />
  68. If zoom#>100 Then zoom#=100 <br />
  69. <br />
  70. ; Set camera zoom <br />
  71. CameraZoom camera,zoom# <br />
  72. <br />
  73. RenderWorld <br />
  74. <br />
  75. Text 0,0,"Use left and right cursor keys to turn around" <br />
  76. Text 0,20,"Use up and down cursor keys to change camera zoom" <br />
  77. Text 0,40,"There is a camel on the horizon, inbetween the cacti. Zoom in to see it." <br />
  78. Text 0,60,"CameraZoom camera,"+zoom# <br />
  79. <br />
  80. Flip <br />
  81. <br />
  82. Wend <br />
  83. <br />
  84. End
  85. </td>
  86. </tr>
  87. </table>
  88. <br>
  89. <a target=_top href=../index.htm>Index</a><br>
  90. <br>
  91. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=CameraZoom&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  92. </html>