diff --git a/CMakeLists.txt b/CMakeLists.txt index f23d274..27f3b5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if (USE_EXTRAS) #set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-s DEMANGLE_SUPPORT=1 --preload-file ${CMAKE_SOURCE_DIR}/assets --bind") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) #set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-s DEMANGLE_SUPPORT=1 --preload-file 'assets' --bind") - set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -s ASSERTIONS=1 -sUSE_GLFW=3 -sFULL_ES3 --preload-file 'assets'") + set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -s ASSERTIONS=1 -sUSE_GLFW=3 --preload-file 'assets'") # these flags will be set by cmake automatically based on build type #set_target_properties(FinalProject PROPERTIES COMPILE_FLAGS "-O3") #set_target_properties(FinalProject PROPERTIES COMPILE_FLAGS "-g") diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index 3144fde..2889f08 100644 Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index e73b8f1..f8a506e 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -8,7 +8,7 @@ 19 685 1675834610617266094 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/vulkan.c.o 7ac098ea2e755b71 2 377 1675835240591243670 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/window.c.o a716fdf6afcb3ac2 19 807 1675834610745269744 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/x11_init.c.o 7a310a4749a2e05 -0 98 1676321976951230956 build.ninja 190f84590f6ee728 +0 98 1676326264824686580 build.ninja 190f84590f6ee728 2 434 1675915441258513581 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 342a5daa6ca9681d 18 706 1675834610629266436 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/init.c.o 6051295f860fb367 1099 1278 1676232079155824369 libraries/BLT/libBLT.a 163b10f2e7f6635 @@ -38,3 +38,13 @@ 2 316 1675881681815231506 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o ac1bd7bf33d73c31 1 1057 1676232078943818647 CMakeFiles/FinalProject.dir/src/render/gl.cpp.o d59ba6eec5836ace 706 883 1675834610809271567 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/linux_joystick.c.o afc8940b6e7eeae1 +1 433 1676342795367607759 CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o c62e5c67ebfa06d +1 670 1676342795599614016 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o 7f43512660c0023 +1 802 1676342795731617574 CMakeFiles/FinalProject.dir/src/main.cpp.o 460fff588e5870a1 +1 813 1676342795743617899 CMakeFiles/FinalProject.dir/src/render/window.cpp.o aa0f847cb87c783c +1 1014 1676342795943623289 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o c71aa549750c4a5 +1 1096 1676342796027625557 CMakeFiles/FinalProject.dir/src/render/gl.cpp.o d59ba6eec5836ace +1096 1207 1676342796135628469 FinalProject 1d2a6005b7208ba1 +1 909 1676342906630613400 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o 13e8110c601a4029 +909 1200 1676342906918621193 libraries/BLT/libBLT.a 163b10f2e7f6635 +1200 1288 1676342907010623684 FinalProject 1d2a6005b7208ba1 diff --git a/cmake-build-debug/CMakeFiles/FinalProject.dir/src/main.cpp.o b/cmake-build-debug/CMakeFiles/FinalProject.dir/src/main.cpp.o index 84b5b62..ec5ba0b 100644 Binary files a/cmake-build-debug/CMakeFiles/FinalProject.dir/src/main.cpp.o and b/cmake-build-debug/CMakeFiles/FinalProject.dir/src/main.cpp.o differ diff --git a/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o b/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o index cb79491..0b84422 100644 Binary files a/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o and b/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o differ diff --git a/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/window.cpp.o b/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/window.cpp.o index 92f8980..dfd2b4b 100644 Binary files a/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/window.cpp.o and b/cmake-build-debug/CMakeFiles/FinalProject.dir/src/render/window.cpp.o differ diff --git a/cmake-build-debug/FinalProject b/cmake-build-debug/FinalProject index 12d6f80..ac5abf3 100755 Binary files a/cmake-build-debug/FinalProject and b/cmake-build-debug/FinalProject differ diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 8ebfff0..a3647a7 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Feb 12 15:01 EST +Start testing: Feb 13 21:49 EST ---------------------------------------------------------- -End testing: Feb 12 15:01 EST +End testing: Feb 13 21:49 EST diff --git a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o index 6b29e88..6a9ed39 100644 Binary files a/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o and b/cmake-build-debug/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o differ diff --git a/cmake-build-debug/libraries/BLT/libBLT.a b/cmake-build-debug/libraries/BLT/libBLT.a index b3a35aa..a604b15 100644 Binary files a/cmake-build-debug/libraries/BLT/libBLT.a and b/cmake-build-debug/libraries/BLT/libBLT.a differ diff --git a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/link.txt b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/link.txt index 613615a..3429510 100644 --- a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/link.txt +++ b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/link.txt @@ -1 +1 @@ -/usr/bin/em++ -g -sMAX_WEBGL_VERSION=2 -s ASSERTIONS=1 -sUSE_GLFW=3 -sFULL_ES3 --preload-file 'assets' @CMakeFiles/FinalProject.dir/objects1 -o FinalProject.js @CMakeFiles/FinalProject.dir/linkLibs.rsp +/usr/bin/em++ -g -sMAX_WEBGL_VERSION=2 -s ASSERTIONS=1 -sUSE_GLFW=3 --preload-file 'assets' @CMakeFiles/FinalProject.dir/objects1 -o FinalProject.js @CMakeFiles/FinalProject.dir/linkLibs.rsp diff --git a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/main.cpp.o.d b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/main.cpp.o.d index 6930e43..78baff1 100644 --- a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/main.cpp.o.d +++ b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/main.cpp.o.d @@ -272,6 +272,9 @@ CMakeFiles/FinalProject.dir/src/main.cpp.o: \ /usr/share/emscripten/cache/sysroot/include/c++/v1/__ranges/enable_view.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/__string \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/render/window.h \ + /usr/share/emscripten/cache/sysroot/include/GLES2/gl2.h \ + /usr/share/emscripten/cache/sysroot/include/GLES2/gl2platform.h \ + /usr/share/emscripten/cache/sysroot/include/KHR/khrplatform.h \ /usr/share/emscripten/cache/sysroot/include/emscripten.h \ /usr/share/emscripten/cache/sysroot/include/emscripten/emscripten.h \ /usr/share/emscripten/cache/sysroot/include/emscripten/em_asm.h \ @@ -283,7 +286,6 @@ CMakeFiles/FinalProject.dir/src/main.cpp.o: \ /usr/share/emscripten/cache/sysroot/include/GLFW/glfw3.h \ /usr/share/emscripten/cache/sysroot/include/GL/gl.h \ /usr/share/emscripten/cache/sysroot/include/GL/glext.h \ - /usr/share/emscripten/cache/sysroot/include/KHR/khrplatform.h \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/libraries/BLT/include/blt/std/math.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/cmath \ /usr/share/emscripten/cache/sysroot/include/compat/math.h \ diff --git a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d index 3e6fcd9..ab85f1d 100644 --- a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d +++ b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d @@ -2,6 +2,17 @@ CMakeFiles/FinalProject.dir/src/render/gl.cpp.o: \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/render/gl.cpp \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/render/gl.h \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/render/window.h \ + /usr/share/emscripten/cache/sysroot/include/GLES2/gl2.h \ + /usr/share/emscripten/cache/sysroot/include/GLES2/gl2platform.h \ + /usr/share/emscripten/cache/sysroot/include/KHR/khrplatform.h \ + /usr/share/emscripten/cache/sysroot/include/c++/v1/stdint.h \ + /usr/share/emscripten/cache/sysroot/include/c++/v1/__config \ + /usr/share/emscripten/cache/sysroot/include/c++/v1/__config_site \ + /usr/share/emscripten/cache/sysroot/include/pthread.h \ + /usr/lib/llvm-14/lib/clang/14.0.6/include/stdint.h \ + /usr/share/emscripten/cache/sysroot/include/stdint.h \ + /usr/share/emscripten/cache/sysroot/include/bits/alltypes.h \ + /usr/share/emscripten/cache/sysroot/include/bits/stdint.h \ /usr/share/emscripten/cache/sysroot/include/emscripten.h \ /usr/share/emscripten/cache/sysroot/include/emscripten/emscripten.h \ /usr/share/emscripten/cache/sysroot/include/emscripten/em_asm.h \ @@ -12,20 +23,11 @@ CMakeFiles/FinalProject.dir/src/render/gl.cpp.o: \ /usr/share/emscripten/cache/sysroot/include/emscripten/version.h \ /usr/share/emscripten/cache/sysroot/include/GLFW/glfw3.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/stddef.h \ - /usr/share/emscripten/cache/sysroot/include/c++/v1/__config \ - /usr/share/emscripten/cache/sysroot/include/c++/v1/__config_site \ - /usr/share/emscripten/cache/sysroot/include/pthread.h \ /usr/lib/llvm-14/lib/clang/14.0.6/include/stddef.h \ /usr/lib/llvm-14/lib/clang/14.0.6/include/__stddef_max_align_t.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/__nullptr \ - /usr/share/emscripten/cache/sysroot/include/c++/v1/stdint.h \ - /usr/lib/llvm-14/lib/clang/14.0.6/include/stdint.h \ - /usr/share/emscripten/cache/sysroot/include/stdint.h \ - /usr/share/emscripten/cache/sysroot/include/bits/alltypes.h \ - /usr/share/emscripten/cache/sysroot/include/bits/stdint.h \ /usr/share/emscripten/cache/sysroot/include/GL/gl.h \ /usr/share/emscripten/cache/sysroot/include/GL/glext.h \ - /usr/share/emscripten/cache/sysroot/include/KHR/khrplatform.h \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/libraries/BLT/include/blt/std/math.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/initializer_list \ /usr/share/emscripten/cache/sysroot/include/c++/v1/cstddef \ diff --git a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o index 5bf48ba..6de2ba0 100644 Binary files a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o and b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o differ diff --git a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d index 4e36933..be26ff6 100644 --- a/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d +++ b/cmake-build-emrelease/CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d @@ -1,6 +1,17 @@ CMakeFiles/FinalProject.dir/src/render/window.cpp.o: \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/render/window.cpp \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/render/window.h \ + /usr/share/emscripten/cache/sysroot/include/GLES2/gl2.h \ + /usr/share/emscripten/cache/sysroot/include/GLES2/gl2platform.h \ + /usr/share/emscripten/cache/sysroot/include/KHR/khrplatform.h \ + /usr/share/emscripten/cache/sysroot/include/c++/v1/stdint.h \ + /usr/share/emscripten/cache/sysroot/include/c++/v1/__config \ + /usr/share/emscripten/cache/sysroot/include/c++/v1/__config_site \ + /usr/share/emscripten/cache/sysroot/include/pthread.h \ + /usr/lib/llvm-14/lib/clang/14.0.6/include/stdint.h \ + /usr/share/emscripten/cache/sysroot/include/stdint.h \ + /usr/share/emscripten/cache/sysroot/include/bits/alltypes.h \ + /usr/share/emscripten/cache/sysroot/include/bits/stdint.h \ /usr/share/emscripten/cache/sysroot/include/emscripten.h \ /usr/share/emscripten/cache/sysroot/include/emscripten/emscripten.h \ /usr/share/emscripten/cache/sysroot/include/emscripten/em_asm.h \ @@ -11,20 +22,11 @@ CMakeFiles/FinalProject.dir/src/render/window.cpp.o: \ /usr/share/emscripten/cache/sysroot/include/emscripten/version.h \ /usr/share/emscripten/cache/sysroot/include/GLFW/glfw3.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/stddef.h \ - /usr/share/emscripten/cache/sysroot/include/c++/v1/__config \ - /usr/share/emscripten/cache/sysroot/include/c++/v1/__config_site \ - /usr/share/emscripten/cache/sysroot/include/pthread.h \ /usr/lib/llvm-14/lib/clang/14.0.6/include/stddef.h \ /usr/lib/llvm-14/lib/clang/14.0.6/include/__stddef_max_align_t.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/__nullptr \ - /usr/share/emscripten/cache/sysroot/include/c++/v1/stdint.h \ - /usr/lib/llvm-14/lib/clang/14.0.6/include/stdint.h \ - /usr/share/emscripten/cache/sysroot/include/stdint.h \ - /usr/share/emscripten/cache/sysroot/include/bits/alltypes.h \ - /usr/share/emscripten/cache/sysroot/include/bits/stdint.h \ /usr/share/emscripten/cache/sysroot/include/GL/gl.h \ /usr/share/emscripten/cache/sysroot/include/GL/glext.h \ - /usr/share/emscripten/cache/sysroot/include/KHR/khrplatform.h \ /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/libraries/BLT/include/blt/std/math.h \ /usr/share/emscripten/cache/sysroot/include/c++/v1/initializer_list \ /usr/share/emscripten/cache/sysroot/include/c++/v1/cstddef \ diff --git a/cmake-build-relwithdebinfo/.ninja_deps b/cmake-build-relwithdebinfo/.ninja_deps index 2e324de..1e67db6 100644 Binary files a/cmake-build-relwithdebinfo/.ninja_deps and b/cmake-build-relwithdebinfo/.ninja_deps differ diff --git a/cmake-build-relwithdebinfo/.ninja_log b/cmake-build-relwithdebinfo/.ninja_log index 3340a8e..4e6c0d8 100644 --- a/cmake-build-relwithdebinfo/.ninja_log +++ b/cmake-build-relwithdebinfo/.ninja_log @@ -33,3 +33,49 @@ 2 409 1676094324978000454 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 49e1226ae352c85c 1 1218 1676232405100658939 CMakeFiles/FinalProject.dir/src/render/gl.cpp.o 2e02d50528893aea 311 524 1675879686313903031 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/linux_joystick.c.o 3df40cb71360060f +1 418 1676342959700050381 CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o 8466edd0d9c6fbd8 +1 636 1676342959916056232 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o b8ecbf9d580cb1ce +1 733 1676342960012058836 CMakeFiles/FinalProject.dir/src/render/window.cpp.o fa6296e23b056a91 +1 794 1676342960072060459 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +1 853 1676342960132062088 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +1 1199 1676342960476071406 CMakeFiles/FinalProject.dir/src/render/gl.cpp.o 2e02d50528893aea +1 1274 1676342960552073465 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o a4d3cad66687d105 +1274 1353 1676342960624075419 libraries/BLT/libBLT.a 163b10f2e7f6635 +1353 1434 1676342960712077804 FinalProject e2e3313cdc6f5890 +1 821 1676342992684944487 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +822 903 1676342992764946656 FinalProject e2e3313cdc6f5890 +1 730 1676343073567139725 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +730 801 1676343073639141681 FinalProject e2e3313cdc6f5890 +2 751 1676343083775417051 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +751 829 1676343083851419116 FinalProject e2e3313cdc6f5890 +1 764 1676343095695740956 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +764 839 1676343095767742915 FinalProject e2e3313cdc6f5890 +1 286 1676347707994543363 CMakeFiles/FinalProject.dir/src/world/registry.cpp.o 3a6f3370180acf81 +1 411 1676347708118546768 CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o 8466edd0d9c6fbd8 +1 813 1676347708518557748 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +1 789 1676347718558833379 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +789 883 1676347718650835905 FinalProject e2e3313cdc6f5890 +2 402 1676347879019239298 CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o 8466edd0d9c6fbd8 +2 786 1676347879403249843 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +2 826 1676347879443250941 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +826 896 1676347879515252919 FinalProject e2e3313cdc6f5890 +2 367 1676347920740385109 CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o 8466edd0d9c6fbd8 +1 812 1676347921184397303 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +2 850 1676347921224398401 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +850 925 1676347921300400489 FinalProject e2e3313cdc6f5890 +1 738 1676347991758335700 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +738 812 1676347991830337678 FinalProject e2e3313cdc6f5890 +1 767 1676348340671921556 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +1 789 1676348340695922215 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +789 869 1676348340771924303 FinalProject e2e3313cdc6f5890 +1 781 1676348494136171853 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +1 850 1676348494204173737 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +851 924 1676348494276175733 FinalProject e2e3313cdc6f5890 +1 802 1676349157234497649 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +1 832 1676349157262498421 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +832 909 1676349157338500519 FinalProject e2e3313cdc6f5890 +1 857 1676349184543250718 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +857 932 1676349184619252813 FinalProject e2e3313cdc6f5890 +1 812 1676349209335934338 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1 +1 912 1676349209435937096 CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o a64a67d7d4fe0e86 +912 1010 1676349209535939851 FinalProject e2e3313cdc6f5890 diff --git a/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/main.cpp.o b/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/main.cpp.o index e08b188..56d3cfa 100644 Binary files a/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/main.cpp.o and b/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/main.cpp.o differ diff --git a/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o b/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o index c3870f6..bb952fb 100644 Binary files a/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o and b/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/gl.cpp.o differ diff --git a/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/window.cpp.o b/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/window.cpp.o index f21e21d..cfeb4b4 100644 Binary files a/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/window.cpp.o and b/cmake-build-relwithdebinfo/CMakeFiles/FinalProject.dir/src/render/window.cpp.o differ diff --git a/cmake-build-relwithdebinfo/FinalProject b/cmake-build-relwithdebinfo/FinalProject index 42fb0f2..eb06b09 100755 Binary files a/cmake-build-relwithdebinfo/FinalProject and b/cmake-build-relwithdebinfo/FinalProject differ diff --git a/cmake-build-relwithdebinfo/Testing/Temporary/LastTest.log b/cmake-build-relwithdebinfo/Testing/Temporary/LastTest.log index e312cdf..9bbe149 100644 --- a/cmake-build-relwithdebinfo/Testing/Temporary/LastTest.log +++ b/cmake-build-relwithdebinfo/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Feb 12 15:07 EST +Start testing: Feb 13 23:33 EST ---------------------------------------------------------- -End testing: Feb 12 15:07 EST +End testing: Feb 13 23:33 EST diff --git a/cmake-build-relwithdebinfo/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o b/cmake-build-relwithdebinfo/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o index e12821a..d3b9dc5 100644 Binary files a/cmake-build-relwithdebinfo/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o and b/cmake-build-relwithdebinfo/libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o differ diff --git a/cmake-build-relwithdebinfo/libraries/BLT/libBLT.a b/cmake-build-relwithdebinfo/libraries/BLT/libBLT.a index ed0c4ad..971d410 100644 Binary files a/cmake-build-relwithdebinfo/libraries/BLT/libBLT.a and b/cmake-build-relwithdebinfo/libraries/BLT/libBLT.a differ diff --git a/include/render/gl.h b/include/render/gl.h index 8cd28a4..ea72cd1 100644 --- a/include/render/gl.h +++ b/include/render/gl.h @@ -55,11 +55,11 @@ namespace fp { inline void update(void* new_data, int data_size) { bind(); // optimization technique is to not reallocate the memory on the GPU if the new buffer size is not larger than our current buffer - //if (data_size <= size){ + if (data_size <= size){ // we can do this as long as we overwrite from the beginning. Since the new draw call will only use of to size of the allocated buffer // to do all its drawing, the extra space unused can be ignored and saved for future use. - // glBufferSubData(type, 0, data_size, new_data); - //} else + glBufferSubData(type, 0, data_size, new_data); + } else glBufferData(type, data_size, new_data, mem_type); data = new_data; size = data_size; diff --git a/include/render/window.h b/include/render/window.h index 1796e29..697da10 100644 --- a/include/render/window.h +++ b/include/render/window.h @@ -15,8 +15,10 @@ #ifndef __EMSCRIPTEN__ #include #else + #include #include #define GL_GLEXT_PROTOTYPES + #define EGL_EGLEXT_PROTOTYPES #endif #include #include diff --git a/include/world/chunk/storage.h b/include/world/chunk/storage.h index d4bd7b4..df7021e 100644 --- a/include/world/chunk/storage.h +++ b/include/world/chunk/storage.h @@ -11,6 +11,7 @@ #include #include "blt/std/logging.h" #include +#include // contains storage classes for block IDs inside chunks plus eventual lookup of block states @@ -18,23 +19,32 @@ namespace fp { class block_storage { private: - char* blocks; + block_type* blocks; public: block_storage() { - blocks = new char[CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE]; + blocks = new unsigned char[CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE]; for (int i = 0; i < CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE; i++) - blocks[i] = 0; + blocks[i] = fp::registry::AIR; } ~block_storage() { delete[] blocks; } - [[nodiscard]] inline char get(const block_pos& pos) const { + [[nodiscard]] inline block_type get(const block_pos& pos) const { return blocks[pos.z * CHUNK_SIZE * CHUNK_SIZE + pos.y * CHUNK_SIZE + pos.x]; } - inline void set(const block_pos& pos, char blockID) { + [[nodiscard]] inline block_type getBounded(bool& outside, const block_pos& pos) const { + if (pos.x < 0 || pos.x >= CHUNK_SIZE || pos.y < 0 || pos.y >= CHUNK_SIZE || pos.z < 0 || pos.z >= CHUNK_SIZE) { + outside = true; + return fp::registry::AIR; + } + outside = false; + return get(pos); + } + + inline void set(const block_pos& pos, block_type blockID) { blocks[pos.z * CHUNK_SIZE * CHUNK_SIZE + pos.y * CHUNK_SIZE + pos.x] = blockID; } }; @@ -49,7 +59,7 @@ namespace fp { auto new_x = array[i] + (float)pos.x; auto new_y = array[i + 1] + (float)pos.y; auto new_z = array[i + 2] + (float)pos.z; - BLT_TRACE("Creating translated vertex {%f, %f, %f} from array position [%d, %d, %d]", new_x, new_y, new_z, i, i + 1, i + 2); +// BLT_TRACE("Creating translated vertex {%f, %f, %f} from array position [%d, %d, %d]", new_x, new_y, new_z, i, i + 1, i + 2); vertices.push_back(new_x); vertices.push_back(new_y); vertices.push_back(new_z); diff --git a/include/world/chunk/typedefs.h b/include/world/chunk/typedefs.h index 9cf8d75..14f2170 100644 --- a/include/world/chunk/typedefs.h +++ b/include/world/chunk/typedefs.h @@ -24,7 +24,7 @@ namespace fp { Z_NEG = 5, }; - enum chunk_status { + enum chunk_mesh_status { // chunk is okay and needs no special action OKAY = 0, // chunk needs its VAO updated with the newest mesh @@ -35,6 +35,11 @@ namespace fp { FULL_MESH = 3 }; + enum chunk_update_status { + NONE = 0, + NEIGHBOUR_CREATE = 1, + }; + struct chunk_pos { int x, y, z; }; diff --git a/include/world/chunk/world.h b/include/world/chunk/world.h index c33661a..03a50e3 100644 --- a/include/world/chunk/world.h +++ b/include/world/chunk/world.h @@ -23,7 +23,7 @@ namespace fp { auto val = coord % CHUNK_SIZE; return val < 0 ? CHUNK_SIZE + val : val; } - + static inline block_pos world_to_internal(const block_pos& coord) { return {world_to_internal(coord.x), world_to_internal(coord.y), world_to_internal(coord.z)}; } @@ -57,7 +57,7 @@ namespace fp { return (int) (ucoord); } - static inline chunk_pos world_to_chunk(const block_pos& pos){ + static inline chunk_pos world_to_chunk(const block_pos& pos) { return {world_to_chunk(pos.x), world_to_chunk(pos.y), world_to_chunk(pos.z)}; } @@ -69,8 +69,9 @@ namespace fp { mesh_storage* mesh = nullptr; VAO* chunk_vao; chunk_pos pos; - - chunk_status dirtiness = OKAY; + + chunk_mesh_status dirtiness = OKAY; + chunk_update_status status = NONE; unsigned long render_size = 0; public: explicit chunk(chunk_pos pos): pos(pos) { @@ -94,14 +95,50 @@ namespace fp { } }; + struct chunk_neighbours { + fp::chunk* neighbours[6]; + + inline chunk*& operator[](int i) { + return neighbours[i]; + } + }; + class world { private: std::unordered_map chunk_storage; protected: + void generateFullMesh(mesh_storage* mesh, chunk* chunk); + + void generateEdgeMesh(mesh_storage* mesh, chunk* chunk); + void generateChunkMesh(chunk* chunk); - inline void insertChunk(chunk* chunk){ + inline void getNeighbours(const chunk_pos& pos, chunk_neighbours& neighbours) { + neighbours[X_POS] = getChunk(chunk_pos{pos.x + 1, pos.y, pos.z}); + neighbours[X_NEG] = getChunk(chunk_pos{pos.x - 1, pos.y, pos.z}); + neighbours[Y_POS] = getChunk(chunk_pos{pos.x, pos.y + 1, pos.z}); + neighbours[Y_NEG] = getChunk(chunk_pos{pos.x, pos.y - 1, pos.z}); + neighbours[Z_POS] = getChunk(chunk_pos{pos.x, pos.y, pos.z + 1}); + neighbours[Z_NEG] = getChunk(chunk_pos{pos.x, pos.y, pos.z - 1}); + } + + inline void insertChunk(chunk* chunk) { chunk_storage.insert({chunk->pos, chunk}); + + chunk_neighbours chunkNeighbours{}; + getNeighbours(chunk->pos, chunkNeighbours); + + for (auto* p : chunkNeighbours.neighbours){ + if (p) + p->status = NEIGHBOUR_CREATE; + } + } + + inline chunk* getChunk(const chunk_pos& pos){ + const auto map_pos = chunk_storage.find(pos); + if (map_pos == chunk_storage.end()) + return nullptr; + return map_pos->second; } inline chunk* getChunk(const block_pos& pos) { @@ -111,6 +148,10 @@ namespace fp { public: world() { insertChunk(new chunk({0, 0, 0})); + insertChunk(new chunk({0, 1, 0})); + insertChunk(new chunk({0, -1, 0})); + insertChunk(new chunk({1, 0, 0})); + insertChunk(new chunk({0, 0, 1})); insertChunk(new chunk({-1, 0, 0})); insertChunk(new chunk({0, 0, -1})); insertChunk(new chunk({-1, 0, -1})); @@ -120,15 +161,20 @@ namespace fp { void render(fp::shader& shader); - inline void setBlock(const block_pos& pos, char blockID) { + inline bool setBlock(const block_pos& pos, block_type blockID) { auto c = getChunk(pos); + if (!c) + return false; // mark the chunk for a mesh update c->dirtiness = FULL_MESH; c->storage->set(_static::world_to_internal(pos), blockID); + return true; } - inline char getBlock(const block_pos& pos) { + inline block_type getBlock(const block_pos& pos) { auto c = getChunk(pos); + if (!c) + return fp::registry::AIR; return c->storage->get(_static::world_to_internal(pos)); } diff --git a/include/world/registry.h b/include/world/registry.h index 5c588f0..a476a1d 100644 --- a/include/world/registry.h +++ b/include/world/registry.h @@ -7,4 +7,37 @@ #ifndef FINALPROJECT_REGISTRY_H #define FINALPROJECT_REGISTRY_H +namespace fp { + typedef unsigned char block_type; +} + +namespace fp::registry { + + enum block_visibility { + OPAQUE = 0, + TRANSLUCENT = 1, + TRANSPARENT = 2, + }; + + struct block_properties { + block_visibility visibility = OPAQUE; + }; + + constexpr block_type AIR = 0; + constexpr block_type STONE = 1; + + void registerBlock(block_type id, block_properties properties); + + block_properties get(block_type id); + + + /** + * Registers all the default blocks used by the engine + */ + inline void registerDefaultBlocks(){ + registerBlock(AIR, {TRANSPARENT}); + registerBlock(STONE, {}); + } + +} #endif //FINALPROJECT_REGISTRY_H diff --git a/libraries/BLT b/libraries/BLT index e50cc74..a196a2a 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit e50cc74bf3ba56455e0db3208d95af3546561341 +Subproject commit a196a2aa7db167fb293cbbea59516c50c45b48c5 diff --git a/src/main.cpp b/src/main.cpp index dc77baa..a95801a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,12 +40,15 @@ int main() { blt::logging::init(logging_properties); fp::window::init(); + fp::registry::registerDefaultBlocks(); chunk_shader = new fp::shader(shader_chunk_vert, shader_chunk_frag); world = new fp::world(); - world->setBlock({0, 0, 0}, 1); - world->setBlock({2, 2, 2}, 1); + for (int i = 1; i < CHUNK_SIZE; i++) + for (int j = 0; j < 3; j++) + for (int k = 5; k < CHUNK_SIZE; k++) + world->setBlock({i,j,k}, 1); world->setBlock({-2, 2, 2}, 1); world->setBlock({-2, 2, -2}, 1); world->setBlock({2, 2, -2}, 1); @@ -60,7 +63,7 @@ int main() { * make sure you render at a proper smooth rate that lines up properly with the browser and monitor." * https://emscripten.org/docs/api_reference/emscripten.h.html */ - emscripten_set_main_loop(loop, 60, true); + emscripten_set_main_loop(loop, 0, true); #else while(!fp::window::isCloseRequested()) loop(); diff --git a/src/render/camera.cpp b/src/render/camera.cpp index 57b699a..d124d8b 100644 --- a/src/render/camera.cpp +++ b/src/render/camera.cpp @@ -23,8 +23,6 @@ void updateCursorGrabbedState(){ #ifndef __EMSCRIPTEN__ if (fp::window::isKeyPressed(GLFW_KEY_ESCAPE) && fp::window::keyState()) fp::window::mouseGrabbed(!fp::window::mouseGrabbed()); -#else - //fp::window::mouseGrabbed(true); #endif } diff --git a/src/render/window.cpp b/src/render/window.cpp index bd832c5..a7b9879 100644 --- a/src/render/window.cpp +++ b/src/render/window.cpp @@ -36,7 +36,8 @@ double mouse_last_y; #ifdef __EMSCRIPTEN__ EM_BOOL on_pointerlockchange(int eventType, const EmscriptenPointerlockChangeEvent *event, void *userData) { BLT_TRACE("Emscripten pointer lock event status %d", event->isActive); - glfwSetInputMode(global_window, GLFW_CURSOR, event->isActive ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL); + if (event->isActive != fp::window::mouseGrabbed()) + glfwSetInputMode(global_window, GLFW_CURSOR, event->isActive ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL); return 0; } #endif diff --git a/src/world/chunk/world.cpp b/src/world/chunk/world.cpp index 619d432..2bde2dd 100644 --- a/src/world/chunk/world.cpp +++ b/src/world/chunk/world.cpp @@ -5,30 +5,75 @@ */ #include -void fp::world::generateChunkMesh(fp::chunk* chunk) { - auto* meshStorage = new mesh_storage; +void fp::world::generateFullMesh(mesh_storage* mesh, fp::chunk* chunk) { + // checks to outside the bounds of the chunk should not have faces added. this will be handled by the partial mesh! + bool outside = false; - if (chunk->dirtiness == FULL_MESH) { // full chunk mesh - for (int i = 0; i < CHUNK_SIZE; i++) { - for (int j = 0; j < CHUNK_SIZE; j++) { - for (int k = 0; k < CHUNK_SIZE; k++) { - auto block = chunk->storage->get({i, j, k}); - if (block != 0) { - meshStorage->addFace(X_NEG, {i, j, k}); - meshStorage->addFace(X_POS, {i, j, k}); - meshStorage->addFace(Y_NEG, {i, j, k}); - meshStorage->addFace(Y_POS, {i, j, k}); - meshStorage->addFace(Z_NEG, {i, j, k}); - meshStorage->addFace(Z_POS, {i, j, k}); - } + for (int i = 1; i < CHUNK_SIZE-1; i++) { + for (int j = 1; j < CHUNK_SIZE-1; j++) { + for (int k = 1; k < CHUNK_SIZE-1; k++) { + auto block = chunk->storage->get({i, j, k}); + // opaque visibility is always 0. Non-zero values (true) are what we care about since opaque blocks are completely hidden + if (!fp::registry::get(block).visibility) { + if (fp::registry::get(chunk->storage->getBounded(outside, {i-1, j, k})).visibility && !outside) + mesh->addFace(X_NEG, {i, j, k}); + if (fp::registry::get(chunk->storage->getBounded(outside, {i+1, j, k})).visibility && !outside) + mesh->addFace(X_POS, {i, j, k}); + if (fp::registry::get(chunk->storage->getBounded(outside, {i, j-1, k})).visibility && !outside) + mesh->addFace(Y_NEG, {i, j, k}); + if (fp::registry::get(chunk->storage->getBounded(outside, {i, j+1, k})).visibility && !outside) + mesh->addFace(Y_POS, {i, j, k}); + if (fp::registry::get(chunk->storage->getBounded(outside, {i, j, k-1})).visibility && !outside) + mesh->addFace(Z_NEG, {i, j, k}); + if (fp::registry::get(chunk->storage->getBounded(outside, {i, j, k+1})).visibility && !outside) + mesh->addFace(Z_POS, {i, j, k}); } } } - } else if (chunk->dirtiness == PARTIAL_MESH){ // partial chunk mesh (had null edges) - } - chunk->mesh = meshStorage; + chunk->dirtiness = PARTIAL_MESH; +} + +void fp::world::generateEdgeMesh(mesh_storage* mesh, fp::chunk* chunk) { + // don't try to regen the chunk mesh unless there is a chance all neighbours are not null + if (chunk->status != chunk_update_status::NEIGHBOUR_CREATE) + return; + + chunk_neighbours neighbours {}; + getNeighbours(chunk->pos, neighbours); + + // if none of the neighbours exist we cannot continue! + for (auto* neighbour : neighbours.neighbours){ + if (!neighbour) + return; + } + + for (int i = 0; i < CHUNK_SIZE; i++){ + for (int j = 0; j < CHUNK_SIZE; j++){ + auto block = chunk->storage->get({0, i, j}); + if (!fp::registry::get(block).visibility) { + auto neighbour = neighbours[X_NEG]->storage->get({CHUNK_SIZE-1, i, j}); + if (fp::registry::get(neighbour).visibility) + mesh->addFace(X_NEG, {0, i, j}); + } + } + } + + chunk->status = NONE; + chunk->dirtiness = REFRESH; +} + +void fp::world::generateChunkMesh(fp::chunk* chunk) { + if (chunk->mesh == nullptr) + chunk->mesh = new mesh_storage; + + if (chunk->dirtiness == FULL_MESH) { // full chunk mesh + generateFullMesh(chunk->mesh, chunk); + } else if (chunk->dirtiness == PARTIAL_MESH){ // partial chunk mesh (had null neighbours) + generateEdgeMesh(chunk->mesh, chunk); + } + chunk->dirtiness = REFRESH; } @@ -42,6 +87,9 @@ void fp::world::render(fp::shader& shader) { for (const auto& chunk_pair : chunk_storage) { auto chunk = chunk_pair.second; + if (chunk == nullptr) + continue; + if (chunk->dirtiness > REFRESH){ generateChunkMesh(chunk); } @@ -55,7 +103,7 @@ void fp::world::render(fp::shader& shader) { // upload the new vertices to the GPU chunk->chunk_vao->getVBO(0)->update(vertices); - chunk->render_size = vertices.size(); + chunk->render_size = vertices.size() / 3; // delete the memory from the CPU. delete(chunk->mesh); @@ -69,7 +117,6 @@ void fp::world::render(fp::shader& shader) { shader.setMatrix("translation", translation); chunk->chunk_vao->bind(); glEnableVertexAttribArray(0); - //glDrawElements(GL_TRIANGLES, render_size, GL_UNSIGNED_INT, nullptr); glDrawArrays(GL_TRIANGLES, 0, (int)chunk->render_size); glDisableVertexAttribArray(0); } diff --git a/src/world/registry.cpp b/src/world/registry.cpp index 52d1df5..1c2323a 100644 --- a/src/world/registry.cpp +++ b/src/world/registry.cpp @@ -3,4 +3,15 @@ * Licensed under GNU General Public License V3.0 * See LICENSE file for license detail */ -#include \ No newline at end of file +#include +#include + +std::unordered_map blocks; + +void fp::registry::registerBlock(fp::block_type id, fp::registry::block_properties properties) { + blocks[id] = properties; +} + +fp::registry::block_properties fp::registry::get(fp::block_type id) { + return blocks.at(id); +}