add a specific lod option for findColDetails

This commit is contained in:
AzaezelX 2025-01-27 17:19:22 -06:00
parent e2a0fbefa3
commit f5b7f70f50
2 changed files with 19 additions and 9 deletions

View file

@ -811,11 +811,11 @@ bool TSShapeInstance::buildConvexOpcode( const MatrixF &objMat, const Point3F &o
return emitted; return emitted;
} }
void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vector<S32> *outLOSDetails ) const void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vector<S32> *outLOSDetails, S32 specifiedLOD) const
{ {
PROFILE_SCOPE( TSShape_findColDetails ); PROFILE_SCOPE( TSShape_findColDetails );
if ( useVisibleMesh ) if ( useVisibleMesh || (specifiedLOD !=0))
{ {
// If we're using the visible mesh for collision then // If we're using the visible mesh for collision then
// find the highest detail and use that. // find the highest detail and use that.
@ -836,12 +836,23 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vect
dStrStartsWith( name, "LOS" ) ) dStrStartsWith( name, "LOS" ) )
continue; continue;
*/ */
if (specifiedLOD != 0)
// Otherwise test against the current highest size
if ( details[i].size > highestSize )
{ {
highestDetail = i; if (details[i].size == specifiedLOD)
highestSize = details[i].size; {
highestDetail = i;
highestSize = details[i].size;
}
}
else
{
// Otherwise test against the current highest size
if (details[i].size > highestSize)
{
highestDetail = i;
highestSize = details[i].size;
}
} }
} }
@ -852,7 +863,6 @@ void TSShape::findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vect
if ( outLOSDetails ) if ( outLOSDetails )
outLOSDetails->push_back( highestDetail ); outLOSDetails->push_back( highestDetail );
} }
return; return;
} }

View file

@ -475,7 +475,7 @@ class TSShape
/// @param outDetails The output detail index vector. /// @param outDetails The output detail index vector.
/// @param outLOSDetails The optional output LOS detail vector. /// @param outLOSDetails The optional output LOS detail vector.
/// ///
void findColDetails( bool useVisibleMesh, Vector<S32> *outDetails, Vector<S32> *outLOSDetails ) const; void findColDetails(bool useVisibleMesh, Vector<S32>* outDetails, Vector<S32>* outLOSDetails, S32 specifiedLOD = 0 ) const;
/// Builds a physics collision shape at the requested scale. /// Builds a physics collision shape at the requested scale.
/// ///