Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ find_package(Qt6Quick REQUIRED)
find_package(Qt6Qml REQUIRED)
find_package(Qt6Charts REQUIRED)
find_package(Qt6Gui REQUIRED)
# Some Qt distributions (notably aqtinstall framework builds on macOS) do not auto-create the
# private-module targets via find_package(Qt6Gui); request Qt6GuiPrivate explicitly so that
# Qt6::GuiPrivate exists. Harmless where it is already provided (Windows/Linux official builds).
find_package(Qt6GuiPrivate REQUIRED)
find_package(Qt6 COMPONENTS ShaderTools)


Expand All @@ -49,5 +53,24 @@ add_definitions(-DQT_ALICEVISIONIMAGEIO_USE_FORMATS_BLACKLIST)
find_package(AliceVision REQUIRED)


# macOS: the QML / imageformats plugins link AliceVision frameworks and their
# dependencies (e.g. libceres) via @rpath but installed no rpath of their own, so at
# load time dyld fell back to system/Homebrew copies — notably a libceres lacking the
# glog symbols statically bundled into AliceVision's — and the plugins failed to load
# ("Symbol not found"). Set relocatable @loader_path rpaths pointing at AliceVision's
# lib dir as laid out in a Meshroom standalone install (the plugins under
# qtPlugins/qml/<Module>/ and qtPlugins/imageformats/ sit beside aliceVision/lib).
# Relative paths keep the binaries redistributable — no absolute or system-specific
# paths are baked in. No-op where rpath is unused.
if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_INSTALL_RPATH
"@loader_path/../../../aliceVision/lib" # qml/<Module>/ -> <root>/aliceVision/lib
"@loader_path/../../aliceVision/lib" # imageformats/ -> <root>/aliceVision/lib
"@loader_path"
"@loader_path/..")
endif()


# Builds
add_subdirectory(src)
23 changes: 23 additions & 0 deletions src/qmlSfmData/CameraLocatorEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,29 @@ CameraLocatorEntity::CameraLocatorEntity(const aliceVision::IndexT& viewId,
_colorAttribute->setName(QAttribute::defaultColorAttributeName());
customGeometry->addAttribute(_colorAttribute);

// normals buffer
// The per-vertex-color material declares a vertexNormal input; on the macOS Metal RHI
// backend a geometry that omits it makes pipeline creation fail and crashes the renderer
// (e.g. on viewer resize). The camera locator is line geometry with no surface normal, so
// provide a constant placeholder (0, 1, 0) purely to satisfy the vertex descriptor.
const int nverts = points.size() / 3;
QVector<float> normals(nverts * 3, 0.0f);
for (int i = 0; i < nverts; ++i)
normals[i * 3 + 1] = 1.0f;
QByteArray normalData(reinterpret_cast<const char*>(normals.data()), normals.size() * static_cast<int>(sizeof(float)));
auto normalDataBuffer = new QBuffer(customGeometry);
Comment thread
NeverGET marked this conversation as resolved.
Outdated
normalDataBuffer->setData(normalData);
auto normalAttribute = new QAttribute(customGeometry);
Comment thread
NeverGET marked this conversation as resolved.
Outdated
normalAttribute->setAttributeType(QAttribute::VertexAttribute);
normalAttribute->setBuffer(normalDataBuffer);
normalAttribute->setVertexBaseType(QAttribute::Float);
normalAttribute->setVertexSize(3);
normalAttribute->setByteOffset(0);
normalAttribute->setByteStride(3 * sizeof(float));
normalAttribute->setCount(static_cast<uint>(nverts));
normalAttribute->setName(QAttribute::defaultNormalAttributeName());
customGeometry->addAttribute(normalAttribute);

// geometry renderer settings
customMeshRenderer->setInstanceCount(1);
customMeshRenderer->setFirstVertex(0);
Expand Down
23 changes: 23 additions & 0 deletions src/qmlSfmData/PointCloudEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,29 @@ void PointCloudEntity::setData(const aliceVision::sfmData::Landmarks& landmarks)
colorAttribute->setName(QAttribute::defaultColorAttributeName());
customGeometry->addAttribute(colorAttribute);

// normals buffer
// The per-vertex-color / diffuse-specular materials used for the SfM display declare a
// vertexNormal input. On the macOS Metal RHI backend a geometry that omits that attribute
// makes pipeline creation fail and crashes the renderer (e.g. on viewer resize). Point
// clouds have no meaningful surface normal, so provide a constant placeholder (0, 1, 0)
// purely to satisfy the vertex descriptor.
std::vector<float> normals(static_cast<size_t>(npoints) * 3, 0.0f);
for (int i = 0; i < npoints; ++i)
normals[static_cast<size_t>(i) * 3 + 1] = 1.0f;
auto normalDataBuffer = new QBuffer(customGeometry);
Comment thread
NeverGET marked this conversation as resolved.
Outdated
QByteArray normalData(reinterpret_cast<const char*>(normals.data()), npoints * 3 * static_cast<int>(sizeof(float)));
normalDataBuffer->setData(normalData);
auto normalAttribute = new QAttribute(customGeometry);
Comment thread
NeverGET marked this conversation as resolved.
Outdated
normalAttribute->setAttributeType(QAttribute::VertexAttribute);
normalAttribute->setBuffer(normalDataBuffer);
normalAttribute->setVertexBaseType(QAttribute::Float);
normalAttribute->setVertexSize(3);
normalAttribute->setByteOffset(0);
normalAttribute->setByteStride(3 * sizeof(float));
normalAttribute->setCount(static_cast<uint>(npoints));
normalAttribute->setName(QAttribute::defaultNormalAttributeName());
customGeometry->addAttribute(normalAttribute);

// geometry renderer settings
customMeshRenderer->setInstanceCount(1);
customMeshRenderer->setFirstVertex(0);
Expand Down