Open nczsl opened 2 years ago
pub fn look_at(eye: Vector3, center: Vector3, up: Vector3) -> Matrix4 { let f = (center - eye).normalize(); let s = f.cross(up).normalize(); let u = s.cross(f).normalize(); let mut result = Matrix4::new(); result.m11 = s.x; result.m12 = s.y; result.m13 = s.z; result.m21 = u.x; result.m22 = u.y; result.m23 = u.z; result.m31 = -f.x; result.m32 = -f.y; result.m33 = -f.z; result.m41 = s.dot(eye); result.m42 = u.dot(eye); result.m43 = f.dot(eye); result.m44 = 1.0; result }
// this is the rust function let vm=rw.Matrix4.look_at(rw.Vector3.new(0.0,0.0,5.0),rw.Vector3.new(0.0,0.0,0.0),rw.Vector3.new(0.0,1.0,0.0)); console.log(vm); //this is the js invoke place
🐛 Bug description
from js invoke rust by wasm_bindgen method/function, if parameter is a wrap type so appear this error that Error: null pointer passed to rust
🤔 Expected Behavior
What should have happened?
👟 Steps to reproduce
Clear steps describing how to reproduce the issue, including commands and flags run. If you are seeing an error, please include the full error message and stack trace.
🌍 Your environment
Include the relevant details of your environment. wasm-pack version: 0.10.2 rustc version: 1.6.0