- C 85.8%
- C++ 13.2%
- Python 0.5%
- GLSL 0.2%
- Batchfile 0.2%
- Other 0.1%
| include | ||
| shaders | ||
| src | ||
| bsp_viewer.exe | ||
| build.bat | ||
| build.sh | ||
| glfw3.dll | ||
| README.md | ||
| setup_deps.py | ||
bsp-viewer
A Source engine BSP map viewer written in C++ with OpenGL 3.3.
⚠️ WARNING: THIS PROJECT IS FULLY UNUSABLE IN ITS CURRENT STATE. The codebase requires a complete bug fix pass and massive refactoring before it can be considered functional. Do not expect anything to work correctly. You have been warned.
pr's are welcomed.
What it is
Attempts to parse and render .bsp map files from Source engine games (CS:GO, Half-Life 2, etc.). Reads VPK archives for textures, parses VMT/VTF material files, and displays the geometry in a 3D viewport.
What it uses
- OpenGL 3.3 Core Profile via GLAD
- GLFW3 for windowing and input
- stb_image for image loading
- C++20
Building
Prerequisites
- MSYS2/MinGW-w64 with GCC
- Run
setup_deps.pyonce to fetch GLAD and stb_image headers - Install GLFW:
pacman -S mingw-w64-x86_64-glfw
Compile
build.bat
Or on Linux/Mac:
./build.sh
Usage
bsp_viewer.exe <map.bsp> [game_dir]
game_dir is the path to the game folder containing a materials/ directory and/or pak01_dir.vpk. Example:
bsp_viewer.exe de_dust2.bsp "C:\Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo"
Controls
| Input | Action |
|---|---|
W A S D |
Move |
| Mouse | Look |
Space / E |
Move up |
Ctrl / Q |
Move down |
Shift |
3x speed boost |
[ / ] |
Halve / double speed |
| Scroll wheel | Adjust speed |
Escape |
Toggle mouse capture |
Current state
The codebase is a rough first pass. Known issues include (but are not limited to):
- Rendering is broken / incomplete
- Texture loading is unreliable
- VPK/VMT/VTF parsing has unresolved bugs
- No proper error handling throughout
- Code structure needs significant refactoring
This needs a full review and rewrite before it is usable for anything.
Source files
| File | Purpose |
|---|---|
src/main.cpp |
Entry point, GLFW setup, main loop |
src/bsp_parser.cpp |
Source BSP file parser |
src/renderer.cpp |
OpenGL rendering |
src/vpk_reader.cpp |
VPK archive reader |
src/vmt_parser.cpp |
VMT material parser |
src/vtf_reader.cpp |
VTF texture reader |
src/mdl_loader.cpp |
MDL model loader |
src/glad.c |
OpenGL loader |