feat: some shut
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "wasm-pack build --release --out-name index --no-default-features",
|
||||
"dev": "cargo watch -s 'pnpm build'"
|
||||
"dev": "cargo watch -s 'wasm-pack build --dev --out-name index --no-default-features'"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use macros::include_definition_file;
|
||||
use utils::{decode_float, encode_float, wrap_arg};
|
||||
use utils::{decode_float, encode_float, evaluate_arg, evaluate_float, get_args, wrap_arg};
|
||||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::console;
|
||||
|
||||
@@ -9,11 +9,15 @@ include_definition_file!("src/input.json");
|
||||
#[wasm_bindgen]
|
||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
|
||||
let size = input[2];
|
||||
let decoded = decode_float(input[2]);
|
||||
utils::set_panic_hook();
|
||||
|
||||
let args = get_args(input);
|
||||
|
||||
let size = evaluate_arg(args[0]);
|
||||
let decoded = decode_float(size);
|
||||
let negative_size = encode_float(-decoded);
|
||||
|
||||
console::log_1(&format!("WASM(triangle): input: {:?} -> {}", input, decoded).into());
|
||||
console::log_1(&format!("WASM(triangle): input: {:?} -> {}", args[0],decoded).into());
|
||||
|
||||
// [[1,3, x, y, z, x, y,z,x,y,z]];
|
||||
wrap_arg(&[
|
||||
@@ -22,8 +26,6 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
1, // 1 face
|
||||
// this are the indeces for the face
|
||||
0, 2, 1,
|
||||
// this is the normal for the single face 1065353216 == 1.0f encoded is i32
|
||||
0, 1065353216, 0,
|
||||
//
|
||||
negative_size, // x -> point 1
|
||||
0, // y
|
||||
@@ -36,6 +38,10 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
0, // x -> point 3
|
||||
0, // y
|
||||
size, // z
|
||||
// this is the normal for the single face 1065353216 == 1.0f encoded is i32
|
||||
0, 1065353216, 0,
|
||||
0, 1065353216, 0,
|
||||
0, 1065353216, 0,
|
||||
])
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user