-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
Frustrum culling for tilemap #8935
base: dev
Are you sure you want to change the base?
Conversation
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.
lgtm.
Small note about readability that might be improved.
int32_t row_count = (int32_t)resource->m_RowCount; | ||
int32_t min_x = resource->m_MinCellX + region_x * TILEGRID_REGION_SIZE; | ||
int32_t min_y = resource->m_MinCellY + region_y * TILEGRID_REGION_SIZE; | ||
int32_t max_x = dmMath::Min(min_x + (int32_t)TILEGRID_REGION_SIZE, resource->m_MinCellX + column_count); |
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.
Will column_count
ever be < 1?
And even if it is, we can set it to 1?
I feel that the two cases inside Min() are a bit tricky to read. One uses "min_x", and the other uses "m_MinCellX".
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.
column_count
can not be < 1. I cast all unsigned type to signed because at last step here https://github.com/defold/defold/pull/8935/files/fa8d2d61102b20660bcee6144fba1c7e79b6ef4d#diff-840abe2ff7226d24a7cc3b2884131009a9cc28f9a062011b163f31a83c1608ebR661-R662 I ran into issue that signed min_...
that < 0 cast to unsigned and I got very huge number. That why I converted all variables to signed types.
fa8d2d6
to
652a9c1
Compare
Fixes #6938, #8744
Technical changes
One render entry for tile map is tilemap region. So I check visibility for whole region, not for every tile. Region size now is 32x32 tiles. That's why id region partially outside of the camera frustrum - is will fully rendered.
Docs: defold/doc#435
PR checklist
Example of a well written PR description:
### Technical changes
Technical changes:
Technical notes: