5255 Commits

Author SHA1 Message Date
Moritz Zwerger
31fa6a809d
occlusion: skip calculating if less then 256 blocks set in chunk
When there are less than 256 blocks set, you will always be able to look from one side to another.
2025-03-09 15:24:38 +01:00
Moritz Zwerger
58a36aa454
section occlusion: don't trace inner regions
They are not needed and thrown away anyways. This makes performance better, because when the section is full, we only need to start 1536 blocks tracing and not all 4096
2025-03-09 15:23:08 +01:00
Moritz Zwerger
8b5e27a47f
OcclusionTracer: use SVec3
Preparations...
2025-03-08 19:41:20 +01:00
Moritz Zwerger
bc41eca59a
SVec3
3x10bit integer vector

Can be used as a replacement for any vec3i if the values don't get too big (-511..511)
2025-03-08 19:36:07 +01:00
Moritz Zwerger
84d71cdd37
position tests: skip verify test if position verify is off
It will fail.
2025-03-08 19:35:15 +01:00
Moritz Zwerger
ab51cb4b37
some occlusion notes 2025-03-08 14:58:52 +01:00
Moritz Zwerger
39af4f75fb
some light level fixes, light level tests 2025-03-08 14:52:20 +01:00
Moritz Zwerger
f0d70af460
some light cleanup, datatype: light level (inlined) 2025-03-08 14:37:32 +01:00
Moritz Zwerger
d6223cf873
cleanup solid mesher a bit, fix light heightmap
Might be a little bit slower now...
2025-03-07 23:46:06 +01:00
Moritz Zwerger
8b0ac1944f
chunk meshing: also prioritize direct neighbours 2025-03-07 23:17:04 +01:00
Moritz Zwerger
ea98f3275d
solid mesher: don't crash when chunk neighbour does not exist anymore
This is a race condition, it should exist, but a chunk that is just getting meshed is getting unloaded, either meshing is too slow, something weird happens or the server is doing shit.
2025-03-07 22:30:31 +01:00
Moritz Zwerger
534352400b
chunk mesher: properly cleanup tasks, requeue on interrupt 2025-03-07 22:23:51 +01:00
Moritz Zwerger
37c3c81d83
chunk meshing: don't interrupt whole chunk when only section changes 2025-03-07 22:23:31 +01:00
Moritz Zwerger
6f8eca6a30
fix wrong entity chunk position 2025-03-07 21:52:42 +01:00
Moritz Zwerger
1576fcdcb3
improve entity position info, handle invalid positions
BlockPosition has only 12 bits for the y coordinate, it must not exceed it (even though it is a valid entity position)
2025-03-07 20:27:11 +01:00
Moritz Zwerger
9ae0b5c278
integration test: don't depend on block tests, get full opaque blocks during setup 2025-03-07 15:44:34 +01:00
Moritz Zwerger
301e5d9df1
chunk neighbour block tracing test 2025-03-07 15:43:15 +01:00
Moritz Zwerger
d45c80e062
chunk neighbours: fix tracing in west direction 2025-03-07 15:42:42 +01:00
Moritz Zwerger
50dfd17444
fix and cleanup BlockPosition::of 2025-03-07 15:42:14 +01:00
Moritz Zwerger
729abc11a9
section occlusion fixes and tests 2025-03-07 00:05:17 +01:00
Moritz Zwerger
a998fcd989
fog: fix color not clearing anymore
When you went in water the blue color never cleared
2025-03-06 23:16:21 +01:00
Moritz Zwerger
8e80d91494
rewrite occlusion culling
Way cleaner and less prone to errors and probably a lot faster. Not tested yet.
2025-03-06 20:41:15 +01:00
Moritz Zwerger
375bccca47
section position 2025-03-06 16:14:42 +01:00
Moritz Zwerger
8f1247d4b1
clarify the StackOverflow catch in SectionOcclusion::floodFill 2025-03-06 00:19:00 +01:00
Moritz Zwerger
97e6cd11cf
Entity: cache id
This workarounds ANOTHER stupid stdlib bug. While entities are ticking SOMETIMES the lock *of the sync* is not releases after acquiring the read lock and no other threads can acquire the lock. I debugged this and it is a race condition in the ReentrantReadWriteLock (or in the synchronizer) class. Pretty ironic.
2025-03-06 00:18:28 +01:00
Moritz Zwerger
7d3f8aece1
fix chunk neighbour tracing with offset
Produced wrong results and high spike in cpu usage for calculating fluid velocity
2025-03-05 23:22:06 +01:00
Moritz Zwerger
ca8e12a7f9
direction vector
inlined, reduces stack size in world visibility graph
2025-03-05 21:23:15 +01:00
Moritz Zwerger
39d97b5a40
more occlusion tests 2025-03-05 19:16:59 +01:00
Moritz Zwerger
3598cd4902
gui cache: don't finish data
Reduces hud allocation a lot
2025-03-05 19:16:39 +01:00
Moritz Zwerger
cf488e1dd6
fix deadlock, fix render test loader
No clue how this test ever passed...
2025-03-05 18:47:43 +01:00
Moritz Zwerger
5f9058e44a
some fixes 2025-03-05 17:39:57 +01:00
Moritz Zwerger
ff2de678a1
last test fixes 2025-03-05 17:28:23 +01:00
Moritz Zwerger
368f224122
fox some tests 2025-03-05 14:19:45 +01:00
Moritz Zwerger
2bb4cfc4dc
fix position encoding 2025-03-05 14:03:29 +01:00
Moritz Zwerger
3feebb8935
fix test executor, block position bounds 2025-03-04 16:39:21 +01:00
Moritz Zwerger
d70f55ad56
fix building of tests 2025-03-04 16:25:31 +01:00
Moritz Zwerger
6abc316d0d
make it build 2025-03-03 19:04:52 +01:00
Moritz Zwerger
dd9aee9c21
chunk mesher: only remove from meshing queue if meshed
If it was interrupted it might not restart the meshing. That probably solves the "sometimes missing chunk" bug.
2025-03-02 20:58:43 +01:00
Moritz Zwerger
f0db36c80b
some tracing 2025-03-02 19:41:03 +01:00
Moritz Zwerger
83c86d2129
lots of build fixes
Down to < 100 errors (without tests)
2025-02-28 23:56:39 +01:00
Moritz Zwerger
d60267a981
more build fixes
700 errors to go
2025-02-21 21:23:27 +01:00
Moritz Zwerger
05855f8ad2
more fixes and inlining
Why are there so many build errors? Still 1000 to go...
2025-02-19 22:18:28 +01:00
Moritz Zwerger
6ee353dedd
more build fixes, some refactor 2025-02-19 12:58:33 +01:00
Moritz Zwerger
fe470a2384
more improvements 2025-02-18 13:57:36 +01:00
Moritz Zwerger
d22cae38de
more inline data type refactor
- more position
 - LightArray
2025-02-14 21:49:17 +01:00
Moritz Zwerger
e730434482
more porting to inlined positions 2025-02-14 20:51:22 +01:00
Moritz Zwerger
b655998304
inline block, chunk, in chunk position 2025-02-14 20:41:03 +01:00
Moritz Zwerger
387877fe27
inline some stuff 2025-02-14 19:16:54 +01:00
Moritz Zwerger
b74d63ac51
section occlusion: work with just the index, not xyz
This actually is a lot faster since there is no need to push xyz recursively (benchmark goes down from 23s to 12s, so 48% improvement).
This is time critical code, because occlusion is calculated on demand in the rendering thread and might cause stuttering when new chunks flow it (the meshing queue depends on it)
2025-02-13 23:34:44 +01:00
Moritz Zwerger
25d4ab6fdc
world visibility graph: check correct chunk position
chunkPosition.x could already have been changed during the check and this random regions just disappear.

Hell, one day I will rewrite this whole part and write tests...
2025-02-09 21:04:59 +01:00