Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ShadowTextureFunction Class Reference

Inheritance diagram for ShadowTextureFunction:

Inheritance graph
Collaboration diagram for ShadowTextureFunction:

Collaboration graph
List of all members.

Public Member Functions

virtual void operator() (float u, float v, float w, unsigned char *pixel)
 ShadowTextureFunction (float _umbra)

Public Attributes

float umbra

Constructor & Destructor Documentation

ShadowTextureFunction::ShadowTextureFunction float  _umbra  )  [inline]
 

Definition at line 255 of file render.cpp.

00255 : umbra(_umbra) {};


Member Function Documentation

void ShadowTextureFunction::operator() float  u,
float  v,
float  w,
unsigned char *  pixel
[virtual]
 

Implements TexelFunctionObject.

Definition at line 260 of file render.cpp.

References sqrt(), and umbra.

00262 {
00263     float r = (float) sqrt(u * u + v * v);
00264     int pixVal = 255;
00265 
00266     // Leave some white pixels around the edges to the shadow doesn't
00267     // 'leak'.  We'll also set the maximum mip map level for this texture to 3
00268     // so we don't have problems with the edge texels at high mip map levels.
00269     r = r / (15.0f / 16.0f);
00270     if (r < 1)
00271     {
00272         // The pixel value should depend on the area of the sun which is
00273         // occluded.  We just fudge it here and use the square root of the
00274         // radius.
00275         if (r <= umbra)
00276             pixVal = 0;
00277         else
00278             pixVal = (int) (sqrt((r - umbra) / (1 - umbra)) * 255.99f);
00279     }
00280 
00281     pixel[0] = pixVal;
00282     pixel[1] = pixVal;
00283     pixel[2] = pixVal;
00284 };


Member Data Documentation

float ShadowTextureFunction::umbra
 

Definition at line 257 of file render.cpp.

Referenced by operator()().


The documentation for this class was generated from the following file:
Generated on Sat Jan 14 22:33:35 2006 for Celestia by  doxygen 1.4.1