Camera InfoAvailability LightWave 6.0 The camera info global returns functions for getting camera-specific information about any of the cameras in a scene. Use the item info global to get the camera list and for generic item information. The information returned by these functions is read-only, but you can set camera parameters using commands. Global Call LWCameraInfo *caminfo; caminfo = global( LWCAMERAINFO_GLOBAL, GFUSE_TRANSIENT ); The global function returns a pointer to an LWCameraInfo. typedef struct st_LWCameraInfo { double (*zoomFactor) (LWItemID, LWTime); double (*focalLength) (LWItemID, LWTime); double (*focalDistance) (LWItemID, LWTime); double (*fStop) (LWItemID, LWTime); double (*blurLength) (LWItemID, LWTime); void (*fovAngles) (LWItemID, LWTime, double *hfov, double *vfov); unsigned int (*flags) (LWItemID); void (*resolution) (LWItemID, int *w, int *h); double (*pixelAspect) (LWItemID, LWTime); double (*separation) (LWItemID, LWTime); void (*regionLimits) (LWItemID, int *x0, int *y0, int *x1, int *y1); void (*maskLimits) (LWItemID, int *x0, int *y0, int *x1, int *y1); void (*maskColor) (LWItemID, LWDVector color); } LWCameraInfo;
Example This code fragment collects information about the first camera. #include <lwserver.h> #include <lwrender.h> LWItemInfo *iteminfo; LWCameraInfo *caminfo; LWItemID id; LWTime t = 3.0; /* seconds */ double zoom, flen, fdist, fstop, blen, hfov, vfov; iteminfo = global( LWITEMINFO_GLOBAL, GFUSE_TRANSIENT ); caminfo = global( LWCAMERAINFO_GLOBAL, GFUSE_TRANSIENT ); if ( iteminfo && caminfo ) { id = iteminfo->first( LWI_CAMERA, NULL ); zoom = caminfo->zoomFactor( id, t ); flen = caminfo->focalLength( id, t ); fdist = caminfo->focalDistance( id, t ); fstop = caminfo->fStop( id, t ); blen = caminfo->blurLength( id, t ); fovAngles( id, t, &hfov, &vfov ); } |