Hello
I have this code that worked perfectly in c-sript(with c-script syntax of course...) but doesent under lite-c (latest public beta). Are material matrices handeled differently? I would appreciate any help...thanks!
with this code I get a fast flickering of the texture...instead of a constant uv-shifting.
Code:
function init_mat_ffe_river()
{
bmap_to_mipmap(mtl.skin1);
bmap_to_mipmap(mtl.skin2);
bmap_to_normals(mtl.skin1,my.riv_wav_height);
vec_set(mtl.ambient_blue,vector(clamp((d3d_fogcolor1.blue*my.riv_fogcol_fac)+(my.riv_add_blue*clamp(sun_angle.tilt/30,0.2,1))+(lightning),0,255),clamp((d3d_fogcolor1.green*my.riv_fogcol_fac)+(my.riv_add_green*clamp(sun_angle.tilt/30,0.2,1))+(lightning),0,255),clamp((d3d_fogcolor1.red*my.riv_fogcol_fac)+(my.riv_add_red*clamp(sun_angle.tilt/30,0.2,1))+(lightning),0,255)));
mat_identity(mtl.matrix);
mtl.matrix31 = floatd(my.riv_wav_speed_x*total_ticks,256);//u-speed
mtl.matrix32 = floatd(my.riv_wav_speed_y*total_ticks,256);//v-speed
mtl.matrix11 = floatv(my.riv_wav_scale/2); // waterbump_size
mtl.matrix22 = floatv(my.riv_wav_scale); // waterbump_size
set(mtl,ENABLE_RENDER);
}
MATERIAL* mat_ffe_river =
{
skin1 = bmp_river_bump_ffe;
skin2 = bmp_river_ffe;
event = init_mat_ffe_river;
effect =
"
texture mtlSkin1;
texture mtlSkin2;
texture mtlSkin3;//alpha in this texture indicates transparancy
texture mtlSkin4;//dummy texture to mix-in material setup
matrix matMtl;
technique reflecting_water
{
pass p0
{
Texture[1] = <mtlSkin1>;
ColorArg1[1] = Texture;
ColorOp[1] = bumpenvmap;
ColorArg2[1] = current;
TextureTransformFlags[1] = Count2;
TextureTransform[1] = <matMtl>;
Texcoordindex[1]=1;
Texture[2] = <mtlSkin2>;
ColorArg1[2] = Texture;
ColorOp[2] = Add;
ColorArg2[2] = Current;
TextureTransformFlags[2] = count2;
TextureTransform[2] = {
3.0, 0.0, 0.0, 0.0,//u-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS!
0.0, 3.0, 0.0, 0.0,//v-scale of lake rgb texture CHANGE THIS TO YOUR NEEDS!
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0
};
texcoordindex[2]= 1;
Texture[3] = <mtlSkin3>;// alpha in this texture makes entSkin1-texture transparent
TexCoordIndex[3] = 1;
ColorArg1[3] = Current;
ColorOp[3] = modulate;
AlphaOp[3] = Modulate;
Texture[4] = <mtlSkin4>;
TexCoordIndex[4] = 0;
ColorArg1[4] = 0.5;
ColorOp[4] = Modulate2x;
ColorArg2[4] = Current;
alphablendenable = true;
alphatestenable = false;//true;
zenable = true;
zwriteenable=true;
CullMode=none;
}
}
technique fallback { pass p0 { } }";
}