-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix: project container.cullArea from local to global coordinate space before doing cull check #11598
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
base: dev
Are you sure you want to change the base?
Conversation
bffadd8
to
8b6b8a4
Compare
@jujurocket , have you had a chance to look into failing unit tests? |
c87e643
to
20be1dc
Compare
The test While I was trying to figure it out however I took the time to create a test scene to visualise it: The tiny red pixel in the top left is how the cullArea behaved before my fix. Because it was global, its position and rotation were unaffected by the position and rotation of its parent. It tests for The green rectangle is how it behaves after my fix, and as you can see it just about touches the corner of the view area. Was this test written as an edge case by design? The cull area really does only just barely touch the view rectangle corner. |
f35e1e3
to
ad46f56
Compare
pixi.js-base • pixi.js-bunny-mark
commit: |
Thank you @jujurocket! |
src/culling/Culler.ts
Outdated
|| bounds.y + bounds.height <= view.y; | ||
container.culled = !tempRectangle.intersects( | ||
container.cullArea, | ||
container.getGlobalTransform(Matrix.shared, skipUpdateTransform) |
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.
hello! we should be able to grab the transform and avoid getGlobalTransform via
container.worldTransform
<- this should be a ready to go global matrix 👍
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.
Would this not mean that the skipUpdateTransform
flag gets ignored though?
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.
@GoodBoyDigital could we get a follow-up on this? Happy to go either way, just wanted to make sure this flag is not being overlooked
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.
heya - sorry for the later reply! slammed at the mo :D
it should yes, my thinking is that al the transforms should have already happened and we don't need to recalcualte them?
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.
no worries!
Ok I am not as familiar with the codebase so happy to go with your suggestion, was just making sure it was not being overlooked 👍
6691104
to
411eb9f
Compare
411eb9f
to
cfcbaa5
Compare
@GoodBoyDigital applied your suggestion and it seems to work the same 👍 to you and @mayakwd thank you both very much for your help! |
Everything is green, well done @jujurocket! |
Description of change
fixes #11597
When an object's
cullArea
is defined, during culling the cullArea will be transformed from local coordinate space to global space (which it should do according to the docs).I fixed it in a bit of a crude manner, so I might have missed some usecases. Please feel free to make changes or suggest any.
It is currently failing the following test in
Culler.test.ts
:If this is indeed the desired behaviour then I will go ahead and change the test as well.
Pre-Merge Checklist
npm run lint
)npm run test
)