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

[Citadel][TPE] Cache Entity data #73

Merged
merged 1 commit into from
Jun 29, 2020
Merged

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Jun 25, 2020

Added flags to keep track of entity changes so that we can return cached data like collide bitmasks and bounding box if no changes are detected.

While making these changes, I noticed there was already a flag to keep track of bounding box changes (bboxDirty) but it was never set to true so bounding boxes were never recomputed.

I added some logic and public functions to to help propagate these flags up the tree (Set|GetParent, ChildrenChanged). Not ideal so feedback welcome.

Signed-off-by: Ian Chen [email protected]

@iche033 iche033 requested a review from mxgrey as a code owner June 25, 2020 23:40
@codecov
Copy link

codecov bot commented Jun 25, 2020

Codecov Report

Merging #73 into tpe_collide_bitmask will increase coverage by 0.08%.
The diff coverage is 96.29%.

Impacted file tree graph

@@                   Coverage Diff                   @@
##           tpe_collide_bitmask      #73      +/-   ##
=======================================================
+ Coverage                82.66%   82.74%   +0.08%     
=======================================================
  Files                      106      106              
  Lines                     3622     3645      +23     
=======================================================
+ Hits                      2994     3016      +22     
- Misses                     628      629       +1     
Impacted Files Coverage Δ
tpe/lib/src/Entity.hh 0.00% <ø> (ø)
tpe/lib/src/Entity.cc 85.34% <95.23%> (+1.50%) ⬆️
tpe/lib/src/Collision.cc 82.22% <100.00%> (+0.82%) ⬆️
tpe/lib/src/Link.cc 100.00% <100.00%> (ø)
tpe/lib/src/Model.cc 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1555caa...bde0515. Read the comment docs.

@iche033 iche033 changed the title [TPE][Citadel] Cache Entity data [Citadel][TPE] Cache Entity data Jun 25, 2020
Copy link
Member

@luca-della-vedova luca-della-vedova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I think the added logic of keeping track of parents and children is OK, considering it will help in case we have other properties to keep track of (like the bounding box issue you just found).
Just a small note on adding tests for the bitmask feature but other than that looks good!

EXPECT_EQ(expectedBoxLinkFrame, linkEnt.GetBoundingBox(true));
EXPECT_EQ(expectedBoxLinkFrame, linkEnt.GetBoundingBox());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting, so basically since _force was being set to true before the dirty flag was actually not being tested?
Can you add a few lines to set bitmasks for the Collision objects here and test the OR-ing / collideBitmaskDirty logic as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's correct, removing the force arg revealed that bounding box caching was not working.

there is already a CollideBitmask test added in pull request #69 (here) and I've been using that to test this PR. It should cover collideBitmaskDirty logic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok saw it, looks great!

@iche033 iche033 merged commit 849bb90 into tpe_collide_bitmask Jun 29, 2020
@iche033 iche033 deleted the tpe_caching branch June 29, 2020 18:36
iche033 added a commit that referenced this pull request Jul 6, 2020
…nd add CollisionFilterMaskFeature (#69)

* Add collide bitmask and CollisionFilterMaskFeature

Signed-off-by: Ian Chen <[email protected]>

* cleanup

Signed-off-by: Ian Chen <[email protected]>

* use unordered map in tpe collision checking, remove bitmask cache

Signed-off-by: Ian Chen <[email protected]>

* tpe cache collide bitmask and bbox (#73)

Signed-off-by: Ian Chen <[email protected]>

* add sdf include

Signed-off-by: Ian Chen <[email protected]>

* fixing windows build

Signed-off-by: Ian Chen <[email protected]>

* fixing windows

Signed-off-by: Ian Chen <[email protected]>

* fixing windows

Signed-off-by: Ian Chen <[email protected]>
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.

2 participants