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-2018 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  };
82 };
83 
90 PX_FLAGS_OPERATORS(PxMaterialFlag::Enum,PxU16)
91 
92 
93 
113 {
114  enum Enum
115  {
116  eAVERAGE = 0,
117  eMIN = 1,
118  eMULTIPLY = 2,
119  eMAX = 3,
120  eN_VALUES = 4,
121  ePAD_32 = 0x7fffffff
122  };
123 };
124 
130 class PxMaterial : public PxBase
131 {
132 public:
133 
139  virtual void release() = 0;
140 
149  virtual PxU32 getReferenceCount() const = 0;
150 
156  virtual void acquireReference() = 0;
157 
169  virtual void setDynamicFriction(PxReal coef) = 0;
170 
178  virtual PxReal getDynamicFriction() const = 0;
179 
191  virtual void setStaticFriction(PxReal coef) = 0;
192 
199  virtual PxReal getStaticFriction() const = 0;
200 
212  virtual void setRestitution(PxReal rest) = 0;
213 
223  virtual PxReal getRestitution() const = 0;
224 
236  virtual void setFlag(PxMaterialFlag::Enum flag, bool) = 0;
237 
238 
247  virtual void setFlags( PxMaterialFlags inFlags ) = 0;
248 
256  virtual PxMaterialFlags getFlags() const = 0;
257 
269  virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0;
270 
280  virtual PxCombineMode::Enum getFrictionCombineMode() const = 0;
281 
293  virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode) = 0;
294 
304  virtual PxCombineMode::Enum getRestitutionCombineMode() const = 0;
305 
306  //public variables:
307  void* userData;
308 
309  virtual const char* getConcreteTypeName() const { return "PxMaterial"; }
310 
311 protected:
312  PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
313  PX_INLINE PxMaterial(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
314  virtual ~PxMaterial() {}
315  virtual bool isKindOf(const char* name) const { return !::strcmp("PxMaterial", name) || PxBase::isKindOf(name); }
316 
317 };
318 
319 #if !PX_DOXYGEN
320 } // namespace physx
321 #endif
322 
324 #endif
Definition: GuContactBuffer.h:37
PX_INLINE PxMaterial(PxBaseFlags baseFlags)
Definition: PxMaterial.h:313
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:314
PxU16 PxType
Definition: PxBase.h:49
PxFlags< PxMaterialFlag::Enum, PxU16 > PxMaterialFlags
collection of set bits defined in PxMaterialFlag.
Definition: PxMaterial.h:89
enumeration that determines the way in which two material properties will be combined to yield a fric...
Definition: PxMaterial.h:112
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxMaterial.h:315
Enum
Definition: PxMaterial.h:114
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition: PxMaterial.h:309
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:307
Material class to represent a set of surface properties.
Definition: PxMaterial.h:130
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:349
PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags)
Definition: PxMaterial.h:312