Additional views from ViewerDrawerBGFX and lines depth offset#29
Open
alemuntoni wants to merge 9 commits intomainfrom
Open
Additional views from ViewerDrawerBGFX and lines depth offset#29alemuntoni wants to merge 9 commits intomainfrom
alemuntoni wants to merge 9 commits intomainfrom
Conversation
Member
alemuntoni
commented
Feb 12, 2026
- ViewerDrawerBGFX provides 4 additional views that can be used by DrawableObjects to render with multiple passes;
- Added a depth offset float setting to Lines class that allows to add a small depth and allow to draw them entirely also when they are colinear with triangles (e.g. wireframe)
# Conflicts: # vclib/render/include/vclib/bgfx/drawers/viewer_drawer_bgfx.h # vclib/render/include/vclib/bgfx/settings/draw_object_settings_bgfx.h
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the BGFX rendering pipeline to support multi-pass drawing via additional view IDs provided by ViewerDrawerBGFX, and adds a configurable depth offset for line rendering to reduce z-fighting (e.g., wireframes over filled triangles).
Changes:
- Added a shared
u_linesSettingsuniform block for line shaders and introduced a depth offset applied in line vertex shaders. - Extended
DrawObjectSettingsBGFX/ViewerDrawerBGFXto provide 4 additional BGFX view IDs for multi-pass rendering. - Updated mesh rendering to submit wireframe/edge/point passes to additional views, and updated the Qt example to exercise vertex/face colors and wireframe buffers.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
vclib/render/shaders/vclib/bgfx/primitives/lines/uniforms.sh |
Introduces shared line uniform definitions, including u_depthOffset. |
vclib/render/shaders/vclib/bgfx/primitives/lines/primitive_lines/vs_primitive_lines.sc |
Applies clip-space depth offset for primitive lines. |
vclib/render/shaders/vclib/bgfx/primitives/lines/primitive_lines/fs_primitive_lines.sc |
Switches to shared line uniforms include. |
vclib/render/shaders/vclib/bgfx/primitives/lines/cpu_generated_lines/vs_cpu_generated_lines.sc |
Applies depth offset to CPU-generated line endpoints. |
vclib/render/shaders/vclib/bgfx/primitives/lines/cpu_generated_lines/fs_cpu_generated_lines.sc |
Switches to shared line uniforms include. |
vclib/render/include/vclib/bgfx/settings/draw_object_settings_bgfx.h |
Adds additionalViewIds to draw settings for multi-pass submissions. |
vclib/render/include/vclib/bgfx/primitives/lines.h |
Adds depthOffset setting and packs line settings into u_linesSettings. |
vclib/render/include/vclib/bgfx/drawers/viewer_drawer_bgfx.h |
Allocates/configures additional BGFX views and propagates them via settings. |
vclib/render/include/vclib/bgfx/drawable/mesh/mesh_render_buffers.h |
Sets a small default line depth offset for edges/wireframe lines. |
vclib/render/include/vclib/bgfx/drawable/drawable_mesh_bgfx.h |
Submits wireframe/edges/points using additional views (multi-pass). |
examples/render/02-mesh-viewer/qt/main.cpp |
Updates example to enable vertex colors and wireframe buffer updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.