Corrected a small bug in colour blending: alpha == 0 is transparent
More texture bugs, hoorah
No need to recalculate the index inside each loop
Learning Zig by building a raycasting engine.
An explicit goal of this project is to do as much as possible in software. As such, except for the skyclinder, all of the rendering is done in software and hardware acceleration is only used to scale the resulting image.
In particular alpha blending is implemented in software. This was the result of an interesting diversion into unsigned integer arithmetic approximations of floating point computations.
*It's topologically a cylinder, not a box; hardware rendered for now
Ensure you have a recent version of Zig (tested on 0.9.0-dev.866+6a6e2cd64
), and the csfml
library somewhere we your linker can find it. Then run
zig build -Drelease-fast run
The default keybinds are FRST for Forward, Left Strafe, Backward, Right Strafe and the arrow keys for similar but turn instead of strafe. Escape exits.
The code is GPLv3+, the artwork is CC-BY-SA 4.0
I make use of the zig-sfml library, which is Copyright (C) 2021 Guigui220D under the terms of the MIT license. For details see src/sfml/LICENCE