mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-28 12:23:25 +02:00
rename the joint-name caches in AvatarData and Avatar so it's more clear that they are different
This commit is contained in:
parent
88c39f3237
commit
6782a891d0
4 changed files with 26 additions and 26 deletions
|
@ -1009,23 +1009,23 @@ glm::vec3 Avatar::getAbsoluteJointTranslationInObjectFrame(int index) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::invalidateJointIndicesCache() const {
|
void Avatar::invalidateJointIndicesCache() const {
|
||||||
QWriteLocker writeLock(&_jointIndicesCacheLock);
|
QWriteLocker writeLock(&_modelJointIndicesCacheLock);
|
||||||
_jointsCached = false;
|
_modelJointsCached = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::withValidJointIndicesCache(std::function<void()> const& worker) const {
|
void Avatar::withValidJointIndicesCache(std::function<void()> const& worker) const {
|
||||||
QReadLocker readLock(&_jointIndicesCacheLock);
|
QReadLocker readLock(&_modelJointIndicesCacheLock);
|
||||||
if (_jointsCached) {
|
if (_modelJointsCached) {
|
||||||
worker();
|
worker();
|
||||||
} else {
|
} else {
|
||||||
readLock.unlock();
|
readLock.unlock();
|
||||||
{
|
{
|
||||||
QWriteLocker writeLock(&_jointIndicesCacheLock);
|
QWriteLocker writeLock(&_modelJointIndicesCacheLock);
|
||||||
if (!_jointsCached) {
|
if (!_modelJointsCached) {
|
||||||
_jointIndicesCache.clear();
|
_modelJointIndicesCache.clear();
|
||||||
if (_skeletonModel && _skeletonModel->isActive()) {
|
if (_skeletonModel && _skeletonModel->isActive()) {
|
||||||
_jointIndicesCache = _skeletonModel->getFBXGeometry().jointIndices;
|
_modelJointIndicesCache = _skeletonModel->getFBXGeometry().jointIndices;
|
||||||
_jointsCached = true;
|
_modelJointsCached = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
worker();
|
worker();
|
||||||
|
@ -1040,8 +1040,8 @@ int Avatar::getJointIndex(const QString& name) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
withValidJointIndicesCache([&]() {
|
withValidJointIndicesCache([&]() {
|
||||||
if (_jointIndicesCache.contains(name)) {
|
if (_modelJointIndicesCache.contains(name)) {
|
||||||
result = _jointIndicesCache[name] - 1;
|
result = _modelJointIndicesCache[name] - 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
@ -1050,7 +1050,7 @@ int Avatar::getJointIndex(const QString& name) const {
|
||||||
QStringList Avatar::getJointNames() const {
|
QStringList Avatar::getJointNames() const {
|
||||||
QStringList result;
|
QStringList result;
|
||||||
withValidJointIndicesCache([&]() {
|
withValidJointIndicesCache([&]() {
|
||||||
result = _jointIndicesCache.keys();
|
result = _modelJointIndicesCache.keys();
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,9 +270,9 @@ protected:
|
||||||
|
|
||||||
void invalidateJointIndicesCache() const;
|
void invalidateJointIndicesCache() const;
|
||||||
void withValidJointIndicesCache(std::function<void()> const& worker) const;
|
void withValidJointIndicesCache(std::function<void()> const& worker) const;
|
||||||
mutable QHash<QString, int> _jointIndicesCache;
|
mutable QHash<QString, int> _modelJointIndicesCache;
|
||||||
mutable QReadWriteLock _jointIndicesCacheLock;
|
mutable QReadWriteLock _modelJointIndicesCacheLock;
|
||||||
mutable bool _jointsCached { false };
|
mutable bool _modelJointsCached { false };
|
||||||
|
|
||||||
glm::vec3 _skeletonOffset;
|
glm::vec3 _skeletonOffset;
|
||||||
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
std::vector<std::shared_ptr<Model>> _attachmentModels;
|
||||||
|
|
|
@ -1462,12 +1462,12 @@ int AvatarData::getJointIndex(const QString& name) const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
QReadLocker readLock(&_jointDataLock);
|
QReadLocker readLock(&_jointDataLock);
|
||||||
return _jointIndices.value(name) - 1;
|
return _fstJointIndices.value(name) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList AvatarData::getJointNames() const {
|
QStringList AvatarData::getJointNames() const {
|
||||||
QReadLocker readLock(&_jointDataLock);
|
QReadLocker readLock(&_jointDataLock);
|
||||||
return _jointNames;
|
return _fstJointNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat AvatarData::getOrientationOutbound() const {
|
glm::quat AvatarData::getOrientationOutbound() const {
|
||||||
|
@ -1720,14 +1720,14 @@ void AvatarData::setJointMappingsFromNetworkReply() {
|
||||||
bool ok;
|
bool ok;
|
||||||
int jointIndex = line.mid(secondSeparatorIndex + 1).trimmed().toInt(&ok);
|
int jointIndex = line.mid(secondSeparatorIndex + 1).trimmed().toInt(&ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
while (_jointNames.size() < jointIndex + 1) {
|
while (_fstJointNames.size() < jointIndex + 1) {
|
||||||
_jointNames.append(QString());
|
_fstJointNames.append(QString());
|
||||||
}
|
}
|
||||||
_jointNames[jointIndex] = jointName;
|
_fstJointNames[jointIndex] = jointName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < _jointNames.size(); i++) {
|
for (int i = 0; i < _fstJointNames.size(); i++) {
|
||||||
_jointIndices.insert(_jointNames.at(i), i + 1);
|
_fstJointIndices.insert(_fstJointNames.at(i), i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1781,8 +1781,8 @@ void AvatarData::sendIdentityPacket() {
|
||||||
void AvatarData::updateJointMappings() {
|
void AvatarData::updateJointMappings() {
|
||||||
{
|
{
|
||||||
QWriteLocker writeLock(&_jointDataLock);
|
QWriteLocker writeLock(&_jointDataLock);
|
||||||
_jointIndices.clear();
|
_fstJointIndices.clear();
|
||||||
_jointNames.clear();
|
_fstJointNames.clear();
|
||||||
_jointData.clear();
|
_jointData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -704,8 +704,8 @@ protected:
|
||||||
QString _displayName;
|
QString _displayName;
|
||||||
QString _sessionDisplayName { };
|
QString _sessionDisplayName { };
|
||||||
|
|
||||||
QHash<QString, int> _jointIndices; ///< 1-based, since zero is returned for missing keys
|
QHash<QString, int> _fstJointIndices; ///< 1-based, since zero is returned for missing keys
|
||||||
QStringList _jointNames; ///< in order of depth-first traversal
|
QStringList _fstJointNames; ///< in order of depth-first traversal
|
||||||
|
|
||||||
quint64 _errorLogExpiry; ///< time in future when to log an error
|
quint64 _errorLogExpiry; ///< time in future when to log an error
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue