CameraFogMode.htm 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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>CameraFogMode camera,mode</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. camera - camera handle <br />
  13. <br />
  14. mode - <br />
  15. 0: no fog (default) <br />
  16. 1: linear fog
  17. </td>
  18. </tr>
  19. </table>
  20. <h1>Description</h1>
  21. <table>
  22. <tr>
  23. <td>
  24. Sets the camera fog mode. <br />
  25. <br />
  26. This will enable/disable fogging, a technique used to gradually fade out graphics the further they are away from the camera. This can be used to avoid 'pop-up', the moment at which 3D objects suddenly appear on the horizon. <br />
  27. <br />
  28. The default fog colour is black and the default fog range is 1-1000, although these can be changed by using CameraFogColor and CameraFogRange respectively. <br />
  29. <br />
  30. Each camera can have its own fog mode, for multiple on-screen fog effects.
  31. </td>
  32. </tr>
  33. </table>
  34. <h1><a href=../3d_examples/CameraFogMode.bb>Example</a></h1>
  35. <table>
  36. <tr>
  37. <td>
  38. ; CameraFogMode Example <br />
  39. ; --------------------- <br />
  40. <br />
  41. Graphics3D 640,480 <br />
  42. SetBuffer BackBuffer() <br />
  43. <br />
  44. camera=CreateCamera() <br />
  45. PositionEntity camera,0,1,0 <br />
  46. CameraFogRange camera,1,10 <br />
  47. <br />
  48. light=CreateLight() <br />
  49. RotateEntity light,90,0,0 <br />
  50. <br />
  51. plane=CreatePlane() <br />
  52. grass_tex=LoadTexture( "media/mossyground.bmp" ) <br />
  53. EntityTexture plane,grass_tex <br />
  54. <br />
  55. While Not KeyDown( 1 ) <br />
  56. <br />
  57. ; Toggle camera fog mode between 0 and 1 when spacebar is pressed <br />
  58. If KeyHit( 57 )=True Then fog_mode=1-fog_mode : CameraFogMode camera,fog_mode <br />
  59. <br />
  60. If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0 <br />
  61. If KeyDown( 203 )=True Then TurnEntity camera,0,1,0 <br />
  62. If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.05 <br />
  63. If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.05 <br />
  64. <br />
  65. RenderWorld <br />
  66. <br />
  67. Text 0,0,"Use cursor keys to move about the infinite plane" <br />
  68. Text 0,20,"Press spacebar to toggle between CameraFogMode 0/1" <br />
  69. If fog_mode=False Then Text 0,40,"CameraFogMode 0" Else Text 0,40,"CameraFogMode 1" <br />
  70. <br />
  71. Flip <br />
  72. <br />
  73. Wend <br />
  74. <br />
  75. End
  76. </td>
  77. </tr>
  78. </table>
  79. <br>
  80. <a target=_top href=../index.htm>Index</a><br>
  81. <br>
  82. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=CameraFogMode&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  83. </html>