mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Skip faded passes when fade is disabled.
This commit is contained in:
parent
47755fd4a0
commit
b7f57c03f0
2 changed files with 7 additions and 3 deletions
|
@ -16,6 +16,7 @@ lcScene::lcScene()
|
||||||
mDrawInterface = false;
|
mDrawInterface = false;
|
||||||
mAllowWireframe = true;
|
mAllowWireframe = true;
|
||||||
mAllowLOD = true;
|
mAllowLOD = true;
|
||||||
|
mHasFadedParts = false;
|
||||||
mPreTranslucentCallback = nullptr;
|
mPreTranslucentCallback = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ void lcScene::Begin(const lcMatrix44& ViewMatrix)
|
||||||
{
|
{
|
||||||
mViewMatrix = ViewMatrix;
|
mViewMatrix = ViewMatrix;
|
||||||
mActiveSubmodelInstance = nullptr;
|
mActiveSubmodelInstance = nullptr;
|
||||||
|
mHasFadedParts = false;
|
||||||
mPreTranslucentCallback = nullptr;
|
mPreTranslucentCallback = nullptr;
|
||||||
mRenderMeshes.RemoveAll();
|
mRenderMeshes.RemoveAll();
|
||||||
mOpaqueMeshes.RemoveAll();
|
mOpaqueMeshes.RemoveAll();
|
||||||
|
@ -70,6 +72,7 @@ void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorInde
|
||||||
const bool ForceTranslucent = (gTranslucentFade && State == lcRenderMeshState::Faded);
|
const bool ForceTranslucent = (gTranslucentFade && State == lcRenderMeshState::Faded);
|
||||||
const bool Translucent = lcIsColorTranslucent(ColorIndex) || ForceTranslucent;
|
const bool Translucent = lcIsColorTranslucent(ColorIndex) || ForceTranslucent;
|
||||||
const lcMeshFlags Flags = Mesh->mFlags;
|
const lcMeshFlags Flags = Mesh->mFlags;
|
||||||
|
mHasFadedParts |= State == lcRenderMeshState::Faded;
|
||||||
|
|
||||||
if ((Flags & (lcMeshFlag::HasSolid | lcMeshFlag::HasLines)) || ((Flags & lcMeshFlag::HasDefault) && !Translucent))
|
if ((Flags & (lcMeshFlag::HasSolid | lcMeshFlag::HasLines)) || ((Flags & lcMeshFlag::HasDefault) && !Translucent))
|
||||||
mOpaqueMeshes.Add(mRenderMeshes.GetSize() - 1);
|
mOpaqueMeshes.Add(mRenderMeshes.GetSize() - 1);
|
||||||
|
@ -348,7 +351,7 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawF
|
||||||
if (ColorIndex == gDefaultColor)
|
if (ColorIndex == gDefaultColor)
|
||||||
ColorIndex = RenderMesh.ColorIndex;
|
ColorIndex = RenderMesh.ColorIndex;
|
||||||
|
|
||||||
if (DrawFadePrepass && !lcIsColorTranslucent(ColorIndex))
|
if (DrawFadePrepass && lcIsColorTranslucent(ColorIndex))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (RenderMesh.State)
|
switch (RenderMesh.State)
|
||||||
|
@ -449,7 +452,7 @@ void lcScene::Draw(lcContext* Context) const
|
||||||
|
|
||||||
const int SolidPrimitiveTypes = LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES;
|
const int SolidPrimitiveTypes = LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES;
|
||||||
|
|
||||||
if (gTranslucentFade)
|
if (gTranslucentFade && mHasFadedParts)
|
||||||
{
|
{
|
||||||
DrawOpaqueMeshes(Context, false, SolidPrimitiveTypes | LinePrimitiveTypes, false, true);
|
DrawOpaqueMeshes(Context, false, SolidPrimitiveTypes | LinePrimitiveTypes, false, true);
|
||||||
|
|
||||||
|
@ -482,7 +485,7 @@ void lcScene::Draw(lcContext* Context) const
|
||||||
if (DrawConditional)
|
if (DrawConditional)
|
||||||
LinePrimitiveTypes |= LC_MESH_CONDITIONAL_LINES;
|
LinePrimitiveTypes |= LC_MESH_CONDITIONAL_LINES;
|
||||||
|
|
||||||
if (gTranslucentFade)
|
if (gTranslucentFade && mHasFadedParts)
|
||||||
{
|
{
|
||||||
DrawOpaqueMeshes(Context, true, LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES, false, true);
|
DrawOpaqueMeshes(Context, true, LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES, false, true);
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ protected:
|
||||||
bool mDrawInterface;
|
bool mDrawInterface;
|
||||||
bool mAllowWireframe;
|
bool mAllowWireframe;
|
||||||
bool mAllowLOD;
|
bool mAllowLOD;
|
||||||
|
bool mHasFadedParts;
|
||||||
|
|
||||||
std::function<void()> mPreTranslucentCallback;
|
std::function<void()> mPreTranslucentCallback;
|
||||||
lcArray<lcRenderMesh> mRenderMeshes;
|
lcArray<lcRenderMesh> mRenderMeshes;
|
||||||
|
|
Loading…
Reference in a new issue