Skip to content

Commit

Permalink
UPBGE: Fix polygons sort with derived mesh.
Browse files Browse the repository at this point in the history
Fix issue #494.
  • Loading branch information
panzergame committed Jun 2, 2017
1 parent ac2fba3 commit 114230c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/gameengine/Rasterizer/RAS_MeshSlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void RAS_MeshSlot::RunNode(const RAS_MeshSlotNodeTuple& tuple)
{
RAS_ManagerNodeData *managerData = tuple.m_managerData;
RAS_MaterialNodeData *materialData = tuple.m_materialData;
RAS_DisplayArrayNodeData *displayArrayData = tuple.m_displayArrayData;
RAS_Rasterizer *rasty = managerData->m_rasty;
rasty->SetClientObject(m_meshUser->GetClientObject());
rasty->SetFrontFace(m_meshUser->GetFrontFace());
Expand All @@ -172,8 +173,8 @@ void RAS_MeshSlot::RunNode(const RAS_MeshSlotNodeTuple& tuple)
materialData->m_material->ActivateMeshSlot(this, rasty);
}

if (materialData->m_zsort && managerData->m_drawingMode >= RAS_Rasterizer::RAS_SOLID) {
RAS_IStorageInfo *storage = tuple.m_displayArrayData->m_storageInfo;
if (materialData->m_zsort && managerData->m_drawingMode >= RAS_Rasterizer::RAS_SOLID && displayArrayData->m_storageInfo) {
RAS_IStorageInfo *storage = displayArrayData->m_storageInfo;
m_mesh->SortPolygons(this, managerData->m_trans * MT_Transform(m_meshUser->GetMatrix()), storage->GetIndexMap());
storage->FlushIndexMap();
}
Expand All @@ -194,7 +195,7 @@ void RAS_MeshSlot::RunNode(const RAS_MeshSlotNodeTuple& tuple)
rasty->IndexPrimitivesDerivedMesh(this);
}
else {
rasty->IndexPrimitives(tuple.m_displayArrayData->m_storageInfo);
rasty->IndexPrimitives(displayArrayData->m_storageInfo);
}

rasty->PopMatrix();
Expand Down

0 comments on commit 114230c

Please sign in to comment.