feat: yaaay a triangle :)))
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"outputs": [],
|
||||
"inputs": {
|
||||
"input": {
|
||||
"type": "plant",
|
||||
"type": "float",
|
||||
"external": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,48 @@
|
||||
use macros::include_definition_file;
|
||||
use utils::evaluate_args;
|
||||
use utils::{decode_float, encode_float};
|
||||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::console;
|
||||
|
||||
include_definition_file!("src/inputs.json");
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[wasm_bindgen]
|
||||
pub fn execute(args: &[i32]) -> Vec<i32> {
|
||||
pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
utils::set_panic_hook();
|
||||
|
||||
// console::log_1(&format!("WASM(output_node): input: {:?}", args).into());
|
||||
let size = input[2];
|
||||
let decoded = decode_float(input[2]);
|
||||
let negative_size = encode_float(-decoded);
|
||||
|
||||
console::log_1(&format!("WASM(output_node): input: {:?} -> {}", input, decoded).into());
|
||||
|
||||
// [[1,3, x, y, z, x, y,z,x,y,z]];
|
||||
vec![
|
||||
0, 1, // opening bracket
|
||||
0, 19, // opening bracket + distance to next bracket
|
||||
1, // 1: geometry
|
||||
3, // 3 vertices
|
||||
1, // 1 face
|
||||
// thise 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
|
||||
0, // z
|
||||
//
|
||||
size, // x -> point 2
|
||||
0, // y
|
||||
0, // z
|
||||
//
|
||||
0, // x -> point 3
|
||||
0, // y
|
||||
size, // z
|
||||
//
|
||||
1, 1, 1, 1, // closing brackets
|
||||
]
|
||||
|
||||
evaluate_args(args)
|
||||
// let decoded = decode_float(result[0], result[1]);
|
||||
|
||||
// console::log_1(&format!("WASM: output: {:?}", decoded).into());
|
||||
|
||||
@@ -11,7 +11,7 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
|
||||
let length = evaluate_args(args[0]);
|
||||
let thickness = evaluate_args(args[1]);
|
||||
let resolution = evaluate_args(args[2]);
|
||||
let resolution = 32; //evaluate_args(args[2]);
|
||||
|
||||
console::log_1(
|
||||
&format!(
|
||||
@@ -21,14 +21,20 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
|
||||
.into(),
|
||||
);
|
||||
|
||||
let mut result: Vec<i32> = Vec::with_capacity(args.len() + 3);
|
||||
|
||||
result.push(0); // encoding the [ bracket
|
||||
result.push(2);
|
||||
result.push(0); // adding the node-type, math: 0
|
||||
result.extend_from_slice(&thickness);
|
||||
result.push(1);
|
||||
result.push(1); // closing bracket
|
||||
|
||||
result
|
||||
vec![
|
||||
0, // opening bracket
|
||||
11, // opening bracket
|
||||
0, // type: plant
|
||||
0, // alpha: 0
|
||||
0, // x
|
||||
0, // y
|
||||
0, // z
|
||||
1, // thickness
|
||||
0, // x
|
||||
2, // y
|
||||
0, // z
|
||||
1, // thickness
|
||||
1, // closing bracket
|
||||
1, //closing bracket
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user