diff options
author | rodri <rgl@antares-labs.eu> | 2024-09-30 13:51:46 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-09-30 13:51:46 +0000 |
commit | 87c28badb511549fc211324a47e18cd7f2b0e0d0 (patch) | |
tree | aed48008b89e22d127eb6d124e8d0a75e59487b4 | |
parent | 545d3c6c2a053007d1a1b032f9e0359d44a9a358 (diff) | |
download | 3dee-87c28badb511549fc211324a47e18cd7f2b0e0d0.tar.gz 3dee-87c28badb511549fc211324a47e18cd7f2b0e0d0.tar.bz2 3dee-87c28badb511549fc211324a47e18cd7f2b0e0d0.zip |
vis: add a specular raster view.
-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) |