dxCameraFogMode(camera%,state%)

Parameters

camera - camera handle

mode -
0: no fog (default)
1: linear fog

Description

Sets the camera fog mode.

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.

The default fog colour is black and the default fog range is 1-1000, although these can be changed by using dxCameraFogColor and dxCameraFogRange respectively.

Each camera can have its own fog mode, for multiple on-screen fog effects.

Example

; dxCameraFogMode Example
; ---------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()
dxPositionEntity camera,0,1,0
dxCameraFogRange camera,1,10

light=dxCreateLight()
dxRotateEntity light,90,0,0

plane=dxCreatePlane()
grass_tex=dxLoadTexture( "media/mossyground.bmp" )
dxEntityTexture plane,grass_tex

While Not dxKeyDown( 1 )

; Toggle camera fog mode between 0 and 1 when spacebar is pressed
If dxKeyHit( 57 )=True Then fog_mode=1-fog_mode : dxCameraFogMode camera,fog_mode

If dxKeyDown( 205 )=True Then dxTurnEntity camera,0,-1,0
If dxKeyDown( 203 )=True Then dxTurnEntity camera,0,1,0
If dxKeyDown( 208 )=True Then dxMoveEntity camera,0,0,-0.05
If dxKeyDown( 200 )=True Then dxMoveEntity camera,0,0,0.05

dxRenderWorld

dxText 0,0,"Use cursor keys to move about the infinite plane"
dxText 0,20,"Press spacebar to toggle between dxCameraFogMode 0/1"
If fog_mode=False Then dxText 0,40,"dxCameraFogMode 0" Else dxText 0,40,"dxCameraFogMode 1"

dxFlip

Wend

End

Index