MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / bloom_scene_attach_model

Function bloom_scene_attach_model

native/linux/src/lib.rs:2248–2286  ·  view source on GitHub ↗
(node_handle: f64, model_handle: f64, mesh_index: f64)

Source from the content-addressed store, hash-verified

2246
2247#[no_mangle]
2248pub extern "C" fn bloom_scene_attach_model(node_handle: f64, model_handle: f64, mesh_index: f64) {
2249 let eng = engine();
2250 let mi = mesh_index as usize;
2251
2252 let model_data = match eng.models.models.get(model_handle) {
2253 Some(md) => md,
2254 None => return,
2255 };
2256 if mi >= model_data.meshes.len() { return; }
2257 let mesh = &model_data.meshes[mi];
2258
2259 let vertices = mesh.vertices.clone();
2260 let indices = mesh.indices.clone();
2261 let base_color_tex = mesh.texture_idx;
2262 let normal_tex = mesh.normal_texture_idx;
2263 let mr_tex = mesh.metallic_roughness_texture_idx;
2264 let emissive_tex = mesh.emissive_texture_idx;
2265 let emissive_factor = mesh.emissive_factor;
2266 eng.scene.update_geometry(node_handle, vertices, indices);
2267
2268 if let Some(tex_idx) = base_color_tex {
2269 eng.scene.set_material_texture(node_handle, tex_idx);
2270 }
2271 if let Some(tex_idx) = normal_tex {
2272 eng.scene.set_material_normal_texture(node_handle, tex_idx);
2273 }
2274 if let Some(tex_idx) = mr_tex {
2275 eng.scene.set_material_metallic_roughness_texture(node_handle, tex_idx);
2276 }
2277 if let Some(tex_idx) = emissive_tex {
2278 eng.scene.set_material_emissive_texture(node_handle, tex_idx);
2279 }
2280 eng.scene.set_material_emissive_factor(
2281 node_handle,
2282 emissive_factor[0],
2283 emissive_factor[1],
2284 emissive_factor[2],
2285 );
2286}
2287
2288// ============================================================
2289// Scene picking (raycasting)

Callers

nothing calls this directly

Calls 9

cloneMethod · 0.80
update_geometryMethod · 0.80
set_material_textureMethod · 0.80
engineFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected