Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d9fb419
[render] drawId writes 64bit values: 16 - ObjectID | 16 -ElementType …
alemuntoni Aug 2, 2026
94087e4
[render] Info editor and relative qt Toolbar widget
alemuntoni Aug 2, 2026
fcd117f
Merge branch 'main' into draw_element_id
alemuntoni Aug 3, 2026
ebc5d32
Merge branch 'main' into draw_element_id
alemuntoni Aug 3, 2026
f2e593c
Merge branch 'main' into draw_element_id
alemuntoni Aug 4, 2026
bc7ad0f
[render] InfoEditor draws selected face
alemuntoni Aug 4, 2026
6d5eada
Merge branch 'main' into draw_element_id
alemuntoni Aug 5, 2026
b4e080e
[render] add InfoEditor to imgui toolbar
alemuntoni Aug 5, 2026
f82509a
[render] InfoEditor settings
alemuntoni Aug 5, 2026
11ea96b
[render] drawId writes face ids - not triangle ids
alemuntoni Aug 5, 2026
8a28234
Merge branch 'main' into draw_element_id
alemuntoni Aug 5, 2026
60c4cf3
[render] writing text using InfoEditor
alemuntoni Aug 5, 2026
67a38bc
[render] manage dpi scaling for text
alemuntoni Aug 5, 2026
b2a2705
[render] allow to set font color and font size for InfoEditor
alemuntoni Aug 5, 2026
4248b71
[render] include vertex ID info in InfoEditor
alemuntoni Aug 5, 2026
a8d1b1c
[render] add InfoEditor settings to imgui::MeshViewer
alemuntoni Aug 5, 2026
7d7c72a
[render] fix TextManager crash at exit
alemuntoni Aug 5, 2026
1883da3
[render] InfoEditor writes vertices info
alemuntoni Aug 5, 2026
9c9cb5f
[render] edges EditorInfo
alemuntoni Aug 5, 2026
0356164
[render] cleanups
alemuntoni Aug 5, 2026
4064dec
Merge branch 'main' into draw_element_id
alemuntoni Aug 5, 2026
f2438b0
Merge branch 'main' into draw_element_id
alemuntoni Aug 5, 2026
6e52969
[render] InfoEditor uses drawContent function to draw
alemuntoni Aug 5, 2026
3a37feb
[tests] InfoEditor headless test
alemuntoni Aug 5, 2026
4bae444
[render] don't use Buffer_RO for surface id when not needed
alemuntoni Aug 6, 2026
681fd74
[tests] add RenderInfo test on a polygon mesh
alemuntoni Aug 6, 2026
c6bda3f
Merge branch 'main' into draw_element_id
alemuntoni Aug 6, 2026
a90fc26
[render] uniforming test 007
alemuntoni Aug 6, 2026
16c8603
[render] docs
alemuntoni Aug 6, 2026
d1f5459
Merge branch 'main' into draw_element_id
alemuntoni Aug 6, 2026
b911bb5
[render] cleanups
alemuntoni Aug 6, 2026
8162cf4
Merge branch 'main' into draw_element_id
alemuntoni Aug 6, 2026
65bce5b
Merge branch 'main' into draw_element_id
alemuntoni Aug 6, 2026
891a4ce
Merge branch 'main' into draw_element_id
alemuntoni Aug 7, 2026
86e1b09
[tests] enable test 007 on linux - vulkan bug fixed
alemuntoni Aug 7, 2026
0c419a0
Merge branch 'main' into draw_element_id
alemuntoni Aug 7, 2026
165ae86
[render] rename isTriMesh() function for better clarity
alemuntoni Aug 7, 2026
bf30d83
Merge branch 'main' into draw_element_id
alemuntoni Aug 7, 2026
0b8a4e9
Merge branch 'main' into draw_element_id
alemuntoni Aug 7, 2026
31db36a
Merge branch 'main' into draw_element_id
alemuntoni Aug 8, 2026
ea6823c
[render] docs and default color bugfix
alemuntoni Aug 8, 2026
918fc51
Merge branch 'main' into draw_element_id
alemuntoni Aug 8, 2026
c804317
Merge branch 'main' into draw_element_id
alemuntoni Aug 9, 2026
fbaff59
[render] InfoEditor with new Settings system
alemuntoni Aug 9, 2026
4077713
Merge branch 'main' into draw_element_id
alemuntoni Aug 11, 2026
ee05f89
[render] add name() to InfoEdtior
alemuntoni Aug 11, 2026
f36f949
Merge branch 'main' into draw_element_id
alemuntoni Aug 11, 2026
dc03465
Merge branch 'main' into draw_element_id
alemuntoni Aug 11, 2026
1700315
Merge branch 'main' into draw_element_id
alemuntoni Aug 19, 2026
a0894d9
[render] InfoEditor settings can be serialized and are available trou…
alemuntoni Aug 19, 2026
3ac3b08
Merge branch 'main' into draw_element_id
alemuntoni Aug 21, 2026
6c771e0
Merge branch 'main' into draw_element_id
alemuntoni Aug 22, 2026
34c5544
[tests] upgrade info tests
alemuntoni Aug 22, 2026
60285c5
Merge branch 'main' into draw_element_id
alemuntoni Aug 22, 2026
6a4c762
Merge branch 'main' into draw_element_id
alemuntoni Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions tests/render/007-info-editor-headless/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# VCLib - Visual Computing Library
# Copyright (C) 2021-2026 Visual Computing Lab, ISTI - CNR.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.

vclib_add_test(
007-info-editor-headless
MODULE render
SOURCES main.cpp
)
60 changes: 60 additions & 0 deletions tests/render/007-info-editor-headless/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// VCLib - Visual Computing Library
// Copyright (C) 2021-2026 Visual Computing Lab, ISTI - CNR.
//
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at https://mozilla.org/MPL/2.0/.

#include "get_drawable_mesh.h"
#include "run_render_test.h"

static const std::string TEST_NAME = "007-info-editor-headless";

TEST_CASE("Info Editor Rendering")
{
SECTION("face_info")
{
runRenderTest(
TEST_NAME,
"face_info",
[](vcl::HeadlessMeshViewer& mv) {
auto mesh =
getDrawableMesh<vcl::TriMesh>("bunny_simplified.obj");
mv.pushDrawableObject(std::move(mesh));
},
0.0f,
-150.0f,
2,
0.005f,
[](vcl::HeadlessMeshViewer& mv) {
mv.pushEditor<vcl::InfoEditorBGFX>(true);
mv.simulateMousePress(
vcl::MouseButton::LEFT,
mv.width() / 2.0,
mv.height() / 2.0);
});
}

SECTION("poly_info")
{
runRenderTest(
TEST_NAME,
"poly_info",
[](vcl::HeadlessMeshViewer& mv) {
auto mesh = getDrawableMesh<vcl::PolyMesh>(
"spot/spot_quadrangulated.obj");
mv.pushDrawableObject(std::move(mesh));
},
1.57079632679f,
-150.0f,
2,
0.005f,
[](vcl::HeadlessMeshViewer& mv) {
mv.pushEditor<vcl::InfoEditorBGFX>(true);
mv.simulateMousePress(
vcl::MouseButton::LEFT,
mv.width() / 2.0,
mv.height() / 2.0);
});
}
}
1 change: 1 addition & 0 deletions tests/render/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ if(TARGET vclib-3rd-bgfx)
add_subdirectory(004-lines-headless)
add_subdirectory(005-mesh-wireframe-headless)
add_subdirectory(006-mesh-pbr-headless)
add_subdirectory(007-info-editor-headless)
endif()
2 changes: 1 addition & 1 deletion vclib/render/include/vclib/bgfx/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class CanvasBGFX
}

mReadRequest.emplace(
ReadFromGPUBuffer::Target::ID, mSize, mDefaultClearColor);
ReadFromGPUBuffer::Target::ID, mSize, vcl::Color::White);
mReadRequest->setPendingRead(point, callback);
return true;
}
Expand Down
37 changes: 28 additions & 9 deletions vclib/render/include/vclib/bgfx/drawable/drawable_mesh_bgfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ class DrawableMeshBGFX : public AbstractDrawableMesh, public MeshType

void drawId(const DrawObjectSettings& settings) override
{
using enum VertFragProgram;

ProgramManager& pm = Context::instance().programManager();

uint64_t state =
0 | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_WRITE_Z |
BGFX_STATE_DEPTH_TEST_LEQUAL |
Expand All @@ -318,25 +314,27 @@ class DrawableMeshBGFX : public AbstractDrawableMesh, public MeshType
mMRB.bindVertexBuffers(mMRS);
mMRB.bindIndexBuffers(mMRS);
mMRB.bindTriToPolyBuffer();
DrawableMeshUniforms::setMeshId(settings.objectId);
DrawableMeshUniforms::setMeshId(
settings.objectId | vcl::ElemId::FACE);
DrawableMeshUniforms::setFirstChunkIndex(0);
bindUniforms();

bgfx::setState(state);
bgfx::setTransform(model.data());

bgfx::submit(
settings.viewId, pm.getProgram<DRAWABLE_MESH_SURFACE_ID>());
bgfx::submit(settings.viewId, surfaceIdProgramSelector());
}

if (mMRS.isEdges(MRI::Edges::VISIBLE)) {
bgfx::setTransform(model.data());
mMRB.drawEdgeLinesId(settings.viewId, settings.objectId);
mMRB.drawEdgeLinesId(
settings.viewId, settings.objectId | vcl::ElemId::EDGE);
}

if (mMRS.isPoints(MRI::Points::VISIBLE)) {
bgfx::setTransform(model.data());
mMRB.drawPointsId(settings.viewId, settings.objectId);
mMRB.drawPointsId(
settings.viewId, settings.objectId | vcl::ElemId::VERTEX);
}
}

Expand Down Expand Up @@ -473,6 +471,27 @@ class DrawableMeshBGFX : public AbstractDrawableMesh, public MeshType
ProgramManager& pm = Context::instance().programManager();
return pm.getProgram(VertFragProgram(program));
}

/**
* @brief Selects the correct shader program for surface ID rendering.
*
* It chooses between trivial and non-trivial ID mapping based on the
* mesh render buffers configuration, ensuring correct mapping from
* primitive ID to face ID when rendering the mesh.
*
* @return The appropriate BGFX program handle.
*/
bgfx::ProgramHandle surfaceIdProgramSelector() const
{
ProgramManager& pm = Context::instance().programManager();

if (mMRB.isMappingTrivial())
return pm.getProgram<
VertFragProgram::DRAWABLE_MESH_SURFACE_ID_MAPPING_TRIVIAL_ON>();
else
return pm.getProgram<
VertFragProgram::DRAWABLE_MESH_SURFACE_ID_MAPPING_TRIVIAL_OFF>();
}
};

} // namespace vcl
Expand Down
Loading
Loading