421 Commits

Author SHA1 Message Date
IntegratedQuantum
69e1fe2f15 Allow rotation modes to create rotated versions of given block models.
A step towards #68
2024-03-20 15:25:19 +01:00
IntegratedQuantum
899083569d Remove redundant window ids. They were asserted to be equal to the file name, now they are initialized to the file name, removing the need for setting it manually.
This makes adding new windows simpler, also affects #273.
2024-03-19 22:17:46 +01:00
IntegratedQuantum
4ea46a6cde Remove the permutation code from the vertex shader, improving performance by 1.5 ms ≈ 10%
The entire permutation stuff was a bad idea. It makes more sense to do these calculations during meshing, using pre-rotated models.
Closes #121
2024-03-19 20:22:15 +01:00
IntegratedQuantum
1f78bde24f Rework meshing to support arbitrary quad models. Add some X-shaped grass to demonstrate that this system works. 2024-03-19 16:28:11 +01:00
IntegratedQuantum
21f2ab084a Light data can now be sampled for arbitrary models. Also remove unnecessarily complex code in transparency sorting.
Again preparing for #134
2024-03-13 20:55:00 +01:00
IntegratedQuantum
a1ddb6755d Pass the texture instead of the block to the GPU.
The block doesn't need to be known for rendering, all the info is in the texture now.
This is another step towards arbitrary models #134
2024-03-12 21:38:38 +01:00
IntegratedQuantum
80a4d2d35a The fog data is now part of the texture.
This is not really optimal, as this doesn't ensure that all textures of a block have the same fog, but this is an important step towards not storing the block id on the GPU and additionally this allows changing the fog of a block in future resource packs.
2024-03-12 11:45:38 +01:00
IntegratedQuantum
a164ee6794 Revert "Use instanced rendering to allow for an unlimited number of faces per chunk (previously it was limited by the size of the index buffer)."
Instanced rendering caused a 3× slowdown on an intel iGPU.

This reverts commit 45422f8be7b158385486666bd951bbcaddc5eb7c.
2024-03-11 21:04:10 +01:00
IntegratedQuantum
a682169562 Add absorption textures - previously absorption was constant throughout the block. 2024-03-11 21:02:56 +01:00
IntegratedQuantum
45422f8be7 Use instanced rendering to allow for an unlimited number of faces per chunk (previously it was limited by the size of the index buffer). 2024-03-11 15:50:54 +01:00
IntegratedQuantum
c4e76d060c Make the biome-type tree more stable when adding new biomes.
fixes #158
2024-03-10 20:25:34 +01:00
IntegratedQuantum
d0c805e0a1 Change how the face data is loaded in the vertex shader in preparation for arbitrary quad models #134
Also makes the shader a bit more readable and even slightly faster.
2024-03-10 16:33:47 +01:00
careeoki
494e46d993
Texture Update (#276)
* Add files via upload

Updated textures

* Add files via upload

* New & more saturated iterations

* New textures

* New and more saturated. Slightly less saturated than last commit

* New sand textures

* Tweak sand blocks, new ice texture

* New mossy cobble, tweaks to other textures

* Update block jsons to reflect texture changes

* Revert line endings

---------

Co-authored-by: IntegratedQuantum <jahe788@gmail.com>
2024-03-10 11:37:08 +01:00
IntegratedQuantum
53657292d7 Add reflectivity mapping and allow opaque blocks to be reflective. 2024-03-08 22:37:55 +01:00
Encrypted
12a85cc0d7 Fixed spelling mistake :) 2024-03-07 23:18:42 +01:00
IntegratedQuantum
fa641e57e4 Fix flipped textures and incorrect item textures.
Another problem caused by switching to z-up
2024-03-03 21:02:22 +01:00
IntegratedQuantum
3ae9921de8 Update Zig 2024-03-03 13:14:18 +01:00
IntegratedQuantum
dcb63fe175 Make surface biomes reach deeper underground in lod to avoid sampling the wrong biome.
Fixes #185
Fixes lod5 terrain, which previously was mostly stone.
2024-02-28 13:56:05 +01:00
IntegratedQuantum
500d997126 Use glClear to wait on vsync.
Otherwise this would happen when first rendering to the screen buffer, which blocks mesh uploading.
Fixes #269
2024-02-28 13:10:17 +01:00
IntegratedQuantum
b21164144d Fix item texture for transparent blocks - it was sorted incorrectly
The fog blocks are very faint, but that's fine.
Fixes #271
2024-02-28 12:32:49 +01:00
IntegratedQuantum
9f87f68f03 Fix some mistakes made while switching to z-up 2024-02-28 11:10:43 +01:00
IntegratedQuantum
1cc6410ef6 z is now up
Closes #272
2024-02-26 17:31:42 +01:00
IntegratedQuantum
69920c343d Don't access the internals of the ChannelChunk.
This makes it easier to swap the implementation for future compression attempts.
2024-02-26 14:59:00 +01:00
IntegratedQuantum
d4f9270fa9 Don't call the compiler twice in the scripts.
Zig sometimes doesn't cache stuff correctly.
In the presence of this bug the game might be recompiled in the second compiler command.
This doubled compile times in the worst case.
2024-02-25 10:39:16 +01:00
IntegratedQuantum
50c20aa28f Don't send empty chat messages(which currently crashes) and display the correct name in the change name gui. 2024-02-16 19:47:54 +01:00
IntegratedQuantum
950933b03f Fix an issue in List.insert*
Fixes #270
2024-02-16 19:40:24 +01:00
IntegratedQuantum
2ba6bfe2bd Officially add the fog testing biome from my videos. 2024-02-14 16:19:10 +01:00
IntegratedQuantum
d08096057f Improve the StackAllocator so it allows all kinds of allocation patterns.
This allows using the StackAllocator for more data structures and library functions.
Fixes #268
Fixes #95 (at least to the point where I can't do anything about it)
2024-02-08 18:01:43 +01:00
IntegratedQuantum
0177099f6b Reduce GPA usage in lighting.zig to improve CPU usage. It's now close to 90%. 2024-02-07 19:00:16 +01:00
IntegratedQuantum
534ca665cb Improve thread utilization from ~40% to ~70%
This is done by reusing the lightQueue instead of allocating new ones(→less locking in the allocator) and by avoiding too frequent task priority updates(→less locking when adding new tasks).
The remaining 30% will hopefully be done by improvements to the zig GPA.
2024-02-07 13:16:20 +01:00
IntegratedQuantum
acd777bf13 Improve light propagation by not walking back in the direction that it came from.
Should be about a 16% improvement and a reduction in scheduled mesh updates.
2024-02-07 11:33:28 +01:00
IntegratedQuantum
781ca89aff Use MemoryPool for chunk and lighting data.
Temporarily fixes #263
2024-02-05 21:33:56 +01:00
IntegratedQuantum
1cca3a5769
Merge pull request #261 from PixelGuys/better_error_handling
Better error handling, instead of merely `try`ing.
2024-02-01 17:46:15 +01:00
IntegratedQuantum
3007dfa15f Properly cleanup resources to avoid leaks on errors. 2024-02-01 17:22:17 +01:00
IntegratedQuantum
74c896c969 Handle errors locally instead of letting them bubble up into the main functions. 2024-01-31 22:42:20 +01:00
IntegratedQuantum
05769cc765 Some improvements to error handling 2024-01-31 15:35:15 +01:00
IntegratedQuantum
2c33f3779d Switch to a self-made list data structure that doesn't return OutOfMemory errors. 2024-01-30 16:34:40 +01:00
IntegratedQuantum
de004841b7 Handle OutOfMemory errors centrally for the globalAllocator and derivatives.
To let the rest of the code know about this decision I implemented a wrapper over the Allocator interface which cannot fail.

This is just the first step in the upcoming refactoring attempt.
2024-01-29 17:22:20 +01:00
IntegratedQuantum
7565223260 Avoid anyerror in gui components by explicitly giving the error set. 2024-01-26 10:46:36 +01:00
IntegratedQuantum
d215755415 Fix undefined behavior when creating the item slot string.
Fixes #260
2024-01-26 10:10:32 +01:00
IntegratedQuantum
178489b044 Merge All ItemSlot types into one struct.
Fixes #240
2024-01-26 00:14:51 +01:00
IntegratedQuantum
3c6147dc6a Fix double free. 2024-01-25 22:22:35 +01:00
IntegratedQuantum
bcdca0bfdd Catch errors in the audio initialization and continue the game instead of panicing
Should fix #255
2024-01-25 22:13:07 +01:00
archbirdplus
fd332139d7
Progress on making compile errors easier to debug for new users: #241, #251, #252 (#254)
* Rename run_release scripts to run_OS (#241)

* Update README with new script names (#241)

* Fix run_windows infinite loop

* Make debug_linux more verbose.

* Make windows script errors match linux

* Automatically set working directory (#252)

* Remote quotes from echo commands in run_windows

* Replace zig run with zig build run

* Replace spaces with tabs in run scripts.

* Make 'Building Cubyz' message more accurate

* Have run scripts check the machine architecture.

* Add failsafe for unrecognized architecture; erase scratch work in debug_windows

* Replace more spaces with tabs in debug_linux

* Linux run script: don't pause if debug build or NO_PAUSE

* Windows run script: do not pause in debug builds or if NO_PAUSE

* Escape a paren

* Fix x64 typo

* Delete logs about failing to build

* Use `call` to call the batch script on windows

Without `call` windows won't execute the lines after calling the batch script.

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2024-01-23 19:02:51 +01:00
IntegratedQuantum
6ce09c52cd
Update README.md, adding a guide to run Cubyz without using git 2024-01-21 13:54:28 +01:00
IntegratedQuantum
83f04993e8 Fix ReleaseSafe bug caused by undefined memory.
Fixes #169
2024-01-21 12:52:16 +01:00
IntegratedQuantum
08704ef4aa Don't load meshes until all surrounding (3×3×3) chunks finished light propagation.
This fixes a bunch of lighting bugs:
Fixes #219
Fixes #170
Fixes #163
2024-01-20 18:23:09 +01:00
IntegratedQuantum
62d4920869 Cleanup some code and fix a data race. Mesh generation should also be a bit faster now. 2024-01-17 19:21:22 +01:00
IntegratedQuantum
d37589397c Update the dependencies, fixing an issue with cross compilation to windows. 2024-01-16 21:32:34 +01:00
IntegratedQuantum
9b51d3e47d Add new stone texture
Co-Authored-By: careeoki <122191047+careeoki@users.noreply.github.com>
2024-01-15 19:59:08 +01:00