Răsfoiți Sursa

add a specific lod option for findColDetails

AzaezelX 7 luni în urmă
părinte
comite
f5b7f70f50
2 a modificat fișierele cu 18 adăugiri și 8 ștergeri
  1. 17 7
      Engine/source/ts/tsCollision.cpp
  2. 1 1
      Engine/source/ts/tsShape.h

+ 17 - 7
Engine/source/ts/tsCollision.cpp

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

+ 1 - 1
Engine/source/ts/tsShape.h

@@ -475,7 +475,7 @@ class TSShape
    /// @param outDetails The output detail index 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.
    ///