Added 'hasLoaded' bool in the syncable storage so that enabling properties in the renderable occurs at the correct time

This commit is contained in:
Victor Lindquist
2022-06-15 19:14:49 -06:00
parent dfe97d348c
commit c011986794
6 changed files with 39 additions and 11 deletions

View File

@@ -855,7 +855,7 @@ void PointDataMessageHandler::postSync() {
try {
for (auto& waitFor : waitForData) {
if (softwareIntegrationModule->isSyncDataDirty(identifier, waitFor)) {
if (!softwareIntegrationModule->dataLoaded(identifier, waitFor)) {
throw std::exception{};
}
}

View File

@@ -651,6 +651,7 @@ void RenderablePointsCloud::loadData(SoftwareIntegrationModule* softwareIntegrat
addPosition(transformedPos);
}
softwareIntegrationModule->setDataLoaded(_identifier.value(), storage::Key::DataPoints);
}
void RenderablePointsCloud::loadColormap(SoftwareIntegrationModule* softwareIntegrationModule) {
@@ -678,6 +679,7 @@ void RenderablePointsCloud::loadColormap(SoftwareIntegrationModule* softwareInte
_colormapTexture->uploadTexture();
_hasLoadedColormap = true;
softwareIntegrationModule->setDataLoaded(_identifier.value(), storage::Key::Colormap);
}
void RenderablePointsCloud::loadColormapAttributeData(SoftwareIntegrationModule* softwareIntegrationModule) {
@@ -709,6 +711,7 @@ void RenderablePointsCloud::loadColormapAttributeData(SoftwareIntegrationModule*
_hasLoadedColormapAttributeData = true;
LDEBUG("Rerendering with colormap attribute data");
softwareIntegrationModule->setDataLoaded(_identifier.value(), storage::Key::ColormapAttrData);
}
void RenderablePointsCloud::loadLinearSizeAttributeData(SoftwareIntegrationModule* softwareIntegrationModule) {
@@ -739,7 +742,8 @@ void RenderablePointsCloud::loadLinearSizeAttributeData(SoftwareIntegrationModul
}
_hasLoadedLinearSizeAttributeData = true;
LDEBUG("Rerendering with linear size attribute data");
LDEBUG("Rerendering with linear size attribute data");
softwareIntegrationModule->setDataLoaded(_identifier.value(), storage::Key::LinearSizeAttrData);
}
void RenderablePointsCloud::loadVelocityData(SoftwareIntegrationModule* softwareIntegrationModule) {
@@ -835,6 +839,7 @@ void RenderablePointsCloud::loadVelocityData(SoftwareIntegrationModule* software
// =========================================
_hasLoadedVelocityData = true;
softwareIntegrationModule->setDataLoaded(_identifier.value(), storage::Key::VelocityData);
LDEBUG("Rerendering with motion based on velocity data");
}

View File

@@ -75,11 +75,18 @@ bool SoftwareIntegrationModule::isDataDirty(
return _syncableFloatDataStorage.isDirty(identifier, key);
}
bool SoftwareIntegrationModule::isSyncDataDirty(
void SoftwareIntegrationModule::setDataLoaded(
const SyncableFloatDataStorage::Identifier& identifier,
const storage::Key key
) {
_syncableFloatDataStorage.setLoaded(identifier, key);
}
bool SoftwareIntegrationModule::dataLoaded(
const SyncableFloatDataStorage::Identifier& identifier,
const storage::Key key
) {
return _syncableFloatDataStorage.isSyncDirty(identifier, key);
return _syncableFloatDataStorage.hasLoaded(identifier, key);
}
void SoftwareIntegrationModule::internalInitialize(const ghoul::Dictionary&) {

View File

@@ -53,7 +53,11 @@ public:
const SyncableFloatDataStorage::Identifier& identifier,
const storage::Key key
);
bool isSyncDataDirty(
void setDataLoaded(
const SyncableFloatDataStorage::Identifier& identifier,
const storage::Key key
);
bool dataLoaded(
const SyncableFloatDataStorage::Identifier& identifier,
const storage::Key key
);

View File

@@ -173,14 +173,24 @@ bool SyncableFloatDataStorage::isDirty(
return _storage.find(identifier)->second.find(key)->second.dirty;
}
bool SyncableFloatDataStorage::isSyncDirty(
const Identifier& identifier, const storage::Key key
) {
void SyncableFloatDataStorage::setLoaded(const Identifier& identifier, const storage::Key key) {
if (!count(identifier, key)) {
return true;
LERROR(fmt::format(
"SceneGraphNode {} has no data with key '{}' in the centralized data storage",
identifier,
storage::getStorageKeyString(key)
));
return;
}
_storage.find(identifier)->second.find(key)->second.hasLoaded = true;
}
bool SyncableFloatDataStorage::hasLoaded(const Identifier& identifier, const storage::Key key) {
if (!count(identifier, key)) {
return false;
}
return _storage.find(identifier)->second.find(key)->second.syncDirty;
return _storage.find(identifier)->second.find(key)->second.hasLoaded;
}
void SyncableFloatDataStorage::store(

View File

@@ -43,6 +43,7 @@ public:
std::vector<float> data;
bool hasEncoded = false;
bool syncDirty = true;
bool hasLoaded = false;
bool dirty = true;
};
using ValueData = decltype(Value::data);
@@ -61,7 +62,8 @@ public:
const ValueData& fetch(const Identifier& identifier, const storage::Key key);
bool isDirty(const Identifier& identifier, const storage::Key key);
bool isSyncDirty(const Identifier& identifier, const storage::Key key);
void setLoaded(const Identifier& identifier, const storage::Key key);
bool hasLoaded(const Identifier& identifier, const storage::Key key);
void store(const Identifier& identifier, const storage::Key key, const ValueData& data);
std::string getStringOfAllKeysInStorage();