Skip to content

Additional views from ViewerDrawerBGFX and lines depth offset#29

Open
alemuntoni wants to merge 9 commits intomainfrom
viewer_additional_views
Open

Additional views from ViewerDrawerBGFX and lines depth offset#29
alemuntoni wants to merge 9 commits intomainfrom
viewer_additional_views

Conversation

@alemuntoni
Copy link
Member

  • 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)

Copy link
Contributor

Copilot AI left a 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 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_linesSettings uniform block for line shaders and introduced a depth offset applied in line vertex shaders.
  • Extended DrawObjectSettingsBGFX / ViewerDrawerBGFX to 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.

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.

2 participants