Globals: Fog Info

LightWave

File Type Pattern Font List Globals Table of Contents

Fog Info

Availability  LightWave 6.0
Component  Layout
Header  lwrender.h

The fog info global returns information about the fog settings for the scene. The parameters are read-only, but you can set them using commands.

Global Call

   LWFogInfo *foginfo;
   foginfo = global( LWFOGINFO_GLOBAL, GFUSE_TRANSIENT );

The global function returns a pointer to an LWFogInfo.

   typedef struct st_LWFogInfo {
      int     type;
      int     flags;
      double (*minDist) (LWTime);
      double (*maxDist) (LWTime);
      double (*minAmt)  (LWTime);
      double (*maxAmt)  (LWTime);
      void   (*color)   (LWTime, double col[3]);
   } LWFogInfo;
type
The fog type. Generally this identifies the falloff function used to interpolate the fog level at distances between minDist and maxDist. Possible types are
LWFOG_NONE
LWFOG_LINEAR
LWFOG_NONLINEAR1
LWFOG_NONLINEAR2
flags
Fog-related flags. Currently the only flag defined for this field is LWFOGF_BACKGROUND, which indicates that fog will affect the backdrop.

amount = minDist( time )
Returns the distance from the viewer (typically the camera) at which the fog effect is at a minimum.

amount = maxDist( time )
Returns the distance at which the fog effect reaches its maximum.

amount = minAmt( time )
Returns the minimum amount of fog (the amount at the minimum distance). Fog amounts range from 0.0 to 1.0.

amount = maxAmt( time )
Returns the maximum amount of fog.

color( time, rgb )
The color of the fog.

Example

This code fragment uses Fog Info to determine whether a point at distance d is in fog at time t.

   #include <lwserver.h>
   #include <lwrender.h>

   LWFogInfo *foginfo;

   foginfo = global( LWFOGINFO_GLOBAL, GFUSE_TRANSIENT );
   if ( foginfo ) {
      if ( foginfo->type != LWFOG_NONE ) {
         if ( d >= foginfo->minDist( t )) {
            ...d is in fog