diff --git a/CMakeLists.txt b/CMakeLists.txt index 717a41e..bfe05ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,32 +1,30 @@ -cmake_minimum_required(VERSION 3.28 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22) project(perlin-shadows) set(CMAKE_CXX_STANDARD 23) +include_directories(src) + link_libraries(-lGL -lglut -lGLEW -lGLU) -add_executable(${CMAKE_PROJECT_NAME}) -target_sources(${CMAKE_PROJECT_NAME} - PRIVATE - src/constants.h - src/final.cpp - src/geography.cpp - src/geography.h - src/grid.cpp - src/grid.h - src/renderer.cpp - src/renderer.h - src/camera.cpp - src/camera.h - src/shader.cpp - src/shader.h - src/point_light.cpp - src/point_light.h - src/renderable.cpp - src/renderable.h - PRIVATE - FILE_SET modules TYPE CXX_MODULES FILES - src/noise.cppm +add_executable(perlin-shadows + src/constants.h + src/final.cpp + src/geography.cpp + src/geography.h + src/grid.cpp + src/grid.h + src/noise_math.h + src/renderer.cpp + src/renderer.h + src/camera.cpp + src/camera.h + src/shader.cpp + src/shader.h + src/point_light.cpp + src/point_light.h + src/renderable.cpp + src/renderable.h ) file(READ src/shader/phong.vert PHONG_VERT) @@ -38,5 +36,4 @@ file(READ src/shader/shadow.frag SHADOW_FRAG) file(READ src/shader/shadow.geom SHADOW_GEOM) configure_file(src/point_light.in.h src/point_light.h @ONLY) -include_directories(src) target_include_directories(perlin-shadows PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/src") diff --git a/src/grid.cpp b/src/grid.cpp index 8fea867..64fd085 100644 --- a/src/grid.cpp +++ b/src/grid.cpp @@ -4,11 +4,9 @@ #include #include "constants.h" - -import noise; +#include "noise_math.h" using namespace std; -using namespace noise; random_device Grid::device_; default_random_engine::result_type Grid::base_random_{0}; diff --git a/src/noise.cppm b/src/noise_math.h similarity index 91% rename from src/noise.cppm rename to src/noise_math.h index 0c40e94..b5d1d08 100644 --- a/src/noise.cppm +++ b/src/noise_math.h @@ -1,6 +1,4 @@ -export module noise; - -export namespace noise { +#pragma once // Based on Ken Perlin's smoother step function: // https://en.wikipedia.org/wiki/Smoothstep#Variations Returns value in range @@ -23,5 +21,3 @@ export namespace noise { const float bound_1) { return bound_0 + SmootherStep(x) * (bound_1 - bound_0); } - -} // namespace noise