diff options
author | Ton Roosendaal <ton@blender.org> | 2003-10-22 22:58:46 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-10-22 22:58:46 +0400 |
commit | 6963bd3947671c498832fc3e4b24c5b303d00ead (patch) | |
tree | f27be5896f0c69823454d8f366ec046d63a8ff62 /source | |
parent | dbdc11690990f18015bb0bfe7a160fb0a18ec9b0 (diff) |
- material editor: each texture channel can be individually switched,
instead of the old 'septex' which only showed the active one
- rendering: the 'stencil' option now works to stencil out normals as well
(special requests from our manual master, s68)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 18 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 20 |
2 files changed, 26 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 5f73bc10ef6..24e20fde963 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1333,17 +1333,18 @@ void do_material_tex() Tex *tex; float *co = NULL, *dx = NULL, *dy = NULL, fact, facm, factt, facmm, facmul = 0.0, stencilTin=1.0; - float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3]; + float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3], Tnor=1.0; int tex_nr, rgbnor= 0; /* 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= R.mat; - tex_nr= 0; - if(R.mat->septex) tex_nr= R.mat->texact; - - for(; tex_nr<8; tex_nr++) { + for(tex_nr=0; tex_nr<8; tex_nr++) { + + /* separate tex switching */ + if(R.mat->septex & (1<<tex_nr)) continue; + if(R.mat->mtex[tex_nr]) { mtex= R.mat->mtex[tex_nr]; @@ -1505,6 +1506,7 @@ void do_material_tex() } else { if(rgbnor & TEX_RGB) Ta*= stencilTin; + else if(rgbnor & TEX_NOR) Tnor*= stencilTin; else Tin*= stencilTin; } @@ -1614,9 +1616,9 @@ void do_material_tex() if(mtex->maptoneg & MAP_NORM) tex->norfac= -mtex->norfac; else tex->norfac= mtex->norfac; - R.vn[0]+= tex->norfac*tex->nor[0]; - R.vn[1]+= tex->norfac*tex->nor[1]; - R.vn[2]+= tex->norfac*tex->nor[2]; + R.vn[0]+= Tnor*tex->norfac*tex->nor[0]; + R.vn[1]+= Tnor*tex->norfac*tex->nor[1]; + R.vn[2]+= Tnor*tex->norfac*tex->nor[2]; Normalise(R.vn); diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index b8b34f6c9ac..27132537bf4 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -2042,7 +2042,7 @@ static void material_panel_texture(Material *ma) MTex *mtex; ID *id; int loos; - int a, xco; + int a; char str[64], *strp; block= uiNewBlock(&curarea->uiblocks, "material_panel_texture", UI_EMBOSS, UI_HELV, curarea->win); @@ -2050,22 +2050,31 @@ static void material_panel_texture(Material *ma) /* TEX CHANNELS */ uiBlockSetCol(block, TH_BUT_NEUTRAL); - xco= 665; + for(a= 0; a<8; a++) { mtex= ma->mtex[a]; if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos); else strcpy(str, ""); str[10]= 0; uiDefButC(block, ROW, B_MATPRV_DRAW, str, 10, 180-22*a, 70, 20, &(ma->texact), 3.0, (float)a, 0, 0, ""); - xco+= 65; } + + /* SEPTEX */ + uiBlockSetCol(block, TH_AUTO); + for(a= 0; a<8; a++) { + mtex= ma->mtex[a]; + if(mtex && mtex->tex) { + if(ma->septex & (1<<a)) strcpy(str, "Off"); + else strcpy(str, "On"); + uiDefButC(block, TOG|BIT|a, B_MATPRV_DRAW, str, -24, 180-22*a, 32, 20, &ma->septex, 0.0, 0.0, 0, 0, "Disable or enable this channel"); + } + } uiDefIconBut(block, BUT, B_MTEXCOPY, ICON_COPYUP, 100,180,23,21, 0, 0, 0, 0, 0, "Copy the mapping settings to the buffer"); uiDefIconBut(block, BUT, B_MTEXPASTE, ICON_PASTEUP, 125,180,23,21, 0, 0, 0, 0, 0, "Paste the mapping settings from the buffer"); uiBlockSetCol(block, TH_AUTO); - uiDefButC(block, TOG, B_MATPRV, "SepTex", 160, 180, 100, 20, &(ma->septex), 0, 0, 0, 0, "Render only use active texture channel"); mtex= ma->mtex[ ma->texact ]; if(mtex==0) { @@ -2096,6 +2105,9 @@ static void material_panel_texture(Material *ma) uiDefBut(block, BUT, B_TEXCLEAR, "Clear", 122, 130, 72, 20, 0, 0, 0, 0, 0, "Erase link to datablock"); } + // force no centering + uiDefBut(block, LABEL, 0, " ", 250, 10, 25, 20, 0, 0, 0, 0, 0, ""); + uiBlockSetCol(block, TH_AUTO); } |