add namespace to cbidngen. use QuatC for rot input instead of Vec3C + real

This commit is contained in:
franchioping 2026-04-04 02:41:15 +01:00
parent 11a55db271
commit ac12715471
2 changed files with 3 additions and 4 deletions

View File

@ -16,6 +16,7 @@ fn run_cbindgen(cargo_dir: &Path, target_dir: &Path) {
cbindgen::Builder::new() cbindgen::Builder::new()
.with_crate(cargo_dir) .with_crate(cargo_dir)
.with_language(cbindgen::Language::Cxx) .with_language(cbindgen::Language::Cxx)
.with_namespace("dcont")
.with_pragma_once(true) .with_pragma_once(true)
.generate() .generate()
.expect("Unable to generate bindings") .expect("Unable to generate bindings")

View File

@ -54,15 +54,13 @@ pub extern "C" fn set_input(ptr: *mut StackedController, inp: Input) {
} }
#[unsafe(no_mangle)] #[unsafe(no_mangle)]
pub extern "C" fn set_cur_rot(ptr: *mut StackedController, parts: Vec3C, scalar: f32) { pub extern "C" fn set_cur_rot(ptr: *mut StackedController, rot: QuatC) {
let controller = unsafe { let controller = unsafe {
assert!(!ptr.is_null()); assert!(!ptr.is_null());
&mut *ptr &mut *ptr
}; };
let quat: na::UnitQuaternion<f32> = controller.set_rotation(rot.into());
na::UnitQuaternion::from_quaternion(na::Quaternion::from_parts(scalar, parts.into()));
controller.set_rotation(quat);
} }
#[unsafe(no_mangle)] #[unsafe(no_mangle)]