Files
dorayme/tests/hw3render.cpp
Godzil c9021974f6 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.
2020-02-22 15:16:25 +00:00

42 lines
793 B
C++

/*
* 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;
}