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)
| Macro | Defined in | Typical use |
|---|---|---|
BLOXD_STRICT | strict-game variants (strict.terrain / strict.liquid / strict.model) | #ifndef BLOXD_STRICT around whole vertex hooks and discard |
BLOXD_ALPHA | variants where BloxdSurface.alpha exists — all liquid + non-strict terrain/model | wrap alpha-touching code |
BLOXD_SCENE_DEPTH | all liquid variants | wrap bloxdOpaqueBehind() calls |
Macro × variant matrix
| Variant | BLOXD_STRICT | BLOXD_ALPHA | BLOXD_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 forbloxdLit(), 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;
}
#endifMacros shape the structs
BloxdSurface.alphaexists only inside#ifdef BLOXD_ALPHAbloxdOpaqueBehind()is callable only inside#ifdef BLOXD_SCENE_DEPTH
See Structures.