BGE modifier: last minute commit to fix a nasty bug with modifers messing the alpha blend mode of the GE. Note the alpha sorting on modified mesh is not implemented so derived mesh should not have alpha faces (clip will work though). Incidently fixed a performance problem in GLSL where the derived mesh was possibly rendered multiple times. Modifier support is still a bit experimental and should not be used in production game.
This commit is contained in:
@@ -382,15 +382,39 @@ RAS_TexVert* RAS_MeshObject::GetVertex(unsigned int matid,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head)
|
||||
void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* deformer)
|
||||
{
|
||||
list<RAS_MeshMaterial>::iterator it;
|
||||
list<RAS_MeshMaterial>::iterator mit;
|
||||
|
||||
for(it = m_materials.begin();it!=m_materials.end();++it) {
|
||||
/* always copy from the base slot, which is never removed
|
||||
* since new objects can be created with the same mesh data */
|
||||
if (deformer && !deformer->UseVertexArray())
|
||||
{
|
||||
// HACK!
|
||||
// this deformer doesn't use vertex array => derive mesh
|
||||
// we must keep only the mesh slots that have unique material id
|
||||
// this is to match the derived mesh drawing function
|
||||
// Need a better solution in the future: scan the derive mesh and create vertex array
|
||||
RAS_IPolyMaterial* curmat = it->m_bucket->GetPolyMaterial();
|
||||
if (curmat->GetFlag() & RAS_BLENDERGLSL)
|
||||
{
|
||||
for(mit = m_materials.begin(); mit != it; ++mit)
|
||||
{
|
||||
RAS_IPolyMaterial* mat = mit->m_bucket->GetPolyMaterial();
|
||||
if ((mat->GetFlag() & RAS_BLENDERGLSL) &&
|
||||
mat->GetMaterialIndex() == curmat->GetMaterialIndex())
|
||||
// no need to convert current mesh slot
|
||||
break;
|
||||
}
|
||||
if (mit != it)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
RAS_MeshSlot *ms = it->m_bucket->CopyMesh(it->m_baseslot);
|
||||
ms->m_clientObj = clientobj;
|
||||
ms->SetDeformer(deformer);
|
||||
it->m_slots.insert(clientobj, ms);
|
||||
head->QAddBack(ms);
|
||||
}
|
||||
|
Reference in New Issue
Block a user