Crate qbsp

Source
Expand description

§QBSP

crates.io docs.rs

Rust crate for parsing, and operating with Quake 1 BSP files.

§Features

  • Parsing .bsp files with the BSP29 and BSP2 formats.
  • Structured easy access to the bsp data.
  • BSP raycasting.
  • Mesh generation.
  • Lightmap atlas generation either per-style or per-slot (.lit supported).
  • BSPX support, including built-in structures/support for the RGBLIGHTING, LIGHTGRID_OCTREE, BRUSHLIST, and DECOUPLED_LM lumps.

§How to use

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
  • PVS data support
  • BSP writing

Re-exports§

pub use glam;
pub use image;
pub use smallvec;

Modules§

data
BSP file data parsing.
mesh
Turning BspData into a renderable mesh.
prelude
query
util

Macros§

smallvec
Creates a SmallVec containing the arguments.

Structs§

BspData
A BSP files contents parsed into structures for easy access.
BspParseContext
BspParseInput
BspParseSettings
Palette
An Id Tech 1 palette to use for embedded images.

Enums§

BspFormat
BspParseError

Statics§

QUAKE_PALETTE
The default quake palette.

Traits§

BspParseResultDoingJobExt

Functions§

read_lump
Helper function to read an array of data of type T from a lump. Takes in the BSP file data, the lump directory, and the lump to read from.

Type Aliases§

BspResult

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).