Add support for text entities in model reification and improve logging

This commit is contained in:
MayaTheShy
2025-11-16 21:50:50 -05:00
parent ad3f079ccf
commit e4519fa47d

View File

@@ -155,6 +155,7 @@ impl Reify for BridgeState {
1 => "cube",
2 => "sphere",
3 => "3D model",
4 => "text",
_ => "unknown"
};
@@ -164,12 +165,21 @@ impl Reify for BridgeState {
format!("primitive from {}", model_path.display())
};
eprintln!("[bridge/reify] Loading {} for node {} {}",
entity_type_name, id, model_source);
eprintln!("[bridge/reify] Loading {} for node {} {}", entity_type_name, id, model_source);
match node.entity_type {
4 => {
// Text entity: use node.name as text for now
let text = ast::elements::Text::new(&node.name)
.character_height(node.dimensions[1].max(0.01))
.color(ast::elements::RgbaLinear::new(
node.color[0], node.color[1], node.color[2], node.color[3]
));
Some(text.build())
}
_ => {
match Model::direct(&model_path) {
Ok(mut model) => {
// Asteroids Model now supports material color tinting.
if node.color != [1.0, 1.0, 1.0, 1.0] {
let color = ast::elements::RgbaLinear::new(
node.color[0], node.color[1], node.color[2], node.color[3]
@@ -178,13 +188,10 @@ impl Reify for BridgeState {
eprintln!("[bridge/reify] Node {}: applied color tint RGBA({:.2}, {:.2}, {:.2}, {:.2})",
id, node.color[0], node.color[1], node.color[2], node.color[3]);
}
// TODO: Apply texture from texture_url (pending API)
if !node.texture_url.is_empty() {
eprintln!("[bridge/reify] Node {} has texture URL: {} - NOT YET APPLIED (API limitation)",
id, node.texture_url);
}
Some(model.build())
}
Err(e) => {
@@ -192,6 +199,8 @@ impl Reify for BridgeState {
None
}
}
}
}
} else {
eprintln!("[bridge/reify] No model available for entity type {} (node {})", node.entity_type, id);
None