-
Notifications
You must be signed in to change notification settings - Fork 23
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
Move to modern JS #16
base: gh-pages
Are you sure you want to change the base?
Conversation
cc2e232
to
09f24c0
Compare
Hi Valerio, and thanks for this hard work, as it gives me a new point of view on "modern JS", of which I'm not an expert yet. I have a few questions:
Again, thanks for your effort. I can't merge it on the main branch as-is (mostly because of the extra kilobytes), though I can add a link to your repo for people looking for an OOP approach. Other forks have started adding hoooks for other languages/systems, I will add links to them too :) Cheers and happy new year, |
Hei Xem, For these reasons I thought that the project could fit better like a tree shakable module than a black or white minified file to download. Cheers and happy new year too, |
FWIW, I think the "micro" aspect of this library is the critical feature, so I don't think there should be any changes that increase the final zipped file by more than a few bytes. |
Hi guys, here Valerio from twitter.
Nice repo.
I've just moved the project to a modern JS implementation using the OOP approach.
In this way we can hide to the developer useless internal method for he/she, have a more clean repository and use shader with original glsl file format. Now the repo is bundled using rollup and at each build it creates a module file (to publish on npm) a simple js file for browser/cdn purposes and a zip file.
The global file is a little heavier but thanks to rollup is tree shakable so if I just need the cube (or any other non necessary model or plugin) the other will be removed at build time!
Other thing is that rollup minified the program so we can use more verbose params and variable names (it's been very hard debug the program with this really short names).
The API is little changed so; now for call the program we need:
const w = new W.Renderer(props)
where, currently, props are:{debug: boolean, canvas: HTMLCanvasElement}
. Then we can call the same method from thew
constant likew.light(props)
.Call the built-in models now is
w.add({modelName: string, object: obj, settings: set})
where object isW.Cube
,W.Spere
and so on and the settings are the usualgroup, name, size, position, rotation, background, texture, smooth...
If I may suggest some advice the next things to do are:
Once the deployments are done we can also remove the
dist/
folder from the repo.