use std::{ffi::CString, os::raw::c_char}; fn main() { convert_fbx_to_3dtiles("/root/data/绿科-三维视图-{三维}111.fbx", "/root/data/out/lk"); } #[repr(C)] pub struct FttContext { pub fbx_file: *mut c_char, pub out_dir: *mut c_char } unsafe extern "C" { pub unsafe fn fbx_parse(name_in: *const u8); pub unsafe fn load_fbx_mesh_to_db(ctx: *const FttContext); } fn convert_fbx_to_3dtiles(fbx_path: &str, out_dir: &str) { let ctx = &FttContext{ fbx_file: CString::new(fbx_path).unwrap().into_raw(), out_dir: CString::new(out_dir).unwrap().into_raw() }; unsafe { // fbx_parse(fbx_path.as_ptr() as *const u8); // 1. load to disk // fbx_path.as_ptr() as *const u8 load_fbx_mesh_to_db(ctx); // free let _ = CString::from_raw(ctx.fbx_file); let _ = CString::from_raw(ctx.out_dir); } // unsafe { // let scene = fbx_parse(fbx_path.as_ptr() as *const i8); // // Assume we have a function to extract geometry from FBX scene // let geometries = extract_geometries(scene); // let mut tiles_data = Vec::new(); // for geometry in geometries { // // Transform the geometry data to 3D Tiles format data // let tile_data = transform_to_3dtiles(geometry); // tiles_data.push(tile_data); // } // // Write the 3D Tiles data to files or serve it as required // write_3dtiles(tiles_data); // } }