ToolHandler AnimLoaderHandler Classes Table of Contents

VolumetricHandler

Handler Activation Function

   XCALL_( int ) MyVolumetric( long version, GlobalFunc *global,
      LWVolumetricHandler *local, void *serverData );

The local argument to a volume renderer's activation function is an LWVolumetricHandler.

   typedef struct st_LWVolumetricHandler {
      LWInstanceFuncs *inst;
      LWItemFuncs     *item;
      LWRenderFuncs   *rend;
      double          (*evaluate) (LWInstance, LWVolumeAccess *);
      unsigned int    (*flags)    (LWInstance);
   } LWVolumetricHandler;

The first three members of this structure point to the standard handler functions. In addition to these, a volume renderer provides an evaluation function and a flags function.

evaluate( instance, access )
This is where the volume renderer does its work. At each time step in the animation, the evaluation function is called for each affected pixel in the image. The access argument, described below, contains information about the volume to be integrated.

flags( instance )
Returns an int that tells the renderer which effects the handler supplies (backdrop, fog, or both). These flags are bitfields that should be bitwise-ORed together to create the return value. The flags are

LWVOLF_ADAPTIVE

Interface Activation Function

   XCALL_( int ) MyInterface( long version, GlobalFunc *global,
      ??? *???, void *serverData );

TBD.

Volumetric Access

This is the structure passed to the handler's evaluation function.

   typedef struct st_LWVolumeAccess {
      void             *ray;
      int               flags;
      LWItemID          source;
      double            o[3], dir[3];
      double            farClip, nearClip;
      double            oDist, frustum;
      void             (*addSample) (void *ray, LWVolumeSample *smp);
      double           (*getOpacity) (void *ray, double dist,
                          double opa[3]);
      LWIlluminateFunc *illuminate;
      LWRayTraceFunc   *rayTrace;
   } LWVolumeAccess;

Volumetric ray access structure is passed to the volume rendering server to add its contribution to a ray passing through space. The ray is given by a void pointer.

flags
evaluation flags. Indicates whether color or opacity or both should be computed.

LWVEF_OPACITY
LWVEF_COLOR

source
origin of ray. Can be a light, the camera, or an object (for surface rendering).
o, dir
origin and direction of ray.
far, near
far and near clipping distances.
oDist
distance from origin (>0 when raytracing reflections / refractions).
frustum
pixel fustrum.
addSample( ray, smp )
add a new volume sample to the ray.
getOpacity( ray, dist, opa )
returns opacity (vector and scalar) at specified distance.

/*
 * A volume sample is a single segment along a ray through a
 * volmetric function that has a uniform color and opacity.  The
 * dist and stride are the position and size of the sample and
 * the opacity and color are given as color vectors.
 */
typedef struct st_LWVolumeSample {
   double      dist;
   double      stride;
   double      opacity[3];
   double      color[3];
} LWVolumeSample;