diff --git a/app/src/lib/graph-templates/index.ts b/app/src/lib/graph-templates/index.ts index 9785018..662ed6e 100644 --- a/app/src/lib/graph-templates/index.ts +++ b/app/src/lib/graph-templates/index.ts @@ -1,2 +1,3 @@ export { grid } from "./grid"; export { tree } from "./tree"; +export { plant } from "./plant"; diff --git a/app/src/lib/graph-templates/plant.ts b/app/src/lib/graph-templates/plant.ts new file mode 100644 index 0000000..bf19244 --- /dev/null +++ b/app/src/lib/graph-templates/plant.ts @@ -0,0 +1,12 @@ +export const plant = { + "settings": { "resolution.circle": 26, "resolution.curve": 39 }, + "nodes": [ + { "id": 9, "position": [180, 80], "type": "max/plantarium/output", "props": {} }, + { "id": 10, "position": [55, 80], "type": "max/plantarium/stem", "props": { "amount": 1, "length": 11, "thickness": 0.71 } }, + { "id": 11, "position": [80, 80], "type": "max/plantarium/noise", "props": { "strength": 35, "scale": 4.6, "fixBottom": 1, "directionalStrength": [1, 0.74, 0.083], "depth": 1 } }, + { "id": 12, "position": [105, 80], "type": "max/plantarium/branch", "props": { "length": 3, "thickness": 0.6, "amount": 10, "rotation": 180, "offsetSingle": 0.34, "lowestBranch": 0.53, "highestBranch": 1, "depth": 1 } }, + { "id": 13, "position": [130, 80], "type": "max/plantarium/noise", "props": { "strength": 8, "scale": 7.7, "fixBottom": 1, "directionalStrength": [1, 0, 1], "depth": 1 } }, + { "id": 14, "position": [155, 80], "type": "max/plantarium/gravity", "props": { "strength": 0.11, "scale": 39, "fixBottom": 0, "directionalStrength": [1, 1, 1], "depth": 1, "curviness": 1 } } + ], + "edges": [[10, 0, 11, "plant"], [11, 0, 12, "plant"], [12, 0, 13, "plant"], [13, 0, 14, "plant"], [14, 0, 9, "input"]] +} diff --git a/app/src/lib/result-viewer/Camera.svelte b/app/src/lib/result-viewer/Camera.svelte new file mode 100644 index 0000000..9adff52 --- /dev/null +++ b/app/src/lib/result-viewer/Camera.svelte @@ -0,0 +1,76 @@ + + + + + diff --git a/app/src/lib/result-viewer/Scene.svelte b/app/src/lib/result-viewer/Scene.svelte index 36b7983..0aa0015 100644 --- a/app/src/lib/result-viewer/Scene.svelte +++ b/app/src/lib/result-viewer/Scene.svelte @@ -1,5 +1,5 @@ + + {#if $AppSettings.showGrid} {/if} - - - - diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte index e63bc4f..e6ad7f1 100644 --- a/app/src/routes/+page.svelte +++ b/app/src/routes/+page.svelte @@ -42,7 +42,7 @@ let graph = localStorage.getItem("graph") ? JSON.parse(localStorage.getItem("graph")!) - : templates.grid(3, 3); + : templates.plant; let manager: GraphManager; let managerStatus: Writable<"loading" | "error" | "idle">; diff --git a/packages/ui/src/lib/elements/Float.svelte b/packages/ui/src/lib/elements/Float.svelte index af1cf3e..d14fbf8 100644 --- a/packages/ui/src/lib/elements/Float.svelte +++ b/packages/ui/src/lib/elements/Float.svelte @@ -64,15 +64,15 @@ inputEl.focus(); } - setTimeout(() => { - if (value >= 0) { - max = getBoundingValue(value); - min = 0; - } else { - min = getBoundingValue(value); - max = 0; - } - }, 500); + // setTimeout(() => { + // if (value >= 0) { + // max = getBoundingValue(value); + // min = 0; + // } else { + // min = getBoundingValue(value); + // max = 0; + // } + // }, 500); document.body.style.cursor = "unset"; window.removeEventListener("mouseup", handleMouseUp); diff --git a/packages/utils/src/tree.rs b/packages/utils/src/tree.rs index ef7854d..bc7c8db 100644 --- a/packages/utils/src/tree.rs +++ b/packages/utils/src/tree.rs @@ -1,47 +1,27 @@ use crate::decode_float; pub fn split_args(args: &[i32]) -> Vec<&[i32]> { - println!("-------------------"); - println!("{:?}", args); - let mut out_args: Vec<&[i32]> = Vec::new(); let mut depth = 0; let mut i = 0; let mut start_index = 0; - let mut nbi = 0; + let mut next_bracket_index = 0; let len = args.len(); while i < len { - print!("{:2} ", i); - let val = args[i]; - let is_bracket = i == nbi; - let is_opening_bracket = val == 0; - if i >= len - 1 { - break; - } - if is_bracket { - nbi = i + args[i + 1] as usize + 1; - if !is_opening_bracket { - depth -= 1; - } - } - - for _ in 0..depth { - print!("-"); - } - - if is_bracket { - if is_opening_bracket { + // check if we are at a bracket + if i == next_bracket_index { + next_bracket_index = i + args[i + 1] as usize + 1; + // check if the bracket is opening + if args[i] == 0 { if depth == 1 { start_index = i; } - println!("[ {}", start_index); depth += 1; } else { - println!("] {}", start_index); + depth -= 1; if depth == 1 { out_args.push(&args[start_index..i + 2]); - println!("-> {:?}", &args[start_index..i + 2]); start_index = i + 2; } } @@ -49,12 +29,8 @@ pub fn split_args(args: &[i32]) -> Vec<&[i32]> { continue; } else if depth == 1 { out_args.push(&args[i..i + 1]); - println!("-> {:?}", &args[i..i + 1]); start_index = i + 1; - } else { - println!("{}", val); } - i += 1; }