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

Function bloom_scene_update_geometry

native/ios/src/lib.rs:2586–2617  ·  view source on GitHub ↗
(
    handle: f64,
    vert_ptr: *const f64,
    vert_count: f64,
    idx_ptr: *const f64,
    idx_count: f64,
)

Source from the content-addressed store, hash-verified

2584
2585#[no_mangle]
2586pub extern "C" fn bloom_scene_update_geometry(
2587 handle: f64,
2588 vert_ptr: *const f64,
2589 vert_count: f64,
2590 idx_ptr: *const f64,
2591 idx_count: f64,
2592) {
2593 if vert_ptr.is_null() || idx_ptr.is_null() { return; }
2594 let nv = vert_count as usize;
2595 let ni = idx_count as usize;
2596
2597 let vert_floats = unsafe { std::slice::from_raw_parts(vert_ptr, nv * 12) };
2598 let idx_floats = unsafe { std::slice::from_raw_parts(idx_ptr, ni) };
2599
2600 let mut vertices = Vec::with_capacity(nv);
2601 for i in 0..nv {
2602 let base = i * 12;
2603 vertices.push(bloom_shared::renderer::Vertex3D {
2604 position: [vert_floats[base] as f32, vert_floats[base+1] as f32, vert_floats[base+2] as f32],
2605 normal: [vert_floats[base+3] as f32, vert_floats[base+4] as f32, vert_floats[base+5] as f32],
2606 color: [vert_floats[base+6] as f32, vert_floats[base+7] as f32, vert_floats[base+8] as f32, vert_floats[base+9] as f32],
2607 uv: [vert_floats[base+10] as f32, vert_floats[base+11] as f32],
2608 joints: [0.0; 4],
2609 weights: [0.0; 4],
2610 tangent: [0.0; 4],
2611 });
2612 }
2613
2614 let indices: Vec<u32> = idx_floats.iter().map(|&v| v as u32).collect();
2615
2616 engine().scene.update_geometry(handle, vertices, indices);
2617}
2618
2619#[no_mangle]
2620pub extern "C" fn bloom_scene_set_material_color(handle: f64, r: f64, g: f64, b: f64, a: f64) {

Callers 1

updateSceneNodeGeometryFunction · 0.50

Calls 4

iterMethod · 0.80
update_geometryMethod · 0.80
engineFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected