00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef PX_SIMULATION_STATISTICS
00032 #define PX_SIMULATION_STATISTICS
00033
00037 #include "PxPhysXConfig.h"
00038 #include "foundation/PxAssert.h"
00039 #include "geometry/PxGeometry.h"
00040
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045
00051 class PxSimulationStatistics
00052 {
00053 public:
00054
00059 enum RbPairStatsType
00060 {
00064 eDISCRETE_CONTACT_PAIRS,
00065
00074 eCCD_PAIRS,
00075
00081 eMODIFIED_CONTACT_PAIRS,
00082
00088 eTRIGGER_PAIRS
00089 };
00090
00091
00092
00096 PxU32 nbActiveConstraints;
00097
00103 PxU32 nbActiveDynamicBodies;
00104
00111 PxU32 nbActiveKinematicBodies;
00112
00116 PxU32 nbStaticBodies;
00117
00123 PxU32 nbDynamicBodies;
00124
00129 PxU32 nbShapes[PxGeometryType::eGEOMETRY_COUNT];
00130
00134 PxU32 nbAggregates;
00135
00139 PxU32 nbArticulations;
00140
00141
00145 PxU32 nbAxisSolverConstraints;
00146
00150 PxU32 compressedContactSize;
00151
00155 PxU32 requiredContactConstraintMemory;
00156
00160 PxU32 peakConstraintMemory;
00161
00162
00168 PX_FORCE_INLINE PxU32 getNbBroadPhaseAdds() const
00169 {
00170 return nbBroadPhaseAdds;
00171 }
00172
00178 PX_FORCE_INLINE PxU32 getNbBroadPhaseRemoves() const
00179 {
00180 return nbBroadPhaseRemoves;
00181 }
00182
00183
00197 PxU32 getRbPairStats(RbPairStatsType pairType, PxGeometryType::Enum g0, PxGeometryType::Enum g1) const
00198 {
00199 PX_ASSERT_WITH_MESSAGE( (pairType >= eDISCRETE_CONTACT_PAIRS) &&
00200 (pairType <= eTRIGGER_PAIRS),
00201 "Invalid pairType in PxSimulationStatistics::getRbPairStats");
00202
00203 if (g0 >= PxGeometryType::eGEOMETRY_COUNT || g1 >= PxGeometryType::eGEOMETRY_COUNT)
00204 {
00205 PX_ASSERT(false);
00206 return 0;
00207 }
00208
00209 PxU32 nbPairs = 0;
00210 switch(pairType)
00211 {
00212 case eDISCRETE_CONTACT_PAIRS:
00213 nbPairs = nbDiscreteContactPairs[g0][g1];
00214 break;
00215 case eCCD_PAIRS:
00216 nbPairs = nbCCDPairs[g0][g1];
00217 break;
00218 case eMODIFIED_CONTACT_PAIRS:
00219 nbPairs = nbModifiedContactPairs[g0][g1];
00220 break;
00221 case eTRIGGER_PAIRS:
00222 nbPairs = nbTriggerPairs[g0][g1];
00223 break;
00224 }
00225 return nbPairs;
00226 }
00227
00231 PxU32 nbDiscreteContactPairsTotal;
00232
00237 PxU32 nbDiscreteContactPairsWithCacheHits;
00238
00242 PxU32 nbDiscreteContactPairsWithContacts;
00243
00247 PxU32 nbNewPairs;
00248
00252 PxU32 nbLostPairs;
00253
00257 PxU32 nbNewTouches;
00258
00262 PxU32 nbLostTouches;
00263
00267 PxU32 nbPartitions;
00268
00269 PxSimulationStatistics() :
00270 nbActiveConstraints (0),
00271 nbActiveDynamicBodies (0),
00272 nbActiveKinematicBodies (0),
00273 nbStaticBodies (0),
00274 nbDynamicBodies (0),
00275 nbAggregates (0),
00276 nbArticulations (0),
00277 nbAxisSolverConstraints (0),
00278 compressedContactSize (0),
00279 requiredContactConstraintMemory (0),
00280 peakConstraintMemory (0),
00281 nbDiscreteContactPairsTotal (0),
00282 nbDiscreteContactPairsWithCacheHits (0),
00283 nbDiscreteContactPairsWithContacts (0),
00284 nbNewPairs (0),
00285 nbLostPairs (0),
00286 nbNewTouches (0),
00287 nbLostTouches (0),
00288 nbPartitions (0)
00289 {
00290 nbBroadPhaseAdds = 0;
00291 nbBroadPhaseRemoves = 0;
00292
00293 for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
00294 {
00295 for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++)
00296 {
00297 nbDiscreteContactPairs[i][j] = 0;
00298 nbModifiedContactPairs[i][j] = 0;
00299 nbCCDPairs[i][j] = 0;
00300 nbTriggerPairs[i][j] = 0;
00301 }
00302 }
00303
00304 for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
00305 {
00306 nbShapes[i] = 0;
00307 }
00308 }
00309
00310
00311
00312
00313
00314
00315 PxU32 nbBroadPhaseAdds;
00316 PxU32 nbBroadPhaseRemoves;
00317
00318
00319 PxU32 nbDiscreteContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00320 PxU32 nbCCDPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00321 PxU32 nbModifiedContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00322 PxU32 nbTriggerPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00323 };
00324
00325 #if !PX_DOXYGEN
00326 }
00327 #endif
00328
00330 #endif