mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:07:07 +02:00
Merge pull request #3407 from ey6es/master
Only allow one "blender" to run at a time for each model.
This commit is contained in:
commit
66ce6b7c3c
2 changed files with 26 additions and 4 deletions
|
@ -61,7 +61,10 @@ Model::Model(QObject* parent) :
|
||||||
_showTrueJointTransforms(true),
|
_showTrueJointTransforms(true),
|
||||||
_lodDistance(0.0f),
|
_lodDistance(0.0f),
|
||||||
_pupilDilation(0.0f),
|
_pupilDilation(0.0f),
|
||||||
_url("http://invalid.com") {
|
_url("http://invalid.com"),
|
||||||
|
_blenderPending(false),
|
||||||
|
_blendRequired(false) {
|
||||||
|
|
||||||
// we may have been created in the network thread, but we live in the main thread
|
// we may have been created in the network thread, but we live in the main thread
|
||||||
moveToThread(Application::getInstance()->thread());
|
moveToThread(Application::getInstance()->thread());
|
||||||
}
|
}
|
||||||
|
@ -998,9 +1001,15 @@ void Model::simulateInternal(float deltaTime) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// post the blender
|
// post the blender if we're not currently waiting for one to finish
|
||||||
if (geometry.hasBlendedMeshes()) {
|
if (geometry.hasBlendedMeshes()) {
|
||||||
QThreadPool::globalInstance()->start(new Blender(this, _geometry, geometry.meshes, _blendshapeCoefficients));
|
if (_blenderPending) {
|
||||||
|
_blendRequired = true;
|
||||||
|
} else {
|
||||||
|
_blendRequired = false;
|
||||||
|
_blenderPending = true;
|
||||||
|
QThreadPool::globalInstance()->start(new Blender(this, _geometry, geometry.meshes, _blendshapeCoefficients));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,10 +1273,20 @@ void Model::renderJointCollisionShapes(float alpha) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model::setBlendedVertices(const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals) {
|
void Model::setBlendedVertices(const QVector<glm::vec3>& vertices, const QVector<glm::vec3>& normals) {
|
||||||
|
_blenderPending = false;
|
||||||
|
|
||||||
|
// start the next blender if required
|
||||||
|
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||||
|
if (_blendRequired) {
|
||||||
|
_blendRequired = false;
|
||||||
|
if (geometry.hasBlendedMeshes()) {
|
||||||
|
_blenderPending = true;
|
||||||
|
QThreadPool::globalInstance()->start(new Blender(this, _geometry, geometry.meshes, _blendshapeCoefficients));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (_blendedVertexBuffers.isEmpty()) {
|
if (_blendedVertexBuffers.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i = 0; i < geometry.meshes.size(); i++) {
|
for (int i = 0; i < geometry.meshes.size(); i++) {
|
||||||
const FBXMesh& mesh = geometry.meshes.at(i);
|
const FBXMesh& mesh = geometry.meshes.at(i);
|
||||||
|
|
|
@ -284,6 +284,9 @@ private:
|
||||||
glm::vec4 _localLightColors[MAX_LOCAL_LIGHTS];
|
glm::vec4 _localLightColors[MAX_LOCAL_LIGHTS];
|
||||||
glm::vec4 _localLightDirections[MAX_LOCAL_LIGHTS];
|
glm::vec4 _localLightDirections[MAX_LOCAL_LIGHTS];
|
||||||
|
|
||||||
|
bool _blenderPending;
|
||||||
|
bool _blendRequired;
|
||||||
|
|
||||||
static ProgramObject _program;
|
static ProgramObject _program;
|
||||||
static ProgramObject _normalMapProgram;
|
static ProgramObject _normalMapProgram;
|
||||||
static ProgramObject _specularMapProgram;
|
static ProgramObject _specularMapProgram;
|
||||||
|
|
Loading…
Reference in a new issue