From 2bd56e034baaf712d838263e12c1bd11172fa669 Mon Sep 17 00:00:00 2001 From: Carmen Fan Date: Thu, 31 Aug 2023 18:33:09 +0100 Subject: [PATCH 1/2] ISSUE #639 federation parameter adjustments --- .../src/repo/manipulator/repo_manipulator.cpp | 30 ++++++++++++------- .../src/repo/manipulator/repo_manipulator.h | 2 +- bouncer/src/repo/repo_controller.cpp | 2 +- bouncer/src/repo/repo_controller.cpp.inl | 2 +- bouncer/src/repo/repo_controller.h | 2 +- .../src/repo/repo_controller_internal.cpp.inl | 2 +- client/src/functions.cpp | 9 +++--- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/bouncer/src/repo/manipulator/repo_manipulator.cpp b/bouncer/src/repo/manipulator/repo_manipulator.cpp index 9e3d4e6c7..06164d7a0 100644 --- a/bouncer/src/repo/manipulator/repo_manipulator.cpp +++ b/bouncer/src/repo/manipulator/repo_manipulator.cpp @@ -102,28 +102,36 @@ repo::core::model::RepoBSON* RepoManipulator::createCredBSON( } repo::core::model::RepoScene* RepoManipulator::createFederatedScene( - const std::map &fedMap) + const std::map &fedMap) { repo::core::model::RepoNodeSet transNodes; repo::core::model::RepoNodeSet refNodes; repo::core::model::RepoNodeSet emptySet; - repo::core::model::TransformationNode rootNode = + auto rootNode = new repo::core::model::TransformationNode( repo::core::model::RepoBSONFactory::makeTransformationNode( - repo::lib::RepoMatrix(), ""); + repo::lib::RepoMatrix(), "Federation")); - transNodes.insert(new repo::core::model::TransformationNode(rootNode)); + transNodes.insert(rootNode); + + std::map groupNameToNode; for (const auto &pair : fedMap) { - transNodes.insert(new repo::core::model::TransformationNode( - pair.first.cloneAndAddParent(rootNode.getSharedID()) - ) - ); + auto parentNode = rootNode; + if (!pair.second.empty()) { + if (groupNameToNode.find(pair.second) == groupNameToNode.end()) { + groupNameToNode[pair.second] = new repo::core::model::TransformationNode(repo::core::model::RepoBSONFactory::makeTransformationNode( + repo::lib::RepoMatrix(), pair.second, { rootNode->getSharedID() })); + transNodes.insert(groupNameToNode[pair.second]); + } + + parentNode = groupNameToNode[pair.second]; + } + refNodes.insert(new repo::core::model::ReferenceNode( - pair.second.cloneAndAddParent(pair.first.getSharedID()) - ) - ); + pair.first.cloneAndAddParent(parentNode->getSharedID()) + )); } //federate scene has no referenced files std::vector empty; diff --git a/bouncer/src/repo/manipulator/repo_manipulator.h b/bouncer/src/repo/manipulator/repo_manipulator.h index 621fdfd7b..32d6bb6c2 100644 --- a/bouncer/src/repo/manipulator/repo_manipulator.h +++ b/bouncer/src/repo/manipulator/repo_manipulator.h @@ -113,7 +113,7 @@ namespace repo { * @return returns a constructed scene graph with the reference. */ repo::core::model::RepoScene* createFederatedScene( - const std::map &fedMap); + const std::map &fedMap); /** * Count the number of documents within the collection diff --git a/bouncer/src/repo/repo_controller.cpp b/bouncer/src/repo/repo_controller.cpp index 9e6dcf13e..b40d8d277 100644 --- a/bouncer/src/repo/repo_controller.cpp +++ b/bouncer/src/repo/repo_controller.cpp @@ -275,7 +275,7 @@ void RepoController::logToFile(const std::string &filePath) } repo::core::model::RepoScene* RepoController::createFederatedScene( - const std::map &fedMap) + const std::map &fedMap) { return impl->createFederatedScene(fedMap); } diff --git a/bouncer/src/repo/repo_controller.cpp.inl b/bouncer/src/repo/repo_controller.cpp.inl index f9e6a293d..753871103 100644 --- a/bouncer/src/repo/repo_controller.cpp.inl +++ b/bouncer/src/repo/repo_controller.cpp.inl @@ -522,7 +522,7 @@ public: * @return returns a constructed scene graph with the reference. */ repo::core::model::RepoScene* createFederatedScene( - const std::map &fedMap); + const std::map &fedMap); /** * Generate and commit a GLTF encoding for the given scene diff --git a/bouncer/src/repo/repo_controller.h b/bouncer/src/repo/repo_controller.h index 657c94239..bdd84732b 100644 --- a/bouncer/src/repo/repo_controller.h +++ b/bouncer/src/repo/repo_controller.h @@ -518,7 +518,7 @@ namespace repo { * @return returns a constructed scene graph with the reference. */ repo::core::model::RepoScene* createFederatedScene( - const std::map &fedMap); + const std::map &fedMap); /** * Generate and commit a GLTF encoding for the given scene diff --git a/bouncer/src/repo/repo_controller_internal.cpp.inl b/bouncer/src/repo/repo_controller_internal.cpp.inl index 4003e3617..65d4d348f 100644 --- a/bouncer/src/repo/repo_controller_internal.cpp.inl +++ b/bouncer/src/repo/repo_controller_internal.cpp.inl @@ -677,7 +677,7 @@ void RepoController::_RepoControllerImpl::subscribeToLogger( } repo::core::model::RepoScene* RepoController::_RepoControllerImpl::createFederatedScene( - const std::map &fedMap) + const std::map &fedMap) { repo::core::model::RepoScene* scene = nullptr; if (fedMap.size() > 0) diff --git a/client/src/functions.cpp b/client/src/functions.cpp index e97adc959..53415cbff 100644 --- a/client/src/functions.cpp +++ b/client/src/functions.cpp @@ -184,7 +184,7 @@ int32_t generateFederation( if (!revIdStr.empty()) { revId = repo::lib::RepoUUID(revIdStr); } - std::map< repo::core::model::TransformationNode, repo::core::model::ReferenceNode> refMap; + std::map< repo::core::model::ReferenceNode, std::string> refMap; if (database.empty() || project.empty()) { @@ -198,6 +198,7 @@ int32_t generateFederation( // ===== Get project info ===== const std::string spDatabase = subPro.second.get("database", database); const std::string spProject = subPro.second.get("project", ""); + const std::string group = subPro.second.get("group", ""); const std::string uuid = subPro.second.get("revId", REPO_HISTORY_MASTER_BRANCH); const bool isRevID = subPro.second.get("isRevId", false); if (spProject.empty()) @@ -231,10 +232,8 @@ int32_t generateFederation( matrix = repo::core::model::TransformationNode::identityMat(); } - std::string nodeNames = spDatabase + ":" + spProject; - auto transNode = repo::core::model::RepoBSONFactory::makeTransformationNode(matrix, nodeNames); - auto refNode = repo::core::model::RepoBSONFactory::makeReferenceNode(spDatabase, spProject, repo::lib::RepoUUID(uuid), isRevID, nodeNames); - refMap[transNode] = refNode; + auto refNode = repo::core::model::RepoBSONFactory::makeReferenceNode(spDatabase, spProject, repo::lib::RepoUUID(uuid), isRevID); + refMap[refNode] = group; } //Create the reference scene From 8cd386e32d742a917f13710e9a10476f73cf95f7 Mon Sep 17 00:00:00 2001 From: Carmen Fan Date: Fri, 1 Sep 2023 16:48:56 +0100 Subject: [PATCH 2/2] ISSUE #639 add UVs --- .../modelconvertor/import/repo_model_import_synchro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bouncer/src/repo/manipulator/modelconvertor/import/repo_model_import_synchro.cpp b/bouncer/src/repo/manipulator/modelconvertor/import/repo_model_import_synchro.cpp index 3b1d7f81c..48cba13d2 100644 --- a/bouncer/src/repo/manipulator/modelconvertor/import/repo_model_import_synchro.cpp +++ b/bouncer/src/repo/manipulator/modelconvertor/import/repo_model_import_synchro.cpp @@ -167,7 +167,7 @@ std::unordered_map SynchroModelImport: for (const auto uv : meshDetails.uv) { uvs.push_back({ (float)uv.x, (float)uv.y }); } - res[meshDetails.geoID] = repo::core::model::RepoBSONFactory::makeMeshNode(vertices, faces, normals, bbox); + res[meshDetails.geoID] = repo::core::model::RepoBSONFactory::makeMeshNode(vertices, faces, normals, bbox, { uvs }); } return res;