PxMaterial.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 
31 #ifndef PX_PHYSICS_NXMATERIAL
32 #define PX_PHYSICS_NXMATERIAL
33 
37 #include "PxPhysXConfig.h"
38 #include "common/PxBase.h"
39 
40 #if !PX_DOXYGEN
41 namespace physx
42 {
43 #endif
44 
45 class PxScene;
46 
53 {
54  enum Enum
55  {
56 
60  eDISABLE_FRICTION = 1 << 0,
61 
80  eDISABLE_STRONG_FRICTION = 1 << 1,
81 
93  eIMPROVED_PATCH_FRICTION = 1 << 2
94  };
95 };
96 
103 PX_FLAGS_OPERATORS(PxMaterialFlag::Enum,PxU16)
104 
105 
106 
126 {
127  enum Enum
128  {
129  eAVERAGE = 0,
130  eMIN = 1,
131  eMULTIPLY = 2,
132  eMAX = 3,
133  eN_VALUES = 4,
134  ePAD_32 = 0x7fffffff
135  };
136 };
137 
143 class PxMaterial : public PxBase
144 {
145 public:
146 
152  virtual void release() = 0;
153 
162  virtual PxU32 getReferenceCount() const = 0;
163 
169  virtual void acquireReference() = 0;
170 
182  virtual void setDynamicFriction(PxReal coef) = 0;
183 
191  virtual PxReal getDynamicFriction() const = 0;
192 
204  virtual void setStaticFriction(PxReal coef) = 0;
205 
212  virtual PxReal getStaticFriction() const = 0;
213 
225  virtual void setRestitution(PxReal rest) = 0;
226 
236  virtual PxReal getRestitution() const = 0;
237 
252  virtual void setFlag(PxMaterialFlag::Enum flag, bool b) = 0;
253 
267  virtual void setFlags(PxMaterialFlags flags) = 0;
268 
276  virtual PxMaterialFlags getFlags() const = 0;
277 
291  virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0;
292 
302  virtual PxCombineMode::Enum getFrictionCombineMode() const = 0;
303 
317  virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode) = 0;
318 
328  virtual PxCombineMode::Enum getRestitutionCombineMode() const = 0;
329 
330  //public variables:
331  void* userData;
332 
333  virtual const char* getConcreteTypeName() const { return "PxMaterial"; }
334 
335 protected:
336  PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
337  PX_INLINE PxMaterial(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
338  virtual ~PxMaterial() {}
339  virtual bool isKindOf(const char* name) const { return !::strcmp("PxMaterial", name) || PxBase::isKindOf(name); }
340 
341 };
342 
343 #if !PX_DOXYGEN
344 } // namespace physx
345 #endif
346 
348 #endif
Definition: GuContactBuffer.h:37
PX_INLINE PxMaterial(PxBaseFlags baseFlags)
Definition: PxMaterial.h:337
A scene is a collection of bodies and constraints which can interact.
Definition: PxScene.h:169
float PxReal
Definition: PxSimpleTypes.h:78
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition: PxBase.h:178
virtual ~PxMaterial()
Definition: PxMaterial.h:338
PxU16 PxType
Definition: PxBase.h:49
PxFlags< PxMaterialFlag::Enum, PxU16 > PxMaterialFlags
collection of set bits defined in PxMaterialFlag.
Definition: PxMaterial.h:102
enumeration that determines the way in which two material properties will be combined to yield a fric...
Definition: PxMaterial.h:125
PxU16 flags
a set of Px1DConstraintFlags
Definition: PxConstraintDesc.h:110
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxMaterial.h:339
Enum
Definition: PxMaterial.h:127
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition: PxMaterial.h:333
Flags which control the behavior of a material.
Definition: PxMaterial.h:52
void * userData
user can assign this to whatever, usually to create a 1:1 relationship with a user object...
Definition: PxMaterial.h:331
Material class to represent a set of surface properties.
Definition: PxMaterial.h:143
Enum
Definition: PxMaterial.h:54
Container for bitfield flag variables associated with a specific enum type.
Definition: PxFlags.h:73
uint16_t PxU16
Definition: PxSimpleTypes.h:73
uint32_t PxU32
Definition: Px.h:48
Base class for objects that can be members of a PxCollection.
Definition: PxBase.h:73
#define PX_INLINE
Definition: PxPreprocessor.h:336
PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags)
Definition: PxMaterial.h:336