-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Object3D: matrixNeedsUpdate and matrix/orientation optimizations #28534
Draft
CodyJasonBennett
wants to merge
17
commits into
mrdoob:dev
Choose a base branch
from
CodyJasonBennett:object3d-update-flags
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
dd76004
Object3D: matrixNeedsUpdate and flags for matrix/orientation sync
CodyJasonBennett 241db0f
Object3D: mark matrixworld only on update
CodyJasonBennett 8c69327
Helpers: don't mutate matrix
CodyJasonBennett 0273ef8
PointLightHelper: automatically update on scene traversal
CodyJasonBennett a58e1f0
Object3D: flip matrixworld flag on decompose
CodyJasonBennett 6ea576e
Object3D: flip worldmatrix flag when local matrix modified
CodyJasonBennett c6b25f0
Merge branch 'dev' into object3d-update-flags
CodyJasonBennett a0be315
Object3D: update matrix when methods are called instead
CodyJasonBennett c979236
Merge branch 'dev' into object3d-update-flags
CodyJasonBennett 1b5b0cc
Object3D: cleanup
CodyJasonBennett fd3c446
Docs: add Object3D.matrixNeedsUpdate
CodyJasonBennett 34f19f7
Merge branch 'dev' into object3d-update-flags
CodyJasonBennett fd4d928
Helpers: cleanup
CodyJasonBennett 3675461
Math: restore private euler/quaternion accessors as aliases
CodyJasonBennett c403f5e
Merge branch 'dev' into object3d-update-flags
CodyJasonBennett fc1cc1a
Euler: restore old JSON format
CodyJasonBennett f22acbd
Merge branch 'dev' into object3d-update-flags
CodyJasonBennett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
|
@@ -107,8 +107,8 @@ class CameraHelper extends LineSegments { | |
this.camera = camera; | ||
if ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix(); | ||
|
||
this.matrix = camera.matrixWorld; | ||
this.matrixAutoUpdate = false; | ||
this.matrixWorld = camera.matrixWorld; | ||
this.matrixWorldAutoUpdate = false; | ||
Comment on lines
-110
to
+111
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This relied on the fact that world matrices were always updated even transiently. Since #28533, we can do this instead. |
||
|
||
this.pointMap = pointMap; | ||
|
||
|
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listenToProperties
adds an on-read and on-write callback to named keys (not a deopt), which we use here to setmatrixNeedsUpdate
when transform properties are modified. On-read is used to convert quaternion/rotation like before, but only if their counterpart is dirty when read, preventing many unneeded conversions on mutation (which can be many times). Notably, if users stick toquaternion
, they will avoid this conversion entirely. This is nice so we don't have to modify math classes like before.listenToMethods
I have as a special case for the local matrix whose members would be deopt if I just listened to all elements in its array. This is because array accessors are not named and unstable, so v8 would need to create a layer of indirection to make them stable. We wantmatrixWorldNeedsUpdate
to be set whenever the local matrix updates to preserve existing behavior, so I instead handle the cases where local matrix is modified by its methods (which are named keys), and don't handle the case wherematrix.elements
is mutated directly (matrixWorldNeedsUpdate
has to then be set by the user). This keeps us on the fast path for common usage without breaking APIs who expected a 1-1 relationship between local and world matrix updates.