LightRayTraversal Class Reference

LightRayTraversal Class Referenceabstract

#include <object.h>

Class Description

This is a callback class that can be given to a ObjLightDesc to have a ray traced through the light volume.

A plug-in derives a class from this one and passes it as a callback in the ObjLightDesc method TraverseVolume(). This allows a developer to integrate the illumination of a segment due to a light. t0 and t1 define the segment in terms of the given ray. This is what the 3ds Max spotlights do: First they break the segment up into three main pieces. The first piece is from the camera to where the ray intersects the lights cone volume. The callback Step() is called once over this segment (t0 and t1 will have this first piece). The illumination is constant over this entire segment from t0 to t1. It is a constant black since the light is not illuminating it at all. The next segment is inside the cone. This segment will be broken up into small pieces. First as it's stepping along it will be between the falloff and the hotspot. The illumination over this segment goes from black to brighter and brighter as it moves towards to hotspot. Across the entire hotspot region the illumination may be constant. Then as it steps from the hotspot to the falloff the illumination will go back down to black. Inside the hotspot region, if shadows are turned on, the light may be brighter or darker depending on if it's inside a shadow or on the edge of a shadow. The light handles all of this. It takes care of the shadows, attenuation, etc. Now consider how the 3ds Max atmospheric effects such as the volume lights use this information. For each light that they are bound to, they call the method TraverseVolume() on the light. The volume light atmospheric effect passes this callback to the TraverseVolume() method. The light then calls this Step() method of the callback for each partial segment of the ray. Given the illumination on the segment (illum) it computes the fog density over that piece. The density may be constant if noise is not turned on, or it may vary if noise is turned on. Using the fog density and the illumination it computes the light reflected off the atmosphere for the segment.

See also
Class ObjLightDesc
+ Inheritance diagram for LightRayTraversal:

Public Member Functions

virtual ~LightRayTraversal ()
 Destructor. More...
 
virtual BOOL Step (float t0, float t1, Color illum, float distAtten)=0
 This method is called for every step defined by t0 and t1. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

virtual ~LightRayTraversal ( )
inlinevirtual

Destructor.

3036 {;}

Member Function Documentation

virtual BOOL Step ( float  t0,
float  t1,
Color  illum,
float  distAtten 
)
pure virtual

This method is called for every step defined by t0 and t1.

The illumination over this segment is passed in illum.

Parameters
t0The start of the segment. This is a distance along the ray. The ray is made up of a point p and a unit length direction vector dir. The point defined by t0 is thus ray.p+t0*ray.dir.
t1The end of the segment. This is a distance along the ray. The ray is made up of a point p and a unit length direction vector dir. The point defined by t1 is thus ray.p+t1*ray.dir.
illumThe light intensity over the entire segment. It can be assumed that the light intensity is constant for the segment.
distAttenThis parameter may be used so that volume effects can use the distance attenuation value as an input variable to their effects. For instance, the volume light uses this to change the fog color based on the distance from the light.
Returns
TRUE to continue; FALSE to halt the integration (stop the traversal).