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 4614d42fb8
commit 9adfde974e
2 changed files with 21 additions and 23 deletions

View file

@ -506,20 +506,14 @@ 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
{
sm->setDisplayLodCharacterFlag(false);
CSkeletonKey key;
// don't bother OptFastFloor precision. NB: 0<pr<=1 here.
// don't bother OptFastFloor precision.
key.Priority= OptFastFloor(pr*0xFFFFFF00);
key.SkeletonModel= sm;
_TmpSortSkeletons.push_back(key);
}
}
}
// **** sort by priority in ascending order
uint nMaxSkelsInNotCLodForm= Scene->getMaxSkeletonsInNotCLodForm();
@ -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;i<n;i++)
{
_TmpSortSkeletons[i].SkeletonModel->setDisplayLodCharacterFlag(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);
}

View file

@ -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);
}