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

Troika Physics #15

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f9855f0
Support setting the `background` property on troika-3d scenes, to all…
Sep 18, 2019
2a6fb95
Add `dispatchEvent` world notifier
Sep 18, 2019
473ee99
troika-physics initial WIP. Worker physics world using ammo.js,
Sep 18, 2019
ac18326
Add troika-physics example
Sep 18, 2019
c6a6d6d
Fix roadmap checkboxes
Sep 18, 2019
1fd7b93
Cleanup. Re-use shared transform instance in `updateBodyMatrix`
Sep 18, 2019
d3089ef
Basic initial pass at automatically inferring physics shape from Thre…
Sep 18, 2019
9669da7
Support for Soft Bodies via `physics.isSoftBody`. Support dynamic cha…
Oct 3, 2019
08218e9
Add custom build of Ammo.js, with single-file WASM output to simplify…
Oct 14, 2019
528de6d
Merge upstream changes
Oct 17, 2019
ecb6691
Custom Ammo.js build now targeted at `worker` environment only to sim…
Oct 22, 2019
154b634
Allow termination of managed workers
Oct 22, 2019
7a0000f
Refactor physics modules to support separate output bundles for diffe…
Oct 22, 2019
1f165c2
Fix build to support commonJs export style in generated Ammo source f…
Oct 22, 2019
a2eed7a
Unique geometries for physics example shapes.
Oct 22, 2019
f6e51df
Don't mutate physicsWorldAmmoModule each time it's used. Add common s…
Oct 22, 2019
63a443e
Eliminate commonjs in main troika build, in favor of manually ES6 mod…
Oct 23, 2019
2902c2e
setMass: calculate inertia for mass change to rigid bodies
Nov 5, 2019
4ede18c
Support cylinders
Nov 5, 2019
83dc14e
WIP automatic compoundShapes and combined geometry from Troika Groups…
Feb 6, 2020
083c457
Update soft bodies to use transferable payloads, and to support 1D ro…
Feb 12, 2020
3c8ba70
refactor(physics): auto-combined colliders, transferable worker messa…
Feb 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 91 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
"node": "=8.16.0",
"npm": "=6.4.1"
},
"standard": {
"parser": "babel-eslint"
},
"devDependencies": {
"@ampproject/rollup-plugin-closure-compiler": "^0.10.0",
"@babel/core": "^7.6.2",
"@babel/preset-env": "^7.6.2",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"buble": "0.19.4",
"jest": "^24.9.0",
Expand All @@ -30,7 +34,7 @@
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-string": "^3.0.0",
"rollup-watch": "^4.3.1",
"standard": "^13.1.0"
"standard": "^14.3.1"
},
"scripts": {
"postinstall": "npm run bootstrap",
Expand All @@ -39,12 +43,13 @@
"build-opentype": "npm run bootstrap && lerna exec --scope=troika-3d-text -- npm run build-opentype",
"build-typr": "lerna exec --scope=troika-3d-text -- npm run build-typr",
"build-yoga": "npm run bootstrap && lerna exec --scope=troika-3d-ui -- npm run build-yoga",
"build-physics-ammo": "npm run bootstrap && lerna exec --scope=troika-physics -- npm run build-ammo",
"test": "jest",
"build-examples": "lerna exec --scope=troika-examples -- npm run build",
"serve-examples": "lerna exec --scope=troika-examples -- npm run serve",
"examples": "npm run serve-examples",
"serve-docs": "cd website && npm start",
"clean": "lerna exec -- rm -rf dist",
"lint": "lerna exec -- standard src/**/*.js src/**/*.jsx"
"lint": "lerna exec --no-bail -- standard src/**/*.js src/**/*.jsx --parser babel-eslint"
}
}
14 changes: 14 additions & 0 deletions packages/troika-3d/src/facade/Scene3DFacade.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ class Scene3DFacade extends Object3DFacade {
this.threeObject.fog = fogObj
}

/**
* Sets the ThreeJS Scene's `background` property.
*
* Parameters supported:
* - Color
* - Texture
* - CubeTexture
*
* @memberof Scene3DFacade
*/
set background(backgroundDef) {
this.threeObject.background = backgroundDef
}

getBoundingSphere() {
return INFINITE_SPHERE
}
Expand Down
1 change: 1 addition & 0 deletions packages/troika-3d/src/facade/World3DFacade.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class World3DFacade extends WorldBaseFacade {
facade: Scene3DFacade,
lights: this.lights,
objects: this.objects,
background: this.background,
fog: this.fog,
onClick: this.onBackgroundClick ? this._onBgClick : null
}
Expand Down
1 change: 1 addition & 0 deletions packages/troika-3d/src/react/Canvas3D.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Canvas3D extends ReactCanvasBase {
antialias: props.antialias,
rendererClass: props.rendererClass,
backgroundColor: props.backgroundColor,
background: props.background,
shadows: props.shadows,
camera: props.camera,
lights: props.lights,
Expand Down
3 changes: 3 additions & 0 deletions packages/troika-core/src/facade/WorldBaseFacade.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ WorldBaseFacade.prototype._notifyWorldHandlers = {
removeAllEventListeners(source) {
this.eventRegistry.removeAllListenersForFacade(source)
},
dispatchEvent(source, data) {
this.eventRegistry.forEachFacadeListenerOfType(data.targetFacade, data.type, data.handler, null)
},
addHtmlOverlay(source) {
this._htmlOverlays[source.$facadeId] = source
},
Expand Down
5 changes: 5 additions & 0 deletions packages/troika-examples/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,9 @@ a {
right: 0;
padding: 10px 20px;
background: rgba(255,255,255,.1);
}

.example_desc.dark {
color: rgba(0,0,0,.7);
background: rgba(0,0,0,.1);
}
Loading