Repo structure
Some thoughts: @bhouston you mentioned that you'd like this project to be able to talk to webgl2 as well as webgpu. Others might even like webgl1. I think it's a good opportunity to make it modular: have the math stuff as a module, a module for the renderer API, one for the material API, and then one module with webgl2 (actual renderer+shaders), same for webgpu... We could have a module for orbit controls then etc. This would turn the structure into the trendy lerna monorepo thing. The big advantage is that it would make the project the more friendly to use and let people transition across webgl1/2/webgpu. The code could look something like:
import { Vector3 } from "@threeify/maths";
import { Box } from "@threeify/geometries";
import { Mesh, Scene } from "@threeify/scene-graph";
import { Renderer } from "@threeify/renderer";
import { PBRMaterial } from "@threeify/materials";
import { webgl2 } from "@threeify/webgl2";
const renderer = new Renderer(webgl2);
const material = new PBRMaterial();
const geometry = new Box();
const mesh = new Mesh({ geometry, material });
TODO: Benchmark how PlayCanvas and Babylon did their webgl2 and webgpu demos from their existing library stack
Can we could also likely make the threeify-glsl-transpiler a module in the same spirit. I do like that structure. Let's do it.
We could just adopt Yarn2 instead of Lerna. I understand this is preferred.
A popular recipe for setting up monorepo for JavScript projects is the combination of Yarn’s workspaces (existed since Yarn 1) and Lerna as a project manager.
The good news with Yarn 2 is that now, Yarn doubles as being both a package manager as well as a project manager and aims to provide a wholesome experience for running monorepos smoothly.
https://snyk.io/blog/yarn-2-intro/
More details:
https://dev.to/lampewebdev/node-on-rails-creating-a-monorepo-aka-workspaces-with-yarn-284i
I've asked for input on Twitter here: https://twitter.com/BenHouston3D/status/1270750233316798467
Yes I wanted to make a case for yarn for another reason, but it's a better tool indeed
Lena works with yarn workspaces also, so we can use both together
Internally we are just using Yarn2. My recommendation is to lets get this working as a rendering engine before going modular. I just want to ensure that we can get provable results from the project before refactoring it.
BTW I was able to get "@threeify/" modules resolution working in the /examples folder via just tsconfig.json settings. Using this approach:
https://stackoverflow.com/a/43330003
I've adopted a mono-repository format.