kmSetFogTable
Sets the fog table.
Description:
This function registers the fog table.
A pointer to an array holding 128 different float values is passed via the argument.
The fog table takes effect on the polygon for which FogTable is specified by VERTEXCONTEXT.
A fog table consists of 128 elements with indexes 0 to 127.
The element of index of a fog table specifies fog density of the following position with a depth of (1/w value):
Depth = ( pow( 2.0, Index >> 4 ) * (float)(( Index & 0x0F ) + 16 ) / 16.0f ) / FogDensity
An element of a fog table that is 0.0 has an attenuation rate 0 and an element that is 1.0 has the maximum attenuation rate.
Therefore, specify the density starting from the most distant point, in sequence.
As indicated in the above formula, the value of depth for each element of the fog table
changes according to the value of FogDensity. The value of FogDensity is set at the kmSetFogDensity function.
Content of the fog table can automatically be generated with the use of the kmGenerateFogTable function.
Parameters:
pfFogTable(input)
This parameter is a pointer to the one-dimensional array in the KMFLOAT format of 128 entries where the fog table is stored.
Return values:
Value | Explanation |
---|---|
KMSTATUS_SUCCESS | Success |
kmSetFogTable