From 05e13733e2f0b54197d88a3998998a1ffc6101f3 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Wed, 20 Mar 2024 01:40:42 +0100 Subject: [PATCH] feat: implement imposters at large zoom scales --- frontend/src/lib/components/edges/Edge.svelte | 30 ++++- .../src/lib/components/graph/Graph.svelte | 107 +++++++++++------- .../src/lib/components/graph/GraphView.svelte | 6 +- frontend/src/lib/components/node/Node.frag | 67 +++++++++++ .../src/lib/components/{ => node}/Node.svelte | 49 ++++++-- frontend/src/lib/components/node/Node.vert | 15 +++ .../components/{ => node}/NodeHeader.svelte | 0 .../components/{ => node}/NodeInput.svelte | 2 +- .../{ => node}/NodeParameter.svelte | 5 +- frontend/src/lib/graph-manager.ts | 6 +- frontend/src/routes/+page.svelte | 10 +- 11 files changed, 231 insertions(+), 66 deletions(-) create mode 100644 frontend/src/lib/components/node/Node.frag rename frontend/src/lib/components/{ => node}/Node.svelte (59%) create mode 100644 frontend/src/lib/components/node/Node.vert rename frontend/src/lib/components/{ => node}/NodeHeader.svelte (100%) rename frontend/src/lib/components/{ => node}/NodeInput.svelte (94%) rename frontend/src/lib/components/{ => node}/NodeParameter.svelte (96%) diff --git a/frontend/src/lib/components/edges/Edge.svelte b/frontend/src/lib/components/edges/Edge.svelte index e6f3807..c6ff08f 100644 --- a/frontend/src/lib/components/edges/Edge.svelte +++ b/frontend/src/lib/components/edges/Edge.svelte @@ -1,10 +1,25 @@ + + - - + +
{ // < - - - - from - - - - to const fromParents = this.getParentsOfNode(from); if (toParents.includes(from)) { - return toParents.splice(toParents.indexOf(from)); + const fromChildren = this.getChildrenOfNode(from); + return toParents.filter(n => fromChildren.includes(n)); } else if (fromParents.includes(to)) { - return [...fromParents.splice(fromParents.indexOf(to)), from]; + const toChildren = this.getChildrenOfNode(to); + return fromParents.filter(n => toChildren.includes(n)); } else { // these two nodes are not connected return; diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 5a0455b..f2766f1 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -4,6 +4,7 @@ import Graph from "$lib/components/graph/Graph.svelte"; import { MemoryRuntimeExecutor } from "$lib/runtime-executor"; import { MemoryNodeRegistry } from "$lib/node-registry"; + import { LinearSRGBColorSpace } from "three"; const nodeRegistry = new MemoryNodeRegistry(); const runtimeExecutor = new MemoryRuntimeExecutor(nodeRegistry); @@ -14,7 +15,7 @@ if (graph) { graphManager.load(JSON.parse(graph)); } else { - graphManager.load(graphManager.createTemplate("grid", 10, 10)); + graphManager.load(graphManager.createTemplate("tree", 5)); } graphManager.on("save", (graph) => { @@ -47,7 +48,12 @@
- +