update
This commit is contained in:
BIN
wasm_trait_rust/Bundled/main.wasm
Normal file
BIN
wasm_trait_rust/Bundled/main.wasm
Normal file
Binary file not shown.
1
wasm_trait_rust/README.md
Normal file
1
wasm_trait_rust/README.md
Normal file
@ -0,0 +1 @@
|
||||
https://github.com/leenkx3d/leenkx/wiki/wasm
|
||||
24
wasm_trait_rust/main.rs
Normal file
24
wasm_trait_rust/main.rs
Normal file
@ -0,0 +1,24 @@
|
||||
extern {
|
||||
fn notify_on_update(f: extern fn() -> ()) -> ();
|
||||
fn get_object(name: *const i8) -> i32;
|
||||
fn set_transform(object: i32, x: f32, y: f32, z: f32, rx: f32, ry: f32, rz: f32, sx: f32, sy: f32, sz: f32) -> ();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn update() -> () {
|
||||
unsafe {
|
||||
let name = std::ffi::CString::new("Cube").unwrap();
|
||||
let object = get_object(name.as_ptr());
|
||||
static mut rot: f32 = 0.1;
|
||||
rot += 0.01;
|
||||
set_transform(object, 0.0, 0.0, 0.0, 0.0, 0.0, rot, 1.0, 1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn main() -> i32 {
|
||||
unsafe {
|
||||
notify_on_update(update);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
BIN
wasm_trait_rust/wasm.png
Normal file
BIN
wasm_trait_rust/wasm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
wasm_trait_rust/wasm_trait_rust.blend
Normal file
BIN
wasm_trait_rust/wasm_trait_rust.blend
Normal file
Binary file not shown.
Reference in New Issue
Block a user