279 Commits

Author SHA1 Message Date
IntegratedQuantum
91bd0b031c Compile all the C files into a static lib first.
Fixes #125

The workaround was taken from here: https://github.com/ziglang/zig/issues/17091#issuecomment-1710907659
2023-10-16 22:30:20 +02:00
person-person
345bb0e419
Exit crash (#140)
* Fixes crash on exit

* Shorter comment

---------

Co-authored-by: Person Person <firestarscree123@gmail.com>
2023-10-16 10:57:39 +02:00
IntegratedQuantum
277bcfe48e Convert windows path seperators to / when generating resource ids.
Fixes #123
2023-10-15 22:49:58 +02:00
IntegratedQuantum
f3a197f6d4 Default gui positions
Resolves #131
2023-10-15 22:26:02 +02:00
IntegratedQuantum
998fd96a7b Load the audio sample rate from the default audio device.
Fixes #128
2023-10-15 20:56:03 +02:00
IntegratedQuantum
30891a6efd Shorter thread name.
Prevents getting above the 15 character limit on Linux for cpus with more than 10 threads.
2023-10-15 13:00:03 +02:00
IntegratedQuantum
39f5111528 Fix the bat file. 2023-10-15 11:25:03 +02:00
IntegratedQuantum
e358832f2f Fix an oversight in the last commit that caused face duplication at chunk borders. 2023-10-09 23:02:54 +02:00
IntegratedQuantum
2f52e9923b Render voxel models using a separate shader.
This allows simplifying the regular shader, improving its performance by ~10%. #96
It does however increase the number of separate draw calls by a bit.
Additionally this opens up more opportunities for the future, in regards to drawing regular models. #134
2023-10-08 18:22:34 +02:00
IntegratedQuantum
4a4af0964e Fix shader compilation warning and work around weird shader miscompilation on my intel laptop. 2023-10-07 18:06:12 +02:00
IntegratedQuantum
546aad5090 Since there is no way to create world right now, I added a save folder to the git. This shall be removed later. 2023-10-07 17:07:47 +02:00
IntegratedQuantum
cc9a06ef29 Fix some TODOs. 2023-10-06 22:34:36 +02:00
IntegratedQuantum
24caa187be I was already using functionality from OpenGL 4.5 which broke on Windows.
I had to use `glTextureBarrier` to be able to read from the depth buffer in the transparent rendering step.

Fixes #124
2023-10-05 18:27:36 +02:00
IntegratedQuantum
c899f9cd65 Add run.bat script for windows that automatically updates and runs zig.
Resolves #104
2023-10-05 18:10:04 +02:00
IntegratedQuantum
d264518cde run.sh: Delete the tar archive after extracting. 2023-10-05 13:17:05 +02:00
IntegratedQuantum
66993820bb Cull transparent backfaces during transparency sorting.
It appears that the vertex shader cost is around 4 ms per 1 million faces, once again proving that #121 is important.
2023-10-05 12:59:14 +02:00
IntegratedQuantum
0b02654c59 Fix block selection outline. 2023-10-05 11:57:32 +02:00
IntegratedQuantum
766dd53d06 Update zig:
@abs (formerly @fabs) now supports integers.
2023-10-04 12:36:00 +02:00
IntegratedQuantum
045ba9c65a Precalculate animation data to avoid recalculating it a million times in the fragment shader.
Improves performance by about 1 ms in a test scene.
2023-10-02 23:49:24 +02:00
IntegratedQuantum
657aa8dc9d Small improvements to the transparent shader. 2023-10-02 22:52:35 +02:00
IntegratedQuantum
044ab3bb62 Rework the fog, so it doesn't need the alpha component anymore.
This also fixes #93 as a side effect
This could also theoretically improve performance due to using a smaller image format, but I couldn't measure a bit difference on my computer, it might be that my driver/hardware just pads the alpha component.
2023-09-29 17:28:38 +02:00
IntegratedQuantum
cc6fb4b55a Improve performance by not calling the raycasting code when the model is a full cube.
Only 0.5 ms, but better than nothing.
2023-09-28 17:12:46 +02:00
IntegratedQuantum
54337f17fd Add a run.sh file that automatically downloads or updates zig and runs the game.
This is a step towards #103
2023-09-26 22:06:35 +02:00
IntegratedQuantum
6c896e2e93 I found a perfect workaround to the compiler regression #17289 2023-09-26 21:21:48 +02:00
IntegratedQuantum
86ab8ef782 Remove portaudio submodule, getting it through the zig package manager instead.
Resolves #103
2023-09-26 17:42:54 +02:00
IntegratedQuantum
6e43ec3d40 Update zig version to 0.12.0-dev.596+2adb932ad
I also had to add some workarounds for a new regression in the zig compiler: https://github.com/ziglang/zig/issues/17289
2023-09-26 17:15:55 +02:00
IntegratedQuantum
257c7d7a3b
Update README.md with a note about required -dev packages on Linux 2023-09-24 11:09:09 +02:00
IntegratedQuantum
3c638017f9 Fix small mistake that messed up texturing. 2023-09-22 11:55:04 +02:00
IntegratedQuantum
3d19feae42 Add dithering when transitioning to raymarching lod. 2023-09-22 11:52:21 +02:00
IntegratedQuantum
f0b5ba3249 Improve the voxel raymarching bound detection.
Now it breaks at the true bound of the model instead of marching into the empty space beyond it.
2023-09-22 11:19:33 +02:00
IntegratedQuantum
c2a499183d Apply dithering if opaque geometry gets partially transparent pixels from mipmapping. 2023-09-21 17:00:59 +02:00
IntegratedQuantum
c73e25a26a Some refactoring to random.nextFloat calls. 2023-09-19 18:42:33 +02:00
IntegratedQuantum
72e27e8500 Render bloom at ¹⁄₄ resolution improving frame time by 3 ms.
Also fix a bug with fog calculation in the bloom shader.
2023-09-19 12:02:16 +02:00
IntegratedQuantum
ba56b78192 Fix a small mistake that caused unnecessary realloc calls during transparency sorting.
Realloc calls, even if the size doesn't change, can have high latency.

fixes #94
2023-09-18 17:45:05 +02:00
IntegratedQuantum
b60feb211c Remove debug code that was slowing done the creative inventory. 2023-09-18 17:14:20 +02:00
IntegratedQuantum
1c72240036 Reduce the amount of dynamic allocation for transparency sorting.
Additionally reduce the data transfer by outputing the face data(8 byte per face) instead of the index data(24 byte per face)
2023-09-18 17:10:23 +02:00
IntegratedQuantum
e7c5635048 Update mach-freetype, it got easier to set up. 2023-09-18 15:40:41 +02:00
IntegratedQuantum
1b2ed56e3c Update zig version to 0.12.0-dev.389+61b70778b and display debug times in µs instead of ns. 2023-09-16 20:21:02 +02:00
IntegratedQuantum
1a3a16c852 Improve performance by storing the noise-based fake reflection in a cube map 2023-09-16 12:13:54 +02:00
IntegratedQuantum
1951416317 Revert reverse-z-buffer commits, which significantly slowed down the game. 2023-09-13 11:38:04 +02:00
IntegratedQuantum
9a64dc1e6f
Merge pull request #58 from PixelGuys/volumetric_fog
Volumetric Fog.
2023-09-12 21:51:13 +02:00
IntegratedQuantum
31e5526b14 Fix fog when the world isn't fully loaded. 2023-09-12 18:36:13 +02:00
IntegratedQuantum
4a84b862b5 The fog now uses the correct distance instead of only using the z component. 2023-09-12 18:25:42 +02:00
IntegratedQuantum
a4bef7d4be Fix backface textures. 2023-09-12 17:01:48 +02:00
IntegratedQuantum
196645c853 Don't draw the backface for non-foggy transparent materials. 2023-09-12 12:21:21 +02:00
IntegratedQuantum
43d5f29066 Some small performance improvements. 2023-09-12 11:34:30 +02:00
IntegratedQuantum
1b7b213c5a Render the air-fog through the same mechanism to ensure that they work well together. 2023-09-11 18:07:41 +02:00
IntegratedQuantum
6aa9acdc4c Fix the block selection outline. 2023-09-11 11:58:26 +02:00
IntegratedQuantum
65f27902b2 Reactivate the old transparency effects. 2023-09-11 11:13:51 +02:00
IntegratedQuantum
2e5910a9cc Handle the case that the player is inside the fog. 2023-09-08 20:18:04 +02:00