Skip to content

Commit

Permalink
Merge pull request #329 from favreau/master
Browse files Browse the repository at this point in the history
Fixed rotation quanterion loaders
  • Loading branch information
favreau authored Nov 23, 2023
2 parents 4da3102 + 00fd777 commit 98d8984
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bioexplorer/backend/science/atlas/AtlasLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ModelDescriptorPtr AtlasLoader::importFromStorage(const std::string& storage, co
const auto position = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_POSITION.name);
const Vector3d pos = core::Vector3d(position[0], position[1], position[2]);
const auto rotation = props.getProperty<std::array<double, 4>>(LOADER_PROPERTY_ROTATION.name);
const Quaterniond rot = core::Quaterniond(rotation[0], rotation[1], rotation[2], rotation[3]);
const Quaterniond rot = core::Quaterniond(rotation[3], rotation[0], rotation[1], rotation[2]);
const auto scale = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_SCALE.name);
Atlas atlas(_scene, details, pos, rot, callback);
return std::move(atlas.getModelDescriptor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ModelDescriptorPtr WhiteMatterLoader::importFromStorage(const std::string& stora
const auto position = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_POSITION.name);
const Vector3d pos = core::Vector3d(position[0], position[1], position[2]);
const auto rotation = props.getProperty<std::array<double, 4>>(LOADER_PROPERTY_ROTATION.name);
const Quaterniond rot = core::Quaterniond(rotation[0], rotation[1], rotation[2], rotation[3]);
const Quaterniond rot = core::Quaterniond(rotation[3], rotation[0], rotation[1], rotation[2]);
const auto scale = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_SCALE.name);
WhiteMatter whiteMatter(_scene, details, pos, rot, callback);
return std::move(whiteMatter.getModelDescriptor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ModelDescriptorPtr AstrocytesLoader::importFromStorage(const std::string& storag
const auto position = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_POSITION.name);
const Vector3d pos = core::Vector3d(position[0], position[1], position[2]);
const auto rotation = props.getProperty<std::array<double, 4>>(LOADER_PROPERTY_ROTATION.name);
const Quaterniond rot = core::Quaterniond(rotation[0], rotation[1], rotation[2], rotation[3]);
const Quaterniond rot = core::Quaterniond(rotation[3], rotation[0], rotation[1], rotation[2]);
const auto scale = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_SCALE.name);
details.scale = {scale[0], scale[1], scale[2]};
Astrocytes astrocytes(_scene, details, pos, rot, callback);
Expand Down
2 changes: 1 addition & 1 deletion bioexplorer/backend/science/morphologies/NeuronsLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ModelDescriptorPtr NeuronsLoader::importFromStorage(const std::string& storage,
const auto position = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_POSITION.name);
const Vector3d pos = core::Vector3d(position[0], position[1], position[2]);
const auto rotation = props.getProperty<std::array<double, 4>>(LOADER_PROPERTY_ROTATION.name);
const Quaterniond rot = core::Quaterniond(rotation[0], rotation[1], rotation[2], rotation[3]);
const Quaterniond rot = core::Quaterniond(rotation[3], rotation[0], rotation[1], rotation[2]);
const auto scale = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_SCALE.name);
details.scale = {scale[0], scale[1], scale[2]};
Neurons Neurons(_scene, details, pos, rot, callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ModelDescriptorPtr VasculatureLoader::importFromStorage(const std::string& stora
const auto position = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_POSITION.name);
const Vector3d pos = core::Vector3d(position[0], position[1], position[2]);
const auto rotation = props.getProperty<std::array<double, 4>>(LOADER_PROPERTY_ROTATION.name);
const Quaterniond rot = core::Quaterniond(rotation[0], rotation[1], rotation[2], rotation[3]);
const Quaterniond rot = core::Quaterniond(rotation[3], rotation[0], rotation[1], rotation[2]);
const auto scale = props.getProperty<std::array<double, 3>>(LOADER_PROPERTY_SCALE.name);
details.scale = {scale[0], scale[1], scale[2]};
Vasculature vasculature(_scene, details, pos, rot, callback);
Expand Down
9 changes: 7 additions & 2 deletions platform/plugins/rockets/RocketsPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const std::string METHOD_CHUNK = "chunk";
const std::string METHOD_QUIT = "quit";
const std::string METHOD_EXIT_LATER = "exit-later";
const std::string METHOD_RESET_CAMERA = "reset-camera";
const std::string METHOD_SET_CAMERA = "set-camera";

const std::string LOADERS_SCHEMA = "loaders-schema";

Expand Down Expand Up @@ -680,10 +681,14 @@ class RocketsPlugin::Impl : public ActionInterface
#if 0 // Not quite sure why the UI does not receive messages when the clientID is set :-/
if (clientID == NO_CURRENT_CLIENT)
rocketsServer->broadcastText(msg);
else
else
rocketsServer->broadcastText(msg, {clientID});

#else
rocketsServer->broadcastText(msg);
if (endpoint != METHOD_SET_CAMERA) // Dirty hack?!? Probably... This avoid message looping
// between UI and Backend when the camera is moved (UI
// informs backend, that sends back update to UI, etc)
rocketsServer->broadcastText(msg);
rocketsServer->broadcastText(msg, {clientID});
#endif
}
Expand Down

0 comments on commit 98d8984

Please sign in to comment.