-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix: render bugs caused by diff algorithm and pre-comp #53
Conversation
WalkthroughThe recent changes involve a refactoring of class properties and methods to improve the handling of masks in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ? TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 2
Configuration used: .coderabbit.yaml
Files selected for processing (3)
- packages/effects-core/src/composition-source-manager.ts (6 hunks)
- packages/effects-core/src/plugins/sprite/sprite-mesh.ts (1 hunks)
- web-packages/demo/src/single.ts (2 hunks)
Files skipped from review due to trivial changes (1)
- web-packages/demo/src/single.ts
Additional comments: 5
packages/effects-core/src/composition-source-manager.ts (3)
134-134: Verify that the
processMask
method is implemented correctly and that it's being called with the correctmaskRef
value. Ensure that themaskRef
value is unique and consistent for each item that requires mask processing.182-182: The
maskRef
variable is incremented each time an item of typecomposition
is processed. Ensure that this increment operation is safe and thatmaskRef
is used correctly throughout the method.243-248: Ensure that the condition
maskMode !== spec.MaskMode.NONE
is the correct logic for determining when to apply themaskRef
to the renderer. If there are other conditions under which the mask should not be applied, they should be included in this check.packages/effects-core/src/plugins/sprite/sprite-mesh.ts (2)
202-210: The logic for visibility checks and transformation assignments has been updated. Ensure that the new logic correctly handles the cases when a sprite is not visible and not initialized, as intended by the PR objectives.
206-206: Verify that setting
mainDataArray[uSizeStart + 2]
to-1
is the correct behavior for sprites that are not visible and not initialized. This seems to be a sentinel value indicating a special state, which should be documented or clarified in the code.
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.
Review Status
Actionable comments generated: 0
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- web-packages/demo/src/single.ts (2 hunks)
Files skipped from review due to trivial changes (1)
- web-packages/demo/src/single.ts
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.
Review Status
Actionable comments generated: 5
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- packages/effects-core/src/composition-source-manager.ts (5 hunks)
Additional comments: 2
packages/effects-core/src/composition-source-manager.ts (2)
196-196: The
processMask
method is called within a loop overref.items
. IfprocessMask
has side effects on shared state, this could lead to unexpected behavior. Ensure thatprocessMask
is idempotent or that its effects are well-documented and understood.243-251: The
processMask
method setsrenderer.mask
only if it is not already set. This logic assumes thatrenderer.mask
being set is an indication that no further processing is needed. Confirm that this assumption is always valid, or consider handling cases whererenderer.mask
might need to be updated or processed further.
} else if (maskMode === spec.MaskMode.OBSCURED || maskMode === spec.MaskMode.REVERSE_OBSCURED) { | ||
renderContent.renderer.mask = mask; | ||
} | ||
this.processMask(renderContent.renderer, this.mask); |
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.
The processMask
method is called with this.mask
which is post-incremented in the assembleItems
method. This could lead to confusion about the value being passed. It would be clearer to increment mask
before passing it to processMask
to ensure the intended value is used.
- let mask = this.mask++;
- this.processMask(renderContent.renderer, this.mask);
+ let mask = ++this.mask;
+ this.processMask(renderContent.renderer, mask);
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
this.processMask(renderContent.renderer, this.mask); | |
let mask = ++this.mask; | |
this.processMask(renderContent.renderer, mask); |
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.
Review Status
Actionable comments generated: 0
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- packages/effects-core/src/composition-source-manager.ts (6 hunks)
Files skipped from review due to trivial changes (1)
- packages/effects-core/src/composition-source-manager.ts
Summary by CodeRabbit
Refactor
CompositionSourceManager
with improved mask handling and processing.SpriteMesh
class for better performance.Bug Fixes
Chores
createPlayer
function to streamline the codebase.