

Public Member Functions | |
| virtual void | operator() (float u, float v, float w, unsigned char *pixel) |
| ShadowTextureFunction (float _umbra) | |
Public Attributes | |
| float | umbra |
|
|
Definition at line 255 of file render.cpp. 00255 : umbra(_umbra) {};
|
|
||||||||||||||||||||
|
Implements TexelFunctionObject. Definition at line 260 of file render.cpp. 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 };
|
|
|
Definition at line 257 of file render.cpp. Referenced by operator()(). |
1.4.1