Materials Reference
Module defined in `lua/common/jbeam/materials.lua`. Processes material switches, glow maps, and deform group material bindings for vehicle 3D objects.
Module defined in lua/common/jbeam/materials.lua. Processes material switches, glow maps, and deform group material bindings for vehicle 3D objects.
Exports
Functions
M.process(vehicleObj, vehicle)
Processes the vehicle's glowMap and flexbody deformGroup data to set up switchable materials on the engine object. Creates material switches for glow maps (with simpleFunction or advancedFunction evaluators), binds deform group materials to beams, and pre-compiles all material states to avoid shader lag at runtime. Stores result in vehicle._materials.
- Parameters:
vehicleObj- userdata - The C++ vehicle object (from scenetree)vehicle- table - Assembled vehicle data withglowMap,flexbodies,beamssections
- Returns: nil
Internal Notes
- Glow map entries support two evaluator types:
simpleFunction: string (single trigger) or table{triggerName = coefficient}- summed and multipliedadvancedFunction:{triggers = {...}, cmd = "..."}- arbitrary expression
- Evaluator functions are compiled via
load()with a material variable environment (mv). - Deform groups link flexbody materials to beams: when a beam in a deform group deforms, its associated flexbody material switches to the damaged variant.
- All material states are pre-switched during processing to force shader precompilation.
- Output stored in
vehicle._materials = { mv, triggerList, triggers, matState, deformMeshes }. triggerscopy sent to vehicle side hasevalFunctionstripped (not serializable).
Loader Reference
Module defined in `lua/common/jbeam/loader.lua`. Main orchestrator for the JBeam vehicle loading pipeline. Coordinates all processing stages from file loading to 3D mesh attachment.
Optimization Reference
Module defined in `lua/common/jbeam/optimization.lua`. Assigns continuous IDs (CIDs) to vehicle data entries, optimizes beam ordering, cleans up runtime-unnecessary data, and dereferences object point