Globals: Backdrop Info

LightWave

Animation Envelopes Bone Info Globals Table of Contents

Backdrop Info

Availability  LightWave 6.0
Component  Layout
Header  lwrender.h

The backdrop info global returns a function that evaluates the color of the backdrop in a specific direction at a given time, as well as the type, colors and squeeze values for the default solid backdrop. The parameters are read-only, but you can set them using commands.

Global Call

   LWBackdropInfo *bkdropinfo;
   bkdropinfo = global( LWBACKDROPINFO_GLOBAL, GFUSE_TRANSIENT );

The global function returns a pointer to an LWBackdropInfo.

   typedef struct st_LWBackdropInfo {
      void     (*backdrop) (LWTime, const double ray[3], double color[3]);
      int       type;
      void     (*color)    (LWTime, double zenith[3], double sky[3],
                              double ground[3], double nadir[3]);
      void     (*squeeze)  (LWTime, double *sky, double *ground);
   } LWBackdropInfo;
backdrop( time, ray, color )
Sets the color argument to the RGB levels of the backdrop color in the ray direction at the specified time. Several effects can cause this color to differ entirely from the one implied by the other members of the LWBackdropInfo.

type
LWBACK_SOLID (the default backdrop is a single uniform color) or LWBACK_GRADIENT (the default backdrop is a gradient derived from the zenith, sky, ground and nadir colors).

color( time, zenith, sky, ground, nadir )
The arrays are filled with the RGB levels for each of the four gradient nodes.

squeeze( time, sky, ground )
The squeeze amount is stored in the sky and ground arguments. A squeeze of 1.0 produces a linear interpolation between the horizon and the pole, while higher amounts cause the color to vary more quickly near the horizon.

Example

This code fragment shows how to obtain the backdrop color in a given direction.

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

   LWBackDropInfo *bkdropinfo;
   double ray[ 3 ], color[ 3 ], dx, dy, dz, d;
   LWTime t;

   bkdropinfo = global( LWBACKDROPINFO_GLOBAL, GFUSE_TRANSIENT );
   if ( !bkdropinfo ) return AFUNC_BADGLOBAL;
   ...

   /* normalize the direction ray */
   d = sqrt( dx * dx + dy * dy + dz * dz );

   if ( d > 0 ) {
      ray[ 0 ] = dx / d;
      ray[ 1 ] = dy / d;
      ray[ 2 ] = dz / d;
      bkdropinfo->backdrop( t, ray, color );
      ...