Commit Graph

118 Commits (7c82a71dd099386d89345c3e100188284f9d4c5e)

Author SHA1 Message Date
EmaMaker f798575cac chunkmanager: add function getBlockAtPos, returns block at world pos
Returns Block::NULLBLK only to signal an invalid position
2023-06-01 21:31:18 +02:00
EmaMaker 0ebbb897dc chunk: handle special cases for getBlocks
Returning Block::AIR when chunk is not yet generated (CHUNK_STATE_GENERATED set to false) is also a way to avoid thread-unsafe concurrent
access to the IntervalMaps data structure, since CHUNK_STATE_GENERATED is set to false before
generating the Chunk and set again to true after generation is complete
2023-06-01 21:31:18 +02:00
EmaMaker 32d0475dbf Merge pull request 'multithread blockpicking' (#2) from multithread into main
Reviewed-on: #2
2023-06-01 17:47:48 +02:00
EmaMaker 095ebfa70d Merge branch 'main' into multithread 2023-06-01 17:47:38 +02:00
EmaMaker 105fff0029 write number of triangles to Chunk only when sending to GPU
previously the current number of vertices was stored in the chunk, and the same variable got later reused for the number of triangles. This modification increases clarity and avoid glitches when blockpicking
2023-05-26 23:07:04 +02:00
EmaMaker 6113886117 multithreaded blockpicking 2023-05-26 23:03:18 +02:00
EmaMaker 802257abe3 Merge pull request 'multithread' (#1) from multithread into main
Reviewed-on: #1
2023-05-20 22:33:56 +02:00
EmaMaker 2f9b7cebcd chunk: make chunk size 32
slight increase in fps with no great increase in ram usage, with greater render distance
2023-05-20 22:15:32 +02:00
EmaMaker 0acb8c7c1e free chunks from memory 2023-05-20 22:15:32 +02:00
EmaMaker e225babb0c chunkmesher: external queue of chunk mesh data
instead of every chunk having its own queue

This decreases usage of ram
2023-05-20 22:15:32 +02:00
EmaMaker 78e3bc11e6 initial update and render with concurrent DS 2023-05-20 22:15:15 +02:00
EmaMaker 1d3132cf3c use oneTBB library 2023-04-29 14:54:09 +02:00
EmaMaker 52537715ef chunks: make chunk state atomic 2023-04-23 16:28:36 +02:00
EmaMaker 3daf994ac3 opengl: disable vsync
This way I can better watch how changes affect FPS/frame times, rather than have it capped at
60FPS/16.6ms
Does not introduce visible tearing.

The engine runs at about 170 FPS on my Tesla M40, and so does minecraft. It never goes past that, I think this is a
limitation of using prime offloading. Runs at 300FPS on average on the Radeon HD6850 to which I
normally offload the Tesla to
2023-04-10 00:45:25 +02:00
EmaMaker 47543c9101 intervalmap: use updated upper_bound when checking removal of next node 2023-04-10 00:30:28 +02:00
EmaMaker 1a4412c5b1 renderer: initial texture support via ArrayTextures
totally stolen textures from minecraft
2023-04-10 00:30:28 +02:00
EmaMaker 2b1991ff2b separate rendering in a dedicated file 2023-04-10 00:30:24 +02:00
EmaMaker b4f3bdad06 experimental 3d generation
a cave-like effect
2023-03-29 21:39:53 +02:00
EmaMaker 40fec8a649 actual random generation 2023-03-29 21:39:53 +02:00
emamaker 179bd20aba update .gitignore 2023-03-27 21:10:45 +02:00
emamaker a039ced6cf gamma correction 2023-03-27 21:10:45 +02:00
EmaMaker 44b027c3e2 Blinn-Phong lighting 2023-03-27 21:10:45 +02:00
EmaMaker 6bd3bdecb8 shader: allow to send vec3 uniforms 2023-03-27 21:10:45 +02:00
EmaMaker b4dd3be584 chunkmesher: push vertices normals to GPU 2023-03-27 21:10:38 +02:00
EmaMaker da6608c66a chunkmanager: only calculate update sphere indices at startup 2023-03-25 16:32:01 +01:00
EmaMaker 8584d2e974 general code cleanup 2023-03-25 16:28:12 +01:00
EmaMaker 19cd81b9fb chunkmesher/manager: move sending data to gpu in dedicated function 2023-03-23 16:19:25 +01:00
EmaMaker 19b3c68015 camera: nearer near clipping plane 2023-03-23 14:26:12 +01:00
EmaMaker e609f4858b initial blockpicking 2023-03-23 14:25:34 +01:00
EmaMaker e18a2cca05 intervalmap: solve bugs with insertion, printing and retrival 2023-03-21 22:15:46 +01:00
EmaMaker 8040868055 chunkmanager: unload chunks after a time treshold 2023-03-13 13:33:32 +01:00
EmaMaker b7077af00f chunkmanager: delete far chunks from memory 2023-03-13 12:56:46 +01:00
EmaMaker ba35689c6c chunkmesher: also cleanup colors at the start 2023-03-13 12:56:10 +01:00
EmaMaker bc2225e0f3 chunk: first delete buffer, then vao 2023-03-13 12:55:20 +01:00
EmaMaker f3d89a2e5a chunk release resources on destruction 2023-03-12 22:14:28 +01:00
EmaMaker ddd047e82f interval map: clean map on destruction 2023-03-12 22:14:05 +01:00
EmaMaker ab762eb9bc use unique_ptr when dumping intervalmap to array 2023-03-12 19:28:23 +01:00
EmaMaker f7eb04a5f1 use unique_ptr when dumping intervalmap to array 2023-03-12 19:24:09 +01:00
EmaMaker 383fb60686 proper frustum culling 2023-03-12 19:24:05 +01:00
EmaMaker e69c58abd3 gracefully shut down secondary threads 2023-03-12 12:43:41 +01:00
EmaMaker 716056b8c5 experimental multithreaded generation and meshing 2023-03-03 21:33:11 +01:00
EmaMaker 2ec728897e main: print currently used GPU at the start 2023-02-23 19:07:35 +01:00
EmaMaker b1e420f564 camera: allow to strafe up and down 2023-02-23 19:07:17 +01:00
EmaMaker cf0bb3f111 update .gitignore 2023-02-23 19:06:42 +01:00
EmaMaker b600ef5214 memory: delete shader when terminating 2023-02-23 17:02:20 +01:00
EmaMaker 0baa2eb649 memory: use proper delete[] 2023-02-22 21:54:15 +01:00
EmaMaker c547d11cd5 chunks: drop per-chunk chunkmesh
Use a single mesher. This, on top of the previous commits, shaves off another 20MB of total RAM usage, using a total of about 120MB for a standard world (16 chunk size, 8 render distance), of which 22 in heap
2023-02-12 14:36:59 +01:00
EmaMaker ec2feb919f chunkmanager: chunkmesh on the stack 2023-02-12 12:20:03 +01:00
EmaMaker 9f82a17bd2 chunkmesh: do not create shader for every object 2023-02-12 12:18:30 +01:00
EmaMaker 2e0ed7b057 clear mesh data after sending to gpu 2023-02-11 22:26:34 +01:00