Trying to make the dump a bit more usefull and slightly less cluttered

This commit is contained in:
Godzil
2020-03-09 17:41:11 +00:00
parent 15a861802a
commit 4e241a1871
6 changed files with 83 additions and 26 deletions

View File

@@ -25,4 +25,18 @@ Tuple SmoothTriangle::localNormalAt(Tuple point, Intersection *hit)
return (this->n2 * hit->u +
this->n3 * hit->v +
this->n1 * (1 - hit->u - hit->v)).normalise();
}
void SmoothTriangle::dumpMe(FILE *fp)
{
Tuple t = this->n1;
fprintf(fp, "\"n1\": { \"x\": %f, \"y\": %f, \"z\": %f}, \n",
t.x, t.y, t.z);
t = this->n2;
fprintf(fp, "\"n2\": { \"x\": %f, \"y\": %f, \"z\": %f}, \n",
t.x, t.y, t.z);
t = this->n3;
fprintf(fp, "\"n3\": { \"x\": %f, \"y\": %f, \"z\": %f}, \n",
t.x, t.y, t.z);
Triangle::dumpMe(fp);
}