diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..82c87a8 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +RayTracingOneWeekend \ No newline at end of file diff --git a/.idea/RayTracingOneWeekend.iml b/.idea/RayTracingOneWeekend.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/RayTracingOneWeekend.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 0000000..963c96f --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,344 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0b76fe5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4845e15 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a9757d3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 4.0) +project(RayTracingOneWeekend) + +set(CMAKE_CXX_STANDARD 20) + +add_executable(RayTracingOneWeekend main.cpp) diff --git a/image.ppm b/image.ppm new file mode 100644 index 0000000..e69de29 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..26504da --- /dev/null +++ b/main.cpp @@ -0,0 +1,25 @@ +#include + +int main() { + //image dimensions + int image_width = 256; + int image_height = 256; + + //Rendering + std::cout << "P3\n" << image_width << ' ' << image_height << "\n255\n"; + + //loops through height and width of screen and assigns color to each pixel + for (int j = 0; j < image_height; j++) { + for (int i = 0; i < image_width; i++) { + auto r = double(i) / (image_width-1); + auto g = double(j) / (image_height-1); + auto b = 0.0; + + int ir = int(255.999 * r); + int ig = int(255.999 * g); + int ib = int(255.999 * b); + + std::cout << ir << ' ' << ig << ' ' << ib << '\n'; + } + } +} \ No newline at end of file