Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo structure #22

Closed
Astrak opened this issue Jun 10, 2020 · 8 comments
Closed

Repo structure #22

Astrak opened this issue Jun 10, 2020 · 8 comments

Comments

@Astrak
Copy link
Collaborator

Astrak commented Jun 10, 2020

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

@bhouston
Copy link
Owner

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.

@bhouston
Copy link
Owner

bhouston commented Jun 10, 2020

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

@bhouston
Copy link
Owner

I've asked for input on Twitter here: https://twitter.com/BenHouston3D/status/1270750233316798467

@Astrak
Copy link
Collaborator Author

Astrak commented Jun 10, 2020

Yes I wanted to make a case for yarn for another reason, but it's a better tool indeed

@Astrak
Copy link
Collaborator Author

Astrak commented Jun 10, 2020

Lena works with yarn workspaces also, so we can use both together

@bhouston
Copy link
Owner

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.

@bhouston
Copy link
Owner

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

@bhouston
Copy link
Owner

I've adopted a mono-repository format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants