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

Function bloom_scene_update_geometry

native/macos/src/lib.rs:2550–2581  ·  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

2548/// and index array.
2549#[no_mangle]
2550pub extern "C" fn bloom_scene_update_geometry(
2551 handle: f64,
2552 vert_ptr: *const f64,
2553 vert_count: f64,
2554 idx_ptr: *const f64,
2555 idx_count: f64,
2556) {
2557 if vert_ptr.is_null() || idx_ptr.is_null() { return; }
2558 let nv = vert_count as usize;
2559 let ni = idx_count as usize;
2560
2561 let vert_floats = unsafe { std::slice::from_raw_parts(vert_ptr, nv * 12) };
2562 let idx_floats = unsafe { std::slice::from_raw_parts(idx_ptr, ni) };
2563
2564 let mut vertices = Vec::with_capacity(nv);
2565 for i in 0..nv {
2566 let base = i * 12;
2567 vertices.push(bloom_shared::renderer::Vertex3D {
2568 position: [vert_floats[base] as f32, vert_floats[base+1] as f32, vert_floats[base+2] as f32],
2569 normal: [vert_floats[base+3] as f32, vert_floats[base+4] as f32, vert_floats[base+5] as f32],
2570 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],
2571 uv: [vert_floats[base+10] as f32, vert_floats[base+11] as f32],
2572 joints: [0.0; 4],
2573 weights: [0.0; 4],
2574 tangent: [0.0; 4],
2575 });
2576 }
2577
2578 let indices: Vec<u32> = idx_floats.iter().map(|&v| v as u32).collect();
2579
2580 engine().scene.update_geometry(handle, vertices, indices);
2581}
2582
2583#[no_mangle]
2584pub extern "C" fn bloom_scene_set_material_color(handle: f64, r: f64, g: f64, b: f64, a: f64) {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected