Add support for light entities in bridge reification

This commit is contained in:
MayaTheShy
2025-11-16 21:55:55 -05:00
parent dfa8b709ec
commit 645ea243a3

View File

@@ -156,6 +156,8 @@ impl Reify for BridgeState {
2 => "sphere",
3 => "3D model",
4 => "text",
5 => "image",
6 => "light",
_ => "unknown"
};
@@ -183,6 +185,19 @@ impl Reify for BridgeState {
let panel = ast::elements::PanelUI::default();
Some(panel.build())
}
6 => {
// Light entity: use asteroids Light element
eprintln!("[bridge/reify] Light entity type detected for node {}.", id);
let color = ast::elements::RgbaLinear::new(
node.color[0], node.color[1], node.color[2], node.color[3]
);
// Use y dimension as intensity if available, else default to 1.0
let intensity = node.dimensions.get(1).copied().unwrap_or(1.0).max(0.01);
let light = ast::elements::Light::new()
.color(color)
.intensity(intensity);
Some(light.build())
}
_ => {
match Model::direct(&model_path) {
Ok(mut model) => {