Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 639 pass UVs to mesh construction on synchro import #640

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ std::unordered_map<std::string, repo::core::model::MeshNode> 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;
Expand Down
30 changes: 19 additions & 11 deletions bouncer/src/repo/manipulator/repo_manipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,36 @@ repo::core::model::RepoBSON* RepoManipulator::createCredBSON(
}

repo::core::model::RepoScene* RepoManipulator::createFederatedScene(
const std::map<repo::core::model::TransformationNode, repo::core::model::ReferenceNode> &fedMap)
const std::map<repo::core::model::ReferenceNode, std::string> &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(), "<root>");
repo::lib::RepoMatrix(), "Federation"));

transNodes.insert(new repo::core::model::TransformationNode(rootNode));
transNodes.insert(rootNode);

std::map<std::string, repo::core::model::TransformationNode*> 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<std::string> empty;
Expand Down
2 changes: 1 addition & 1 deletion bouncer/src/repo/manipulator/repo_manipulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace repo {
* @return returns a constructed scene graph with the reference.
*/
repo::core::model::RepoScene* createFederatedScene(
const std::map<repo::core::model::TransformationNode, repo::core::model::ReferenceNode> &fedMap);
const std::map<repo::core::model::ReferenceNode, std::string> &fedMap);

/**
* Count the number of documents within the collection
Expand Down
2 changes: 1 addition & 1 deletion bouncer/src/repo/repo_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void RepoController::logToFile(const std::string &filePath)
}

repo::core::model::RepoScene* RepoController::createFederatedScene(
const std::map<repo::core::model::TransformationNode, repo::core::model::ReferenceNode> &fedMap)
const std::map<repo::core::model::ReferenceNode, std::string> &fedMap)
{
return impl->createFederatedScene(fedMap);
}
Expand Down
2 changes: 1 addition & 1 deletion bouncer/src/repo/repo_controller.cpp.inl
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public:
* @return returns a constructed scene graph with the reference.
*/
repo::core::model::RepoScene* createFederatedScene(
const std::map<repo::core::model::TransformationNode, repo::core::model::ReferenceNode> &fedMap);
const std::map<repo::core::model::ReferenceNode, std::string> &fedMap);

/**
* Generate and commit a GLTF encoding for the given scene
Expand Down
2 changes: 1 addition & 1 deletion bouncer/src/repo/repo_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ namespace repo {
* @return returns a constructed scene graph with the reference.
*/
repo::core::model::RepoScene* createFederatedScene(
const std::map<repo::core::model::TransformationNode, repo::core::model::ReferenceNode> &fedMap);
const std::map<repo::core::model::ReferenceNode, std::string> &fedMap);

/**
* Generate and commit a GLTF encoding for the given scene
Expand Down
2 changes: 1 addition & 1 deletion bouncer/src/repo/repo_controller_internal.cpp.inl
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ void RepoController::_RepoControllerImpl::subscribeToLogger(
}

repo::core::model::RepoScene* RepoController::_RepoControllerImpl::createFederatedScene(
const std::map<repo::core::model::TransformationNode, repo::core::model::ReferenceNode> &fedMap)
const std::map<repo::core::model::ReferenceNode, std::string> &fedMap)
{
repo::core::model::RepoScene* scene = nullptr;
if (fedMap.size() > 0)
Expand Down
9 changes: 4 additions & 5 deletions client/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -198,6 +198,7 @@ int32_t generateFederation(
// ===== Get project info =====
const std::string spDatabase = subPro.second.get<std::string>("database", database);
const std::string spProject = subPro.second.get<std::string>("project", "");
const std::string group = subPro.second.get<std::string>("group", "");
const std::string uuid = subPro.second.get<std::string>("revId", REPO_HISTORY_MASTER_BRANCH);
const bool isRevID = subPro.second.get<bool>("isRevId", false);
if (spProject.empty())
Expand Down Expand Up @@ -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
Expand Down
Loading