CameraViewport.htm 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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>CameraViewport camera,x,y,width,height</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. camera - camera handle <br />
  13. x - x coordinate of top left hand corner of viewport <br />
  14. y - y coordinate of top left hand corner of viewport <br />
  15. width - width of viewport <br />
  16. height - height of viewport
  17. </td>
  18. </tr>
  19. </table>
  20. <h1>Description</h1>
  21. <table>
  22. <tr>
  23. <td>
  24. Sets the camera viewport position and size. <br />
  25. <br />
  26. The camera viewport is the area of the 2D screen that the 3D graphics as viewed by the camera are displayed in. <br />
  27. <br />
  28. Setting the camera viewport allows you to achieve spilt-screen and rear-view mirror effects.
  29. </td>
  30. </tr>
  31. </table>
  32. <h1><a href=../3d_examples/CameraViewport.bb>Example</a></h1>
  33. <table>
  34. <tr>
  35. <td>
  36. ; CameraViewport Example <br />
  37. ; ---------------------- <br />
  38. <br />
  39. Graphics3D 640,480 <br />
  40. SetBuffer BackBuffer() <br />
  41. <br />
  42. ; Create first camera <br />
  43. cam1=CreateCamera() <br />
  44. <br />
  45. ; Set the first camera's viewport so that it fills the top half of the camera <br />
  46. CameraViewport cam1,0,0,GraphicsWidth(),GraphicsHeight()/2 <br />
  47. <br />
  48. ; Create second camera <br />
  49. cam2=CreateCamera() <br />
  50. <br />
  51. ; Set the second camera's viewport so that it fills the bottom half of the camera <br />
  52. CameraViewport cam2,0,GraphicsHeight()/2,GraphicsWidth(),GraphicsHeight()/2 <br />
  53. <br />
  54. light=CreateLight() <br />
  55. RotateEntity light,90,0,0 <br />
  56. <br />
  57. plane=CreatePlane() <br />
  58. grass_tex=LoadTexture( "media/mossyground.bmp" ) <br />
  59. EntityTexture plane,grass_tex <br />
  60. PositionEntity plane,0,-1,0 <br />
  61. <br />
  62. While Not KeyDown( 1 ) <br />
  63. <br />
  64. If KeyDown( 205 )=True Then TurnEntity cam1,0,-1,0 <br />
  65. If KeyDown( 203 )=True Then TurnEntity cam1,0,1,0 <br />
  66. If KeyDown( 208 )=True Then MoveEntity cam1,0,0,-0.05 <br />
  67. If KeyDown( 200 )=True Then MoveEntity cam1,0,0,0.05 <br />
  68. <br />
  69. RenderWorld <br />
  70. <br />
  71. Text 0,0,"Use cursor keys to move the first camera about the infinite plane" <br />
  72. <br />
  73. Flip <br />
  74. <br />
  75. Wend <br />
  76. <br />
  77. End
  78. </td>
  79. </tr>
  80. </table>
  81. <br>
  82. <a target=_top href=../index.htm>Index</a><br>
  83. <br>
  84. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=CameraViewport&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  85. </html>