CameraClsMode.htm 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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>CameraClsMode camera,cls_color,cls_zbuffer</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. camera - camera handle <br />
  13. cls_color - true to clear the color buffer, false not to <br />
  14. cls_zbuffer - true to clear the z-buffer, false not to
  15. </td>
  16. </tr>
  17. </table>
  18. <h1>Description</h1>
  19. <table>
  20. <tr>
  21. <td>
  22. Sets camera clear mode.
  23. </td>
  24. </tr>
  25. </table>
  26. <h1><a href=../3d_examples/CameraClsMode.bb>Example</a></h1>
  27. <table>
  28. <tr>
  29. <td>
  30. ; CameraClsMode Example <br />
  31. ; --------------------- <br />
  32. <br />
  33. Graphics3D 640,480 <br />
  34. SetBuffer BackBuffer() <br />
  35. <br />
  36. camera=CreateCamera() <br />
  37. PositionEntity camera,0,1,-10 <br />
  38. <br />
  39. light=CreateLight() <br />
  40. RotateEntity light,90,0,0 <br />
  41. <br />
  42. plane=CreatePlane() <br />
  43. ground_tex=LoadTexture("media/MossyGround.bmp") <br />
  44. EntityTexture plane,ground_tex <br />
  45. <br />
  46. cube=CreateCube() <br />
  47. PositionEntity cube,0,1,0 <br />
  48. <br />
  49. ; Load 2D background image <br />
  50. background=LoadImage("media/sky.bmp") <br />
  51. <br />
  52. ; Use red ink color so we can see text on top of black or light blue background <br />
  53. Color 255,0,0 <br />
  54. <br />
  55. While Not KeyDown(1) <br />
  56. <br />
  57. If KeyDown(205)=True Then TurnEntity camera,0,-1,0 <br />
  58. If KeyDown(203)=True Then TurnEntity camera,0,1,0 <br />
  59. If KeyDown(208)=True Then MoveEntity camera,0,0,-0.05 <br />
  60. If KeyDown(200)=True Then MoveEntity camera,0,0,0.05 <br />
  61. <br />
  62. ; Toggle cls_color value between 0 and 1 when spacebar is pressed <br />
  63. If KeyHit(57)=True Then cls_color=1-cls_color <br />
  64. <br />
  65. ; Set the camera clear mode, using the cls_color value <br />
  66. CameraClsMode camera,cls_color,1 <br />
  67. <br />
  68. ; Draw a 2D background. When cls_color is set to 0, the 2D graphics will show behind the 3D graphics. <br />
  69. TileBlock background,0,0 <br />
  70. <br />
  71. RenderWorld <br />
  72. <br />
  73. Text 0,0,"Use cursor keys to move about" <br />
  74. Text 0,20,"Press space bar to enable/disable colour clearing" <br />
  75. Text 0,40,"CameraClsMode camera,"+cls_color+","+1 <br />
  76. <br />
  77. Flip <br />
  78. <br />
  79. Wend <br />
  80. <br />
  81. End
  82. </td>
  83. </tr>
  84. </table>
  85. <br>
  86. <a target=_top href=../index.htm>Index</a><br>
  87. <br>
  88. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=CameraClsMode&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  89. </html>