Commit Graph

122 Commits (fix-multithread)

Author SHA1 Message Date
EmaMaker e593696af3 restore seamless chunk borders 2023-10-03 20:47:53 +02:00
EmaMaker df933bebdd refactor message-sending system between main and update thread
restores blockpicking with new multithread system
2023-10-03 18:43:33 +02:00
EmaMaker 950e8c68ab separate input handling from main 2023-10-03 18:16:45 +02:00
EmaMaker 4c46811a25 delete meshes relative to deleted chunks 2023-10-03 18:04:06 +02:00
EmaMaker bc3c5587f8 calculateIndex belongs to Chunk namespace 2023-10-03 15:42:01 +02:00
EmaMaker b95ea49c93 gpu printed in debug window 2023-10-03 15:35:56 +02:00
EmaMaker 90fabf73ee add to queues only if completely free 2023-10-03 15:35:34 +02:00
EmaMaker 96bf3c651d player debug variables updated in main 2023-10-03 15:32:49 +02:00
EmaMaker 170deaccf7 eliminate unused variables+stricter "free" condition 2023-10-03 15:28:21 +02:00
EmaMaker da6ceeb605 set generation/meshing queue flags before pushing to queues 2023-10-03 12:31:02 +02:00
EmaMaker ca44c0f284 initial update/mesh/render thread communication refactor
Quirks to iron out:
- Some stuff is rendered wrong/not rendered (chunks missing)
- Still no way to delete stuff from ChunksToRender
2023-10-03 12:27:01 +02:00
EmaMaker a05d019c69 use concurrent_hash_map and parallel_for for chunk update
memory VIRT is higher, RES is the same. memory usage stabilizes after a while
2023-10-01 19:45:51 +02:00
EmaMaker 49edf2de85 move chunk update back to secondary thread 2023-10-01 18:12:14 +02:00
EmaMaker 8a3c963721 solve some memory leaks regarding thread communication queues
also temporarly move chunk update in primary thread
2023-10-01 18:11:54 +02:00
EmaMaker 1ec529fae5 fallimentary attempt at fixing memory management with onetbb 2023-09-30 15:09:26 +02:00
EmaMaker 00cdd22e10 renderer: try frustum culling only if chunk has vertices 2023-09-22 09:06:48 +02:00
EmaMaker a65fc44069 renderer: correct distance check 2023-09-21 17:13:21 +02:00
EmaMaker 3f02ca91db chunkmgr: proper use of int instead of uint in chunk indices 2023-09-21 16:58:18 +02:00
EmaMaker 01f1f9da16 squashed commits
erase chunk buffers only after marking as to be deleted

update chunks around player with a cube instead of concentric spheres

only generate chunks around player, update all chunks use onetbb::parallel_for
2023-09-21 15:49:50 +02:00
EmaMaker 5f396a9801 camera: set atomic position at startup
this avoids the first few chunk update loops recognizing the camera as being positioned at (0,0,0), which in turns avoids wastefully generating chunks out of view at startup
2023-09-21 15:43:51 +02:00
EmaMaker 9ad0485a79 Merge pull request 'Adds HUD elements' (#9) from hud into main
Reviewed-on: #9
2023-09-20 12:43:59 +02:00
EmaMaker 50bc52a679 debug window: use wireframe from checkbox in rendering 2023-09-20 12:42:05 +02:00
EmaMaker 07068d740a debug window: use block type from slider in block picking 2023-09-20 12:42:05 +02:00
EmaMaker 52696f2dde debug window: use crosshair type from slider in shader 2023-09-20 12:42:05 +02:00
EmaMaker 9d2d0c8772 debug window: populate with data 2023-09-20 12:42:05 +02:00
EmaMaker f526e9b152 create debug window with imgui 2023-09-20 12:42:05 +02:00
EmaMaker e7c4b2d56b lib: add dearimgui lib 2023-09-20 12:42:05 +02:00
EmaMaker a6a419fdff hud: crosshair with fragment shader 2023-09-20 12:42:05 +02:00
EmaMaker 3f61a6a753 renderer: screenshot by saving render texture to file 2023-09-20 12:37:32 +02:00
EmaMaker 00a4b8e1e2 renderer: properly handle framebuffer resizing 2023-09-20 12:37:32 +02:00
EmaMaker 4b723d58fa libs: import stb_image_write 2023-09-20 12:37:32 +02:00
EmaMaker 1c0ee1315f renderer: render scene to a texture
And then render the texture onto a quad that fills the screen
The screen-filled quad upon which the texture is rendered must never be rendered in wireframe. Rendering in wireframe only makes sense when rendering the world on the texture
2023-09-20 12:37:32 +02:00
EmaMaker 6670f3b41c shader: make geometry shader not mandatory 2023-09-20 12:37:32 +02:00
EmaMaker 41275486a6 blockpicking: eventually mesh nearby chunks when destroying a block
this prevents stray floating quads when destroy a block near the chunk border
2023-08-12 08:44:46 +02:00
EmaMaker 3d0d8b7593 chunkmgr: chunk can be meshed if all neighbors are generated
(Restores seemless chunk borders)
2023-08-08 17:54:20 +02:00
EmaMaker 8d160c3239 Merge pull request 'Responsive block picking during generation and meshing' (#7) from better-generation into main
Reviewed-on: #7
2023-07-30 12:30:31 +02:00
EmaMaker ca04afcc89 Merge pull request 'Better World Generation' (#6) from better-generation into main
Reviewed-on: #6
2023-07-30 12:28:59 +02:00
EmaMaker 1bea6c835c separate mesh and generation threads, with priority queues for input
Allows blockpicking while the world is generating, without hiccups
2023-07-30 12:17:51 +02:00
EmaMaker 83f0aafba0 give leaves a sprinkle of color 2023-07-30 12:17:51 +02:00
EmaMaker b0cf413baf generator: add comments + a bit of refactor 2023-07-30 12:17:48 +02:00
EmaMaker baa8d14bb3 generator: optimize leaves generation routine with LUT 2023-07-30 12:17:00 +02:00
EmaMaker 381cd698c7 Initial tree generation
Still very slow because multiple noise evaluations are needed
2023-07-30 12:16:32 +02:00
EmaMaker 9bc5bab3b2 mountain terrain with multiple octaves of noise 2023-07-30 12:13:08 +02:00
EmaMaker 8313ee97bc Merge pull request 'Use Geometry Shader to generate the Mesh' (#5) from vram-reduce into main
Reviewed-on: #5
2023-07-19 13:19:18 +02:00
EmaMaker 4fa89fd2f5 gamma correction 2023-07-19 13:06:01 +02:00
EmaMaker 950c43b163 refactor chunk meshing routine 2023-07-19 12:56:55 +02:00
EmaMaker 54c7fa172f generate mesh from points using geometry shader 2023-07-19 12:42:45 +02:00
EmaMaker e7fc35ec47 create chunk mesh as cloud of points 2023-07-19 12:42:23 +02:00
EmaMaker ea036f403c shader.hpp: add geometry shader support 2023-07-19 12:41:44 +02:00
EmaMaker bff9e6ad4f move normal data to own array 2023-07-18 21:18:12 +02:00