ref: 87c28badb511549fc211324a47e18cd7f2b0e0d0
parent: 545d3c6c2a053007d1a1b032f9e0359d44a9a358
author: rodri <rgl@antares-labs.eu>
date: Mon Sep 30 09:51:46 EDT 2024
vis: add a specular raster view.
--- a/shaders.inc
+++ b/shaders.inc
@@ -162,6 +162,10 @@
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 @@
c = addpt3(ambient, addpt3(diffuse, specular));
c.a = m.diffuse.a;
+
+ specular.a = 1;
+ sp->toraster(sp, "specular", &specular);
+
return c;
}
--- a/vis.c
+++ b/vis.c
@@ -285,6 +285,7 @@
TSBILINEAR,
SP1,
SHOWNORMALS,
+ SHOWSPECULAR,
SHOWZBUFFER,
SP2,
SETCLRCOL,
@@ -304,6 +305,7 @@
[TSBILINEAR] "use bilinear sampler",
"",
[SHOWNORMALS] "show normals",
+ [SHOWSPECULAR] "show specular",
[SHOWZBUFFER] "show z-buffer",
"",
[SETCLRCOL] "set clear color",
@@ -344,6 +346,9 @@
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 @@
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)