Skip to content

Object3D: granular control of matrix updates with matrixWorldAutoUpdate#24028

Merged
mrdoob merged 8 commits intomrdoob:devfrom
CodyJasonBennett:feat/object3d-autoupdate
Aug 23, 2022
Merged

Object3D: granular control of matrix updates with matrixWorldAutoUpdate#24028
mrdoob merged 8 commits intomrdoob:devfrom
CodyJasonBennett:feat/object3d-autoupdate

Conversation

@CodyJasonBennett
Copy link
Contributor

@CodyJasonBennett CodyJasonBennett commented May 8, 2022

Related issue: #21387

Description

Currently, all scene objects have their matrices updated in Object3D#updateWorldMatrix or Object3D#updateMatrixWorld if somehow added to the scene. You can toggle this behavior with Scene.autoUpdate, but there's no way to let other objects do the same at any point in the scene graph.

This PR moves the Scene.autoUpdate property to Object3D.matrixWorldAutoUpdate to enable object-level opt-out of matrix updates in Object3D#updateWorldMatrix and Object3D#updateMatrixWorld. This behavior extends to matrix updates to cameras and scene objects from renderers.

@CodyJasonBennett CodyJasonBennett changed the title Move Scene.autoUpdate to Object3D for granular control in updateWorldMatrix Move Scene.autoUpdate to Object3D for granular control of matrix updates May 8, 2022
@mrdoob mrdoob added this to the r144 milestone Jul 28, 2022
@AlaricBaraou
Copy link
Contributor

Just saw that LOD objects extend Object3D and already use the autoUpdate property.

I thought this might be worth mentioning

@mrdoob
Copy link
Owner

mrdoob commented Aug 19, 2022

For consistency...

Should we just name it DefaultMatrixWorldAutoUpdate? ... and matixWorldAutoUpdate?

@CodyJasonBennett
Copy link
Contributor Author

I'd much prefer that to just autoUpdate. From a casual perspective, I wouldn't otherwise be able to guess what it does.

@CodyJasonBennett CodyJasonBennett changed the title Move Scene.autoUpdate to Object3D for granular control of matrix updates Object3D: granular control of matrix updates with matrixWorldAutoUpdate Aug 19, 2022
@mrdoob mrdoob merged commit d091564 into mrdoob:dev Aug 23, 2022
@mrdoob
Copy link
Owner

mrdoob commented Aug 23, 2022

Thanks!

@CodyJasonBennett CodyJasonBennett deleted the feat/object3d-autoupdate branch August 23, 2022 01:02
@mrdoob
Copy link
Owner

mrdoob commented Aug 23, 2022

A few tweaks: 7ca0bb6 757dadf c6e9386

abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
…te (mrdoob#24028)

* feat(Object3D): object-level `autoUpdate`

* chore: update docs

* fix(Object3D): respect `autoUpdate` in updateMatrixWorld

* fix(renderers): respect `camera.autoUpdate` on render

* Use strict equal codestyle, respect autoUpdate with `updateParents`

* Object3D: rename autoUpdate to matrixWorldAutoUpdate

* Global: respect Object3D.matrixWorldAutoUpdate
snagy pushed a commit to snagy/three.js-1 that referenced this pull request Sep 21, 2022
…te (mrdoob#24028)

* feat(Object3D): object-level `autoUpdate`

* chore: update docs

* fix(Object3D): respect `autoUpdate` in updateMatrixWorld

* fix(renderers): respect `camera.autoUpdate` on render

* Use strict equal codestyle, respect autoUpdate with `updateParents`

* Object3D: rename autoUpdate to matrixWorldAutoUpdate

* Global: respect Object3D.matrixWorldAutoUpdate
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

Successfully merging this pull request may close these issues.

3 participants