mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 11:52:43 +02:00
make ModelBlender work with DependancyManager
This commit is contained in:
parent
e0a017e963
commit
049cb25f07
2 changed files with 8 additions and 14 deletions
|
@ -1149,7 +1149,7 @@ void Blender::run() {
|
|||
}
|
||||
}
|
||||
// post the result to the geometry cache, which will dispatch to the model if still alive
|
||||
QMetaObject::invokeMethod(ModelBlender::getInstance(), "setBlendedVertices",
|
||||
QMetaObject::invokeMethod(DependencyManager::get<ModelBlender>(), "setBlendedVertices",
|
||||
Q_ARG(const QPointer<Model>&, _model), Q_ARG(int, _blendNumber),
|
||||
Q_ARG(const QWeakPointer<NetworkGeometry>&, _geometry), Q_ARG(const QVector<glm::vec3>&, vertices),
|
||||
Q_ARG(const QVector<glm::vec3>&, normals));
|
||||
|
@ -1312,7 +1312,7 @@ void Model::simulateInternal(float deltaTime) {
|
|||
// post the blender if we're not currently waiting for one to finish
|
||||
if (geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) {
|
||||
_blendedBlendshapeCoefficients = _blendshapeCoefficients;
|
||||
ModelBlender::getInstance()->noteRequiresBlend(this);
|
||||
DependencyManager::get<ModelBlender>()->noteRequiresBlend(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2545,11 +2545,6 @@ int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMod
|
|||
return meshPartsRendered;
|
||||
}
|
||||
|
||||
ModelBlender* ModelBlender::getInstance() {
|
||||
static ModelBlender instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
ModelBlender::ModelBlender() :
|
||||
_pendingBlenders(0) {
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "Transform.h"
|
||||
#include <AABox.h>
|
||||
#include <AnimationCache.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <PhysicsEntity.h>
|
||||
|
||||
|
@ -460,17 +461,11 @@ Q_DECLARE_METATYPE(QWeakPointer<NetworkGeometry>)
|
|||
Q_DECLARE_METATYPE(QVector<glm::vec3>)
|
||||
|
||||
/// Handle management of pending models that need blending
|
||||
class ModelBlender : public QObject {
|
||||
class ModelBlender : public QObject, public DependencyManager::Dependency {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
static ModelBlender* getInstance();
|
||||
|
||||
ModelBlender();
|
||||
virtual ~ModelBlender();
|
||||
|
||||
|
||||
/// Adds the specified model to the list requiring vertex blends.
|
||||
void noteRequiresBlend(Model* model);
|
||||
|
||||
|
@ -479,6 +474,10 @@ public slots:
|
|||
const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals);
|
||||
|
||||
private:
|
||||
ModelBlender();
|
||||
virtual ~ModelBlender();
|
||||
friend class DependencyManager;
|
||||
|
||||
QList<QPointer<Model> > _modelsRequiringBlends;
|
||||
int _pendingBlenders;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue