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_CLOTH_TYPES
15#define PX_PHYSICS_NX_CLOTH_TYPES
16/** \addtogroup cloth
17 @{
18*/
19
20#include "PxPhysXConfig.h"
21#include "foundation/PxFlags.h"
22
23#include "foundation/PxVec3.h"
24
25#ifndef PX_DOXYGEN
26namespace physx
27{
28#endif
29
30/**
31 \brief flag for behaviors of the cloth solver
32 \details Defines flags to turn on/off features of the cloth solver.
33 The flag can be set during the cloth object construction (\see PxPhysics.createCloth() ),
34 or individually after the cloth has been created (\see PxCloth.setClothFlag() ).
35 */
36struct PxClothFlag
37{
38 enum Enum
39 {
40 eGPU = (1<<0), //!< turn on/off gpu based solver
41 eSWEPT_CONTACT = (1<<1), //!< use swept contact (continuous collision)
42 eSCENE_COLLISION = (1<<2), //!< collide against rigid body shapes in scene
43 eCOUNT = 3 // internal use only
44 };
45};
46
47typedef PxFlags<PxClothFlag::Enum,PxU16> PxClothFlags;
48PX_FLAGS_OPERATORS(PxClothFlag::Enum, PxU16)
49
50/**
51 \brief Per particle data for cloth.
52 \details Defines position of the cloth particle as well as inverse mass.
53 When inverse mass is set to 0, the particle gets fully constrained
54 to the position during simulation.
55 \see PxPhysics.createCloth()
56 \see PxCloth.setParticles()
57*/
58struct PxClothParticle
59{
60 PxVec3 pos; //!< position of the particle (in cloth local space)
61 PxReal invWeight; //!< inverse mass of the particle. If set to 0, the particle is fully constrained.
62
63 /**
64 \brief Default constructor, performs no initialization.
65 */
66 PxClothParticle() {}
67 PxClothParticle(const PxVec3& pos_, PxReal invWeight_)
68 : pos(pos_), invWeight(invWeight_){}
69};
70
71/**
72\brief Constraints for cloth particle motion.
73\details Defines a spherical volume to which the motion of a particle should be constrained.
74@see PxCloth.setMotionConstraints()
75*/
76struct PxClothParticleMotionConstraint
77{
78 PxVec3 pos; //!< Center of the motion constraint sphere (in cloth local space)
79 PxReal radius; //!< Maximum distance the particle can move away from the sphere center.
80
81 /**
82 \brief Default constructor, performs no initialization.
83 */
84 PxClothParticleMotionConstraint() {}
85 PxClothParticleMotionConstraint(const PxVec3& p, PxReal r)
86 : pos(p), radius(r){}
87};
88
89/**
90\brief Separation constraints for cloth particle movement
91\details Defines a spherical volume such that corresponding particles should stay outside.
92@see PxCloth.setSeparationConstraints()
93*/
94struct PxClothParticleSeparationConstraint
95{
96 PxVec3 pos; //!< Center of the constraint sphere (in cloth local space)
97 PxReal radius; //!< Radius of the constraint sphere such that the particle stay outside of this sphere.
98
99 /**
100 \brief Default constructor, performs no initialization.
101 */
102 PxClothParticleSeparationConstraint() {}
103 PxClothParticleSeparationConstraint(const PxVec3& p, PxReal r)
104 : pos(p), radius(r){}
105};
106
107#ifndef PX_DOXYGEN
108} // namespace physx
109#endif
110
111/** @} */
112#endif
113