diff options
-rw-r--r-- | shaders.inc | 8 | ||||
-rw-r--r-- | vis.c | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/shaders.inc b/shaders.inc index 0e0d0fe..8b6f670 100644 --- a/shaders.inc +++ b/shaders.inc @@ -162,6 +162,10 @@ phongshader(Shaderparams *sp) c = addpt3(ambient, addpt3(diffuse, specular)); c.a = m.diffuse.a; + + specular.a = 1; + sp->toraster(sp, "specular", &specular); + return c; } @@ -237,6 +241,10 @@ blinnshader(Shaderparams *sp) c = addpt3(ambient, addpt3(diffuse, specular)); c.a = m.diffuse.a; + + specular.a = 1; + sp->toraster(sp, "specular", &specular); + return c; } @@ -285,6 +285,7 @@ mmb(void) TSBILINEAR, SP1, SHOWNORMALS, + SHOWSPECULAR, SHOWZBUFFER, SP2, SETCLRCOL, @@ -304,6 +305,7 @@ mmb(void) [TSBILINEAR] "use bilinear sampler", "", [SHOWNORMALS] "show normals", + [SHOWSPECULAR] "show specular", [SHOWZBUFFER] "show z-buffer", "", [SETCLRCOL] "set clear color", @@ -344,6 +346,9 @@ mmb(void) case SHOWNORMALS: curraster = curraster && strcmp(curraster, "normals") == 0? nil: "normals"; break; + case SHOWSPECULAR: + curraster = curraster && strcmp(curraster, "specular") == 0? nil: "specular"; + break; case SHOWZBUFFER: curraster = curraster && strcmp(curraster, "z-buffer") == 0? nil: "z-buffer"; break; @@ -708,6 +713,7 @@ fprint(2, "screen %R\n", screenb->r); v = mkviewport(fbw == 0 || fbh == 0? screenb->r: Rect(0,0,fbw,fbh)); v->setscale(v, scale, scale); v->createraster(v, "normals", COLOR32); + v->createraster(v, "specular", COLOR32); v->p.x = (Dx(screenb->r) - v->getwidth(v))/2; v->p.y = (Dy(screenb->r) - v->getheight(v))/2; if(scale == 2) |