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

Function bloom_scene_update_geometry

native/android/src/lib.rs:2235–2266  ·  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

2233
2234#[no_mangle]
2235pub extern "C" fn bloom_scene_update_geometry(
2236 handle: f64,
2237 vert_ptr: *const f64,
2238 vert_count: f64,
2239 idx_ptr: *const f64,
2240 idx_count: f64,
2241) {
2242 if vert_ptr.is_null() || idx_ptr.is_null() { return; }
2243 let nv = vert_count as usize;
2244 let ni = idx_count as usize;
2245
2246 let vert_floats = unsafe { std::slice::from_raw_parts(vert_ptr, nv * 12) };
2247 let idx_floats = unsafe { std::slice::from_raw_parts(idx_ptr, ni) };
2248
2249 let mut vertices = Vec::with_capacity(nv);
2250 for i in 0..nv {
2251 let base = i * 12;
2252 vertices.push(bloom_shared::renderer::Vertex3D {
2253 position: [vert_floats[base] as f32, vert_floats[base+1] as f32, vert_floats[base+2] as f32],
2254 normal: [vert_floats[base+3] as f32, vert_floats[base+4] as f32, vert_floats[base+5] as f32],
2255 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],
2256 uv: [vert_floats[base+10] as f32, vert_floats[base+11] as f32],
2257 joints: [0.0; 4],
2258 weights: [0.0; 4],
2259 tangent: [0.0; 4],
2260 });
2261 }
2262
2263 let indices: Vec<u32> = idx_floats.iter().map(|&v| v as u32).collect();
2264
2265 engine().scene.update_geometry(handle, vertices, indices);
2266}
2267
2268#[no_mangle]
2269pub extern "C" fn bloom_splat_impulse(x: f64, z: f64, radius: f64, strength: 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