How chiroyupy/shadeflow works
ShadeFlow is a browser-based node shader editor: users build and inspect a graph, the app compiles it to typed IR and generates shader code, and WebGL2 runs GLSL for the result preview. The UI also supports project files, local autosave, node-level previews, and GLSL/WGSL/HLSL code views; the README documents examples and explanatory notes. Edges follow the sampled calls and explicit README architecture; some UI capabilities and implementation details are unsampled, so uncertain links are omitted.
Main entry points: App.tsx App coordinator · Editor.tsx Graph editor · fileActions.ts Project and clipboard actions · lower.ts Graph lowering
Components 30
Editor interface
- App coordinator
src/App.tsx - Graph editor
src/editor/Editor.tsx - Shader nodes
src/editor/ShadeNode.tsx - Node preview view
src/editor/NodePreview.tsx - Node palette
src/ui/NodePalette.tsx - Toolbar
src/ui/Toolbar.tsx - Code panel
src/ui/CodePanel.tsx - Context menu
src/ui/ContextMenu.tsx
Project and UI state
- Graph store
src/store/graphStore.ts - UI store
src/store/uiStore.ts - Project and clipboard actions
src/store/fileActions.ts
Graph compiler
- Graph model
src/core/graph.ts - Node definitions
src/core/nodes/definition.ts - Node registry
src/core/nodes/registry.ts - Port typing
src/core/typing.ts - Graph lowering
src/core/compile/lower.ts - IR builder
src/core/ir/builder.ts - Typed IR
src/core/ir/ir.ts - Code generation
src/core/codegen/emit.ts - GLSL backend
src/core/codegen/glsl.ts - WGSL backend
src/core/codegen/wgsl.ts - HLSL backend
src/core/codegen/hlsl.ts
Shader rendering
- Node preview hub
src/render/previewHub.ts - Result preview
src/ui/Preview.tsx - Shader canvas
src/render/ShaderCanvas.tsx - WebGL renderer
src/render/ShaderRenderer.ts - WebGL2 context
src/render/gl.ts
Other components
- Shader author
- Browser local storage
- JSON project files
Connections 35
- Shader author → Graph editor: edits graph
README.md - App coordinator → Graph editor: renders
src/App.tsx - Graph editor → Graph store: edits graph state
src/editor/Editor.tsx - Graph editor → Shader nodes: renders nodes
src/editor/Editor.tsx - Shader nodes → Node preview view: renders preview
src/editor/ShadeNode.tsx - Node preview view → Node preview hub: registers previews
src/editor/NodePreview.tsx - App coordinator → Graph lowering: compiles graph
src/App.tsx - App coordinator → GLSL backend: generates GLSL
src/App.tsx - App coordinator → Result preview: shows result
src/App.tsx - App coordinator → Toolbar: renders
src/App.tsx - App coordinator → Node palette: renders
src/App.tsx - App coordinator → Code panel: renders
src/App.tsx - App coordinator → Context menu: renders
src/App.tsx - Toolbar → Project and clipboard actions: runs project actions
src/ui/Toolbar.tsx - Context menu → Project and clipboard actions: runs clipboard actions
src/ui/ContextMenu.tsx - Project and clipboard actions → Graph store: replaces graph
src/store/fileActions.ts - Project and clipboard actions → UI store: sets notices
src/store/fileActions.ts - Graph store → Browser local storage: autosaves project
src/store/graphStore.ts - Graph store → JSON project files: parses and serializes
src/store/graphStore.ts - Project and clipboard actions → JSON project files: imports and exports
src/store/fileActions.ts - Graph lowering → Graph model: reads graph
src/core/compile/lower.ts - Graph lowering → Node registry: looks up definitions
src/core/compile/lower.ts - Graph lowering → IR builder: builds instructions
src/core/compile/lower.ts - IR builder → Typed IR: constructs
src/core/ir/builder.ts - Node registry → Node definitions: registers definitions
src/core/nodes/registry.ts - Graph editor → Port typing: uses port validation
src/editor/Editor.tsx - Code generation → Typed IR: reads instructions
src/core/codegen/emit.ts - GLSL backend → Code generation: emits GLSL
src/core/index.ts - WGSL backend → Code generation: emits WGSL
src/core/codegen/wgsl.ts - HLSL backend → Code generation: emits HLSL
src/core/index.ts - Node preview hub → Graph store: subscribes to graph
src/render/previewHub.ts - Node preview hub → Graph lowering: compiles node output
src/render/previewHub.ts - Result preview → Shader canvas: renders canvas
src/ui/Preview.tsx - Shader canvas → WebGL renderer: draws shader
src/ui/Preview.tsx - WebGL renderer → WebGL2 context: creates GL context
src/render/ShaderRenderer.ts