function mtl_uvspeed_render()
{
// using the material matrix:
// u' = u * mtl.matrix11 + v * mtl.matrix21 + mtl.matrix31;
// v' = u * mtl.matrix12 + v * mtl.matrix22 + mtl.matrix32;
mtl.matrix31 = floatd(my.skill1*total_ticks,256);
mtl.matrix32 = floatd(my.skill2*total_ticks,256);
}
function mtl_uvspeed_init()
{
// copy standard model material properties
mtl_copy(mat_model);
mat_identity(mtl.matrix);
mtl.event = mtl_uvspeed_render;
mtl.ENABLE_RENDER = on;
}
MATERIAL mtl_uvspeed
{
event = mtl_uvspeed_init;
effect = "
matrix matMtl;
technique uvspeed
{
pass one
{
TextureTransformFlags[0] = Count2;
TextureTransform[0] = <matMtl>;
}
}
technique fallback { pass one { } }
";
}
//action: fx_uvspeed
//title: Texture shifting in u and v direction
//
//skill1: Speed_U 0
//help: Texture Speed in U direction, default 0
//skill2: Speed_V -2
//help: Texture Speed in V direction, default -2
//desc:
//desc: Shifts a texture in u and v direction.
//desc: To be assigned to a model.
//
action fx_uvspeed()
{
my.material = mtl_uvspeed;
if (0 == my.skill1 && 0 == my.skill2) { my.skill2 = -2; }
}