From 8d9869838614fc8d9ba5b8e91ce8c311d2a25f72 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Thu, 14 Jan 2021 08:48:55 +0100 Subject: Refactor code for multiplatform --- include/window.hpp | 11 +---------- src/main.cpp | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/include/window.hpp b/include/window.hpp index 44d6501..536a000 100644 --- a/include/window.hpp +++ b/include/window.hpp @@ -1,16 +1,7 @@ #ifndef __WINDOW_HPP_ #define __WINDOW_HPP_ -#include - -#if defined(__linux__) -#define LINUX -#include -#include -#elif defined(_WIN32) || defined(_WIN64) -#define WINDOWS -#include -#endif +#include "defines.hpp" #if defined(LINUX) #include diff --git a/src/main.cpp b/src/main.cpp index ff352c5..08004d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,14 +4,6 @@ #include #include - -#if defined(LINUX) -#include -#include -#elif defined(WINDOWS) -#include -#endif - #include "vk-renderer.hpp" #include "thirdparty/renderdoc.h" @@ -20,6 +12,15 @@ #include "sphere.hpp" #include "camera.hpp" #include "utils.hpp" +#include "defines.hpp" + +#if defined(LINUX) +#include +#include +#elif defined(WINDOWS) +#include +#endif + color ground_color { 1.0, 1.0, 1.0 }; color sky_color { 0.5, 0.7, 1.0 }; @@ -151,11 +152,6 @@ int main() { // World hittable objects random_scene(inputs.spheres); - // PPM format header - // std::cout << "P3\n" << width << '\n' << height << "\n255" << std::endl; - - // std::cerr << "Generating image" << std::endl; - // To start a frame capture, call StartFrameCapture. // You can specify NULL, NULL for the device to capture on if you have only one device and // either no windows at all or only one window, and it will capture from that device. @@ -175,8 +171,10 @@ int main() { } //------------------------- - // GPU path tracer + // Image exporter //------------------------- + // PPM format header + // std::cout << "P3\n" << width << '\n' << height << "\n255" << std::endl; // auto output_image = renderer.output_image(); // for (size_t index = 0; index < height * width; index++) { // write_color(std::cout, output_image[index]); -- cgit v1.3