diff options
author | Ton Roosendaal <ton@blender.org> | 2004-04-26 20:49:05 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-04-26 20:49:05 +0400 |
commit | 6d2970e40691c04e672b8150a5a702d6716d9fa9 (patch) | |
tree | fbac2467e349d99541e98915c8ac1eec550c9857 | |
parent | 2b8c917de3f6ed60edd9ce74bbd664c91f279302 (diff) |
Added Ambient channel in "Map To" Panel for materials. Is now means to
control AO and Radio with texture too.
-rw-r--r-- | source/blender/makesdna/DNA_material_types.h | 1 | ||||
-rw-r--r-- | source/blender/render/intern/source/texture.c | 19 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 13 |
3 files changed, 25 insertions, 8 deletions
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 92642c63437..75669af631f 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -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 */ diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index d99c58d6aa3..47a12627bf0 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -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; + } } } } diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 106ffeb3c15..5f23ea69c76 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -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"); |