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:
@@ -19,6 +19,11 @@ gtest_discover_tests(testMyRays
|
||||
)
|
||||
|
||||
|
||||
add_executable(hw3render)
|
||||
target_include_directories(hw3render PUBLIC ../source/include)
|
||||
target_sources(hw3render PRIVATE hw3render.cpp)
|
||||
target_link_libraries(hw3render rayonnement)
|
||||
|
||||
add_executable(ch5_test)
|
||||
target_include_directories(ch5_test PUBLIC ../source/include)
|
||||
target_sources(ch5_test PRIVATE ch5_test.cpp)
|
||||
|
||||
42
tests/hw3render.cpp
Normal file
42
tests/hw3render.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user