Code:
// test.wdl
// Load in a blank 1024x768 bitmap to render to:
bmap bitmap_motion_blur="bitmap_motion_blur.tga";
var video_mode = 6;
// This is the panel that contains that bitmap:
panel panel_motion_blur {
bmap = bitmap_motion_blur;
layer = 5;
flags = transparent;
pos_x = 0;
pos_y = 0;
}
var motion_blur;
var newval;
// This essentially sets the transparency (alpha value) of our view at 100fps. Call with values of 0..100:
function set_motion_blur(newval)
{
motion_blur=newval;
if(newval==0)
{
// No blur; shut off the panel:
while(panel_motion_blur.alpha < 100)
{
panel_motion_blur.alpha += 3*time;
wait(1);
}
panel_motion_blur.visible=0;
camera.bmap = 0;
}
else
{
// Blur is positive:
panel_motion_blur.visible=1;
camera.bmap = bitmap_motion_blur;
}
}
function main()
{
level_load("test.wmb");
wait(3);
set_motion_blur(30);
while(1)
{
//if(motion_blur)
//{
panel_motion_blur.alpha = 100 - pow( ((100-motion_blur)/100), (time/0.16) )*100 ;
//}
wait(1);
}
}