Add a world generator based on another raytracer file format I made in the past and add a crude tool to run it.

it does not render properly, there are some major differences between both engine especially in the material definition. Will need more work, but is not urgent.
This commit is contained in:
Godzil
2020-02-22 15:16:25 +00:00
parent 4d4c4a7453
commit c9021974f6
4 changed files with 335 additions and 225 deletions

42
tests/hw3render.cpp Normal file
View File

@@ -0,0 +1,42 @@
/*
* DoRayMe - a quick and dirty Raytracer
* Renderer using hw3 files as world builder.
*
* Created by Manoël Trapier
* Copyright (c) 2020 986-Studio.
*
*/
#include <stdio.h>
#include <world.h>
#include <worldbuilder.h>
#include <light.h>
#include <sphere.h>
#include <material.h>
#include <colour.h>
#include <canvas.h>
#include <camera.h>
#include <transformation.h>
int main(int argc, char *argv[])
{
if(argc != 2)
{
printf("usage: %s file.hw3\n", argv[0]);
return -1;
}
Hw3File world = Hw3File(argv[1]);
/* Set the camera resolution */
Camera cam = Camera(640, 480, world.camFoV);
cam.setTransform(world.cam);
/* Now render it */
Canvas image = cam.render(world);
image.SaveAsPNG("hw3render.png");
return 0;
}