| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>TerrainShading terrain,enable</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- terrain - terrain handle
<br />
- enable - True to enable terrain shading, False to to disable it. The default mode is False.
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- Enables or disables terrain shading.
<br />
-
<br />
- Shaded terrains are a little slower than non-shaded terrains, and in some instances can increase the visibility of LOD 'pop-in'. However, the option is there to have shaded terrains if you wish to do so.
- </td>
- </tr>
- </table>
- <h1><a href=../3d_examples/TerrainShading.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; TerrainShading Example
<br />
- ; ----------------------
<br />
-
<br />
- Graphics3D 640,480
<br />
- SetBuffer BackBuffer()
<br />
-
<br />
- camera=CreateCamera()
<br />
- PositionEntity camera,1,1,1
<br />
-
<br />
- light=CreateLight()
<br />
- RotateEntity light,45,0,0
<br />
-
<br />
- ; Load terrain
<br />
- terrain=LoadTerrain( "media/height_map.bmp" )
<br />
-
<br />
- ; Set terrain detail, enable vertex morphing
<br />
- TerrainDetail terrain,4000,True
<br />
-
<br />
- ; Scale terrain
<br />
- ScaleEntity terrain,1,50,1
<br />
-
<br />
- ; Texture terrain
<br />
- grass_tex=LoadTexture( "media/mossyground.bmp" )
<br />
- EntityTexture terrain,grass_tex,0,1
<br />
-
<br />
- While Not KeyDown( 1 )
<br />
-
<br />
- ; Toggle terrain shading value between 0 and 1 when spacebar is pressed
<br />
- If KeyHit(57)=True Then terra_shade=1-terra_shade
<br />
-
<br />
- ; Enable/disable terrain shading
<br />
- TerrainShading terrain,terra_shade
<br />
-
<br />
- If KeyDown( 203 )=True Then x#=x#-0.1
<br />
- If KeyDown( 205 )=True Then x#=x#+0.1
<br />
- If KeyDown( 208 )=True Then y#=y#-0.1
<br />
- If KeyDown( 200 )=True Then y#=y#+0.1
<br />
- If KeyDown( 44 )=True Then z#=z#-0.1
<br />
- If KeyDown( 30 )=True Then z#=z#+0.1
<br />
-
<br />
- If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
<br />
- If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
<br />
- If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.1
<br />
- If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.1
<br />
-
<br />
- x#=EntityX(camera)
<br />
- y#=EntityY(camera)
<br />
- z#=EntityZ(camera)
<br />
-
<br />
- terra_y#=TerrainY(terrain,x#,y#,z#)+5
<br />
-
<br />
- PositionEntity camera,x#,terra_y#,z#
<br />
-
<br />
- RenderWorld
<br />
-
<br />
- Text 0,0,"Use cursor keys to move about the terrain"
<br />
- Text 0,20,"Press spacebar to toggle between TerrainShading True/False"
<br />
- If terra_shade=True Then Text 0,40,"TerrainShading: True" Else Text 0,40,"TerrainShading: False"
<br />
-
<br />
- Flip
<br />
-
<br />
- Wend
<br />
-
<br />
- End
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=TerrainShading&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|