Chunk storage and switch to vertex arrays
parent
d3db6e90e0
commit
6c265b7c3c
Binary file not shown.
|
@ -1,26 +1,28 @@
|
|||
# ninja log v5
|
||||
2 20 1676232077903790563 CMakeFiles/FinalProject.dir/src/world/registry.cpp.o 1550caaa717d6c77
|
||||
50 999 1673895013560650475 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o cfdb4277170e1146
|
||||
19 736 1675834610673267689 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/monitor.c.o 239e3c995f2fc57c
|
||||
1 523 1676069587365885604 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o d9d07699ecf3c7f6
|
||||
2 1125 1675915441950533587 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o f6cc949795fe632a
|
||||
1 591 1676069587433887466 CMakeFiles/FinalProject.dir/src/render/window.cpp.o aa0f847cb87c783c
|
||||
2 421 1676232078307801473 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o d9d07699ecf3c7f6
|
||||
2 1098 1676232078983819728 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o f6cc949795fe632a
|
||||
2 768 1676232078655810871 CMakeFiles/FinalProject.dir/src/render/window.cpp.o aa0f847cb87c783c
|
||||
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 1676224079279616938 build.ninja 190f84590f6ee728
|
||||
0 98 1676240847353699603 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
|
||||
948 1087 1676069680836445373 libraries/BLT/libBLT.a 163b10f2e7f6635
|
||||
870 1011 1676096394558982469 FinalProject 542cc2a74c29d7b
|
||||
1099 1278 1676232079155824369 libraries/BLT/libBLT.a 163b10f2e7f6635
|
||||
1278 1376 1676232079259827178 FinalProject 907f0360f99b8435
|
||||
1 49 1673895012612644820 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/queues.cpp.o 55504c9533707c50
|
||||
556 706 1675834610629266436 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/posix_thread.c.o 1da38a427ecbe82e
|
||||
2 1036 1675915441858530925 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o 13e8110c601a4029
|
||||
2 1099 1676232078983819728 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o 13e8110c601a4029
|
||||
677 879 1675834610785270884 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/glx_context.c.o cc5282d2f93e112a
|
||||
555 677 1675834610613265978 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/xkb_unicode.c.o 86b8813c62a6792d
|
||||
1 668 1676232078555808170 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o 7f43512660c0023
|
||||
19 1031 1675834610965276015 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/x11_window.c.o f99a7b64357948e7
|
||||
2 948 1676069680728442417 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o 7528e7ecb90e9c26
|
||||
4 334 1675868672109234286 libraries/glfw-3.3.8/src/libglfw3.a 4545fd6d0d1d5667
|
||||
1 869 1676096394410976932 CMakeFiles/FinalProject.dir/src/main.cpp.o 460fff588e5870a1
|
||||
1 858 1676232078743813246 CMakeFiles/FinalProject.dir/src/main.cpp.o 460fff588e5870a1
|
||||
1 1125 1673895013688651239 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/random.cpp.o 2e94f773455f509
|
||||
18 830 1675834610765270314 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/input.c.o cb7dfd07cdb7c2ab
|
||||
825 1269 1675834611193282518 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o 18383112b14888b9
|
||||
|
@ -30,19 +32,9 @@
|
|||
911 1024 1675172775513082023 Final_Project ac4f30c617bfa6fd
|
||||
680 883 1675834610813271683 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/egl_context.c.o e777fb0716cc9fd8
|
||||
2 438 1675894969704002907 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o a93fa48842fb10a4
|
||||
686 825 1675834610761270198 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/osmesa_context.c.o c49ca4e889b3908b
|
||||
2 316 1675881681815231506 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o ac1bd7bf33d73c31
|
||||
1 798 1676096311636683630 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
|
||||
2 20 1676232077903790563 CMakeFiles/FinalProject.dir/src/world/registry.cpp.o 1550caaa717d6c77
|
||||
2 421 1676232078307801473 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o d9d07699ecf3c7f6
|
||||
2 490 1676232078375803310 CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o c62e5c67ebfa06d
|
||||
1 668 1676232078555808170 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o 7f43512660c0023
|
||||
2 768 1676232078655810871 CMakeFiles/FinalProject.dir/src/render/window.cpp.o aa0f847cb87c783c
|
||||
686 825 1675834610761270198 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/osmesa_context.c.o c49ca4e889b3908b
|
||||
2 849 1676232078735813031 CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o c2a1c71b30b93ca7
|
||||
1 858 1676232078743813246 CMakeFiles/FinalProject.dir/src/main.cpp.o 460fff588e5870a1
|
||||
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
|
||||
2 1098 1676232078983819728 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o f6cc949795fe632a
|
||||
2 1099 1676232078983819728 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o 13e8110c601a4029
|
||||
1099 1278 1676232079155824369 libraries/BLT/libBLT.a 163b10f2e7f6635
|
||||
1278 1376 1676232079259827178 FinalProject 907f0360f99b8435
|
||||
706 883 1675834610809271567 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/linux_joystick.c.o afc8940b6e7eeae1
|
||||
|
|
|
@ -1,39 +1,11 @@
|
|||
/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -G Ninja -S "/home/brett/Documents/Brock/CS 3P98/Final Project" -B "/home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-debug"
|
||||
-- The C compiler identification is GNU 12.2.0
|
||||
-- The CXX compiler identification is GNU 12.2.0
|
||||
-- Detecting C compiler ABI info
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Check for working C compiler: /usr/bin/cc - skipped
|
||||
-- Detecting C compile features
|
||||
-- Detecting C compile features - done
|
||||
-- Detecting CXX compiler ABI info
|
||||
-- Detecting CXX compiler ABI info - done
|
||||
-- Check for working CXX compiler: /usr/bin/c++ - skipped
|
||||
-- Detecting CXX compile features
|
||||
-- Detecting CXX compile features - done
|
||||
Building for Debug
|
||||
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
|
||||
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
|
||||
-- Found Threads: TRUE
|
||||
-- Using X11 for window creation
|
||||
-- Found X11: /usr/include
|
||||
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
|
||||
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
|
||||
-- Looking for gethostbyname
|
||||
-- Looking for gethostbyname - found
|
||||
-- Looking for connect
|
||||
-- Looking for connect - found
|
||||
-- Looking for remove
|
||||
-- Looking for remove - found
|
||||
-- Looking for shmat
|
||||
-- Looking for shmat - found
|
||||
-- Looking for IceConnectionNumber in ICE
|
||||
-- Looking for IceConnectionNumber in ICE - found
|
||||
Standard Files /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/filesystem.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/format.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/loader.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/logging.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/system.cpp
|
||||
Profiler Files /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/profiling/profiler.cpp
|
||||
Source: /home/brett/Documents/Brock/CS 3P98/Final Project
|
||||
Current Source: /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT
|
||||
BLT 3.3.8 Successfully included!
|
||||
BLT Successfully included!
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: /home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-debug
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,39 +1,11 @@
|
|||
/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -G Ninja -S "/home/brett/Documents/Brock/CS 3P98/Final Project" -B "/home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-release"
|
||||
-- The C compiler identification is GNU 12.2.0
|
||||
-- The CXX compiler identification is GNU 12.2.0
|
||||
-- Detecting C compiler ABI info
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Check for working C compiler: /usr/bin/cc - skipped
|
||||
-- Detecting C compile features
|
||||
-- Detecting C compile features - done
|
||||
-- Detecting CXX compiler ABI info
|
||||
-- Detecting CXX compiler ABI info - done
|
||||
-- Check for working CXX compiler: /usr/bin/c++ - skipped
|
||||
-- Detecting CXX compile features
|
||||
-- Detecting CXX compile features - done
|
||||
Building for Release
|
||||
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
|
||||
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
|
||||
-- Found Threads: TRUE
|
||||
-- Using X11 for window creation
|
||||
-- Found X11: /usr/include
|
||||
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
|
||||
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
|
||||
-- Looking for gethostbyname
|
||||
-- Looking for gethostbyname - found
|
||||
-- Looking for connect
|
||||
-- Looking for connect - found
|
||||
-- Looking for remove
|
||||
-- Looking for remove - found
|
||||
-- Looking for shmat
|
||||
-- Looking for shmat - found
|
||||
-- Looking for IceConnectionNumber in ICE
|
||||
-- Looking for IceConnectionNumber in ICE - found
|
||||
Standard Files /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/filesystem.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/format.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/loader.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/logging.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/system.cpp
|
||||
Profiler Files /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/profiling/profiler.cpp
|
||||
Source: /home/brett/Documents/Brock/CS 3P98/Final Project
|
||||
Current Source: /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT
|
||||
BLT 3.3.8 Successfully included!
|
||||
BLT Successfully included!
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: /home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-release
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -1,23 +1,25 @@
|
|||
# ninja log v5
|
||||
2 11 1676232112772732564 CMakeFiles/FinalProject.dir/src/world/registry.cpp.o 3a6f3370180acf81
|
||||
1 268 1675879686057895775 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/monitor.c.o 3306a3caed247cee
|
||||
2 462 1676094325030001887 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 9999b1f01228dc1e
|
||||
3 1909 1676094326474041633 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 3879c77c4691aa0a
|
||||
2 540 1676094325106003980 CMakeFiles/FinalProject.dir/src/render/window.cpp.o fa6296e23b056a91
|
||||
2 617 1676232113376748890 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 9999b1f01228dc1e
|
||||
2 1761 1676232114520779812 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 3879c77c4691aa0a
|
||||
2 722 1676232404604645452 CMakeFiles/FinalProject.dir/src/render/window.cpp.o fa6296e23b056a91
|
||||
1 184 1675879685973893394 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/vulkan.c.o 726a0ce9066c22d2
|
||||
1 338 1675879686125897703 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/window.c.o f41ed544e41bb850
|
||||
2 417 1675879686205899971 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/x11_init.c.o 84c854e192bd136
|
||||
2 578 1676094325146005079 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 3b328e151712ca4
|
||||
1 213 1675879686001894187 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/init.c.o 7363bcb2dba2054a
|
||||
1909 1977 1676094326534043287 libraries/BLT/libBLT.a 163b10f2e7f6635
|
||||
675 757 1676094384419636592 FinalProject 15ed46d94186936d
|
||||
1761 1836 1676232114588781647 libraries/BLT/libBLT.a 163b10f2e7f6635
|
||||
609 685 1676232422409129549 FinalProject 610f68e05cfd8836
|
||||
240 342 1675879686133897930 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/posix_thread.c.o ed8a69d447bea26a
|
||||
2 1444 1676094326010028861 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o a4d3cad66687d105
|
||||
2 1568 1676232114328774619 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o a4d3cad66687d105
|
||||
268 513 1675879686301902692 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/glx_context.c.o 3a83b8e61a7e27f1
|
||||
185 272 1675879686061895889 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/xkb_unicode.c.o b26e96d6509cc15d
|
||||
1 629 1676232404512642951 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o b8ecbf9d580cb1ce
|
||||
3 816 1675879686605911309 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/x11_window.c.o 3c77d54154e66152
|
||||
2 1148 1676094325714020716 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o dba8b361d1594e59
|
||||
816 896 1675879686681913464 libraries/glfw-3.3.8/src/libglfw3.a 4545fd6d0d1d5667
|
||||
1 675 1676094384335634280 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1
|
||||
1 644 1676232404528643389 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1
|
||||
1 489 1675879686277902012 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/input.c.o b9b0555d1bde647a
|
||||
490 862 1675879686649912557 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o 2100792179af25a6
|
||||
1 240 1675879686029894982 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/context.c.o 66a0481f161ec0b0
|
||||
|
@ -25,35 +27,9 @@
|
|||
2 311 1675879686097896910 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/x11_monitor.c.o f704fd1b3f3f9ebf
|
||||
273 531 1675879686321903260 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/egl_context.c.o b183bcb8286b3466
|
||||
3 598 1676094325166005631 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 3e0e238c32ed62ec
|
||||
299 466 1675879686253901332 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/osmesa_context.c.o a913dd02c9ac6f97
|
||||
2 409 1676094324978000454 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 49e1226ae352c85c
|
||||
2 1269 1676094325838024127 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
|
||||
2 11 1676232112772732564 CMakeFiles/FinalProject.dir/src/world/registry.cpp.o 3a6f3370180acf81
|
||||
2 525 1676232113288746511 CMakeFiles/FinalProject.dir/src/world/chunk/storage.cpp.o 8466edd0d9c6fbd8
|
||||
2 617 1676232113376748890 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 9999b1f01228dc1e
|
||||
2 816 1676232113576754295 CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o 901d26561b8e342a
|
||||
1 832 1676232113592754727 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1
|
||||
2 861 1676232113620755485 CMakeFiles/FinalProject.dir/src/render/window.cpp.o fa6296e23b056a91
|
||||
1 930 1676232113692757428 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o b8ecbf9d580cb1ce
|
||||
1 1311 1676232114072767702 CMakeFiles/FinalProject.dir/src/render/gl.cpp.o 2e02d50528893aea
|
||||
2 1568 1676232114328774619 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o a4d3cad66687d105
|
||||
2 1761 1676232114520779812 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 3879c77c4691aa0a
|
||||
1761 1836 1676232114588781647 libraries/BLT/libBLT.a 163b10f2e7f6635
|
||||
1836 1918 1676232114676784028 FinalProject 610f68e05cfd8836
|
||||
1 618 1676232178958522931 CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o 901d26561b8e342a
|
||||
618 686 1676232179026524771 FinalProject 610f68e05cfd8836
|
||||
1 680 1676232264640844706 CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o 901d26561b8e342a
|
||||
1 709 1676232264672845577 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1
|
||||
1 711 1676232264672845577 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o b8ecbf9d580cb1ce
|
||||
1 781 1676232264744847527 CMakeFiles/FinalProject.dir/src/render/window.cpp.o fa6296e23b056a91
|
||||
1 1236 1676232265196859788 CMakeFiles/FinalProject.dir/src/render/gl.cpp.o 2e02d50528893aea
|
||||
1236 1310 1676232265272861850 FinalProject 610f68e05cfd8836
|
||||
1 629 1676232404512642951 CMakeFiles/FinalProject.dir/src/render/camera.cpp.o b8ecbf9d580cb1ce
|
||||
1 644 1676232404528643389 CMakeFiles/FinalProject.dir/src/main.cpp.o d6fd815a69105af1
|
||||
2 645 1676232404528643389 CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o 901d26561b8e342a
|
||||
2 722 1676232404604645452 CMakeFiles/FinalProject.dir/src/render/window.cpp.o fa6296e23b056a91
|
||||
1 1218 1676232405100658939 CMakeFiles/FinalProject.dir/src/render/gl.cpp.o 2e02d50528893aea
|
||||
1218 1293 1676232405176661003 FinalProject 610f68e05cfd8836
|
||||
299 466 1675879686253901332 libraries/glfw-3.3.8/src/CMakeFiles/glfw.dir/osmesa_context.c.o a913dd02c9ac6f97
|
||||
2 609 1676232422337127593 CMakeFiles/FinalProject.dir/src/world/chunk/chunk.cpp.o 901d26561b8e342a
|
||||
609 685 1676232422409129549 FinalProject 610f68e05cfd8836
|
||||
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,39 +1,11 @@
|
|||
/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -G Ninja -S "/home/brett/Documents/Brock/CS 3P98/Final Project" -B "/home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-relwithdebinfo"
|
||||
-- The C compiler identification is GNU 12.2.0
|
||||
-- The CXX compiler identification is GNU 12.2.0
|
||||
-- Detecting C compiler ABI info
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Check for working C compiler: /usr/bin/cc - skipped
|
||||
-- Detecting C compile features
|
||||
-- Detecting C compile features - done
|
||||
-- Detecting CXX compiler ABI info
|
||||
-- Detecting CXX compiler ABI info - done
|
||||
-- Check for working CXX compiler: /usr/bin/c++ - skipped
|
||||
-- Detecting CXX compile features
|
||||
-- Detecting CXX compile features - done
|
||||
Building for Release
|
||||
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
|
||||
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
|
||||
-- Found Threads: TRUE
|
||||
-- Using X11 for window creation
|
||||
-- Found X11: /usr/include
|
||||
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
|
||||
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
|
||||
-- Looking for gethostbyname
|
||||
-- Looking for gethostbyname - found
|
||||
-- Looking for connect
|
||||
-- Looking for connect - found
|
||||
-- Looking for remove
|
||||
-- Looking for remove - found
|
||||
-- Looking for shmat
|
||||
-- Looking for shmat - found
|
||||
-- Looking for IceConnectionNumber in ICE
|
||||
-- Looking for IceConnectionNumber in ICE - found
|
||||
Standard Files /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/filesystem.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/format.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/loader.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/logging.cpp;/home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/std/system.cpp
|
||||
Profiler Files /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT/src/blt/profiling/profiler.cpp
|
||||
Source: /home/brett/Documents/Brock/CS 3P98/Final Project
|
||||
Current Source: /home/brett/Documents/Brock/CS 3P98/Final Project/libraries/BLT
|
||||
BLT 3.3.8 Successfully included!
|
||||
BLT Successfully included!
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: /home/brett/Documents/Brock/CS 3P98/Final Project/cmake-build-relwithdebinfo
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Created by Brett on 11/02/23.
|
||||
* Licensed under GNU General Public License V3.0
|
||||
* See LICENSE file for license detail
|
||||
*/
|
||||
|
||||
#ifndef FINALPROJECT_CHUNK_H
|
||||
#define FINALPROJECT_CHUNK_H
|
||||
|
||||
#include <world/chunk/storage.h>
|
||||
#include <render/gl.h>
|
||||
|
||||
namespace fp {
|
||||
|
||||
class chunk {
|
||||
private:
|
||||
block_storage* storage;
|
||||
VAO* chunk_vao;
|
||||
|
||||
bool isDirty = false;
|
||||
unsigned long render_size = 0;
|
||||
protected:
|
||||
mesh_storage* generateMesh();
|
||||
|
||||
/**
|
||||
* Converts from world coord to chunk coords
|
||||
* @param coord world space coordinate
|
||||
* @return chunk internal coord
|
||||
*/
|
||||
static inline int cc(int coord) {
|
||||
auto val = coord % CHUNK_SIZE;
|
||||
return val < 0 ? CHUNK_SIZE + val : val;
|
||||
}
|
||||
|
||||
public:
|
||||
chunk() {
|
||||
storage = new block_storage();
|
||||
chunk_vao = new VAO();
|
||||
// set up the VBOs which will be later updated when the mesh is generated.
|
||||
chunk_vao->bindVBO(new VBO(ARRAY_BUFFER, nullptr, 0), 0, 3);
|
||||
chunk_vao->bindElementVBO(new VBO(ELEMENT_BUFFER, nullptr, 0));
|
||||
}
|
||||
|
||||
void update();
|
||||
void render(fp::shader& chunk_shader);
|
||||
|
||||
inline void setBlock(int x, int y, int z, char blockID){
|
||||
// mark the chunk for a mesh update
|
||||
isDirty = true;
|
||||
storage->set(cc(x), cc(y), cc(z), blockID);
|
||||
}
|
||||
|
||||
inline void setBlock(float x, float y, float z, char blockID){setBlock((int)x,(int)y,(int)z, blockID);}
|
||||
|
||||
inline char getBlock(int x, int y, int z){
|
||||
return storage->get(x, y, z);
|
||||
}
|
||||
|
||||
inline char getBlock(float x, float y, float z){
|
||||
return getBlock((int)x,(int)y,(int)z);
|
||||
}
|
||||
|
||||
~chunk() {
|
||||
delete storage;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //FINALPROJECT_CHUNK_H
|
|
@ -17,7 +17,7 @@
|
|||
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 = 12;
|
||||
constexpr int VTX_ARR_SIZE = 18;
|
||||
|
||||
namespace fp {
|
||||
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* Created by Brett on 11/02/23.
|
||||
* Licensed under GNU General Public License V3.0
|
||||
* See LICENSE file for license detail
|
||||
*/
|
||||
|
||||
#ifndef FINALPROJECT_WORLD_H
|
||||
#define FINALPROJECT_WORLD_H
|
||||
|
||||
#include <world/chunk/storage.h>
|
||||
#include <render/gl.h>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace fp {
|
||||
|
||||
struct ChunkPos {
|
||||
int x, y, z;
|
||||
};
|
||||
|
||||
namespace _static {
|
||||
/**
|
||||
* Converts from world coord to chunk-internal coords
|
||||
* @param coord world space coordinate
|
||||
* @return chunk internal coord
|
||||
*/
|
||||
static inline int world_to_internal(int coord) {
|
||||
auto val = coord % CHUNK_SIZE;
|
||||
return val < 0 ? CHUNK_SIZE + val : val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts from world coord to chunk pos coords
|
||||
*
|
||||
* consider: (int) (-31 / 32) which equals 0
|
||||
* but a negative chunk would be stored at -1, not 0 (since that is taken by the positive coord chunk)
|
||||
* an arithmetic right shift would produce the desired -1 (see Java, which performs a signed right bit shift)
|
||||
* however in C++ shifting on a signed type is undefined behaviour. So we must emulate an arithmetic right shift.
|
||||
*
|
||||
* @param coord x,y, or z coordinate to convert
|
||||
* @return a right arithmetic bit shift resulting in a signed division of the coordinate by CHUNK_SIZE
|
||||
*/
|
||||
static inline int world_to_chunk(int coord) {
|
||||
auto ucoord = (unsigned int) coord;
|
||||
|
||||
ucoord >>= CHUNK_SHIFT;
|
||||
|
||||
if (coord < 0) {
|
||||
// the mask only has to be generated once since it is never modified at runtime beyond assignment
|
||||
static unsigned int mask = 0;
|
||||
if (mask == 0) {
|
||||
for (int i = 0; i < CHUNK_SHIFT; i++)
|
||||
mask |= (1 << ((sizeof(int) * 8 - 1) - i));
|
||||
}
|
||||
ucoord |= mask;
|
||||
}
|
||||
|
||||
return (int) (ucoord);
|
||||
}
|
||||
|
||||
// std::unordered_map requires a type. As a result the functions are encapsulated.
|
||||
struct ChunkPosHash {
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct chunk {
|
||||
public:
|
||||
block_storage* storage;
|
||||
mesh_storage* mesh = nullptr;
|
||||
VAO* chunk_vao;
|
||||
ChunkPos pos;
|
||||
|
||||
unsigned char dirtiness = 0;
|
||||
unsigned long render_size = 0;
|
||||
public:
|
||||
explicit chunk(ChunkPos pos): pos(pos) {
|
||||
storage = new block_storage();
|
||||
chunk_vao = new VAO();
|
||||
// using indices uses:
|
||||
// 12 faces * 4 vertex * 3 float * 4 bytes + 12 faces * 6 indices * 4 bytes = 864 bytes for vertex + index
|
||||
|
||||
// using only vertices:
|
||||
// 12 faces * 6 vertex * 3 floats * 4 bytes = 864 bytes.
|
||||
|
||||
// since they both use the same amount of memory we will only store the vertices and draw with drawArrays, since it is less complex.
|
||||
// set up the VBOs which will be later updated when the mesh is generated.
|
||||
chunk_vao->bindVBO(new VBO(ARRAY_BUFFER, nullptr, 0), 0, 3);
|
||||
}
|
||||
|
||||
~chunk() {
|
||||
delete storage;
|
||||
delete chunk_vao;
|
||||
}
|
||||
};
|
||||
|
||||
class world {
|
||||
private:
|
||||
std::unordered_map<ChunkPos, chunk*, _static::ChunkPosHash, _static::ChunkPosEquality> chunk_storage;
|
||||
protected:
|
||||
mesh_storage* generateChunkMesh(chunk* chunk);
|
||||
|
||||
chunk* getChunk(int x, int y, int z) {
|
||||
return chunk_storage.at(ChunkPos{_static::world_to_chunk(x), _static::world_to_chunk(y), _static::world_to_chunk(z)});
|
||||
}
|
||||
|
||||
public:
|
||||
world() {
|
||||
chunk_storage.insert({{0, 0, 0}, new chunk({0, 0, 0})});
|
||||
}
|
||||
|
||||
void update();
|
||||
|
||||
void render(fp::shader& shader);
|
||||
|
||||
inline void setBlock(int x, int y, int z, char blockID) {
|
||||
auto c = getChunk(x, y, z);
|
||||
// mark the chunk for a mesh update
|
||||
c->dirtiness = 2;
|
||||
c->storage->set(_static::world_to_internal(x), _static::world_to_internal(y), _static::world_to_internal(z), blockID);
|
||||
}
|
||||
|
||||
inline void setBlock(float x, float y, float z, char blockID) { setBlock((int) x, (int) y, (int) z, blockID); }
|
||||
|
||||
inline char getBlock(int x, int y, int z) {
|
||||
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() {
|
||||
for (auto& chunk : chunk_storage)
|
||||
delete (chunk.second);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //FINALPROJECT_WORLD_H
|
17
src/main.cpp
17
src/main.cpp
|
@ -6,7 +6,7 @@
|
|||
#include <shaders/chunk.frag>
|
||||
#include <shaders/chunk.vert>
|
||||
#include "render/camera.h"
|
||||
#include "world/chunk/chunk.h"
|
||||
#include "world/chunk/world.h"
|
||||
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
@ -16,15 +16,14 @@
|
|||
#endif
|
||||
|
||||
fp::shader* chunk_shader;
|
||||
fp::chunk* chunk;
|
||||
fp::world* world;
|
||||
|
||||
void loop(){
|
||||
glClearColor(1.0, 1.0, 1.0, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
chunk_shader->use();
|
||||
chunk->update();
|
||||
chunk->render(*chunk_shader);
|
||||
world->update();
|
||||
world->render(*chunk_shader);
|
||||
|
||||
if (fp::window::isKeyPressed(GLFW_KEY_R)){
|
||||
BLT_DEBUG("R Key is pressed!");
|
||||
|
@ -48,10 +47,10 @@ int main() {
|
|||
fp::window::init();
|
||||
|
||||
chunk_shader = new fp::shader(shader_chunk_vert, shader_chunk_frag);
|
||||
chunk = new fp::chunk();
|
||||
world = new fp::world();
|
||||
|
||||
chunk->setBlock(0, 0, 0, 1);
|
||||
chunk->setBlock(2, 2, 2, 1);
|
||||
world->setBlock(0, 0, 0, 1);
|
||||
world->setBlock(2, 2, 2, 1);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
@ -70,7 +69,7 @@ int main() {
|
|||
#endif
|
||||
|
||||
delete(chunk_shader);
|
||||
delete(chunk);
|
||||
delete(world);
|
||||
|
||||
fp::window::close();
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ void fp::camera::update() {
|
|||
if (window::isKeyPressed(GLFW_KEY_LEFT_CONTROL)){
|
||||
speed = MAX_SPEED;
|
||||
} else if (window::isKeyPressed(GLFW_KEY_LEFT_ALT))
|
||||
speed = DEFAULT_SPEED / 2;
|
||||
speed = DEFAULT_SPEED / 8;
|
||||
else
|
||||
speed = DEFAULT_SPEED;
|
||||
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Created by Brett on 11/02/23.
|
||||
* Licensed under GNU General Public License V3.0
|
||||
* See LICENSE file for license detail
|
||||
*/
|
||||
#include <world/chunk/chunk.h>
|
||||
|
||||
fp::mesh_storage* fp::chunk::generateMesh() {
|
||||
auto* meshStorage = new mesh_storage;
|
||||
|
||||
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 = 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return meshStorage;
|
||||
}
|
||||
|
||||
void fp::chunk::update() {
|
||||
|
||||
}
|
||||
|
||||
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(), indices.size(), vertices.size() * sizeof(float), indices.size() * sizeof(unsigned int));
|
||||
|
||||
chunk_vao->getVBO(0)->update(vertices);
|
||||
chunk_vao->getVBO(-1)->update(indices);
|
||||
|
||||
render_size = indices.size();
|
||||
|
||||
delete(new_mesh);
|
||||
isDirty = false;
|
||||
}
|
||||
|
||||
if (render_size > 0){
|
||||
chunk_vao->bind();
|
||||
glEnableVertexAttribArray(0);
|
||||
glDrawElements(GL_TRIANGLES, render_size, GL_UNSIGNED_INT, nullptr);
|
||||
glDisableVertexAttribArray(0);
|
||||
}
|
||||
|
||||
}
|
|
@ -9,40 +9,64 @@
|
|||
constexpr float scale = 0.5f;
|
||||
|
||||
const float x_positive_vertices[VTX_ARR_SIZE] = {
|
||||
scale, scale, scale, // +x top right
|
||||
// +x first triangle
|
||||
scale, -scale, scale, // +x top left
|
||||
scale, scale, -scale, // +x bottom right
|
||||
scale, scale, scale, // +x top right
|
||||
// +x second triangle
|
||||
scale, -scale, scale, // +x top left
|
||||
scale, -scale, -scale, // +x bottom left
|
||||
scale, -scale, scale // +x top left
|
||||
scale, scale, -scale, // +x bottom right
|
||||
};
|
||||
const float x_negative_vertices[VTX_ARR_SIZE] = {
|
||||
-scale, scale, scale, // -x top right
|
||||
-scale, scale, -scale, // -x bottom right
|
||||
// -x first triangle
|
||||
-scale, scale, scale, // -x top right
|
||||
-scale, scale, -scale, // -x bottom right
|
||||
-scale, -scale, scale, // -x top left
|
||||
// -x second triangle
|
||||
-scale, scale, -scale, // -x bottom right
|
||||
-scale, -scale, -scale, // -x bottom left
|
||||
-scale, -scale, scale // -x top left
|
||||
-scale, -scale, scale, // -x top left
|
||||
};
|
||||
const float y_positive_vertices[VTX_ARR_SIZE] = {
|
||||
scale, scale, scale, // +y top right
|
||||
-scale, scale, scale, // +y bottom right
|
||||
-scale, scale, -scale, // +y bottom left
|
||||
scale, scale, -scale, // +y top left
|
||||
// first triangle
|
||||
scale, scale, -scale, // top left
|
||||
-scale, scale, scale, // bottom right
|
||||
scale, scale, scale, // top right
|
||||
// second triangle
|
||||
scale, scale, -scale, // top left
|
||||
-scale, scale, -scale, // bottom left
|
||||
-scale, scale, scale, // bottom right
|
||||
};
|
||||
const float y_negative_vertices[VTX_ARR_SIZE] = {
|
||||
scale, -scale, scale, // -y top right
|
||||
-scale, -scale, scale, // -y bottom right
|
||||
-scale, -scale, -scale, // -y bottom left
|
||||
scale, -scale, -scale, // -y top left
|
||||
// first triangle
|
||||
scale, -scale, scale, // top right
|
||||
-scale, -scale, scale, // bottom right
|
||||
scale, -scale, -scale, // top left
|
||||
// second triangle
|
||||
-scale, -scale, scale, // bottom right
|
||||
-scale, -scale, -scale, // bottom left
|
||||
scale, -scale, -scale, // top left
|
||||
};
|
||||
const float z_positive_vertices[VTX_ARR_SIZE] = {
|
||||
scale, scale, scale, // +z top right
|
||||
scale, -scale, scale, // +z bottom right
|
||||
-scale, -scale, scale, // +z bottom left
|
||||
-scale, scale, scale // +z top left
|
||||
// first triangle
|
||||
-scale, scale, scale, // top left
|
||||
scale, -scale, scale, // bottom right
|
||||
scale, scale, scale, // top right
|
||||
// second triangle
|
||||
-scale, scale, scale, // top left
|
||||
-scale, -scale, scale, // bottom left
|
||||
scale, -scale, scale, // bottom right
|
||||
};
|
||||
const float z_negative_vertices[VTX_ARR_SIZE] = {
|
||||
scale, scale, -scale, // -z top right
|
||||
scale, -scale, -scale, // -z bottom right
|
||||
-scale, -scale, -scale, // -z bottom left
|
||||
-scale, scale, -scale // -z top left
|
||||
// first triangle
|
||||
scale, scale, -scale, // top right
|
||||
scale, -scale, -scale, // bottom right
|
||||
-scale, scale, -scale, // top left
|
||||
// second triangle
|
||||
scale, -scale, -scale, // bottom right
|
||||
-scale, -scale, -scale, // bottom left
|
||||
-scale, scale, -scale, // top left
|
||||
};
|
||||
|
||||
// always ordered the same as the enum!
|
||||
|
@ -55,29 +79,6 @@ const float* face_decode[] = {
|
|||
z_negative_vertices
|
||||
};
|
||||
|
||||
// indices are the same on all axis but are flipped between negative / positive as a result of back-face culling.
|
||||
const std::vector<unsigned int> negative_indices = {
|
||||
0, 1, 3,
|
||||
1, 2, 3
|
||||
};
|
||||
const std::vector<unsigned int> positive_indices = {
|
||||
3, 1, 0,
|
||||
3, 2, 1
|
||||
};
|
||||
|
||||
void fp::mesh_storage::addFace(fp::face face, float x, float y, float z) {
|
||||
BLT_DEBUG("Creating face %d ", face);
|
||||
add_and_translate(face_decode[face], x, y, z);
|
||||
|
||||
// 3 floats per vertex, 4 vertices per face
|
||||
|
||||
// 576 + 288 = 864 bytes for vertex + index
|
||||
// 12 faces * 6 vertex * 3 floats * 4 bytes = 864 bytes.
|
||||
|
||||
// no savings but extra complexity
|
||||
// auto indice_offset = (vertices.size()/3 - 4);
|
||||
// auto& face_indices = face % 2 == 0 ? positive_indices : negative_indices;
|
||||
//
|
||||
// for (unsigned int indice : face_indices)
|
||||
// indices.push_back(indice_offset + indice);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Created by Brett on 11/02/23.
|
||||
* Licensed under GNU General Public License V3.0
|
||||
* See LICENSE file for license detail
|
||||
*/
|
||||
#include <world/chunk/world.h>
|
||||
|
||||
|
||||
//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;
|
||||
|
||||
if (chunk->dirtiness > 1) { // 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (chunk->dirtiness > 0){ // partial chunk mesh (had null edges)
|
||||
|
||||
}
|
||||
|
||||
return meshStorage;
|
||||
}
|
||||
|
||||
void fp::world::update() {
|
||||
|
||||
}
|
||||
|
||||
void fp::world::render(fp::shader& shader) {
|
||||
shader.use();
|
||||
|
||||
for (const auto& chunk_pair : chunk_storage) {
|
||||
auto chunk = chunk_pair.second;
|
||||
|
||||
if (chunk->dirtiness > 0){
|
||||
auto mesh = 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));
|
||||
|
||||
chunk->chunk_vao->getVBO(0)->update(vertices);
|
||||
//chunk_vao->getVBO(-1)->update(indices);
|
||||
|
||||
chunk->render_size = vertices.size();
|
||||
|
||||
delete(mesh);
|
||||
chunk->dirtiness = 0;
|
||||
}
|
||||
|
||||
if (chunk->render_size > 0){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue