PxSceneDesc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12 
13 
14 #ifndef PX_PHYSICS_NX_SCENEDESC
15 #define PX_PHYSICS_NX_SCENEDESC
16 
20 #include "PxPhysXConfig.h"
21 #include "foundation/PxFlags.h"
22 #include "foundation/PxBounds3.h"
23 #include "PxFiltering.h"
24 #include "PxBroadPhase.h"
26 
27 #ifndef PX_DOXYGEN
28 namespace physx
29 {
30 #endif
31 
32 class PxCpuDispatcher;
33 class PxGpuDispatcher;
34 class PxSpuDispatcher;
35 
54 {
55  enum Enum
56  {
60 
61  eLAST
62  };
63 };
64 
65 
75 {
76  enum Enum
77  {
79  eSOLVE_COLLIDE
80  };
81 };
82 
83 
84 
99  {
100  enum Enum
101  {
104  eTWO_DIRECTIONAL
105  };
106  };
107 
115 {
116  enum Enum
117  {
130  eENABLE_ACTIVETRANSFORMS =(1<<1),
131 
144  eENABLE_CCD =(1<<2),
145 
165  eDISABLE_CCD_RESWEEP =(1<<3),
166 
167 
175  eADAPTIVE_FORCE =(1<<4),
176 
177 
188  eENABLE_KINEMATIC_STATIC_PAIRS =(1<<5),
189 
190 
201  eENABLE_KINEMATIC_PAIRS =(1<<6),
202 
203 
211  eENABLE_PCM = (1 << 9),
212 
221  eDISABLE_CONTACT_REPORT_BUFFER_RESIZE = (1 << 10),
222 
231  eDISABLE_CONTACT_CACHE = (1 << 11),
232 
233 
249  eREQUIRE_RW_LOCK = (1 << 12),
250 
258  eENABLE_STABILIZATION = (1 << 14),
259 
268  eENABLE_AVERAGE_POINT = (1 << 15)
269 
270  };
271 };
272 
280 
281 
286 
295 {
296 public:
305 
309  PX_INLINE PxSceneLimits();
310 
314  PX_INLINE void setToDefault();
315 
320  PX_INLINE bool isValid() const;
321 };
322 
323 PX_INLINE PxSceneLimits::PxSceneLimits() //constructor sets to default
324 {
325  maxNbActors = 0;
326  maxNbBodies = 0;
327  maxNbStaticShapes = 0;
328  maxNbDynamicShapes = 0;
329  maxNbAggregates = 0;
330  maxNbConstraints = 0;
331  maxNbRegions = 0;
332  maxNbObjectsPerRegion = 0;
333 }
334 
336 {
337  *this = PxSceneLimits();
338 }
339 
341 {
342  if(maxNbRegions>256) // max number of regions is currently limited
343  return false;
344 
345  return true;
346 }
347 
356 {
357 public:
358 
370 
382 
391 
400 
410  const void* filterShaderData;
411 
420 
431 
441 
450 
462 
469 
484 
485 
497 
513 
524 
539 
546 
553 
562 
571 
578 
583 
602 
608  void* userData;
609 
626 
641 
661 
676 
689 
700 
712 
713 
724 
725 private:
729  // For internal use only
730  PxTolerancesScale tolerancesScale;
736 public:
747 
757  PX_INLINE void setToDefault(const PxTolerancesScale& scale);
758 
763  PX_INLINE bool isValid() const;
764 
768  // For internal use only
769  PX_INLINE const PxTolerancesScale& getTolerancesScale() const { return tolerancesScale; }
773 };
774 
776  gravity (PxVec3(0.0f)),
777  simulationEventCallback (NULL),
778  contactModifyCallback (NULL),
779  ccdContactModifyCallback (NULL),
780 
781  filterShaderData (NULL),
782  filterShaderDataSize (0),
783  filterShader (NULL),
784  filterCallback (NULL),
785  broadPhaseType (PxBroadPhaseType::eSAP),
786  broadPhaseCallback (NULL),
787 
788  meshContactMargin (0.01f * scale.length),
789  frictionType (PxFrictionType::ePATCH),
790  contactCorrelationDistance (0.025f * scale.length),
791  bounceThresholdVelocity (0.2f * scale.speed),
792  frictionOffsetThreshold (0.04f * scale.length),
793 
794  flags (0),
795 
796  cpuDispatcher (NULL),
797  gpuDispatcher (NULL),
798  spuDispatcher (NULL),
799 
800  staticStructure (PxPruningStructure::eDYNAMIC_AABB_TREE),
801  dynamicStructure (PxPruningStructure::eDYNAMIC_AABB_TREE),
802  dynamicTreeRebuildRateHint (100),
803 
804  userData (NULL),
805 
806  solverBatchSize (32),
807 
808 #ifdef PX_PS3
809  nbContactDataBlocks (256),
810 #else
811  nbContactDataBlocks (0),
812 #endif
813 
814  maxNbContactDataBlocks (1<<16),
815  contactReportStreamBufferSize (8192),
816  ccdMaxPasses (1),
817  simulationOrder (PxSimulationOrder::eCOLLIDE_SOLVE),
818  wakeCounterResetValue (20.0f*0.02f),
821  tolerancesScale (scale)
822 {
823 }
824 
826 {
827  *this = PxSceneDesc(scale);
828 }
829 
831 {
832  if(filterShader == NULL)
833  return false;
834 
835  if( ((filterShaderDataSize == 0) && (filterShaderData != NULL)) ||
836  ((filterShaderDataSize > 0) && (filterShaderData == NULL)) )
837  return false;
838 
839  if(!limits.isValid())
840  return false;
841 
843  return false;
844 
846  return false;
847 
848  if(meshContactMargin < 0.0f)
849  return false;
850  if(contactCorrelationDistance < 0.0f)
851  return false;
852  if(bounceThresholdVelocity < 0.0f)
853  return false;
854  if(frictionOffsetThreshold < 0.f)
855  return false;
856 
857  if(cpuDispatcher == NULL)
858  return false;
859 
861  return false;
862 
864  return false;
865 
866  if (wakeCounterResetValue <= 0.0f)
867  return false;
868 
869 #if !PX_ENABLE_INVERTED_STEPPER_FEATURE
871  return false;
872 #endif
873 
874  //Adaptive force and stabilization are incompatible. You can only have one or the other
876  return false;
877 
878  if(!sanityBounds.isValid())
879  return false;
880 
881  return true;
882 }
883 
884 
885 #ifndef PX_DOXYGEN
886 } // namespace physx
887 #endif
888 
890 #endif


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com