Added Ambient channel in "Map To" Panel for materials. Is now means to

control AO and Radio with texture too.
This commit is contained in:
Ton Roosendaal 2004-04-26 16:49:05 +00:00
parent 2b8c917de3
commit 6d2970e406
3 changed files with 25 additions and 8 deletions

@ -172,6 +172,7 @@ typedef struct Material {
#define MAP_HAR 256
#define MAP_RAYMIRR 512
#define MAP_TRANSLU 1024
#define MAP_AMB 2048
#define MAP_DISPLACE 4096
/* pr_type */

@ -1099,7 +1099,7 @@ int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex)
void do_material_tex(ShadeInput *shi)
{
Object *ob;
Material *mat_col, *mat_colspec, *mat_colmir, *mat_ref;
Material *mat_col, *mat_colspec, *mat_colmir, *mat_ref, *mat_amb;
Material *mat_spec, *mat_har, *mat_emit, *mat_alpha, *mat_ray_mirr, *mat_translu;
MTex *mtex;
Tex *tex;
@ -1110,7 +1110,7 @@ void do_material_tex(ShadeInput *shi)
/* here: test flag if there's a tex (todo) */
mat_col=mat_colspec=mat_colmir=mat_ref=mat_spec=mat_har=mat_emit=mat_alpha=mat_ray_mirr=mat_translu= shi->mat;
mat_col=mat_colspec=mat_colmir=mat_ref=mat_spec=mat_har=mat_emit=mat_alpha=mat_ray_mirr=mat_translu=mat_amb= shi->mat;
for(tex_nr=0; tex_nr<8; tex_nr++) {
@ -1565,6 +1565,21 @@ void do_material_tex(ShadeInput *shi)
}
mat_translu= shi->matren;
}
if(mtex->mapto & MAP_AMB) {
if(mtex->maptoneg & MAP_AMB) {factt= facm; facmm= fact;}
else {factt= fact; facmm= facm;}
if(mtex->blendtype==MTEX_BLEND)
shi->matren->amb= factt*mtex->def_var+ facmm*mat_translu->amb;
else if(mtex->blendtype==MTEX_MUL)
shi->matren->amb= (facmul+factt)*mat_translu->amb;
else {
shi->matren->amb= factt+mat_translu->amb;
if(shi->matren->amb<0.0) shi->matren->amb= 0.0;
else if(shi->matren->amb>1.0) shi->matren->amb= 1.0;
}
mat_amb= shi->matren;
}
}
}
}

@ -2293,12 +2293,13 @@ static void material_panel_map_to(Material *ma)
/* MAP TO */
uiBlockBeginAlign(block);
uiDefButS(block, TOG|BIT|0, B_MATPRV, "Col", 900,180,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic colour of the material");
uiDefButS(block, TOG3|BIT|1, B_MATPRV, "Nor", 960,180,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the rendered normal");
uiDefButS(block, TOG|BIT|2, B_MATPRV, "Csp", 1020,180,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity colour");
uiDefButS(block, TOG|BIT|3, B_MATPRV, "Cmir", 1080,180,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affext the mirror colour");
uiDefButS(block, TOG3|BIT|4, B_MATPRV, "Ref", 1140,180,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of the materials reflectivity");
uiDefButS(block, TOG3|BIT|5, B_MATPRV, "Spec", 1200,180,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of specularity");
uiDefButS(block, TOG|BIT|0, B_MATPRV, "Col", 900,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect basic colour of the material");
uiDefButS(block, TOG3|BIT|1, B_MATPRV, "Nor", 950,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the rendered normal");
uiDefButS(block, TOG|BIT|2, B_MATPRV, "Csp", 1000,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the specularity colour");
uiDefButS(block, TOG|BIT|3, B_MATPRV, "Cmir", 1050,180,55,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affext the mirror colour");
uiDefButS(block, TOG3|BIT|4, B_MATPRV, "Ref", 1105,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of the materials reflectivity");
uiDefButS(block, TOG3|BIT|5, B_MATPRV, "Spec", 1155,180,55,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of specularity");
uiDefButS(block, TOG3|BIT|11, B_MATPRV, "Amb", 1210,180,50,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the value of ambient");
uiDefButS(block, TOG3|BIT|8, B_MATPRV, "Hard", 900,160,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the hardness value");
uiDefButS(block, TOG3|BIT|9, B_MATPRV, "RayMir",960,160,60,19, &(mtex->mapto), 0, 0, 0, 0, "Causes the texture to affect the ray-mirror value");