red# - red ambient light value green# - green ambient light value blue# - blue ambient light value The green, red and blue values should be in the range 0-255. The default ambient light colour is 127,127,127. |
Sets the ambient lighting colour. 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. Ambient light is useful for providing a certain level of light, before adding other lights to provide a realistic lighting effect. An ambient light level of 0,0,0 will result in no ambient light being displayed. See also: dxCreateLight. |
; dxAmbientLight Example ; -------------------- dxGraphics3D 640,480 dxSetBuffer dxBackBuffer() camera=dxCreateCamera() sphere=dxCreateSphere( 32 ) dxPositionEntity sphere,-2,0,5 cone=dxCreateCone( 32 ) dxPositionEntity cone,2,0,5 ; Set initial ambient light colour values red#=127 green#=127 blue#=127 While Not dxKeyDown( 1 ) ; Change red, green, blue values depending on key pressed If dxKeyDown( 2 )=True And red#>0 Then red#=red#-1 If dxKeyDown( 3 )=True And red#<255 Then red#=red#+1 If dxKeyDown( 4 )=True And green#>0 Then green#=green#-1 If dxKeyDown( 5 )=True And green#<255 Then green#=green#+1 If dxKeyDown( 6 )=True And blue#>0 Then blue#=blue#-1 If dxKeyDown( 7 )=True And blue#<255 Then blue#=blue#+1 ; Set ambient light dxColor using red, green, blue values dxAmbientLight red#,green#,blue# dxRenderWorld dxText 0,0,"Press keys 1-6 to change dxAmbientLight red#,green#,blue# values dxText 0,20,"Ambient Red: "+red# dxText 0,40,"Ambient Green: "+green# dxText 0,60,"Ambient Blue: "+blue# dxFlip Wend End |