Added mesh LOD distance option.

This commit is contained in:
Leonardo Zide
2020-08-15 16:16:26 -07:00
parent c8acaeb2f0
commit 0828fd1e2c
11 changed files with 55 additions and 4 deletions
+2 -1
View File
@@ -14,6 +14,7 @@ lcScene::lcScene()
mDrawInterface = false;
mAllowWireframe = true;
mAllowLOD = true;
mMeshLODDistance = 250.0f;
mHasFadedParts = false;
mPreTranslucentCallback = nullptr;
}
@@ -69,7 +70,7 @@ void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorInde
RenderMesh.Mesh = Mesh;
RenderMesh.ColorIndex = ColorIndex;
RenderMesh.State = State;
const float Distance = fabsf(lcMul31(WorldMatrix[3], mViewMatrix).z);
const float Distance = fabsf(lcMul31(WorldMatrix[3], mViewMatrix).z) - mMeshLODDistance;
RenderMesh.LodIndex = mAllowLOD ? RenderMesh.Mesh->GetLodIndex(Distance) : LC_MESH_LOD_HIGH;
const bool ForceTranslucent = (mTranslucentFade && State == lcRenderMeshState::Faded);