- increased toon value 'size' to 3.14 for diff, and 1.53 for spec, as in

tuhopuu (as max for buttons)
- Sun lamps now do toon specularity too

Hemi lamps dont do any other shader than the old ones still... the
implimentation of it in Tuhopuu is disputable, will solve this for 2.29
This commit is contained in:
Ton Roosendaal 2003-08-11 18:18:11 +00:00
parent 2289f3abb6
commit 159f53f0a0
3 changed files with 23 additions and 25 deletions

@ -1204,15 +1204,12 @@ void shadeLampLusFloat()
if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) { if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) {
if(lar->type==LA_SUN || lar->type==LA_HEMI) { if(lar->type==LA_HEMI) {
if(lar->type==LA_SUN) { /* hemi uses no spec shaders (yet) */
lv[2]-= 1.0;
} lv[0]+= view[0];
else { lv[1]+= view[1];
lv[0]+= view[0]; lv[2]+= view[2];
lv[1]+= view[1];
lv[2]+= view[2];
}
Normalise(lv); Normalise(lv);
@ -1221,9 +1218,7 @@ void shadeLampLusFloat()
if(lar->type==LA_HEMI) { if(lar->type==LA_HEMI) {
t= 0.5*t+0.5; t= 0.5*t+0.5;
} }
/* watch it: shadfac and lampdist used below */
/* sun and hemi use no shaders */
t= ma->spec*spec(t, ma->har); t= ma->spec*spec(t, ma->har);
isr+= t*(lar->r * ma->specr); isr+= t*(lar->r * ma->specr);
isg+= t*(lar->g * ma->specg); isg+= t*(lar->g * ma->specg);
@ -1232,7 +1227,10 @@ void shadeLampLusFloat()
else { else {
/* specular shaders */ /* specular shaders */
float specfac; float specfac;
/* we force a different lamp vector for sun light */
if(lar->type==LA_SUN) lv[2]-= 1.0;
if(ma->spec_shader==MA_SPEC_PHONG) if(ma->spec_shader==MA_SPEC_PHONG)
specfac= Phong_Spec(vn, lv, view, ma->har); specfac= Phong_Spec(vn, lv, view, ma->har);
else if(ma->spec_shader==MA_SPEC_COOKTORR) else if(ma->spec_shader==MA_SPEC_COOKTORR)

@ -1827,15 +1827,12 @@ void shade_lamp_loop()
if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) { if(ma->spec!=0.0 && !(lar->mode & LA_NO_SPEC)) {
if(lar->type==LA_SUN || lar->type==LA_HEMI) { if(lar->type==LA_HEMI) {
if(lar->type==LA_SUN) { /* hemi uses no spec shaders (yet) */
lv[2]-= 1.0;
} lv[0]+= view[0];
else { lv[1]+= view[1];
lv[0]+= view[0]; lv[2]+= view[2];
lv[1]+= view[1];
lv[2]+= view[2];
}
Normalise(lv); Normalise(lv);
@ -1844,7 +1841,7 @@ void shade_lamp_loop()
if(lar->type==LA_HEMI) { if(lar->type==LA_HEMI) {
t= 0.5*t+0.5; t= 0.5*t+0.5;
} }
/* sun and hemi use no shaders */
t= ma->spec*spec(t, ma->har); t= ma->spec*spec(t, ma->har);
isr+= t*(lar->r * ma->specr); isr+= t*(lar->r * ma->specr);
isg+= t*(lar->g * ma->specg); isg+= t*(lar->g * ma->specg);
@ -1853,7 +1850,10 @@ void shade_lamp_loop()
else { else {
/* specular shaders */ /* specular shaders */
float specfac; float specfac;
/* we force a different lamp vector for sun light */
if(lar->type==LA_SUN) lv[2]-= 1.0;
if(ma->spec_shader==MA_SPEC_PHONG) if(ma->spec_shader==MA_SPEC_PHONG)
specfac= Phong_Spec(vn, lv, view, ma->har); specfac= Phong_Spec(vn, lv, view, ma->har);
else if(ma->spec_shader==MA_SPEC_COOKTORR) else if(ma->spec_shader==MA_SPEC_COOKTORR)

@ -4243,7 +4243,7 @@ void matbuts(void)
if(ma->diff_shader==MA_DIFF_ORENNAYAR) if(ma->diff_shader==MA_DIFF_ORENNAYAR)
uiDefButF(block, NUM, B_MATPRV, "Rough:", 200, 70, 95,18, &(ma->roughness), 0.0, 3.14, 0, 0, "Oren Nayar Roughness"); uiDefButF(block, NUM, B_MATPRV, "Rough:", 200, 70, 95,18, &(ma->roughness), 0.0, 3.14, 0, 0, "Oren Nayar Roughness");
else if(ma->diff_shader==MA_DIFF_TOON) { else if(ma->diff_shader==MA_DIFF_TOON) {
uiDefButF(block, NUM, B_MATPRV, "Size:", 200, 70, 95,18, &(ma->param[0]), 0.0, 1.0, 0, 0, "Size of diffuse toon area"); uiDefButF(block, NUM, B_MATPRV, "Size:", 200, 70, 95,18, &(ma->param[0]), 0.0, 3.14, 0, 0, "Size of diffuse toon area");
uiDefButF(block, NUM, B_MATPRV, "Smooth:", 200, 50, 95,18, &(ma->param[1]), 0.0, 1.0, 0, 0, "Smoothness of diffuse toon area"); uiDefButF(block, NUM, B_MATPRV, "Smooth:", 200, 50, 95,18, &(ma->param[1]), 0.0, 1.0, 0, 0, "Smoothness of diffuse toon area");
} }
@ -4253,7 +4253,7 @@ void matbuts(void)
if(ma->spec_shader==MA_SPEC_BLINN) if(ma->spec_shader==MA_SPEC_BLINN)
uiDefButF(block, NUM, B_MATPRV, "Refr:", 295, 50, 90,18, &(ma->refrac), 1.0, 10.0, 0, 0, "Refraction index"); uiDefButF(block, NUM, B_MATPRV, "Refr:", 295, 50, 90,18, &(ma->refrac), 1.0, 10.0, 0, 0, "Refraction index");
if(ma->spec_shader==MA_SPEC_TOON) { if(ma->spec_shader==MA_SPEC_TOON) {
uiDefButF(block, NUM, B_MATPRV, "Size:", 295, 70, 90,18, &(ma->param[2]), 0.0, 1.0, 0, 0, "Size of specular toon area"); uiDefButF(block, NUM, B_MATPRV, "Size:", 295, 70, 90,18, &(ma->param[2]), 0.0, 1.53, 0, 0, "Size of specular toon area");
uiDefButF(block, NUM, B_MATPRV, "Smooth:", 295, 50, 90,18, &(ma->param[3]), 0.0, 1.0, 0, 0, "Smoothness of specular toon area"); uiDefButF(block, NUM, B_MATPRV, "Smooth:", 295, 50, 90,18, &(ma->param[3]), 0.0, 1.0, 0, 0, "Smoothness of specular toon area");
} }