Camera Info

Availability LightWave 6.0 | Component Layout | Header lwrender.h

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;
zoom = zoomFactor( camera, time )
Returns the zoom factor.
flen = focalLength( camera, time )
Returns the focal length in millimeters.
fdist = focalDistance( camera, time )
Returns the distance from the camera at which objects are in focus.
fstop = fStop( camera, time )
Returns the f-stop number.
blurlen = blurLength( camera, time )
Returns the blur length as a fraction of the frame time.
fovAngles( camera, time, hfov, vfov )
Gets the hfov and vfov (horizontal and vertical field of view) angles, expressed in radians.
f = flags( camera );
Returns flags describing the camera, combined using bitwise-or.
LWCAMF_STEREO
LWCAMF_LIMITED_REGION
LWCAMF_MASK
resolution( camera, width, height )
Gets the image size in pixels for the images rendered by the camera.
aspect = pixelAspect( camera, time )
Returns the pixel aspect ratio of images rendered by the camera, expressed as width/height. Values greater than 1.0 mean short wide pixels and values less than 1.0 mean tall thin pixels.
sep = separation( camera, time )
Returns the interocular distance (eye separation) for stereoscopic rendering, in meters.
regionLimits( camera, x0, y0, x1, y1 )
Gets the limited region rectangle for the camera.
maskLimits( camera, x0, y0, x1, y1 )
Gets the mask rectangle for the camera.
maskColor( camera, color )
Gets the color that will be rendered in areas of the image outside the mask rectangle.

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 );
   }