forked from silviopaganini/physijs-browserify
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(docs): add a README describing physijs changes
- this makes it more explicit why it's been vendored in -- it has incompatible changes -- and makes more explicit what those changes are with documentation (instead of just commit messages) - it also explains why those changes were made, with lots of links as there's a decent bit of context around that - and this context is key to what made this library possible, so it's good to have finally documented it! - also add the same worker links to the app root README for anyone who might want more info on those - (pkg): modify package.json files config so that this new README isn't included in the package
- Loading branch information
Showing
3 changed files
with
21 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# PhysiJS Changes | ||
|
||
The files here are 99.9% the same as the original [`physijs`](https://github.com/chandlerprall/Physijs) code. | ||
There are a few small modifications to make it compatible with bundlers and work out-of-the-box with zero config: | ||
|
||
- accepting the `PhysijsWorker` constructor function as an argument instead of just using `new Worker(...)` | ||
- this allows for custom workers, such as those of [`worker-loader`](https://github.com/webpack-contrib/worker-loader) and [`webworkify`](https://github.com/browserify/webworkify) | ||
- it also means one no longer has to set `Physijs.scripts.worker` | ||
- `require`ing `ammo.js` directly in the `physijs_worker.js` file instead of using [`importScripts`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Importing_scripts_and_libraries) | ||
- this can only be done because of the extra functionality we get from a bundler and its custom worker | ||
- this means one no longer has to set `Physijs.scripts.ammo` | ||
- slightly change the `Ammo` code so it doesn't try to `require` anything in its Emscripten header | ||
- Emscripten (or at least the old version that was used to create Physijs's old vendored `ammo.js`) output both web and node code in one file, so it caused issues when being parsed by bundlers (can read more [here](https://github.com/agilgur5/physijs-webpack/commit/0174f2c073f62684c764b83cacf66102445d2218)) | ||
|
||
[`silviopaganini/physijs-browserify`](https://github.com/silviopaganini/physijs-browserify), which this library was originally based off, also made some changes: | ||
|
||
- exporting as a CJS module with `module.exports` instead of a global with `window.Physijs` | ||
- accepting [`THREE`](https://github.com/mrdoob/three.js) as an argument instead of assuming it exists as a global |