Added wrapper for glDepthMask.

This commit is contained in:
Leonardo Zide
2019-11-09 18:11:25 -08:00
parent 655498f3ee
commit 5854cfce89
6 changed files with 39 additions and 30 deletions
+18 -8
View File
@@ -71,11 +71,6 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab
{
const lcArray<int>& Meshes = DrawTranslucent ? mTranslucentMeshes : mOpaqueMeshes;
if (DrawTranslucent)
Context->BeginTranslucent();
else
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
for (int MeshIndex : Meshes)
{
const lcRenderMesh& RenderMesh = mRenderMeshes[MeshIndex];
@@ -233,9 +228,6 @@ void lcScene::DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool Enab
}
#endif
}
if (DrawTranslucent)
Context->EndTranslucent();
}
void lcScene::Draw(lcContext* Context) const
@@ -253,6 +245,8 @@ void lcScene::Draw(lcContext* Context) const
if (ShadingMode == LC_SHADING_WIREFRAME && !mAllowWireframe)
ShadingMode = LC_SHADING_FLAT;
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
if (ShadingMode == LC_SHADING_WIREFRAME)
{
Context->BindTexture2D(0);
@@ -296,6 +290,10 @@ void lcScene::Draw(lcContext* Context) const
if (!mTranslucentMeshes.IsEmpty())
{
glEnable(GL_BLEND);
Context->SetDepthWrite(false);
Context->SetPolygonOffset(LC_POLYGON_OFFSET_TRANSLUCENT);
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
DrawRenderMeshes(Context, LC_MESH_TRIANGLES, false, true, false);
@@ -308,6 +306,10 @@ void lcScene::Draw(lcContext* Context) const
Context->BindTexture2D(0);
}
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
Context->SetDepthWrite(true);
glDisable(GL_BLEND);
}
}
else
@@ -340,6 +342,10 @@ void lcScene::Draw(lcContext* Context) const
if (!mTranslucentMeshes.IsEmpty())
{
glEnable(GL_BLEND);
Context->SetDepthWrite(false);
Context->SetPolygonOffset(LC_POLYGON_OFFSET_TRANSLUCENT);
Context->SetMaterial(LC_MATERIAL_FAKELIT_COLOR);
DrawRenderMeshes(Context, LC_MESH_TRIANGLES, true, true, false);
@@ -352,6 +358,10 @@ void lcScene::Draw(lcContext* Context) const
Context->BindTexture2D(0);
}
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
Context->SetDepthWrite(true);
glDisable(GL_BLEND);
}
}
}