feat: make node definitions type safe with zod

This commit is contained in:
2024-04-22 00:33:04 +02:00
parent 4c7c4cac2c
commit ad197db873
28 changed files with 221 additions and 147 deletions

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/array",
"outputs": [
"float"
],

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/box",
"outputs": [
"model"
],

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/float",
"outputs": [
"float"
],

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/math",
"outputs": [
"float"
],

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/output",
"outputs": [],
"inputs": {
"input": {

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/random",
"outputs": [
"float"
],

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/stem",
"outputs": [
"plant"
],

View File

@@ -31,9 +31,9 @@ pub fn execute(input: &[i32]) -> Vec<i32> {
for i in 0..res_curve {
let a = i as f32 / (res_curve - 1) as f32;
path_p[i * 4] = origin[0] + (a * 8.0).sin() * 0.2;
path_p[i * 4] = origin[0];
path_p[i * 4 + 1] = origin[1] + a * length;
path_p[i * 4 + 2] = origin[2] + ((a + 2.0) * 8.0).sin() * 0.2;
path_p[i * 4 + 2] = origin[2];
path_p[i * 4 + 3] = thickness * (1.0 - a);
}

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/sum",
"outputs": [
"float"
],

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/triangle",
"outputs": [
"model"
],

View File

@@ -1,5 +1,5 @@
use macros::include_definition_file;
use utils::{decode_float, encode_float, evaluate_arg, evaluate_float, get_args, wrap_arg};
use utils::{decode_float, encode_float, evaluate_arg, get_args, wrap_arg};
use wasm_bindgen::prelude::*;
use web_sys::console;

View File

@@ -1,4 +1,5 @@
{
"id": "max/plantarium/vec3",
"outputs": [
"vec3"
],