-
Notifications
You must be signed in to change notification settings - Fork 3
Support rendering web content in layers #172
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
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.
Pull Request Overview
This PR adds support for rendering web content in layers by introducing a new RenderLayer component and updating the rendering pipeline to support transparent materials. The changes enable proper rendering of scrollable containers with overflow handling by supporting both opaque and transparent render passes.
- Introduces
RenderLayercomponent to support layered rendering - Updates web content materials to use transparent rendering instead of opaque
- Removes render pass filtering to allow both opaque and transparent passes
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scene.hpp | Adds include for new RenderLayer header |
| scene.cpp | Registers RenderLayer component and adds it to entity creation |
| scene_renderer.cpp | Adds stencil buffer clearing before volume mask rendering |
| mesh_material.hpp | Adds transparency checks and render pass matching logic |
| web_content_instanced.cpp | Changes web content material from opaque to transparent |
| material_base.hpp | Adds constructor overload to specify opacity |
| client_renderer.hpp | Removes documentation comments |
| client_renderer.cpp | Removes render pass filtering and adds material pass matching |
| */ | ||
| inline bool matchesPass(const RenderPass &pass) const | ||
| { | ||
| assert(pass == RenderPass::kOpaques || pass == RenderPass::kTransparents); |
Copilot
AI
Jul 31, 2025
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 assertion duplicates the logic in the if-else conditions below. Consider removing the assertion or simplifying the function to avoid redundant checks.
| assert(pass == RenderPass::kOpaques || pass == RenderPass::kTransparents); |
| else if (pass == RenderPass::kTransparents) | ||
| return isTransparent(); | ||
| else | ||
| return false; |
Copilot
AI
Jul 31, 2025
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 final else clause will never execute due to the assertion above. If the assertion is removed, this should be unreachable code. Consider removing this clause or handling unexpected enum values appropriately.
| else if (pass == RenderPass::kTransparents) | |
| return isTransparent(); | |
| else | |
| return false; | |
| else // pass == RenderPass::kTransparents | |
| return isTransparent(); |
|
|
||
| WebContentInstancedMaterial::WebContentInstancedMaterial() | ||
| : Material() | ||
| : Material(false) // Web content must use transparent material |
Copilot
AI
Jul 31, 2025
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.
[nitpick] The comment explains why web content uses transparent material, but it would be helpful to explain the relationship to overflow implementation or layer rendering mentioned in the PR description.
| : Material(false) // Web content must use transparent material | |
| : Material(false) // Web content must use transparent material to ensure proper rendering of layers and handling of overflow. Transparent material allows blending and compositing of web content layers, which is essential for implementing overflow behavior and maintaining visual fidelity. |
| if (!materialComponent->initialized()) | ||
| renderer_->initializeMeshMaterial3d(meshComponent, materialComponent); | ||
|
|
||
| // Skip rendering if the material does not for this render pass, such as the mesh is not opaque but the render pass |
Copilot
AI
Jul 31, 2025
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.
Grammar error: 'does not for this render pass' should be 'does not match this render pass' or similar.
| // Skip rendering if the material does not for this render pass, such as the mesh is not opaque but the render pass | |
| // Skip rendering if the material does not match this render pass, such as when the mesh is not opaque but the render pass |
This PR supports rendering web content in layers by scrollable containers, this is required to achieve the complete overflow implementation.