BSP map rendering with textures, lightmaps, and skybox #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/4-bsp-rendering"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements full BSP map rendering in the web client (closes #4).
BSP Parser (
bsp/parser.js)dface_t), planes, texinfo, texdata, models, dispinfo, dispverts, entitiesGeometry (
bsp/geometry.js)texinfo.textureVecstexinfo.lightmapVecs(brush) and grid interpolation (displacements)Lightmap Atlas (
bsp/lightmap.js)Material Textures (
bsp/vtf.js,bsp/vmt.js,bsp/material.js)$basetexture, followspatch/includedirectivesmaps/<mapname>/material_X_Y_Z→ base materialSkybox (
bsp/skybox.js)sky_cameraentity detection, geometry splitting by proximity, 16x scale, camera-tracking positionStats (gm_construct)
Known limitations
Full material texture pipeline for BSP map rendering: VTF decoder (bsp/vtf.js): - Parses VTF header (version, dimensions, format, mip levels) - Decodes image formats: DXT1 (BC1), DXT3 (BC2), DXT5 (BC3), RGBA8888, BGRA8888, ABGR8888, ARGB8888, RGB888, BGR888 - Software DXT decompression to RGBA for universal WebGL support - Creates Three.js DataTexture with repeat wrapping and mipmaps VMT parser (bsp/vmt.js): - Extracts $basetexture path from Valve KeyValues format - Handles basic material properties (translucent, alphatest) Geometry builder restructured: - Faces grouped by material/texture name (187 groups for gm_construct) - Computes both texture UVs (from texinfo.textureVecs) and lightmap UVs - Returns array of { textureName, geometry } for per-material rendering Loader updated: - Creates per-material meshes in a Three.js Group - Async texture loading: VMT → extract $basetexture → load VTF → decode → apply - Lightmap applied as lightMap on MeshBasicMaterial with uv2 channel - 34 textures successfully decoded for gm_construct Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>