From b26e6ced32f8eb980c40537a0f33f76e355994e9 Mon Sep 17 00:00:00 2001 From: kervala Date: Thu, 24 Feb 2011 19:00:36 +0100 Subject: [PATCH] Fixed: Use of LOD meshes when it shouldn't (patch provided by Sywindt, thanks a lot) --- code/nel/src/3d/clip_trav.cpp | 31 +++++++++-------------------- code/nel/src/3d/transform_shape.cpp | 13 +++++++++++- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/code/nel/src/3d/clip_trav.cpp b/code/nel/src/3d/clip_trav.cpp index 859671690..a1728a0bd 100644 --- a/code/nel/src/3d/clip_trav.cpp +++ b/code/nel/src/3d/clip_trav.cpp @@ -506,18 +506,12 @@ void CClipTrav::loadBalanceSkeletonCLod() // If valid priority (CLOd enabled, and skeleton visible) if(pr>0) { - // if the priority is >1, then display as CLod - if(pr>1) - sm->setDisplayLodCharacterFlag(true); - // else load balance. - else - { - CSkeletonKey key; - // don't bother OptFastFloor precision. NB: 0setDisplayLodCharacterFlag(false); + CSkeletonKey key; + // don't bother OptFastFloor precision. + key.Priority= OptFastFloor(pr*0xFFFFFF00); + key.SkeletonModel= sm; + _TmpSortSkeletons.push_back(key); } } @@ -529,16 +523,9 @@ void CClipTrav::loadBalanceSkeletonCLod() sort(_TmpSortSkeletons.begin(), _TmpSortSkeletons.end()); } - // **** set CLod flag - uint n= min(nMaxSkelsInNotCLodForm, (uint)_TmpSortSkeletons.size()); - uint i; - // The lowest priority are displayed in std form - for(i=0;isetDisplayLodCharacterFlag(false); - } - // the other are displayed in CLod form - for(i=n;i<_TmpSortSkeletons.size();i++) + // **** set CLod flag for skeletons > setting + uint n = min(nMaxSkelsInNotCLodForm, (uint)_TmpSortSkeletons.size()); + for (uint i = n; i < _TmpSortSkeletons.size(); i++) { _TmpSortSkeletons[i].SkeletonModel->setDisplayLodCharacterFlag(true); } diff --git a/code/nel/src/3d/transform_shape.cpp b/code/nel/src/3d/transform_shape.cpp index 47386f068..05101bfa4 100644 --- a/code/nel/src/3d/transform_shape.cpp +++ b/code/nel/src/3d/transform_shape.cpp @@ -296,7 +296,18 @@ void CTransformShape::traverseLoadBalancingPass0() // *************************************************************************** void CTransformShape::traverseLoadBalancingPass1() { - // Set the result into the isntance. + // Show more polygons for upscaled shapes to preserve visual quality + float factor = 1.0f; + if (getTransformMode() == RotEuler || getTransformMode() == RotQuat) + { + factor = std::max(1.0f, std::max(getScale().x, std::max(getScale().y, getScale().z))); + if (factor > 1) + { + _FaceCount = factor * std::max(_FaceCount, factor * 200.0f); + } + } + + // Set the result into the instance. _NumTrianglesAfterLoadBalancing= _LoadBalancingGroup->computeModelNbFace(_FaceCount); }