message: implement the ability to inject a user pointer in ray queries
diff: @@ -43,27 +43,48 @@ struct Model
  uniform int32 volumeCount;
  };
  -/*! trace a ray (using embree where possible) */
  -inline void traceRay(uniform Model *uniform model, varying Ray &ray)
  +struct UserIntersectionContext
  {
  - uniform RTCIntersectContext context;
  - rtcInitIntersectContext(&context);
  + RTCIntersectContext ectx;
  + void *uniform userPtr;
  +};
  +
  +inline void traceRay(uniform Model *uniform model,
  + varying Ray &ray,
  + void *uniform userPtr)
  +{
  + uniform UserIntersectionContext context;
  + rtcInitIntersectContext(&context.ectx);
  + context.userPtr = userPtr;
  rtcIntersectV(model->embreeSceneHandle,
  - &context,
  + &context.ectx,
  (varying RTCRayHit* uniform)&ray);
  }
  -/*! determine if ray is occluded (using embree where possible) */
  -inline bool isOccluded(uniform Model *uniform model, varying Ray &ray)
  +inline void traceRay(uniform Model *uniform model,
  + varying Ray &ray)
  {
  - uniform RTCIntersectContext context;
  - rtcInitIntersectContext(&context);
  + traceRay(model, ray, NULL);
  +}
  +
  +inline bool isOccluded(uniform Model *uniform model,
  + varying Ray &ray,
  + void *uniform userPtr)
  +{
  + uniform UserIntersectionContext context;
  + rtcInitIntersectContext(&context.ectx);
  + context.userPtr = userPtr;
  rtcOccludedV(model->embreeSceneHandle,
  - &context,
  + &context.ectx,
  (varying RTCRay* uniform)&ray);
  return ray.t < ray.t0;
  }
  +inline bool isOccluded(uniform Model *uniform model, varying Ray &ray)
  +{
  + return isOccluded(model, ray, NULL);
  +}
  +
  /*! Perform post-intersect computations, i.e. fill the members of
  DifferentialGeometry. Should only get called for rays that actually hit
  that given model. Variables are calculated according to 'flags', a
  