93 lines
2.6 KiB
HTML
93 lines
2.6 KiB
HTML
<html>
|
|
<head>
|
|
<title>Blitz3D Docs</title>
|
|
<link rel=stylesheet href=../css/commands.css type=text/css>
|
|
</head>
|
|
<body>
|
|
<h1>AmbientLight red#,green#,blue#</h1>
|
|
<h1>Parameters</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
red# - red ambient light value
|
|
<br />
|
|
green# - green ambient light value
|
|
<br />
|
|
blue# - blue ambient light value
|
|
<br />
|
|
<br />
|
|
The green, red and blue values should be in the range 0-255. The default ambient light colour is 127,127,127.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1>Description</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
Sets the ambient lighting colour.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
Ambient light is a light source that affects all points on a 3D object equally. So with ambient light only, all 3D objects will appear flat, as there will be no shading.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
Ambient light is useful for providing a certain level of light, before adding other lights to provide a realistic lighting effect.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
An ambient light level of 0,0,0 will result in no ambient light being displayed.
|
|
<br>
|
|
<br>
|
|
See also: <a class=small href=CreateLight.htm>CreateLight</a>.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1><a href=../3d_examples/AmbientLight.bb>Example</a></h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
; AmbientLight Example
|
|
<br />
|
|
; --------------------
|
|
<br />
|
|
|
|
<br />
|
|
Graphics3D 640,480
|
|
<br />
|
|
SetBuffer BackBuffer()
|
|
<br />
|
|
|
|
<br />
|
|
camera=CreateCamera()
|
|
<br />
|
|
|
|
<br />
|
|
sphere=CreateSphere( 32 )
|
|
<br />
|
|
PositionEntity sphere,-2,0,5
|
|
<br />
|
|
|
|
<br />
|
|
cone=CreateCone( 32 )
|
|
<br />
|
|
PositionEntity cone,2,0,5
|
|
<br />
|
|
|
|
<br />
|
|
; Set initial ambient light colour values
|
|
<br />
|
|
red#=127
|
|
<br />
|
|
green#=127
|
|
<br />
|
|
blue#=127
|
|
<br />
|
|
|
|
<br />
|
|
While Not KeyDown( 1 )
|
|
<br />
|
|
|
|
<br />
|
|
; Change red, green, blue values depending on key pressed
|
|
<br />
|
|
If KeyDown( 2 )=True And red#>0 Then red#=red#-1
|
|
<br />
|
|
If KeyDown( 3 )=True And red#<255 Then red#=red#+1
|
|
<br />
|
|
If KeyDown( 4 )=True And green#>0 Then green#=green#-1
|
|
<br />
|
|
If KeyDown( 5 )=True And green#<255 Then green#=green#+1
|
|
<br />
|
|
If KeyDown( 6 )=True And blue#>0 Then blue#=blue#-1
|
|
<br />
|
|
If KeyDown( 7 )=True And blue#<255 Then blue#=blue#+1
|
|
<br />
|
|
|
|
<br />
|
|
; Set ambient light color using red, green, blue values
|
|
<br />
|
|
AmbientLight red#,green#,blue#
|
|
<br />
|
|
|
|
<br />
|
|
RenderWorld
|
|
<br />
|
|
|
|
<br />
|
|
Text 0,0,"Press keys 1-6 to change AmbientLight red#,green#,blue# values
|
|
<br />
|
|
Text 0,20,"Ambient Red: "+red#
|
|
<br />
|
|
Text 0,40,"Ambient Green: "+green#
|
|
<br />
|
|
Text 0,60,"Ambient Blue: "+blue#
|
|
<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=AmbientLight&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
|
|
</html>
|