aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorladevieq <qladevie@wanadev.fr>2021-01-14 08:48:55 +0100
committerladevieq <qladevie@wanadev.fr>2021-01-15 17:42:39 +0100
commit8d9869838614fc8d9ba5b8e91ce8c311d2a25f72 (patch)
tree1db0f99dcc617b5a742b23641e397a3c2c25f0e3
parentf1e35c16b65f888b8e74ad97aec2b2747a3e4dce (diff)
Refactor code for multiplatform
-rw-r--r--include/window.hpp11
-rw-r--r--src/main.cpp26
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 <cstdint>
-
-#if defined(__linux__)
-#define LINUX
-#include <unistd.h>
-#include <dlfcn.h>
-#elif defined(_WIN32) || defined(_WIN64)
-#define WINDOWS
-#include <Windows.h>
-#endif
+#include "defines.hpp"
#if defined(LINUX)
#include <xcb/xcb.h>
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 <cstdio>
#include <cassert>
-
-#if defined(LINUX)
-#include <unistd.h>
-#include <dlfcn.h>
-#elif defined(WINDOWS)
-#include <Windows.h>
-#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 <unistd.h>
+#include <dlfcn.h>
+#elif defined(WINDOWS)
+#include <Windows.h>
+#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]);