Light InfoAvailability LightWave 6.0 The light info global returns functions for getting light-specific information about any of the lights in a scene. Use the Item Info global to get the light list and for generic item information. The information returned by these functions is read-only, but you can use commands to set many of the parameters. Global Call LWLightInfo *lightinfo; lightinfo = global( LWLIGHTINFO_GLOBAL, GFUSE_TRANSIENT ); The global function returns a pointer to an LWLightInfo. typedef struct st_LWLightInfo {
void (*ambient) (LWTime, LWDVector color);
int (*type) (LWItemID);
void (*color) (LWItemID, LWTime, LWDVector color);
int (*shadowType) (LWItemID);
void (*coneAngles) (LWItemID, LWTime, double *radius,
double *edge);
unsigned int (*flags) (LWItemID);
double (*range) (LWItemID, LWTime);
int (*falloff) (LWItemID);
LWImageID (*projImage) (LWItemID);
int (*shadMapSize) (LWItemID);
double (*shadMapAngle)(LWItemID, LWTime);
double (*shadMapFuzz) (LWItemID, LWTime);
int (*quality) (LWItemID);
void (*rawColor) (LWItemID, LWTime, LWDVector color);
double (*intensity) (LWItemID, LWTime);
} LWLightInfo;
History In LightWave 7.0, the server name for this global (LWLIGHTINFO_GLOBAL) was incremented from "LW Light Info 2" to "LW Light Info 3". The following functions and flags were added. falloff projImage shadMapSize shadMapAngle shadMapFuzz quality rawColor intensity LWLFL_FIT_CONE LWLFL_CACHE_SHAD_MAP A time argument was added to the range and coneAngles functions, and coneAngles now returns angles in radians rather than degrees. Example This code fragment collects information about the first light. #include <lwserver.h>
#include <lwrender.h>
LWItemInfo *iteminfo;
LWLightInfo *ltinfo;
LWItemID id;
LWTime t = 3.0; /* seconds */
LWDVector color;
double range, radius, edge;
int lighttype, shadowtype;
unsigned int flags;
iteminfo = global( LWITEMINFO_GLOBAL, GFUSE_TRANSIENT );
ltinfo = global( LWLIGHTINFO_GLOBAL, GFUSE_TRANSIENT );
if ( iteminfo && ltinfo ) {
id = iteminfo->first( LWI_LIGHT, NULL );
lighttype = ltinfo->type( id );
shadowtype = ltinfo->shadowType( id );
flags = ltinfo->flags( id );
ltinfo->color( id, t, color );
if ( type == LWLIGHT_SPOT )
ltinfo->coneAngles( id, &radius, &edge );
if ( flags & LWLFL_LIMITED_RANGE )
range = ltinfo->range( id );
}
|