This is a Half-Life 1 BSP loader and renderer written in C++ and OpenGL 3.3 Core. It was designed to be later hacked into intergrated into Xash3D or GoldSrc.
The project is made up from several static libraries and executables.
Name | Purpose | Docs |
---|---|---|
appfw | Utility library the provides dev console, platform info. | Link |
bsp | Library for reading BSP and WAD files. | Link |
renderer | Provides rendering of BSP world surfaces as well as text rendering. | Link |
bspviewer | A utility for opening BSP maps and viewing them. Used to test the renderer. | Link |
rad | Radiosity simulator for generating cutom lightmaps. Not yet finished. | - |
You can find documentation for individual projects in their directory in /src/.
- OpenGL mathematics library (GLM)
- SDL2 library
- Freetype library
Note: code is designed to be portable but was only tested on Windows with Visual Studio 2017. Some patches may be required.
Renderer doesn't load lightmaps stored in .bsp file like the GoldSrc engine does. Instead it loads custom lightmaps generated by rad utility. However, the utility is only half-done and has a lot of problems.
- VIS data embeded into BSP file is not used. On any non-tiny maps it would eat all available RAM and crash.
- Visibility between patches is not checked. That means there are no shadows. See
BSPTree::recursiveTraceLine
in rad/src/bsp_tree.cpp for details. - It doesn't read texture color for proper lighting simulation.
- Completely single-threaded.
- All settings (patch size, map name, bounce count) are hardcoded in rad/src/main.cpp.
- Extremely slow in debug build.
When lightmap data is not available, there is r_fullbright 1
which disables lighting and shows everything in max brightness and r_fullbright 4
which enables basic direct lighting.
A lot of rendering code is based on Xash3D so thanks to everyone who worked on it. Also thanks to id Software for open-sourcing Quake engine code which helped massively.