Expand description
§QBSP
Rust crate for parsing, and operating with Quake 1, 2, and GoldSrc BSP files.
§Features
- Parsing
.bspfiles with the BSP29 BSP2, BSP30 BSP38, and Qbism formats. - Structured easy access to the bsp data.
- BSP raycasting.
- Mesh generation.
- Lightmap atlas generation either per-style or per-slot (
.litsupported). - BSPX support, including built-in structures for the
RGBLIGHTING,LIGHTGRID_OCTREE,BRUSHLIST, andDECOUPLED_LMlumps.
§Quickstart
use qbsp::prelude::*;
let _ = BspData::parse(BspParseInput {
bsp: &[], // Data of the bsp file.
lit: None, // Optional lit file for colored lighting if no `RGBLIGHTING` BSPX lump is present.
settings: BspParseSettings::default(),
});§Feature wishlist
I might work on these at a later date, but if anyone wants to help out or just give some ideas, they’re more than welcome to!
- More flexible meshing API
- BSP writing
Re-exports§
Modules§
- data
- Datatype definitions for lumps within a BSP file.
- mesh
- Module for turning
BspDatainto a renderable mesh. - prelude
- Module that re-exports common/necessary imports to make the user experience that much nicer.
- query
- Module for various more advanced queries into
BspData, such as raycasting, potentially visible set, and potentially audible set. - reader
- Module containing the core of reading a binary BSP file and interpreting it into structured data.
- util
- Various utilities that don’t fit cleanly into other modules, but are too small to warrant their own.
Structs§
- BspData
- A BSP files contents parsed into structures for easy access.
- BspParse
Input - BspParse
Settings
Enums§
- BspFormat
- The format of a BSP file. This is determined by the magic number made up of the first 4 bytes of the file, and governs how the rest of the file attempts to parse.
- BspParse
Error
Statics§
- QUAKE_
PALETTE - The default quake palette.
Traits§
Functions§
- read_
lump - Helper function to read an array of data of type
Tfrom a lump. Takes in the BSP file data, the lump directory, and the lump to read from. - read_
mip_ texture_ lump - The texture lump is more complex than just a vector of the same type of item, so it needs its own function.
Type Aliases§
Derive Macros§
- BspValue
- Automatically implements BspValue on structs in the order of the fields, or unit enums with
#[repr(...)]and explicit discriminants (e.g. Foo = 1). - BspVariable
Value - Automatically implement
BspVariableValueon single-field tuple structs. Note: This will additionally implementFrom<T> where (inner field type): From<T>for the type, in order to convert from the individual format types, and will implement{Deref,DerefMut}<Target = (inner field type)>. Specify the variant types per BSP format with#[bsp2(..)],#[bsp29(..)],#[bsp30(..)]and#[bsp38(..)]annotations respectively. All format variants must be specified, if a field does not exist in a format useNoFieldand implementFrom<NoField>for the inner field type.