Fixed: Use of LOD meshes when it shouldn't (patch provided by Sywindt, thanks a lot)

This commit is contained in:
kervala 2011-02-24 19:00:36 +01:00
parent 6c4f4bb1df
commit 3454cb2cec
2 changed files with 21 additions and 23 deletions

View file

@ -506,18 +506,12 @@ void CClipTrav::loadBalanceSkeletonCLod()
// If valid priority (CLOd enabled, and skeleton visible) // If valid priority (CLOd enabled, and skeleton visible)
if(pr>0) if(pr>0)
{ {
// if the priority is >1, then display as CLod sm->setDisplayLodCharacterFlag(false);
if(pr>1) CSkeletonKey key;
sm->setDisplayLodCharacterFlag(true); // don't bother OptFastFloor precision.
// else load balance. key.Priority= OptFastFloor(pr*0xFFFFFF00);
else key.SkeletonModel= sm;
{ _TmpSortSkeletons.push_back(key);
CSkeletonKey key;
// don't bother OptFastFloor precision. NB: 0<pr<=1 here.
key.Priority= OptFastFloor(pr*0xFFFFFF00);
key.SkeletonModel= sm;
_TmpSortSkeletons.push_back(key);
}
} }
} }
@ -529,16 +523,9 @@ void CClipTrav::loadBalanceSkeletonCLod()
sort(_TmpSortSkeletons.begin(), _TmpSortSkeletons.end()); sort(_TmpSortSkeletons.begin(), _TmpSortSkeletons.end());
} }
// **** set CLod flag // **** set CLod flag for skeletons > setting
uint n= min(nMaxSkelsInNotCLodForm, (uint)_TmpSortSkeletons.size()); uint n = min(nMaxSkelsInNotCLodForm, (uint)_TmpSortSkeletons.size());
uint i; for (uint i = n; i < _TmpSortSkeletons.size(); i++)
// The lowest priority are displayed in std form
for(i=0;i<n;i++)
{
_TmpSortSkeletons[i].SkeletonModel->setDisplayLodCharacterFlag(false);
}
// the other are displayed in CLod form
for(i=n;i<_TmpSortSkeletons.size();i++)
{ {
_TmpSortSkeletons[i].SkeletonModel->setDisplayLodCharacterFlag(true); _TmpSortSkeletons[i].SkeletonModel->setDisplayLodCharacterFlag(true);
} }

View file

@ -296,7 +296,18 @@ void CTransformShape::traverseLoadBalancingPass0()
// *************************************************************************** // ***************************************************************************
void CTransformShape::traverseLoadBalancingPass1() 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); _NumTrianglesAfterLoadBalancing= _LoadBalancingGroup->computeModelNbFace(_FaceCount);
} }