Skip to Content
API ReferencePreprocessor

Preprocessor

Target API: 5 · Target build: bbb6l5 (2026-11-20, production and preprod) · Status: Analyzed (restored from the live validator)

Conditional compilation supports only #define NAME (no value) / #ifdef / #ifndef / #else / #endif. The # goes at the start of a line (inside functions is fine). Flag-name matching is case-insensitive; a wrong #ifdef name makes the error message list the official set.

Defined macros (3)

MacroDefined inTypical use
BLOXD_STRICTstrict-game variants (strict.terrain / strict.liquid / strict.model)#ifndef BLOXD_STRICT around whole vertex hooks and discard
BLOXD_ALPHAvariants where BloxdSurface.alpha exists — all liquid + non-strict terrain/modelwrap alpha-touching code
BLOXD_SCENE_DEPTHall liquid variantswrap bloxdOpaqueBehind() calls

Macro × variant matrix

VariantBLOXD_STRICTBLOXD_ALPHABLOXD_SCENE_DEPTH
allow.terrain–✓–
allow.liquid–✓✓
allow.model–✓–
strict.terrain✓––
strict.liquid✓✓✓
strict.model✓––

Terrain / liquid / model differences are separate programs, not macros — #ifdef BLOXD_TERRAIN does not exist.

Removed macros

  • BLOXD_LIGHTING — removed in v5. Lighting state is a runtime question for bloxdLit(), not a compile branch. Using it fails validation with:

“BLOXD_LIGHTING was removed in apiVersion 5; test bloxdLit() in code instead.”

v4 migration pattern:

// v4 (fails validation on v5) #ifdef BLOXD_LIGHTING fn bloxdTerrainLight(s: BloxdSurface, l: BloxdLightIn) -> BloxdLight { ... } #endif // v5 (migrated) fn bloxdTerrainLight(surface: BloxdSurface, light: BloxdLightIn) -> BloxdLight { if (!bloxdLit()) { return bloxdDefaultLight(surface, light); } // ... lighting-enabled processing }

Example

fn bloxdTerrainSurface(s: BloxdSurfaceIn) -> BloxdSurface { var out = bloxdDefaultSurface(s); out.colour = out.colour * vec3f(1.0, 0.9, 0.8); #ifdef BLOXD_ALPHA // terrain has alpha only in allow out.alpha = s.alpha; #endif return out; } #ifndef BLOXD_STRICT // vertex hooks always need this guard fn bloxdTerrainVertex(v: BloxdVertexIn) -> BloxdVertex { var out = bloxdDefaultVertex(v); out.position.y += sin(bloxdSeconds()) * 0.05; return out; } #endif

Macros shape the structs

  • BloxdSurface.alpha exists only inside #ifdef BLOXD_ALPHA
  • bloxdOpaqueBehind() is callable only inside #ifdef BLOXD_SCENE_DEPTH

See Structures.