Light InfoAvailability LightWave® 6.0Component Layout, Modeler Header lwrender.h 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, LWTime); void (*rawColor) (LWItemID, LWTime, LWDVector color); double (*intensity) (LWItemID, LWTime); void (*shadowColor) (LWItemID, LWTime, LWDVector color); double (*ambientIntensity) (LWTime); void (*ambientRaw) (LWTime, LWDVector color); } LWLightInfo;
lighttype = type( light ) LWLIGHT_DISTANT LWLIGHT_POINT LWLIGHT_SPOT LWLIGHT_LINEAR LWLIGHT_AREA shadowtype = shadowType( light ) LWLSHAD_OFF LWLSHAD_RAYTRACE LWLSHAD_MAP settings = flags( light ) LWLFL_LIMITED_RANGE LWLFL_NO_DIFFUSE LWLFL_NO_SPECULAR LWLFL_NO_CAUSTICS LWLFL_LENS_FLARE LWLFL_VOLUMETRIC LWLFL_NO_OPENGL LWLFL_FIT_CONE LWLFL_CACHE_SHAD_MAPThe FIT_CONE flag indicates that the shadow map angle is set to the light's spotlight cone angle. falloff_type = falloff( light )
image = projImage( light ) size = shadMapSize( light ) angle = shadMapAngle( light, time ) fuzziness = shadMapFuzz( light, time ) index = quality( light ) index = quality( light, time ) (rev.4+) rawColor( light, time, rgb ) level = intensity( light, time ) shadowColor( light, time, rgb ) (LW7.5+) intensity = ambientIntensity( time ) (LW9.6+) Global Call LWLightEvaluationFuncs *lightfuncs; lightfuncs = global( LWLIGHTEVALUATIONFUNCS_GLOBAL, GFUSE_TRANSIENT );The global function returns a pointer to an LWLightEvaluationFuncs, used to evaluate lights. typedef struct st_LWLightEvaluationFuncs { LWLightEvaluatorID (*create) (LWItemID light); void (*destroy) (LWLightEvaluatorID); unsigned int (*flags) (LWLightEvaluatorID); LWError (*init) (LWLightEvaluatorID, int mode); void (*cleanUp) (LWLightEvaluatorID); LWError (*newTime) (LWLightEvaluatorID, LWFrame frame, LWTime time); LWError (*newFrame) (LWLightEvaluatorID, const LWFrameInfo* frameinfo, unsigned int* maxilluminations, const LWLightAccess* lightaccess); int (*evaluate) (LWLightEvaluatorID, const LWDVector spot, double fractime, LWIllumination illumination[], const LWLightAccess* lightaccess); unsigned int (*getPhotons) (LWLightEvaluatorID, unsigned int maxphotons, LWPhoton photons[], const LWLightAccess* lightaccess); unsigned int (*getRayIlluminations) (LWLightEvaluatorID, LWDVector raystart, LWDVector raydir, double farclip, unsigned int maxrayilluminations, LWRayIllumination rayilluminations[], const LWLightAccess* lightaccess); } LWLightEvaluationFuncs;See the LightHandler documentation for an explanation of the light interface. 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 ); } |