Started expanding the module and renderable to include luminosity and velocity

This commit is contained in:
aniisaaden
2020-10-13 10:15:09 +02:00
parent 3321be2a81
commit c428f097ea
7 changed files with 43 additions and 9 deletions

View File

@@ -130,8 +130,12 @@ namespace openspace {
// And delegate decoding depending on message type
if (type == "CONN")
return Message(MessageType::Connection, messageBuffer);
if (type == "DATA")
else if (type == "DATA")
return Message(MessageType::ReadPointData, messageBuffer);
else if (type == "LUMI")
return Message(MessageType::ReadLuminosityData, messageBuffer);
else if (type == "VELO")
return Message(MessageType::ReadVelocityData, messageBuffer);
else if( type == "ASGN")
return Message(MessageType::AddSceneGraphNode, messageBuffer);
else if (type == "RSGN")

View File

@@ -40,6 +40,8 @@ public:
enum class MessageType : uint32_t {
Connection = 0,
ReadPointData,
ReadLuminosityData,
ReadVelocityData,
AddSceneGraphNode,
RemoveSceneGraphNode,
Color,

View File

@@ -41,6 +41,8 @@ namespace {
constexpr const char* ProgramName = "shaderProgram";
constexpr const char* _loggerCat = "PointsCloud";
constexpr const char* KeyData = "Data";
constexpr const char* KeyLuminosity = "Luminosity";
constexpr const char* KeyVelocity = "Velocity";
constexpr int8_t CurrentCacheVersion = 1;
@@ -140,6 +142,16 @@ namespace openspace {
_hasPointData = true;
}
if (dictionary.hasKey(KeyLuminosity)) {
_luminosityData = dictionary.value<std::vector<float>>(KeyLuminosity);
_hasLuminosityData = true;
}
if (dictionary.hasKey(KeyVelocity)) {
_velocityData = dictionary.value<std::vector<float>>(KeyVelocity);
_hasVelocityData = true;
}
if (dictionary.hasKey(OpacityInfo.identifier)) {
_opacity = static_cast<float>(
dictionary.value<double>(OpacityInfo.identifier));

View File

@@ -61,6 +61,8 @@ protected:
bool readPointData();
bool _hasPointData = false;
bool _hasLuminosityData = false;
bool _hasVelocityData = false;
bool _isDirty = true;
std::unique_ptr<ghoul::opengl::ProgramObject> _shaderProgram = nullptr;
@@ -71,6 +73,8 @@ protected:
properties::Vec3Property _color;
std::vector<std::vector<float>> _pointData;
std::vector<float> _luminosityData;
std::vector<float> _velocityData;
std::vector<float> _fullData;
std::vector<float> _slicedData;

View File

@@ -191,6 +191,22 @@ namespace openspace {
}
break;
}
case SoftwareConnection::MessageType::ReadLuminosityData: {
messageOffset = 0; // Resets message offset
luminosityData.clear();
luminosityData = readData(message);
break;
}
case SoftwareConnection::MessageType::ReadVelocityData: {
messageOffset = 0; // Resets message offset
velocityData.clear();
velocityData = readData(message);
break;
}
case SoftwareConnection::MessageType::AddSceneGraphNode: {
std::string identifier = readIdentifier(message);
glm::vec3 color = readColor(message);

View File

@@ -84,6 +84,8 @@ private:
std::string readGUI(std::vector<char>& message);
std::vector<std::vector<float>> pointData;
std::vector<float> luminosityData;
std::vector<float> velocityData;
std::unordered_map<size_t, std::shared_ptr<Peer>> _peers;
mutable std::mutex _peerListMutex;