Skip to content

Commit 130bc8a

Browse files
committed
readme, over, metatags, build test
1 parent 85f1026 commit 130bc8a

File tree

8 files changed

+135
-5
lines changed

8 files changed

+135
-5
lines changed

.github/workflows/pages.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy app to girhub pages
2+
3+
# Trigger the workflow on push to the main branch
4+
on:
5+
push:
6+
branches:
7+
- main # Change this if your default branch is different (e.g., 'master')
8+
9+
# Permissions for deploying to gh-pages
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
# Jobs to run
16+
jobs:
17+
build-and-deploy:
18+
runs-on: ubuntu-latest # Use the latest Ubuntu runner
19+
20+
steps:
21+
# Checkout the repository code
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
# Set up Node.js environment
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20' # Use the Node version compatible with your project
30+
cache: 'pnpm' # Cache pnpm dependencies for faster builds
31+
32+
# Install PNPM
33+
- name: Install PNPM
34+
run: npm install -g pnpm # Installs pnpm globally
35+
36+
# Install dependencies with PNPM
37+
- name: Install Dependencies
38+
run: pnpm install # Uses pnpm to install project dependencies
39+
40+
# Build the Vite project with PNPM
41+
- name: Build
42+
run: pnpm run build # Assumes your package.json has "build": "vite build"
43+
44+
# Configure GitHub Pages deployment
45+
- name: Setup Pages
46+
uses: actions/configure-pages@v5
47+
48+
# Upload the built files (Vite outputs to 'dist' by default)
49+
- name: Upload Artifact
50+
uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: ./dist # Vite's default output directory
53+
54+
# Deploy to GitHub Pages
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4
58+
59+
# Optional: Concurrency to avoid multiple deployments running at once
60+
concurrency:
61+
group: "pages"
62+
cancel-in-progress: true

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# three.js TSL Visual Node Editor
2+
3+
## **[!] Work in progress | Alpha state** <br/>
4+
Visual node editor, inspired by [Blender's shader editor](https://www.blender.org/), is a tool to visually build [Three.js](https://threejs.org/) materials using [Three.js-Shading-Language](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language).
5+
6+
It is currently in development, and hoping to welcome developers from the comunity to jump in and add new nodes. Credit will be given to everyone!
7+
8+
# How does it work?
9+
When you use the app: You create the nodes and the output will be a javascript file that will contain the nodes you created + the node setup in a comment, in case you want to edit the nodes after saving. In your real life project you will import the materials from this js, that will export an array of the materials. You will do something like...
10+
11+
```js
12+
import { materials } from "./your-saved-file.js";
13+
const material1 = materials[0]; //<-- this is a THREE.Material
14+
```
15+
16+
# How to collaborate?
17+
I did a few basic nodes, I think the skeleton is setup to allow for easy addition of new nodes, the ideal is for "you" to add new nodes or even improve the current ones. To do so, you must check the [Three.js-Shading-Language Docs](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language)
18+
19+
You can also fix bugs or improve the code/interface. Just clone and do a pull request.
20+
21+
# == Nodes "done"... ==
22+
These are the nodes currently "done" (room for improvement)...
23+
- UV Channel
24+
- Scene Preview
25+
- (incomplete) MeshStandardNode shader node. ( only colorNode property )
26+
- Image texture node
27+
28+
------
29+
------
30+
------
31+
32+
# Design / How it works...
33+
## Concepts / Building blocks
34+
- **Node** : they live in `src/nodes` they are the objects in charge of defining a node and whatever that node does. A Node is not a 1:1 recreation of a TSL node, a node can do a bunch of things, even use many nodes at the same time and build complex structures in TSL.
35+
- **Property** : Nodes are a bag filled with properties. They live in `src/properties` and each property is in charge of one aspect of the node.
36+
- **Outlet**: the input or output socket of a node. A node can have many of both. An outlet is a property that handles the connection between the outside and the node.
37+
- **Component**: The most basic UI unit. A button, a TextLabel, etc...
38+
- **Script**: Since this exports a javascript, a `src/export/Script` object is created the moment of the export and each node will be asked to "write" on this script whatever it needs to function. Then this script is covnerted to a string and downloaded as the .js file. The layout info is stored in this file as a comment.
39+
- **ThreeScene**: object in charge of the preview scene running in the background that allows us to see how the material will look.
40+
41+
## Theme / colors / styles
42+
The app is "skinned" using the theme provided by `src/colors/Theme`. A singleton class that provides the settings for the styles.
43+
44+
## The Script
45+
Nodes in this app export to a javascript file. This object is in charge of handling how that file is written.
46+
47+
A `Script` is an object that serves as a scope for every node when writing their scripts. "Writing their scripts" means basically writing the actual javascript TSL code that the node represents.
48+
49+
The process is first triggered by the `src/Editor.ts:save()` that creates this object and then asks every node to `.writeScript( script )` to it. This process will generate a domino effect that will "travel" from the node, then it will to the connected nodes vía the input outlets that connect the node to the next node, and so on... until there's no more nodes with connections.
50+
51+
For more info ask me here or via x @bandinopla...

index.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
5+
<link rel="shortcut icon" href="favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + TS</title>
7+
<meta name="twitter:card" content="summary_large_image">
8+
<meta name="twitter:site" content="@bandinopla">
9+
<meta name="twitter:title" content="Three.js - TSL Visual Node Editor">
10+
<meta property="og:image" content="https://github.com/bandinopla/three.js-visual-node-editor/raw/main/cover.png">
11+
<title>Three.js - TSL Visual Node Editor </title>
812
<style>
913
html, body {
1014
padding: 0px;
@@ -19,9 +23,18 @@
1923
top:0px;
2024
left: 0px;
2125
}
26+
.controls {
27+
position: fixed;
28+
bottom: 10px;
29+
left: 0px;
30+
right: 0px;
31+
text-align: center;
32+
z-index: 99;
33+
}
2234
</style>
2335
</head>
2436
<body>
37+
<div class="controls"><strong>ALPHA RELEASE</strong> | DOUBLE CLICK: add new node | SHIFT+A : open | SHIFT+S : save | <a href="https://github.com/bandinopla/three.js-visual-node-editor" target="_blank">Github Page</a></div>
2538
<canvas id="app" width="1024" height="1024"></canvas>
2639
<script type="module" src="/src/main.ts"></script>
2740
</body>

public/cover.png

90.6 KB
Loading

public/favicon.ico

1.47 KB
Binary file not shown.

src/Editor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,10 @@ export class Editor {
10931093

10941094
this.restore( data );
10951095
}
1096+
else
1097+
{
1098+
alert("The selected file is not compatible or what not made by this app.")
1099+
}
10961100
};
10971101

10981102
reader.onerror = () => alert('Error reading file') ;

src/ThreeScene.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class ThreeScene {
5858
//
5959
// dummy objects
6060
//
61-
const cube = new THREE.Mesh( new THREE.BoxGeometry( 2, 2, 2 ), material );
61+
const cube = new THREE.Mesh( new THREE.BoxGeometry( 1, 1, 1 ), material );
6262
cube.name="Cube";
6363
this.objs.push( cube );
6464
this.objHolder.add(cube);

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
/* Linting */
1717
"strict": true,
18-
"noUnusedLocals": true,
19-
"noUnusedParameters": true,
18+
"noUnusedLocals": false,
19+
"noUnusedParameters": false,
2020
"noFallthroughCasesInSwitch": true,
2121
"noUncheckedSideEffectImports": true
2222
},

0 commit comments

Comments
 (0)