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

fix: render bugs caused by diff algorithm and pre-comp #53

Merged
merged 5 commits into from
Dec 19, 2023
Merged

Conversation

RGCHN
Copy link
Contributor

@RGCHN RGCHN commented Dec 18, 2023

Summary by CodeRabbit

  • Refactor

    • Enhanced the CompositionSourceManager with improved mask handling and processing.
    • Optimized the visibility check and transformation assignment in the SpriteMesh class for better performance.
  • Bug Fixes

    • Updated the data fetch URL in the demo application to ensure accurate content retrieval.
  • Chores

    • Removed an unused variable from the createPlayer function to streamline the codebase.

Copy link
Contributor

coderabbitai bot commented Dec 18, 2023

Walkthrough

The recent changes involve a refactoring of class properties and methods to improve the handling of masks in the CompositionSourceManager, and a restructuring of visibility and transformation logic in the SpriteMesh class. Additionally, there's a minor update in a demo TypeScript file where the URL for a JSON resource is updated, and an unused variable is removed.

Changes

Files Summary
.../composition-source-manager.ts, .../sprite/sprite-mesh.ts Refactored properties and methods for mask handling; restructured visibility and transformation logic.
web-packages/demo/src/single.ts Updated JSON resource URL; removed unused variable.

"In the code where logic threads weave,
🐇 A rabbit hopped, making changes with glee.
Masks and sprites dance in a new light,
Bugs hop away, out of sight."

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 ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Sruimeng
Sruimeng previously approved these changes Dec 18, 2023
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 9248cc1 and f4b0782.
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 correct maskRef value. Ensure that the maskRef value is unique and consistent for each item that requires mask processing.

  • 182-182: The maskRef variable is incremented each time an item of type composition is processed. Ensure that this increment operation is safe and that maskRef 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 the maskRef 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between f4b0782 and 36e153d.
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

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 36e153d and 40eac18.
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 over ref.items. If processMask has side effects on shared state, this could lead to unexpected behavior. Ensure that processMask is idempotent or that its effects are well-documented and understood.

  • 243-251: The processMask method sets renderer.mask only if it is not already set. This logic assumes that renderer.mask being set is an indication that no further processing is needed. Confirm that this assumption is always valid, or consider handling cases where renderer.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);
Copy link
Contributor

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.

Suggested change
this.processMask(renderContent.renderer, this.mask);
let mask = ++this.mask;
this.processMask(renderContent.renderer, mask);

packages/effects-core/src/composition-source-manager.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 40eac18 and 30581eb.
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

@yiiqii yiiqii merged commit a245207 into main Dec 19, 2023
2 checks passed
@yiiqii yiiqii deleted the hotfix/render branch December 19, 2023 06:59
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.

6 participants