RavEngine
Loading...
Searching...
No Matches
PxMaterial.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_MATERIAL_H
30#define PX_MATERIAL_H
35#include "PxBaseMaterial.h"
36
37#if !PX_DOXYGEN
38namespace physx
39{
40#endif
41
42class PxScene;
43
50{
51 enum Enum
52 {
53
58
79
93
98 eCOMPLIANT_CONTACT = 1 << 3
99 };
100};
101
108PX_FLAGS_OPERATORS(PxMaterialFlag::Enum,PxU16)
109
110
111
131{
132 enum Enum
133 {
134 eAVERAGE = 0,
135 eMIN = 1,
136 eMULTIPLY = 2,
137 eMAX = 3,
138 eN_VALUES = 4,
139 ePAD_32 = 0x7fffffff
140 };
141};
142
149{
150public:
151
163 virtual void setDynamicFriction(PxReal coef) = 0;
164
172 virtual PxReal getDynamicFriction() const = 0;
173
185 virtual void setStaticFriction(PxReal coef) = 0;
186
193 virtual PxReal getStaticFriction() const = 0;
194
210 virtual void setRestitution(PxReal rest) = 0;
211
221 virtual PxReal getRestitution() const = 0;
222
223
237 virtual void setDamping(PxReal damping) = 0;
238
248 virtual PxReal getDamping() const = 0;
249
264 virtual void setFlag(PxMaterialFlag::Enum flag, bool b) = 0;
265
279 virtual void setFlags(PxMaterialFlags flags) = 0;
280
288 virtual PxMaterialFlags getFlags() const = 0;
289
303 virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0;
304
315
330
341
342 // PxBase
343 virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxMaterial"; }
344 //~PxBase
345
346protected:
347 PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBaseMaterial(concreteType, baseFlags) {}
348 PX_INLINE PxMaterial(PxBaseFlags baseFlags) : PxBaseMaterial(baseFlags) {}
349 virtual ~PxMaterial() {}
350 virtual bool isKindOf(const char* name) const { return !::strcmp("PxMaterial", name) || PxBaseMaterial::isKindOf(name); }
351};
352
353#if !PX_DOXYGEN
354} // namespace physx
355#endif
356
358#endif
Base material class.
Definition PxBaseMaterial.h:49
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxBaseMaterial.h:54
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
Material class to represent a set of surface properties.
Definition PxMaterial.h:149
virtual PxCombineMode::Enum getFrictionCombineMode() const =0
Retrieves the friction combine mode.
virtual PxReal getStaticFriction() const =0
Retrieves the coefficient of static friction.
virtual PxCombineMode::Enum getRestitutionCombineMode() const =0
Retrieves the restitution combine mode.
virtual void setFlags(PxMaterialFlags flags)=0
sets all the material flags.
virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode)=0
Sets the restitution combine mode.
virtual void setRestitution(PxReal rest)=0
Sets the coefficient of restitution.
virtual PxReal getDamping() const =0
Retrieves the coefficient of damping.
virtual void setDynamicFriction(PxReal coef)=0
Sets the coefficient of dynamic friction.
virtual PxReal getDynamicFriction() const =0
Retrieves the DynamicFriction value.
virtual PxReal getRestitution() const =0
Retrieves the coefficient of restitution.
virtual void setFlag(PxMaterialFlag::Enum flag, bool b)=0
Raises or clears a particular material flag.
virtual void setDamping(PxReal damping)=0
Sets the coefficient of damping.
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxMaterial.h:350
virtual PxMaterialFlags getFlags() const =0
Retrieves the flags. See #PxMaterialFlag.
virtual void setStaticFriction(PxReal coef)=0
Sets the coefficient of static friction.
virtual const char * getConcreteTypeName() const PX_OVERRIDE
Returns string name of dynamic type.
Definition PxMaterial.h:343
virtual void setFrictionCombineMode(PxCombineMode::Enum combMode)=0
Sets the friction combine mode.
#define PX_OVERRIDE
Definition PxPreprocessor.h:375
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxFlags< PxMaterialFlag::Enum, PxU16 > PxMaterialFlags
collection of set bits defined in PxMaterialFlag.
Definition PxMaterial.h:107
Enumeration that determines the way in which two material properties will be combined to yield a fric...
Definition PxMaterial.h:131
Enum
Definition PxMaterial.h:133
Flags which control the behavior of a material.
Definition PxMaterial.h:50
Enum
Definition PxMaterial.h:52
@ eDISABLE_STRONG_FRICTION
Whether to use strong friction. The difference between "normal" and "strong" friction is that the str...
Definition PxMaterial.h:78
@ eCOMPLIANT_CONTACT
This flag has the effect of enabling an implicit spring model for the normal force computation.
Definition PxMaterial.h:98
@ eDISABLE_FRICTION
If this flag is set, friction computations are always skipped between shapes with this material and a...
Definition PxMaterial.h:57
@ eIMPROVED_PATCH_FRICTION
Whether to use the patch friction model. This flag only has an effect if PxFrictionType::ePATCH frict...
Definition PxMaterial.h:92