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

refactor(web, server): Refacting depth test against terrain to globe #1161

Merged
merged 8 commits into from
Oct 4, 2024

Conversation

ZTongci
Copy link
Contributor

@ZTongci ZTongci commented Oct 1, 2024

Overview

What I've done

Refacting depth test against terrain to globe

What I haven't done

How I tested

  • Check the UI on FE

  • Add a sketch layer, add a marker, style with point

    {
      "marker": {
        "pointColor": "red",
        "pointSize": 100,
        "style": "point"
      }
    }
  • Enable/disable and check the map, half of the point should be invisible when this option been enabled.

  • Refresh page and check whether the value is well saved.

  • Test on published page.

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • New Features

    • Introduced a new group for depth testing against terrain, enhancing the globe rendering capabilities.
    • Added new fields for minimum and maximum zoom levels for tile management.
  • Bug Fixes

    • Restructured depth testing management to improve visibility control of objects beneath terrain.
  • Documentation

    • Updated manifest files to reflect new schema changes and field modifications.

Copy link

coderabbitai bot commented Oct 1, 2024

Walkthrough

The changes involve updates to the manifest.yml and manifest_ja.yml files, introducing a new group for depth testing against terrain and modifying existing fields related to globe rendering. Additionally, the mapping of the depthTestAgainstTerrain property in the convert-object.ts file has been updated to reflect these structural changes. These alterations enhance the functionality of the Re:Earth Official Plugin, particularly regarding terrain visibility and tile management.

Changes

File Change Summary
server/pkg/builtin/manifest.yml Added a new group globeDepthTestAgainstTerrain with a field for depthTestAgainstTerrain, removed the same field from the terrain group, and added fields for tile zoom levels.
server/pkg/builtin/manifest_ja.yml Introduced a new property schema globeDepthTestAgainstTerrain with a field for depthTestAgainstTerrain, removed the previous field from the terrain section.
web/src/beta/utils/convert-object.ts Updated the mapping key for depthTestAgainstTerrain from terrain.depthTestAgainstTerrain to globeDepthTestAgainstTerrain.depthTestAgainstTerrain.

Possibly related PRs

  • refactor(server): delete useless server stamen definition #1142: This PR modifies the manifest.yml file, which is directly related to the changes in the main PR regarding the structure and fields in the same file. Both PRs involve alterations to the manifest.yml and manifest_ja.yml files, although they focus on different aspects (depth testing vs. map layers).

Suggested reviewers

  • pyshx
  • mkumbobeaty

Poem

In the land of code where rabbits roam,
New depths are tested, a vibrant home.
With tiles that zoom and shadows that play,
The globe now shines in a brighter way.
Hopping through changes, we cheer with delight,
For every new feature brings joy to our 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 your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Oct 1, 2024

Deploy Preview for reearth-web ready!

Name Link
🔨 Latest commit f0e7941
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/66ff82d30951ef0009b3431c
😎 Deploy Preview https://deploy-preview-1161--reearth-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ZTongci ZTongci changed the title refactor: Refacting depth test against terrain to globe refactor(web, server): Refacting depth test against terrain to globe Oct 1, 2024
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 20.56%. Comparing base (bdf32d6) to head (f0e7941).
Report is 62 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1161      +/-   ##
==========================================
+ Coverage   15.18%   20.56%   +5.37%     
==========================================
  Files         642      985     +343     
  Lines       63207   101829   +38622     
  Branches      792      660     -132     
==========================================
+ Hits         9600    20937   +11337     
- Misses      53607    79650   +26043     
- Partials        0     1242    +1242     
Flag Coverage Δ
server 31.93% <ø> (?)
web 13.85% <ø> (-1.34%) ⬇️
web-beta 13.85% <ø> (-1.34%) ⬇️
web-classic 13.85% <ø> (-1.34%) ⬇️
web-utils 13.85% <ø> (-1.34%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 828 files with indirect coverage changes

Copy link

@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.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (3)
server/pkg/builtin/manifest_ja.yml (1)

92-97: Summary of changes and recommendation for system-wide testing

The changes in this file are focused on introducing a new global depth testing configuration (globeDepthTestAgainstTerrain) to replace the previous terrain-specific configuration. This aligns well with the PR objectives of refactoring depth testing to work with a globe.

While the implementation looks correct, I recommend:

  1. Conducting thorough system-wide testing to ensure all components that rely on depth testing are compatible with this new global configuration.
  2. Updating any relevant documentation or comments in other parts of the codebase that may reference the old terrain-specific depth testing.
  3. Considering adding a brief comment in the YAML file explaining the purpose and impact of this new global configuration for future maintainers.
server/pkg/builtin/manifest.yml (2)

197-204: New group for Globe DepthTest looks good, minor suggestion for clarity.

The addition of the "Globe DepthTest Against Ground and Terrain" group is well-structured and follows the existing pattern in the file. The boolean field type is appropriate for this feature.

Consider slightly rewording the description for better clarity:

- description: Hides objects under the terrain. Depending on the loading status of the terrain, objects may be shown or hidden.
+ description: Hides objects under the terrain. Note: Object visibility may fluctuate based on terrain loading status.

Line range hint 359-367: New tile zoom level controls added, consider adding descriptions.

The addition of tile_minLevel and tile_maxLevel fields enhances control over tile visibility. These are well-placed within the "Tiles" group and use the appropriate 'number' type.

Consider adding descriptions to these new fields for better clarity:

  - id: tile_minLevel
    type: number
    title: Minimum zoom level
    min: 0
    max: 30
+   description: The minimum zoom level at which this tile layer becomes visible.

  - id: tile_maxLevel
    type: number
    title: Maximum zoom level
    min: 0
    max: 30
+   description: The maximum zoom level at which this tile layer remains visible.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b00aca9 and 388b4f5.

📒 Files selected for processing (3)
  • server/pkg/builtin/manifest.yml (1 hunks)
  • server/pkg/builtin/manifest_ja.yml (1 hunks)
  • web/src/beta/utils/convert-object.ts (1 hunks)
🔇 Additional comments (3)
web/src/beta/utils/convert-object.ts (1)

80-81: LGTM! Verify impact on dependent code.

The change from "terrain.depthTestAgainstTerrain" to "globeDepthTestAgainstTerrain.depthTestAgainstTerrain" aligns well with the PR objective of refactoring the depth test against terrain to globe. This new key structure provides a more specific categorization of the depth test property.

To ensure this change doesn't break any existing functionality, please run the following script to check for any occurrences of the old key in the codebase:

If the first command returns any results, those occurrences may need to be updated to use the new key.

✅ Verification successful

Verification Successful: The old key "terrain.depthTestAgainstTerrain" is no longer present, and the new key "globeDepthTestAgainstTerrain.depthTestAgainstTerrain" is correctly used in web/src/beta/utils/convert-object.ts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for occurrences of the old key "terrain.depthTestAgainstTerrain"

# Test: Search for the old key. Expect: No results, as it should have been updated.
rg --type typescript --type javascript "terrain\.depthTestAgainstTerrain"

# Test: Search for the new key. Expect: At least one result (this file).
rg --type typescript --type javascript "globeDepthTestAgainstTerrain\.depthTestAgainstTerrain"

Length of output: 242


Script:

#!/bin/bash
# Description: Search for occurrences of the old key "terrain.depthTestAgainstTerrain" and the new key "globeDepthTestAgainstTerrain.depthTestAgainstTerrain"

# Test: Search for the old key. Expect: No results, as it should have been updated.
rg "terrain\.depthTestAgainstTerrain" --type-add 'ts=*.ts' --type-add 'js=*.js' -t ts -t js

# Test: Search for the new key. Expect: At least one result (this file).
rg "globeDepthTestAgainstTerrain\.depthTestAgainstTerrain" --type-add 'ts=*.ts' --type-add 'js=*.js' -t ts -t js

Length of output: 328


Script:

#!/bin/bash
# Description: Search for occurrences of the old key "terrain.depthTestAgainstTerrain" and the new key "globeDepthTestAgainstTerrain.depthTestAgainstTerrain"

# Test: Search for the old key. Expect: No results, as it should have been updated.
rg "terrain\.depthTestAgainstTerrain" --glob "*.ts" --glob "*.js"

# Test: Search for the new key. Expect: At least one result (this file).
rg "globeDepthTestAgainstTerrain\.depthTestAgainstTerrain" --glob "*.ts" --glob "*.js"

Length of output: 251

server/pkg/builtin/manifest_ja.yml (1)

92-97: Consider the impact of globalizing depth testing configuration

The move from a terrain-specific depth testing configuration to a global one (globeDepthTestAgainstTerrain) is a significant change. While it aligns with the PR objectives, it may have broader implications on how other parts of the system interact with depth testing.

To ensure this change doesn't negatively impact existing functionality, please consider the following:

  1. Verify that all parts of the system that previously relied on the terrain-specific depth testing now correctly use the new global configuration.
  2. Test various scenarios where depth testing is crucial to ensure the new global configuration provides the expected behavior across different use cases.

Could you provide some insights into how this change has been tested across the system? Additionally, it might be helpful to update the relevant documentation to reflect this architectural change.

server/pkg/builtin/manifest.yml (1)

Line range hint 1-1161: Changes align well with PR objectives, good job!

The modifications in this file successfully implement the depth test functionality for the globe, as outlined in the PR objectives. The new "Globe DepthTest Against Ground and Terrain" group and the additional tile zoom level controls are well-structured and consistent with the existing file format.

These changes effectively support the refactoring of the depth test functionality to work against a globe instead of just terrain, as mentioned in the PR summary.

server/pkg/builtin/manifest_ja.yml Outdated Show resolved Hide resolved
Copy link

@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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
server/pkg/builtin/manifest.yml (2)

197-203: LGTM! Consider enhancing the description.

The addition of the "Globe DepthTest Against Ground and Terrain" group is well-implemented and aligns with the PR objectives. It provides a clear way to control the visibility of objects beneath the terrain.

Consider adding a more descriptive explanation for the "depthTestAgainstTerrain" field. For example:

 - id: depthTestAgainstTerrain
   type: bool
   title: Enable
+  description: When enabled, objects beneath the terrain will be hidden based on the globe's curvature and terrain elevation.

This would provide users with a clearer understanding of the feature's functionality.


Line range hint 332-340: LGTM! Consider adding descriptions for new fields.

The addition of "tile_minLevel" and "tile_maxLevel" fields in the "Tiles" group is a good enhancement, providing more granular control over tile visibility at different zoom levels.

Consider adding descriptions for these new fields to improve clarity for users:

 - id: tile_minLevel
   type: number
   title: Minimum zoom level
   min: 0
   max: 30
+  description: The minimum zoom level at which tiles will be displayed. Lower values show tiles from further away.

 - id: tile_maxLevel
   type: number
   title: Maximum zoom level
   min: 0
   max: 30
+  description: The maximum zoom level at which tiles will be displayed. Higher values allow for more detailed tiles when zoomed in close.

These descriptions would help users understand the impact of adjusting these values.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 388b4f5 and 864a48d.

📒 Files selected for processing (2)
  • server/pkg/builtin/manifest.yml (1 hunks)
  • server/pkg/builtin/manifest_ja.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/pkg/builtin/manifest_ja.yml
🔇 Additional comments (1)
server/pkg/builtin/manifest.yml (1)

Line range hint 1-1037: Overall, the changes look good and align with the PR objectives.

The modifications to the manifest file successfully implement the depth test refactoring for the globe and enhance tile control. The new "Globe DepthTest Against Ground and Terrain" group and the additional tile zoom level controls are well-integrated into the existing structure.

Key points:

  1. The depth test functionality now operates against a globe, as intended.
  2. Tile visibility can be more finely controlled with the new minimum and maximum zoom level fields.

The code maintains good consistency with the existing manifest format, and no major issues were identified. The minor suggestions for improved descriptions will enhance user understanding of these new features.

@ZTongci ZTongci merged commit e33d88e into main Oct 4, 2024
17 checks passed
@ZTongci ZTongci deleted the refactor/globeDepthTestAgainstTerrain branch October 4, 2024 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants