LW Bone Info Channel Info Globals Table of Contents

"LW Camera Info"

Availability:  LightWave 6.0
Component:  Layout

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.

Global Call

   LWCameraInfo *caminfo;
   caminfo = global( "LW Camera Info", 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 *horizontal,
                                 double *vertical);
   } LWCameraInfo;
zoom = zoomFactor( camera, time )
Returns the zoom factor for the camera at the given time.

flen = focalLength( camera, time )
Returns the focal length of the camera lens at the given time. Focal length is expressed in millimeters.

fdist = focalDistance( camera, time )
Returns the distance to the focal plane of the camera at the given time.

fstop = fStop( camera, time )
Returns the F-Stop number at the given time.

blurlen = blurLength( camera, time )
Returns the blur length as a fraction of the frame time for the given time.

fovAngles( camera, time, hfov, vfov )
Gets the hfov and vfov (horizontal and vertical field of view) angles for the camera at the given time. These are angles in radians centered around the camera direction.

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( "LW Item Info 2", GFUSE_TRANSIENT );
   caminfo  = global( "LW Camera Info", 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 );
   }