parent
6c265b7c3c
commit
a62bbdc654
|
@ -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")
|
#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}/)
|
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 "-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 --preload-file 'assets'")
|
set_target_properties(FinalProject PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -s ASSERTIONS=1 -sUSE_GLFW=3 -sFULL_ES3 --preload-file 'assets'")
|
||||||
# these flags will be set by cmake automatically based on build type
|
# 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 "-O3")
|
||||||
#set_target_properties(FinalProject PROPERTIES COMPILE_FLAGS "-g")
|
#set_target_properties(FinalProject PROPERTIES COMPILE_FLAGS "-g")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
19 685 1675834610617266094 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/vulkan.c.o 7ac098ea2e755b71
|
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
|
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
|
19 807 1675834610745269744 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/x11_init.c.o 7a310a4749a2e05
|
||||||
0 98 1676240847353699603 build.ninja 190f84590f6ee728
|
0 98 1676321976951230956 build.ninja 190f84590f6ee728
|
||||||
2 434 1675915441258513581 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 342a5daa6ca9681d
|
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
|
18 706 1675834610629266436 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/init.c.o 6051295f860fb367
|
||||||
1099 1278 1676232079155824369 libraries/BLT/libBLT.a 163b10f2e7f6635
|
1099 1278 1676232079155824369 libraries/BLT/libBLT.a 163b10f2e7f6635
|
||||||
|
|
|
@ -12,8 +12,8 @@ set(CMAKE_DEPENDS_DEPENDENCY_FILES
|
||||||
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/camera.cpp" "CMakeFiles/FinalProject.dir/src/render/camera.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/render/camera.cpp.o.d"
|
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/camera.cpp" "CMakeFiles/FinalProject.dir/src/render/camera.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/render/camera.cpp.o.d"
|
||||||
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/gl.cpp" "CMakeFiles/FinalProject.dir/src/render/gl.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d"
|
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/gl.cpp" "CMakeFiles/FinalProject.dir/src/render/gl.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d"
|
||||||
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/window.cpp" "CMakeFiles/FinalProject.dir/src/render/window.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d"
|
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/window.cpp" "CMakeFiles/FinalProject.dir/src/render/window.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d"
|
||||||
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/chunk.cpp" "CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o.d"
|
|
||||||
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/storage.cpp" "CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o.d"
|
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/storage.cpp" "CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o.d"
|
||||||
|
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/world.cpp" "CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o.d"
|
||||||
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/registry.cpp" "CMakeFiles/FinalProject.dir/src/world/registry.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/world/registry.cpp.o.d"
|
"/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/registry.cpp" "CMakeFiles/FinalProject.dir/src/world/registry.cpp.o" "gcc" "CMakeFiles/FinalProject.dir/src/world/registry.cpp.o.d"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -132,26 +132,11 @@ CMakeFiles/FinalProject.dir/src/render/window.cpp.s: cmake_force
|
||||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/FinalProject.dir/src/render/window.cpp.s"
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/FinalProject.dir/src/render/window.cpp.s"
|
||||||
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S "/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/window.cpp" -o CMakeFiles/FinalProject.dir/src/render/window.cpp.s
|
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S "/home/brett/Documents/Brock/CS 3P98/Final Project/src/render/window.cpp" -o CMakeFiles/FinalProject.dir/src/render/window.cpp.s
|
||||||
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o: CMakeFiles/FinalProject.dir/flags.make
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o: CMakeFiles/FinalProject.dir/includes_CXX.rsp
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o: /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/world/chunk/chunk.cpp
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o: CMakeFiles/FinalProject.dir/compiler_depend.ts
|
|
||||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir="/home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-emrelease/CMakeFiles" --progress-num=$(CMAKE_PROGRESS_5) "Building CXX object CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o"
|
|
||||||
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o -MF CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o.d -o CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o -c "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/chunk.cpp"
|
|
||||||
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.i: cmake_force
|
|
||||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.i"
|
|
||||||
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/chunk.cpp" > CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.i
|
|
||||||
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.s: cmake_force
|
|
||||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.s"
|
|
||||||
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/chunk.cpp" -o CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.s
|
|
||||||
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: CMakeFiles/FinalProject.dir/flags.make
|
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: CMakeFiles/FinalProject.dir/flags.make
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: CMakeFiles/FinalProject.dir/includes_CXX.rsp
|
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: CMakeFiles/FinalProject.dir/includes_CXX.rsp
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/world/chunk/storage.cpp
|
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/world/chunk/storage.cpp
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: CMakeFiles/FinalProject.dir/compiler_depend.ts
|
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o: CMakeFiles/FinalProject.dir/compiler_depend.ts
|
||||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir="/home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-emrelease/CMakeFiles" --progress-num=$(CMAKE_PROGRESS_6) "Building CXX object CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o"
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir="/home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-emrelease/CMakeFiles" --progress-num=$(CMAKE_PROGRESS_5) "Building CXX object CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o"
|
||||||
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o -MF CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o.d -o CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o -c "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/storage.cpp"
|
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o -MF CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o.d -o CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o -c "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/storage.cpp"
|
||||||
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.i: cmake_force
|
CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.i: cmake_force
|
||||||
|
@ -162,6 +147,21 @@ CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.s: cmake_force
|
||||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.s"
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.s"
|
||||||
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/storage.cpp" -o CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.s
|
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/storage.cpp" -o CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.s
|
||||||
|
|
||||||
|
CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o: CMakeFiles/FinalProject.dir/flags.make
|
||||||
|
CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o: CMakeFiles/FinalProject.dir/includes_CXX.rsp
|
||||||
|
CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o: /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/world/chunk/world.cpp
|
||||||
|
CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o: CMakeFiles/FinalProject.dir/compiler_depend.ts
|
||||||
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir="/home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-emrelease/CMakeFiles" --progress-num=$(CMAKE_PROGRESS_6) "Building CXX object CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o"
|
||||||
|
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o -MF CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o.d -o CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o -c "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/world.cpp"
|
||||||
|
|
||||||
|
CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.i: cmake_force
|
||||||
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.i"
|
||||||
|
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/world.cpp" > CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.i
|
||||||
|
|
||||||
|
CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.s: cmake_force
|
||||||
|
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.s"
|
||||||
|
/usr/bin/em++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S "/home/brett/Documents/Brock/CS 3P98/Final Project/src/world/chunk/world.cpp" -o CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.s
|
||||||
|
|
||||||
CMakeFiles/FinalProject.dir/src/world/registry.cpp.o: CMakeFiles/FinalProject.dir/flags.make
|
CMakeFiles/FinalProject.dir/src/world/registry.cpp.o: CMakeFiles/FinalProject.dir/flags.make
|
||||||
CMakeFiles/FinalProject.dir/src/world/registry.cpp.o: CMakeFiles/FinalProject.dir/includes_CXX.rsp
|
CMakeFiles/FinalProject.dir/src/world/registry.cpp.o: CMakeFiles/FinalProject.dir/includes_CXX.rsp
|
||||||
CMakeFiles/FinalProject.dir/src/world/registry.cpp.o: /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/world/registry.cpp
|
CMakeFiles/FinalProject.dir/src/world/registry.cpp.o: /home/brett/Documents/Brock/CS\ 3P98/Final\ Project/src/world/registry.cpp
|
||||||
|
@ -183,8 +183,8 @@ FinalProject_OBJECTS = \
|
||||||
"CMakeFiles/FinalProject.dir/src/render/camera.cpp.o" \
|
"CMakeFiles/FinalProject.dir/src/render/camera.cpp.o" \
|
||||||
"CMakeFiles/FinalProject.dir/src/render/gl.cpp.o" \
|
"CMakeFiles/FinalProject.dir/src/render/gl.cpp.o" \
|
||||||
"CMakeFiles/FinalProject.dir/src/render/window.cpp.o" \
|
"CMakeFiles/FinalProject.dir/src/render/window.cpp.o" \
|
||||||
"CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o" \
|
|
||||||
"CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o" \
|
"CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o" \
|
||||||
|
"CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o" \
|
||||||
"CMakeFiles/FinalProject.dir/src/world/registry.cpp.o"
|
"CMakeFiles/FinalProject.dir/src/world/registry.cpp.o"
|
||||||
|
|
||||||
# External object files for target FinalProject
|
# External object files for target FinalProject
|
||||||
|
@ -194,8 +194,8 @@ FinalProject.js: CMakeFiles/FinalProject.dir/src/main.cpp.o
|
||||||
FinalProject.js: CMakeFiles/FinalProject.dir/src/render/camera.cpp.o
|
FinalProject.js: CMakeFiles/FinalProject.dir/src/render/camera.cpp.o
|
||||||
FinalProject.js: CMakeFiles/FinalProject.dir/src/render/gl.cpp.o
|
FinalProject.js: CMakeFiles/FinalProject.dir/src/render/gl.cpp.o
|
||||||
FinalProject.js: CMakeFiles/FinalProject.dir/src/render/window.cpp.o
|
FinalProject.js: CMakeFiles/FinalProject.dir/src/render/window.cpp.o
|
||||||
FinalProject.js: CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o
|
|
||||||
FinalProject.js: CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o
|
FinalProject.js: CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o
|
||||||
|
FinalProject.js: CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o
|
||||||
FinalProject.js: CMakeFiles/FinalProject.dir/src/world/registry.cpp.o
|
FinalProject.js: CMakeFiles/FinalProject.dir/src/world/registry.cpp.o
|
||||||
FinalProject.js: CMakeFiles/FinalProject.dir/build.make
|
FinalProject.js: CMakeFiles/FinalProject.dir/build.make
|
||||||
FinalProject.js: libraries/BLT/libBLT.a
|
FinalProject.js: libraries/BLT/libBLT.a
|
||||||
|
|
|
@ -7,10 +7,10 @@ file(REMOVE_RECURSE
|
||||||
"CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d"
|
"CMakeFiles/FinalProject.dir/src/render/gl.cpp.o.d"
|
||||||
"CMakeFiles/FinalProject.dir/src/render/window.cpp.o"
|
"CMakeFiles/FinalProject.dir/src/render/window.cpp.o"
|
||||||
"CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d"
|
"CMakeFiles/FinalProject.dir/src/render/window.cpp.o.d"
|
||||||
"CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o"
|
|
||||||
"CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o.d"
|
|
||||||
"CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o"
|
"CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o"
|
||||||
"CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o.d"
|
"CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o.d"
|
||||||
|
"CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o"
|
||||||
|
"CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o.d"
|
||||||
"CMakeFiles/FinalProject.dir/src/world/registry.cpp.o"
|
"CMakeFiles/FinalProject.dir/src/world/registry.cpp.o"
|
||||||
"CMakeFiles/FinalProject.dir/src/world/registry.cpp.o.d"
|
"CMakeFiles/FinalProject.dir/src/world/registry.cpp.o.d"
|
||||||
"FinalProject.js"
|
"FinalProject.js"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
/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
|
/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
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
CMakeFiles/FinalProject.dir/src/main.cpp.o CMakeFiles/FinalProject.dir/src/render/camera.cpp.o CMakeFiles/FinalProject.dir/src/render/gl.cpp.o CMakeFiles/FinalProject.dir/src/render/window.cpp.o CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o CMakeFiles/FinalProject.dir/src/world/registry.cpp.o
|
CMakeFiles/FinalProject.dir/src/main.cpp.o CMakeFiles/FinalProject.dir/src/render/camera.cpp.o CMakeFiles/FinalProject.dir/src/render/gl.cpp.o CMakeFiles/FinalProject.dir/src/render/window.cpp.o CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o CMakeFiles/FinalProject.dir/src/world/registry.cpp.o
|
||||||
|
|
Binary file not shown.
|
@ -320,7 +320,9 @@ CMakeFiles/FinalProject.dir/src/main.cpp.o: \
|
||||||
/usr/share/emscripten/cache/sysroot/include/c++/v1/streambuf \
|
/usr/share/emscripten/cache/sysroot/include/c++/v1/streambuf \
|
||||||
/usr/share/emscripten/cache/sysroot/include/c++/v1/__bsd_locale_fallbacks.h \
|
/usr/share/emscripten/cache/sysroot/include/c++/v1/__bsd_locale_fallbacks.h \
|
||||||
/usr/share/emscripten/cache/sysroot/include/c++/v1/sstream \
|
/usr/share/emscripten/cache/sysroot/include/c++/v1/sstream \
|
||||||
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/shaders/test.frag \
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/shaders/chunk.frag \
|
||||||
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/shaders/test.vert \
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/shaders/chunk.vert \
|
||||||
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/render/camera.h \
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/render/camera.h \
|
||||||
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/world/chunk/storage.h
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/world/chunk/world.h \
|
||||||
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/world/chunk/storage.h \
|
||||||
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/include/world/chunk/typedefs.h
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -320,4 +320,8 @@ CMakeFiles/FinalProject.dir/src/render/window.cpp.o: \
|
||||||
/usr/share/emscripten/cache/sysroot/include/c++/v1/__bsd_locale_fallbacks.h \
|
/usr/share/emscripten/cache/sysroot/include/c++/v1/__bsd_locale_fallbacks.h \
|
||||||
/usr/share/emscripten/cache/sysroot/include/c++/v1/sstream \
|
/usr/share/emscripten/cache/sysroot/include/c++/v1/sstream \
|
||||||
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/libraries/BLT/include/blt/std/logging.h \
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/libraries/BLT/include/blt/std/logging.h \
|
||||||
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/libraries/BLT/include/blt/std/time.h
|
/home/brett/Documents/Brock/CS\ 3P98/Final\ Project/libraries/BLT/include/blt/std/time.h \
|
||||||
|
/usr/share/emscripten/cache/sysroot/include/emscripten/html5.h \
|
||||||
|
/usr/share/emscripten/cache/sysroot/include/emscripten/eventloop.h \
|
||||||
|
/usr/share/emscripten/cache/sysroot/include/emscripten/console.h \
|
||||||
|
/usr/share/emscripten/cache/sysroot/include/emscripten/html5_webgl.h
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
hello this is a test of embedded files
|
|
||||||
this is a new line
|
|
||||||
hello world!
|
|
||||||
this is also a new line
|
|
||||||
second hello world!
|
|
||||||
|
|
||||||
NEW DATA
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -241,30 +241,6 @@ src/render/window.cpp.s:
|
||||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/render/window.cpp.s
|
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/render/window.cpp.s
|
||||||
.PHONY : src/render/window.cpp.s
|
.PHONY : src/render/window.cpp.s
|
||||||
|
|
||||||
src/world/chunk/chunk.o: src/world/chunk/chunk.cpp.o
|
|
||||||
.PHONY : src/world/chunk/chunk.o
|
|
||||||
|
|
||||||
# target to build an object file
|
|
||||||
src/world/chunk/chunk.cpp.o:
|
|
||||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o
|
|
||||||
.PHONY : src/world/chunk/chunk.cpp.o
|
|
||||||
|
|
||||||
src/world/chunk/chunk.i: src/world/chunk/chunk.cpp.i
|
|
||||||
.PHONY : src/world/chunk/chunk.i
|
|
||||||
|
|
||||||
# target to preprocess a source file
|
|
||||||
src/world/chunk/chunk.cpp.i:
|
|
||||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.i
|
|
||||||
.PHONY : src/world/chunk/chunk.cpp.i
|
|
||||||
|
|
||||||
src/world/chunk/chunk.s: src/world/chunk/chunk.cpp.s
|
|
||||||
.PHONY : src/world/chunk/chunk.s
|
|
||||||
|
|
||||||
# target to generate assembly for a file
|
|
||||||
src/world/chunk/chunk.cpp.s:
|
|
||||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.s
|
|
||||||
.PHONY : src/world/chunk/chunk.cpp.s
|
|
||||||
|
|
||||||
src/world/chunk/storage.o: src/world/chunk/storage.cpp.o
|
src/world/chunk/storage.o: src/world/chunk/storage.cpp.o
|
||||||
.PHONY : src/world/chunk/storage.o
|
.PHONY : src/world/chunk/storage.o
|
||||||
|
|
||||||
|
@ -289,6 +265,30 @@ src/world/chunk/storage.cpp.s:
|
||||||
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.s
|
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.s
|
||||||
.PHONY : src/world/chunk/storage.cpp.s
|
.PHONY : src/world/chunk/storage.cpp.s
|
||||||
|
|
||||||
|
src/world/chunk/world.o: src/world/chunk/world.cpp.o
|
||||||
|
.PHONY : src/world/chunk/world.o
|
||||||
|
|
||||||
|
# target to build an object file
|
||||||
|
src/world/chunk/world.cpp.o:
|
||||||
|
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.o
|
||||||
|
.PHONY : src/world/chunk/world.cpp.o
|
||||||
|
|
||||||
|
src/world/chunk/world.i: src/world/chunk/world.cpp.i
|
||||||
|
.PHONY : src/world/chunk/world.i
|
||||||
|
|
||||||
|
# target to preprocess a source file
|
||||||
|
src/world/chunk/world.cpp.i:
|
||||||
|
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.i
|
||||||
|
.PHONY : src/world/chunk/world.cpp.i
|
||||||
|
|
||||||
|
src/world/chunk/world.s: src/world/chunk/world.cpp.s
|
||||||
|
.PHONY : src/world/chunk/world.s
|
||||||
|
|
||||||
|
# target to generate assembly for a file
|
||||||
|
src/world/chunk/world.cpp.s:
|
||||||
|
$(MAKE) $(MAKESILENT) -f CMakeFiles/FinalProject.dir/build.make CMakeFiles/FinalProject.dir/src/world/chunk/world.cpp.s
|
||||||
|
.PHONY : src/world/chunk/world.cpp.s
|
||||||
|
|
||||||
src/world/registry.o: src/world/registry.cpp.o
|
src/world/registry.o: src/world/registry.cpp.o
|
||||||
.PHONY : src/world/registry.o
|
.PHONY : src/world/registry.o
|
||||||
|
|
||||||
|
@ -335,12 +335,12 @@ help:
|
||||||
@echo "... src/render/window.o"
|
@echo "... src/render/window.o"
|
||||||
@echo "... src/render/window.i"
|
@echo "... src/render/window.i"
|
||||||
@echo "... src/render/window.s"
|
@echo "... src/render/window.s"
|
||||||
@echo "... src/world/chunk/chunk.o"
|
|
||||||
@echo "... src/world/chunk/chunk.i"
|
|
||||||
@echo "... src/world/chunk/chunk.s"
|
|
||||||
@echo "... src/world/chunk/storage.o"
|
@echo "... src/world/chunk/storage.o"
|
||||||
@echo "... src/world/chunk/storage.i"
|
@echo "... src/world/chunk/storage.i"
|
||||||
@echo "... src/world/chunk/storage.s"
|
@echo "... src/world/chunk/storage.s"
|
||||||
|
@echo "... src/world/chunk/world.o"
|
||||||
|
@echo "... src/world/chunk/world.i"
|
||||||
|
@echo "... src/world/chunk/world.s"
|
||||||
@echo "... src/world/registry.o"
|
@echo "... src/world/registry.o"
|
||||||
@echo "... src/world/registry.i"
|
@echo "... src/world/registry.i"
|
||||||
@echo "... src/world/registry.s"
|
@echo "... src/world/registry.s"
|
||||||
|
|
|
@ -6,6 +6,8 @@ precision mediump float;
|
||||||
|
|
||||||
layout (location = 0) in vec3 vertex;
|
layout (location = 0) in vec3 vertex;
|
||||||
|
|
||||||
|
uniform mat4 translation;
|
||||||
|
|
||||||
layout (std140) uniform StandardMatrices
|
layout (std140) uniform StandardMatrices
|
||||||
{
|
{
|
||||||
mat4 projection;
|
mat4 projection;
|
||||||
|
@ -15,7 +17,7 @@ layout (std140) uniform StandardMatrices
|
||||||
};
|
};
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = projection * view * vec4(vertex.x, vertex.y, vertex.z, 1.0);
|
gl_Position = projection * view * translation * vec4(vertex.x, vertex.y, vertex.z, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
")";
|
")";
|
||||||
|
|
|
@ -10,26 +10,12 @@
|
||||||
#include <blt/std/math.h>
|
#include <blt/std/math.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "blt/std/logging.h"
|
#include "blt/std/logging.h"
|
||||||
|
#include <world/chunk/typedefs.h>
|
||||||
|
|
||||||
// contains storage classes for block IDs inside chunks plus eventual lookup of block states
|
// contains storage classes for block IDs inside chunks plus eventual lookup of block states
|
||||||
|
|
||||||
// size of the chunk in number of blocks
|
|
||||||
constexpr int CHUNK_SIZE = 32;
|
|
||||||
const int CHUNK_SHIFT = (int)(log(CHUNK_SIZE) / log(2));
|
|
||||||
// size that the base vertex arrays are assumed to be (per face)
|
|
||||||
constexpr int VTX_ARR_SIZE = 18;
|
|
||||||
|
|
||||||
namespace fp {
|
namespace fp {
|
||||||
|
|
||||||
enum face {
|
|
||||||
X_POS = 0,
|
|
||||||
X_NEG = 1,
|
|
||||||
Y_POS = 2,
|
|
||||||
Y_NEG = 3,
|
|
||||||
Z_POS = 4,
|
|
||||||
Z_NEG = 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
class block_storage {
|
class block_storage {
|
||||||
private:
|
private:
|
||||||
char* blocks;
|
char* blocks;
|
||||||
|
@ -44,33 +30,25 @@ namespace fp {
|
||||||
delete[] blocks;
|
delete[] blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char get(const blt::vec3& pos) { return get(pos.x(), pos.y(), pos.z()); }
|
[[nodiscard]] inline char get(const block_pos& pos) const {
|
||||||
|
return blocks[pos.z * CHUNK_SIZE * CHUNK_SIZE + pos.y * CHUNK_SIZE + pos.x];
|
||||||
inline char get(float x, float y, float z) { return get(int(x), int(y), int(z)); }
|
|
||||||
|
|
||||||
inline char get(int x, int y, int z) {
|
|
||||||
return blocks[z * CHUNK_SIZE * CHUNK_SIZE + y * CHUNK_SIZE + x];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void set(const blt::vec3& pos, char blockID) { return set(pos.x(), pos.y(), pos.z(), blockID); }
|
inline void set(const block_pos& pos, char blockID) {
|
||||||
|
blocks[pos.z * CHUNK_SIZE * CHUNK_SIZE + pos.y * CHUNK_SIZE + pos.x] = blockID;
|
||||||
inline void set(float x, float y, float z, char blockID) { return set(int(x), int(y), int(z), blockID); }
|
|
||||||
|
|
||||||
inline void set(int x, int y, int z, char blockID) {
|
|
||||||
blocks[z * CHUNK_SIZE * CHUNK_SIZE + y * CHUNK_SIZE + x] = blockID;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class mesh_storage {
|
class mesh_storage {
|
||||||
private:
|
private:
|
||||||
std::vector<float> vertices;
|
std::vector<float> vertices;
|
||||||
inline void add_and_translate(const float* array, float x, float y, float z) {
|
inline void add_and_translate(const float* array, const block_pos& pos) {
|
||||||
// since a chunk mesh contains all the faces for all the blocks inside the chunk
|
// since a chunk mesh contains all the faces for all the blocks inside the chunk
|
||||||
// we can add the translated values of predefined "unit" faces. This is for the simple "fast" chunk mesh generator.
|
// we can add the translated values of predefined "unit" faces. This is for the simple "fast" chunk mesh generator.
|
||||||
for (int i = 0; i < VTX_ARR_SIZE; i+=3){
|
for (int i = 0; i < VTX_ARR_SIZE; i+=3){
|
||||||
auto new_x = array[i] + x;
|
auto new_x = array[i] + (float)pos.x;
|
||||||
auto new_y = array[i + 1] + y;
|
auto new_y = array[i + 1] + (float)pos.y;
|
||||||
auto new_z = array[i + 2] + z;
|
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_x);
|
||||||
vertices.push_back(new_y);
|
vertices.push_back(new_y);
|
||||||
|
@ -78,10 +56,7 @@ namespace fp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
void addFace(face face, float x, float y, float z);
|
void addFace(face face, const block_pos& pos);
|
||||||
inline void addFace(face face, int x, int y, int z) {
|
|
||||||
addFace(face, (float)x, (float)y, (float)z);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::vector<float>& getVertices() {
|
inline std::vector<float>& getVertices() {
|
||||||
return vertices;
|
return vertices;
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* Created by Brett on 13/02/23.
|
||||||
|
* Licensed under GNU General Public License V3.0
|
||||||
|
* See LICENSE file for license detail
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FINALPROJECT_CHUNK_TYPEDEFS_H
|
||||||
|
#define FINALPROJECT_CHUNK_TYPEDEFS_H
|
||||||
|
|
||||||
|
// size of the chunk in number of blocks
|
||||||
|
constexpr int CHUNK_SIZE = 32;
|
||||||
|
const int CHUNK_SHIFT = (int)(log(CHUNK_SIZE) / log(2));
|
||||||
|
// size that the base vertex arrays are assumed to be (per face)
|
||||||
|
constexpr int VTX_ARR_SIZE = 18;
|
||||||
|
|
||||||
|
namespace fp {
|
||||||
|
|
||||||
|
enum face {
|
||||||
|
X_POS = 0,
|
||||||
|
X_NEG = 1,
|
||||||
|
Y_POS = 2,
|
||||||
|
Y_NEG = 3,
|
||||||
|
Z_POS = 4,
|
||||||
|
Z_NEG = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum chunk_status {
|
||||||
|
// chunk is okay and needs no special action
|
||||||
|
OKAY = 0,
|
||||||
|
// chunk needs its VAO updated with the newest mesh
|
||||||
|
REFRESH = 1,
|
||||||
|
// chunk needs its edges re-meshed because it was created with null neighbours
|
||||||
|
PARTIAL_MESH = 2,
|
||||||
|
// chunk needs a complete re-mesh.
|
||||||
|
FULL_MESH = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
struct chunk_pos {
|
||||||
|
int x, y, z;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct block_pos {
|
||||||
|
int x, y, z;
|
||||||
|
|
||||||
|
block_pos(int x, int y, int z): x(x), y(y), z(z) {}
|
||||||
|
|
||||||
|
block_pos(float x, float y, float z): block_pos(int(x), int(y), int(z)) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace _static {
|
||||||
|
|
||||||
|
// std::unordered_map requires a type. As a result the functions are encapsulated.
|
||||||
|
struct chunk_pos_hash {
|
||||||
|
inline size_t operator()(const chunk_pos& pos) const {
|
||||||
|
size_t p1 = std::hash<int>()(pos.x);
|
||||||
|
size_t p2 = std::hash<int>()(pos.y);
|
||||||
|
size_t p3 = std::hash<int>()(pos.z);
|
||||||
|
return (p1 ^ (p2 << 1)) ^ p3;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct chunk_pos_equality {
|
||||||
|
inline bool operator()(const chunk_pos& p1, const chunk_pos& p2) const {
|
||||||
|
return p1.x == p2.x && p1.y == p2.y && p1.z == p2.z;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //FINALPROJECT_CHUNK_TYPEDEFS_H
|
|
@ -13,10 +13,6 @@
|
||||||
|
|
||||||
namespace fp {
|
namespace fp {
|
||||||
|
|
||||||
struct ChunkPos {
|
|
||||||
int x, y, z;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace _static {
|
namespace _static {
|
||||||
/**
|
/**
|
||||||
* Converts from world coord to chunk-internal coords
|
* Converts from world coord to chunk-internal coords
|
||||||
|
@ -28,6 +24,10 @@ namespace fp {
|
||||||
return val < 0 ? CHUNK_SIZE + val : val;
|
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)};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts from world coord to chunk pos coords
|
* Converts from world coord to chunk pos coords
|
||||||
*
|
*
|
||||||
|
@ -57,21 +57,9 @@ namespace fp {
|
||||||
return (int) (ucoord);
|
return (int) (ucoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::unordered_map requires a type. As a result the functions are encapsulated.
|
static inline chunk_pos world_to_chunk(const block_pos& pos){
|
||||||
struct ChunkPosHash {
|
return {world_to_chunk(pos.x), world_to_chunk(pos.y), world_to_chunk(pos.z)};
|
||||||
inline size_t operator()(const ChunkPos& pos) const {
|
|
||||||
size_t p1 = std::hash<int>()(pos.x);
|
|
||||||
size_t p2 = std::hash<int>()(pos.y);
|
|
||||||
size_t p3 = std::hash<int>()(pos.z);
|
|
||||||
return (p1 ^ (p2 << 1)) ^ p3;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
struct ChunkPosEquality {
|
|
||||||
inline bool operator()(const ChunkPos& p1, const ChunkPos& p2) const {
|
|
||||||
return p1.x == p2.x && p1.y == p2.y && p1.z == p2.z;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,12 +68,12 @@ namespace fp {
|
||||||
block_storage* storage;
|
block_storage* storage;
|
||||||
mesh_storage* mesh = nullptr;
|
mesh_storage* mesh = nullptr;
|
||||||
VAO* chunk_vao;
|
VAO* chunk_vao;
|
||||||
ChunkPos pos;
|
chunk_pos pos;
|
||||||
|
|
||||||
unsigned char dirtiness = 0;
|
chunk_status dirtiness = OKAY;
|
||||||
unsigned long render_size = 0;
|
unsigned long render_size = 0;
|
||||||
public:
|
public:
|
||||||
explicit chunk(ChunkPos pos): pos(pos) {
|
explicit chunk(chunk_pos pos): pos(pos) {
|
||||||
storage = new block_storage();
|
storage = new block_storage();
|
||||||
chunk_vao = new VAO();
|
chunk_vao = new VAO();
|
||||||
// using indices uses:
|
// using indices uses:
|
||||||
|
@ -102,44 +90,46 @@ namespace fp {
|
||||||
~chunk() {
|
~chunk() {
|
||||||
delete storage;
|
delete storage;
|
||||||
delete chunk_vao;
|
delete chunk_vao;
|
||||||
|
delete mesh;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class world {
|
class world {
|
||||||
private:
|
private:
|
||||||
std::unordered_map<ChunkPos, chunk*, _static::ChunkPosHash, _static::ChunkPosEquality> chunk_storage;
|
std::unordered_map<chunk_pos, chunk*, _static::chunk_pos_hash, _static::chunk_pos_equality> chunk_storage;
|
||||||
protected:
|
protected:
|
||||||
mesh_storage* generateChunkMesh(chunk* chunk);
|
void generateChunkMesh(chunk* chunk);
|
||||||
|
|
||||||
chunk* getChunk(int x, int y, int z) {
|
inline void insertChunk(chunk* chunk){
|
||||||
return chunk_storage.at(ChunkPos{_static::world_to_chunk(x), _static::world_to_chunk(y), _static::world_to_chunk(z)});
|
chunk_storage.insert({chunk->pos, chunk});
|
||||||
|
}
|
||||||
|
|
||||||
|
inline chunk* getChunk(const block_pos& pos) {
|
||||||
|
return chunk_storage.at(_static::world_to_chunk(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
world() {
|
world() {
|
||||||
chunk_storage.insert({{0, 0, 0}, new chunk({0, 0, 0})});
|
insertChunk(new chunk({0, 0, 0}));
|
||||||
|
insertChunk(new chunk({-1, 0, 0}));
|
||||||
|
insertChunk(new chunk({0, 0, -1}));
|
||||||
|
insertChunk(new chunk({-1, 0, -1}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
void render(fp::shader& shader);
|
void render(fp::shader& shader);
|
||||||
|
|
||||||
inline void setBlock(int x, int y, int z, char blockID) {
|
inline void setBlock(const block_pos& pos, char blockID) {
|
||||||
auto c = getChunk(x, y, z);
|
auto c = getChunk(pos);
|
||||||
// mark the chunk for a mesh update
|
// mark the chunk for a mesh update
|
||||||
c->dirtiness = 2;
|
c->dirtiness = FULL_MESH;
|
||||||
c->storage->set(_static::world_to_internal(x), _static::world_to_internal(y), _static::world_to_internal(z), blockID);
|
c->storage->set(_static::world_to_internal(pos), blockID);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setBlock(float x, float y, float z, char blockID) { setBlock((int) x, (int) y, (int) z, blockID); }
|
inline char getBlock(const block_pos& pos) {
|
||||||
|
auto c = getChunk(pos);
|
||||||
inline char getBlock(int x, int y, int z) {
|
return c->storage->get(_static::world_to_internal(pos));
|
||||||
auto c = getChunk(x, y, z);
|
|
||||||
return c->storage->get(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline char getBlock(float x, float y, float z) {
|
|
||||||
return getBlock((int) x, (int) y, (int) z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~world() {
|
~world() {
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -20,16 +20,11 @@ fp::world* world;
|
||||||
|
|
||||||
void loop(){
|
void loop(){
|
||||||
glClearColor(1.0, 1.0, 1.0, 1.0);
|
glClearColor(1.0, 1.0, 1.0, 1.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
world->update();
|
world->update();
|
||||||
world->render(*chunk_shader);
|
world->render(*chunk_shader);
|
||||||
|
|
||||||
if (fp::window::isKeyPressed(GLFW_KEY_R)){
|
|
||||||
BLT_DEBUG("R Key is pressed!");
|
|
||||||
if (fp::window::keyState())
|
|
||||||
BLT_TRACE("R Key Single Press!");
|
|
||||||
}
|
|
||||||
fp::camera::update();
|
fp::camera::update();
|
||||||
fp::window::update();
|
fp::window::update();
|
||||||
}
|
}
|
||||||
|
@ -49,8 +44,11 @@ int main() {
|
||||||
chunk_shader = new fp::shader(shader_chunk_vert, shader_chunk_frag);
|
chunk_shader = new fp::shader(shader_chunk_vert, shader_chunk_frag);
|
||||||
world = new fp::world();
|
world = new fp::world();
|
||||||
|
|
||||||
world->setBlock(0, 0, 0, 1);
|
world->setBlock({0, 0, 0}, 1);
|
||||||
world->setBlock(2, 2, 2, 1);
|
world->setBlock({2, 2, 2}, 1);
|
||||||
|
world->setBlock({-2, 2, 2}, 1);
|
||||||
|
world->setBlock({-2, 2, -2}, 1);
|
||||||
|
world->setBlock({2, 2, -2}, 1);
|
||||||
|
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
|
|
|
@ -127,5 +127,7 @@ void fp::camera::update() {
|
||||||
position[1] += (float)(dy * window::getFrameDelta());
|
position[1] += (float)(dy * window::getFrameDelta());
|
||||||
position[2] += (float)(dz * window::getFrameDelta());
|
position[2] += (float)(dz * window::getFrameDelta());
|
||||||
|
|
||||||
|
// BLT_TRACE("Pos: %f, %f, %f", position[0], position[1], position[2]);
|
||||||
|
|
||||||
updateViewMatrix();
|
updateViewMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
#include <blt/std/time.h>
|
#include <blt/std/time.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
#include <emscripten.h>
|
||||||
|
#include <emscripten/html5.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
GLFWwindow* global_window = nullptr;
|
GLFWwindow* global_window = nullptr;
|
||||||
|
|
||||||
std::unordered_map<int, bool> key_state{};
|
std::unordered_map<int, bool> key_state{};
|
||||||
|
@ -28,6 +33,15 @@ double mouse_last_x;
|
||||||
double mouse_dy;
|
double mouse_dy;
|
||||||
double mouse_last_y;
|
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);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GLFW error callback
|
* GLFW error callback
|
||||||
* @param error provided by GLFW
|
* @param error provided by GLFW
|
||||||
|
@ -119,6 +133,7 @@ void fp::window::init(int width, int height) {
|
||||||
int version = gladLoadGLES2(glfwGetProcAddress);
|
int version = gladLoadGLES2(glfwGetProcAddress);
|
||||||
BLT_INFO("Using GLAD GL %d.%d\n", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
|
BLT_INFO("Using GLAD GL %d.%d\n", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
|
||||||
#else
|
#else
|
||||||
|
emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, 0, on_pointerlockchange);
|
||||||
BLT_INFO("Using Emscripten!");
|
BLT_INFO("Using Emscripten!");
|
||||||
// we don't want to waste the web browser's resources or cause it to lockup
|
// we don't want to waste the web browser's resources or cause it to lockup
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
|
|
@ -79,6 +79,6 @@ const float* face_decode[] = {
|
||||||
z_negative_vertices
|
z_negative_vertices
|
||||||
};
|
};
|
||||||
|
|
||||||
void fp::mesh_storage::addFace(fp::face face, float x, float y, float z) {
|
void fp::mesh_storage::addFace(fp::face face, const block_pos& pos) {
|
||||||
add_and_translate(face_decode[face], x, y, z);
|
add_and_translate(face_decode[face], pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,60 +5,31 @@
|
||||||
*/
|
*/
|
||||||
#include <world/chunk/world.h>
|
#include <world/chunk/world.h>
|
||||||
|
|
||||||
|
void fp::world::generateChunkMesh(fp::chunk* chunk) {
|
||||||
//void fp::chunk::render(fp::shader& chunk_shader) {
|
|
||||||
// // process mesh updates
|
|
||||||
// if (isDirty){
|
|
||||||
// auto* new_mesh = generateMesh();
|
|
||||||
//
|
|
||||||
// auto& vertices = new_mesh->getVertices();
|
|
||||||
// //auto& indices = new_mesh->getIndices();
|
|
||||||
//
|
|
||||||
// BLT_INFO("Chunk mesh updated with %d vertices and %d indices taking (%d, %d) bytes!", vertices.size(), 0, vertices.size() * sizeof(float), 0 * sizeof(unsigned int));
|
|
||||||
//
|
|
||||||
// chunk_vao->getVBO(0)->update(vertices);
|
|
||||||
// //chunk_vao->getVBO(-1)->update(indices);
|
|
||||||
//
|
|
||||||
// render_size = vertices.size();
|
|
||||||
//
|
|
||||||
// delete(new_mesh);
|
|
||||||
// isDirty = false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (render_size > 0){
|
|
||||||
// chunk_vao->bind();
|
|
||||||
// glEnableVertexAttribArray(0);
|
|
||||||
// //glDrawElements(GL_TRIANGLES, render_size, GL_UNSIGNED_INT, nullptr);
|
|
||||||
// glDrawArrays(GL_TRIANGLES, 0, render_size);
|
|
||||||
// glDisableVertexAttribArray(0);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
||||||
fp::mesh_storage* fp::world::generateChunkMesh(fp::chunk* chunk) {
|
|
||||||
auto* meshStorage = new mesh_storage;
|
auto* meshStorage = new mesh_storage;
|
||||||
|
|
||||||
if (chunk->dirtiness > 1) { // full chunk mesh
|
if (chunk->dirtiness == FULL_MESH) { // full chunk mesh
|
||||||
for (int i = 0; i < CHUNK_SIZE; i++) {
|
for (int i = 0; i < CHUNK_SIZE; i++) {
|
||||||
for (int j = 0; j < CHUNK_SIZE; j++) {
|
for (int j = 0; j < CHUNK_SIZE; j++) {
|
||||||
for (int k = 0; k < CHUNK_SIZE; k++) {
|
for (int k = 0; k < CHUNK_SIZE; k++) {
|
||||||
auto block = chunk->storage->get(i, j, k);
|
auto block = chunk->storage->get({i, j, k});
|
||||||
if (block != 0) {
|
if (block != 0) {
|
||||||
meshStorage->addFace(X_NEG, i, j, k);
|
meshStorage->addFace(X_NEG, {i, j, k});
|
||||||
meshStorage->addFace(X_POS, i, j, k);
|
meshStorage->addFace(X_POS, {i, j, k});
|
||||||
meshStorage->addFace(Y_NEG, i, j, k);
|
meshStorage->addFace(Y_NEG, {i, j, k});
|
||||||
meshStorage->addFace(Y_POS, i, j, k);
|
meshStorage->addFace(Y_POS, {i, j, k});
|
||||||
meshStorage->addFace(Z_NEG, i, j, k);
|
meshStorage->addFace(Z_NEG, {i, j, k});
|
||||||
meshStorage->addFace(Z_POS, i, j, k);
|
meshStorage->addFace(Z_POS, {i, j, k});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (chunk->dirtiness > 0){ // partial chunk mesh (had null edges)
|
} else if (chunk->dirtiness == PARTIAL_MESH){ // partial chunk mesh (had null edges)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return meshStorage;
|
chunk->mesh = meshStorage;
|
||||||
|
chunk->dirtiness = REFRESH;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fp::world::update() {
|
void fp::world::update() {
|
||||||
|
@ -71,22 +42,31 @@ void fp::world::render(fp::shader& shader) {
|
||||||
for (const auto& chunk_pair : chunk_storage) {
|
for (const auto& chunk_pair : chunk_storage) {
|
||||||
auto chunk = chunk_pair.second;
|
auto chunk = chunk_pair.second;
|
||||||
|
|
||||||
if (chunk->dirtiness > 0){
|
if (chunk->dirtiness > REFRESH){
|
||||||
auto mesh = generateChunkMesh(chunk);
|
generateChunkMesh(chunk);
|
||||||
auto& vertices = mesh->getVertices();
|
}
|
||||||
|
|
||||||
BLT_INFO("Chunk mesh updated with %d vertices and %d indices taking (%d, %d) bytes!", vertices.size(), 0, vertices.size() * sizeof(float), 0 * sizeof(unsigned int));
|
if (chunk->dirtiness == REFRESH){
|
||||||
|
auto& vertices = chunk->mesh->getVertices();
|
||||||
|
|
||||||
|
BLT_INFO("Chunk [%d, %d, %d] mesh updated with %d vertices and %d indices taking (%d, %d) bytes!",
|
||||||
|
chunk->pos.x, chunk->pos.y, chunk->pos.z,
|
||||||
|
vertices.size(), 0, vertices.size() * sizeof(float), 0 * sizeof(unsigned int));
|
||||||
|
|
||||||
|
// upload the new vertices to the GPU
|
||||||
chunk->chunk_vao->getVBO(0)->update(vertices);
|
chunk->chunk_vao->getVBO(0)->update(vertices);
|
||||||
//chunk_vao->getVBO(-1)->update(indices);
|
|
||||||
|
|
||||||
chunk->render_size = vertices.size();
|
chunk->render_size = vertices.size();
|
||||||
|
|
||||||
delete(mesh);
|
// delete the memory from the CPU.
|
||||||
chunk->dirtiness = 0;
|
delete(chunk->mesh);
|
||||||
|
chunk->mesh = nullptr;
|
||||||
|
chunk->dirtiness = OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunk->render_size > 0){
|
if (chunk->render_size > 0){
|
||||||
|
blt::mat4x4 translation {};
|
||||||
|
translation.translate((float)chunk->pos.x * CHUNK_SIZE, (float)chunk->pos.y * CHUNK_SIZE, (float)chunk->pos.z * CHUNK_SIZE);
|
||||||
|
shader.setMatrix("translation", translation);
|
||||||
chunk->chunk_vao->bind();
|
chunk->chunk_vao->bind();
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
//glDrawElements(GL_TRIANGLES, render_size, GL_UNSIGNED_INT, nullptr);
|
//glDrawElements(GL_TRIANGLES, render_size, GL_UNSIGNED_INT, nullptr);
|
||||||
|
|
Loading…
Reference in New Issue