Start working on dumping the world (to a JSON file) for debug purposes.

This commit is contained in:
Godzil
2020-02-27 18:03:08 +00:00
parent 2926166ce6
commit c369d2fe2d
15 changed files with 116 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include <pattern.h>
#include <shape.h>
#include <stdio.h>
Pattern::Pattern(Colour a, Colour b): a(a), b(b)
{
@@ -28,4 +29,10 @@ void Pattern::setTransform(Matrix transform)
{
this->transformMatrix = transform;
this->inverseTransform = transform.inverse();
}
void Pattern::dumpMe(FILE *fp)
{
fprintf(fp, "\"Colour A\": {\"red\": %f, \"green\": %f, \"blue\": %f},\n", this->a.x, this->a.y, this->a.z);
fprintf(fp, "\"Colour B\": {\"red\": %f, \"green\": %f, \"blue\": %f},\n", this->b.x, this->b.y, this->b.z);
}