kmSetFogDensity

Specifies a coefficient (scale factor) to table fog.


KMSTATUS KMAPI
kmSetFogDensity(
IN KMDWORD FogDensity
)

Description:

This function assigns a coefficient (scale factor) to table fog. PowerVR has a fog table containing 128 levels from 0 to 127. FogDensity determines the depth range over which each of these 128 levels is effective. If a low value is specified for FogDensity, the effect of fog appears from the polygon with the higher 1/w (Fog density increases). If a high value is specified for FogDensity, the effect of fog can be seen only on the polygon with a low 1/w (Fog density decreases).

FogDensity consists of two bytes. The higher byte indicates the mantissa and the lower byte indicates the exponent (the nth power of 2).
Example:0x0100= 0.0000001(b)= 0.015625
0x8000= 1.0(b)= 1.0
0xFF00= 1.1111111(b)= 1.984375
0xFF01= 11.111111(b)= 3.96875
0xFF06= 1111111.1(b)= 128.5
0xFF07= 11111111.0(b)= 255
0xFF08= 111111110.0(b)= 510
0xFF09= 1111111100.0(b)= 1020
0xFF0A= 2040
0xFF0B= 4080
0xFF0C= 8160
The value of FogDensity as well as the content of the fog table can automatically be generated with the use of the kmGenerateFogTable function. For details, see the description of kmGenerateFogTable, kmConvertFogDensity, and kmSetFogTable.

Parameters:

FogDensity(input)
This parameter is a coefficient of table fog (scale factor). Specify this parameter as "kmSetFogDensity(0xFF09)."

Return values:

ValueExplanation
KMSTATUS_SUCCESS Success

  kmSetFogDensity