BGE: Allow skinned meshes with modifiers to do skinning updates in parallel.
This commit is contained in:
@@ -197,6 +197,15 @@ bool BL_ModifierDeformer::Update(void)
|
|||||||
}
|
}
|
||||||
m_lastModifierUpdate=m_gameobj->GetLastFrame();
|
m_lastModifierUpdate=m_gameobj->GetLastFrame();
|
||||||
bShapeUpdate = true;
|
bShapeUpdate = true;
|
||||||
|
|
||||||
|
int nmat = m_pMeshObject->NumMaterials();
|
||||||
|
for (int imat=0; imat<nmat; imat++) {
|
||||||
|
RAS_MeshMaterial *mmat = m_pMeshObject->GetMeshMaterial(imat);
|
||||||
|
RAS_MeshSlot **slot = mmat->m_slots[(void*)m_gameobj];
|
||||||
|
if (!slot || !*slot)
|
||||||
|
continue;
|
||||||
|
(*slot)->m_pDerivedMesh = m_dm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return bShapeUpdate;
|
return bShapeUpdate;
|
||||||
}
|
}
|
||||||
@@ -206,14 +215,5 @@ bool BL_ModifierDeformer::Apply(RAS_IPolyMaterial *mat)
|
|||||||
if (!Update())
|
if (!Update())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// drawing is based on derived mesh, must set it in the mesh slots
|
|
||||||
int nmat = m_pMeshObject->NumMaterials();
|
|
||||||
for (int imat=0; imat<nmat; imat++) {
|
|
||||||
RAS_MeshMaterial *mmat = m_pMeshObject->GetMeshMaterial(imat);
|
|
||||||
RAS_MeshSlot **slot = mmat->m_slots[(void*)m_gameobj];
|
|
||||||
if (!slot || !*slot)
|
|
||||||
continue;
|
|
||||||
(*slot)->m_pDerivedMesh = m_dm;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1601,7 +1601,6 @@ void KX_Scene::AddAnimatedObject(CValue* gameobj)
|
|||||||
static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(threadid))
|
static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(threadid))
|
||||||
{
|
{
|
||||||
KX_GameObject *gameobj, *child;
|
KX_GameObject *gameobj, *child;
|
||||||
RAS_Deformer *deformer;
|
|
||||||
CListValue *children;
|
CListValue *children;
|
||||||
bool needs_update;
|
bool needs_update;
|
||||||
double curtime = *(double*)BLI_task_pool_userdata(pool);
|
double curtime = *(double*)BLI_task_pool_userdata(pool);
|
||||||
@@ -1649,12 +1648,7 @@ static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(t
|
|||||||
for (int j=0; j<children->GetCount(); ++j) {
|
for (int j=0; j<children->GetCount(); ++j) {
|
||||||
child = (KX_GameObject*)children->GetValue(j);
|
child = (KX_GameObject*)children->GetValue(j);
|
||||||
|
|
||||||
deformer = child->GetDeformer();
|
if (child->GetDeformer()) {
|
||||||
|
|
||||||
// This check is ugly, but the modifier deformer currently doesn't
|
|
||||||
// work if called from here. This is a quick work-around to prevent
|
|
||||||
// crashing, but it really should be fixed.
|
|
||||||
if (deformer && !dynamic_cast<BL_ModifierDeformer*>(deformer)) {
|
|
||||||
child->GetDeformer()->Update();
|
child->GetDeformer()->Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user