mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-29 15:16:05 +00:00
Fixed: Use of LOD meshes when it shouldn't (patch provided by Sywindt, thanks a lot)
This commit is contained in:
parent
4614d42fb8
commit
9adfde974e
2 changed files with 21 additions and 23 deletions
|
@ -506,20 +506,14 @@ 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)
|
|
||||||
sm->setDisplayLodCharacterFlag(true);
|
|
||||||
// else load balance.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CSkeletonKey key;
|
CSkeletonKey key;
|
||||||
// don't bother OptFastFloor precision. NB: 0<pr<=1 here.
|
// don't bother OptFastFloor precision.
|
||||||
key.Priority= OptFastFloor(pr*0xFFFFFF00);
|
key.Priority= OptFastFloor(pr*0xFFFFFF00);
|
||||||
key.SkeletonModel= sm;
|
key.SkeletonModel= sm;
|
||||||
_TmpSortSkeletons.push_back(key);
|
_TmpSortSkeletons.push_back(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// **** sort by priority in ascending order
|
// **** sort by priority in ascending order
|
||||||
uint nMaxSkelsInNotCLodForm= Scene->getMaxSkeletonsInNotCLodForm();
|
uint nMaxSkelsInNotCLodForm= Scene->getMaxSkeletonsInNotCLodForm();
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue