FLEX  1.2.0
NvFlexExt.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2013-2020 NVIDIA Corporation. All rights reserved.
27 
28 #ifndef NV_FLEX_EXT_H
29 #define NV_FLEX_EXT_H
30 
36 #include "NvFlex.h"
37 
38 #include <cassert>
39 #include <cstddef>
40 
41 // A vector type that wraps a NvFlexBuffer, behaves like a standard vector for POD types (no construction)
42 // The vector must be mapped using map() before any read/write access to elements or resize operation
43 
44 template <typename T>
46 {
48  {
49  if (size)
50  {
51  resize(size);
52 
53  // resize implicitly maps, unmap initial allocation
54  unmap();
55  }
56  }
57 
59  {
60  assign(ptr, size);
61  unmap();
62  }
63 
64 
66  {
67  destroy();
68  }
69 
72 
74  int count;
75  int capacity;
77 
78  // reinitialize the vector leaving it unmapped
79  void init(int size)
80  {
81  destroy();
82  resize(size);
83  unmap();
84  }
85 
86  void destroy()
87  {
88  if (mappedPtr)
89  NvFlexUnmap(buffer);
90 
91  if (buffer)
92  NvFlexFreeBuffer(buffer);
93 
94  mappedPtr = NULL;
95  buffer = NULL;
96  capacity = 0;
97  count = 0;
98  }
99 
100  void map(int flags=eNvFlexMapWait)
101  {
102  if (!buffer)
103  return;
104 
105  assert(!mappedPtr);
106  mappedPtr = (T*)NvFlexMap(buffer, flags);
107  }
108 
109  void unmap()
110  {
111  if (!buffer)
112  return;
113 
114  assert(mappedPtr);
115 
116  NvFlexUnmap(buffer);
117  mappedPtr = 0;
118  }
119 
120  const T& operator[](int index) const
121  {
122  assert(mappedPtr);
123  assert(index < count);
124 
125  return mappedPtr[index];
126  }
127 
128  T& operator[](int index)
129  {
130  assert(mappedPtr);
131  assert(index < count);
132 
133  return mappedPtr[index];
134  }
135 
136  void push_back(const T& t)
137  {
138  assert(mappedPtr || !buffer);
139 
140  reserve(count+1);
141 
142  // copy element
143  mappedPtr[count++] = t;
144  }
145 
146  void assign(const T* srcPtr, int newCount)
147  {
148  assert(mappedPtr || !buffer);
149 
150  resize(newCount);
151 
152  memcpy(mappedPtr, srcPtr, newCount*sizeof(T));
153  }
154 
155  void copyto(T* dest, int count)
156  {
157  assert(mappedPtr);
158 
159  memcpy(dest, mappedPtr, sizeof(T)*count);
160  }
161 
162  int size() const { return count; }
163 
164  bool empty() const { return size() == 0; }
165 
166  const T& back() const
167  {
168  assert(mappedPtr);
169  assert(!empty());
170 
171  return mappedPtr[count-1];
172  }
173 
174  void reserve(int minCapacity)
175  {
176  if (minCapacity > capacity)
177  {
178  // growth factor of 1.5
179  const int newCapacity = minCapacity*3/2;
180 
181  NvFlexBuffer* newBuf = NvFlexAllocBuffer(lib, newCapacity, sizeof(T), type);
182 
183  // copy contents to new buffer
184  void* newPtr = NvFlexMap(newBuf, eNvFlexMapWait);
185  memcpy(newPtr, mappedPtr, count*sizeof(T));
186 
187  // unmap old buffer, but leave new buffer mapped
188  unmap();
189 
190  if (buffer)
191  NvFlexFreeBuffer(buffer);
192 
193  // swap
194  buffer = newBuf;
195  mappedPtr = (T*)newPtr;
196  capacity = newCapacity;
197  }
198  }
199 
200  // resizes mapped buffer and leaves new buffer mapped
201  void resize(int newCount)
202  {
203  assert(mappedPtr || !buffer);
204 
205  reserve(newCount);
206 
207  // resize but do not initialize new entries
208  count = newCount;
209  }
210 
211  void resize(int newCount, const T& val)
212  {
213  assert(mappedPtr || !buffer);
214 
215  const int startInit = count;
216  const int endInit = newCount;
217 
218  resize(newCount);
219 
220  // init any new entries
221  for (int i=startInit; i < endInit; ++i)
222  mappedPtr[i] = val;
223  }
224 };
225 
226 extern "C" {
227 
232 {
233  float position[3];
234  float rotation[4];
235 
236  float velocity[3];
237  float omega[3];
238 
239  float acceleration[3];
240  float tau[3];
241 
242  float delta[4][4];
243 };
244 
281 NV_FLEX_API void NvFlexExtMovingFrameInit(NvFlexExtMovingFrame* frame, const float* worldTranslation, const float* worldRotation);
282 
283 /* Update a frame to a new position, this will automatically update the velocity and acceleration of
284  * the frame, which can then be used to calculate inertial forces. This should be called once per-frame
285  * with the new position and time-step used when moving the frame.
286  *
287  * @param[in] frame A pointer to a user-allocated NvFlexExtMovingFrame struct
288  * @param[in] worldTranslation A pointer to a vec3 storing the frame's initial translation in world space
289  * @param[in] worldRotation A pointer to a quaternion storing the frame's initial rotation in world space
290  * @param[in] dt The time that elapsed since the last call to the frame update
291  */
292 NV_FLEX_API void NvFlexExtMovingFrameUpdate(NvFlexExtMovingFrame* frame, const float* worldTranslation, const float* worldRotation, float dt);
293 
294 /* Teleport particles to the frame's new position and apply the inertial forces
295  *
296  * @param[in] frame A pointer to a user-allocated NvFlexExtMovingFrame struct
297  * @param[in] positions A pointer to an array of particle positions in (x, y, z, 1/m) format
298  * @param[in] velocities A pointer to an array of particle velocities in (vx, vy, vz) format
299  * @param[in] numParticles The number of particles to update
300  * @param[in] linearScale How strongly the translational inertial forces should be applied, 0.0 corresponds to a purely local space simulation removing all inertial forces, 1.0 corresponds to no inertial damping and has no benefit over regular world space simulation
301  * @param[in] angularScale How strongly the angular inertial forces should be applied, 0.0 corresponds to a purely local space simulation, 1.0 corresponds to no inertial damping
302  * @param[in] dt The time that elapsed since the last call to the frame update, should match the value passed to NvFlexExtMovingFrameUpdate()
303  */
304 NV_FLEX_API void NvFlexExtMovingFrameApply(NvFlexExtMovingFrame* frame, float* positions, float* velocities, int numParticles, float linearScale, float angularScale, float dt);
305 
306 
312 {
313  // particles
314  float* particles;
317 
318  // springs
323 
324  // shapes
329  float* shapeCenters;
330  int numShapes;
331 
332  // plastic deformation
335 
336  // faces for cloth
339 
340  // inflatable params
341  bool inflatable;
345 };
346 
351 {
354 
358 
360  float* shapeRotations;
361 
363 
364  void* userData;
365 };
366 
372 {
377 
378  float shapeTranslations[3];
379  float shapeRotations[4];
380 
381  float stiffness;
382 
383  bool initialized;
384 };
385 
390 
402 NV_FLEX_API int NvFlexExtCreateWeldedMeshIndices(const float* vertices, int numVertices, int* uniqueVerts, int* originalToUniqueMap, float threshold);
403 
419 NV_FLEX_API NvFlexExtAsset* NvFlexExtCreateClothFromMesh(const float* particles, int numParticles, const int* indices, int numTriangles, float stretchStiffness, float bendStiffness, float tetherStiffness, float tetherGive, float pressure);
420 
439 NV_FLEX_API NvFlexExtAsset* NvFlexExtCreateTearingClothFromMesh(const float* particles, int numParticles, int maxParticles, const int* indices, int numTriangles, float stretchStiffness, float bendStiffness, float pressure);
440 
445 NV_FLEX_API void NvFlexExtDestroyTearingCloth(NvFlexExtAsset* asset);
446 
453 {
454  int srcIndex;
456 };
457 
466 {
467  int triIndex; // index into the triangle indices array to update
468  int newParticleIndex; // new value for the index
469 };
470 
485 NV_FLEX_API void NvFlexExtTearClothMesh(NvFlexExtAsset* asset, float maxStrain, int maxSplits, NvFlexExtTearingParticleClone* particleCopies, int* numParticleCopies, int maxCopies, NvFlexExtTearingMeshEdit* triangleEdits, int* numTriangleEdits, int maxEdits);
486 
498 NV_FLEX_API NvFlexExtAsset* NvFlexExtCreateRigidFromMesh(const float* vertices, int numVertices, const int* indices, int numTriangleIndices, float radius, float expand);
499 
520 NV_FLEX_API NvFlexExtAsset* NvFlexExtCreateSoftFromMesh(const float* vertices, int numVertices, const int* indices, int numTriangleIndices, float particleSpacing, float volumeSampling, float surfaceSampling, float clusterSpacing, float clusterRadius, float clusterStiffness, float linkRadius, float linkStiffness, float globalStiffness, float clusterPlasticThreshold, float clusterPlasticCreep);
521 
526 NV_FLEX_API void NvFlexExtDestroyAsset(NvFlexExtAsset* asset);
527 
540 NV_FLEX_API void NvFlexExtCreateSoftMeshSkinning(const float* vertices, int numVertices, const float* bones, int numBones, float falloff, float maxDistance, float* skinningWeights, int* skinningIndices);
541 
550 NV_FLEX_API NvFlexExtContainer* NvFlexExtCreateContainer(NvFlexLibrary* lib, NvFlexSolver* solver, int maxParticles);
551 
557 NV_FLEX_API void NvFlexExtDestroyContainer(NvFlexExtContainer* container);
558 
566 NV_FLEX_API int NvFlexExtAllocParticles(NvFlexExtContainer* container, int n, int* indices);
567 
575 NV_FLEX_API void NvFlexExtFreeParticles(NvFlexExtContainer* container, int n, const int* indices);
576 
577 
585 NV_FLEX_API int NvFlexExtGetActiveList(NvFlexExtContainer* container, int* indices);
586 
587 
589 {
590  float* particles;
591  float* restParticles;
592  float* velocities;
593  int* phases;
594  float* normals;
595 
596  const float* lower;
597  const float* upper;
598 };
599 
607 NV_FLEX_API void NvFlexExtUnmapParticleData(NvFlexExtContainer* container);
608 
610 {
611  int* indices;
612  float* normals;
613 };
614 
621 
625 NV_FLEX_API void NvFlexExtUnmapTriangleData(NvFlexExtContainer* container);
626 
628 {
629  float* rotations;
630  float* positions;
631  int n;
632 };
633 
640 
644 NV_FLEX_API void NvFlexExtUnmapShapeData(NvFlexExtContainer* container);
645 
661 NV_FLEX_API NvFlexExtInstance* NvFlexExtCreateInstance(NvFlexExtContainer* container, NvFlexExtParticleData* particleData, const NvFlexExtAsset* asset, const float* transform, float vx, float vy, float vz, int phase, float invMassScale);
662 
668 NV_FLEX_API void NvFlexExtDestroyInstance(NvFlexExtContainer* container, const NvFlexExtInstance* instance);
669 
676 NV_FLEX_API void NvFlexExtNotifyAssetChanged(NvFlexExtContainer* container, const NvFlexExtAsset* asset);
677 
707 NV_FLEX_API void NvFlexExtTickContainer(NvFlexExtContainer* container, float dt, int numSubsteps, bool enableTimers=false);
708 
714 NV_FLEX_API void NvFlexExtPushToDevice(NvFlexExtContainer* container);
715 
721 NV_FLEX_API void NvFlexExtPullFromDevice(NvFlexExtContainer* container);
722 
728 NV_FLEX_API void NvFlexExtUpdateInstances(NvFlexExtContainer* container);
729 
730 
735 {
738 
741 
744 };
745 
750 {
751  float mPosition[3];
752  float mRadius;
753  float mStrength;
756 };
757 
763 
772 
779 
787 NV_FLEX_API void NvFlexExtSetForceFields(NvFlexExtForceFieldCallback* callback, const NvFlexExtForceField* forceFields, int numForceFields);
788 
799 NV_FLEX_API NvFlexExtSoftJoint* NvFlexExtCreateSoftJoint(NvFlexExtContainer* container, const int* particleIndices, const float* particleLocalPositions, const int numJointParticles, const float stiffness);
800 
806 NV_FLEX_API void NvFlexExtDestroySoftJoint(NvFlexExtContainer* container, NvFlexExtSoftJoint* joint);
807 
815 NV_FLEX_API void NvFlexExtSoftJointSetTransform(NvFlexExtContainer* container, NvFlexExtSoftJoint* joint, const float* position, const float* rotation);
816 
817 } // extern "C"
818 
819 #endif // NV_FLEX_EXT_H
820 
bool mLinearFalloff
Linear or no falloff.
Definition: NvFlexExt.h:755
void destroy()
Definition: NvFlexExt.h:86
NvFlexBufferType type
Definition: NvFlexExt.h:76
int numParticles
Number of particles.
Definition: NvFlexExt.h:315
float * shapeCenters
The position of the center of mass of each shape, an array of vec3s mNumShapes in length...
Definition: NvFlexExt.h:329
NV_FLEX_API void NvFlexExtSetForceFields(NvFlexExtForceFieldCallback *callback, const NvFlexExtForceField *forceFields, int numForceFields)
NV_FLEX_API void NvFlexExtMovingFrameApply(NvFlexExtMovingFrame *frame, float *positions, float *velocities, int numParticles, float linearScale, float angularScale, float dt)
float * shapeRotations
Shape matching group rotations (quaternions)
Definition: NvFlexExt.h:360
NvFlexVector(NvFlexLibrary *l, const T *ptr, int size, NvFlexBufferType type=eNvFlexBufferHost)
Definition: NvFlexExt.h:58
int n
Number of valid tranforms.
Definition: NvFlexExt.h:631
NvFlexLibrary * lib
Definition: NvFlexExt.h:70
float * particles
Local space particle positions, x,y,z,1/mass.
Definition: NvFlexExt.h:314
int * shapeOffsets
Each entry stores the end of the shape's indices in the indices array (exclusive prefix sum of shape ...
Definition: NvFlexExt.h:327
int newParticleIndex
Definition: NvFlexExt.h:468
NV_FLEX_API void NvFlexUnmap(NvFlexBuffer *buffer)
NV_FLEX_API void NvFlexExtDestroyInstance(NvFlexExtContainer *container, const NvFlexExtInstance *instance)
NV_FLEX_API void NvFlexExtMovingFrameUpdate(NvFlexExtMovingFrame *frame, const float *worldTranslation, const float *worldRotation, float dt)
void init(int size)
Definition: NvFlexExt.h:79
NV_FLEX_API NvFlexExtAsset * NvFlexExtCreateRigidFromMesh(const float *vertices, int numVertices, const int *indices, int numTriangleIndices, float radius, float expand)
float * springRestLengths
Spring rest-lengths.
Definition: NvFlexExt.h:321
int size() const
Definition: NvFlexExt.h:162
NV_FLEX_API void NvFlexExtTickContainer(NvFlexExtContainer *container, float dt, int numSubsteps, bool enableTimers=false)
Definition: NvFlexExt.h:588
int numParticles
Number of simulation particles.
Definition: NvFlexExt.h:353
NV_FLEX_API void NvFlexExtUnmapParticleData(NvFlexExtContainer *container)
struct NvFlexExtContainer NvFlexExtContainer
Definition: NvFlexExt.h:389
T & operator[](int index)
Definition: NvFlexExt.h:128
NV_FLEX_API NvFlexExtSoftJoint * NvFlexExtCreateSoftJoint(NvFlexExtContainer *container, const int *particleIndices, const float *particleLocalPositions, const int numJointParticles, const float stiffness)
void * userData
User data pointer.
Definition: NvFlexExt.h:364
NV_FLEX_API void NvFlexExtPullFromDevice(NvFlexExtContainer *container)
void resize(int newCount, const T &val)
Definition: NvFlexExt.h:211
int * triangleIndices
Indexed triangle mesh indices for clothing.
Definition: NvFlexExt.h:337
int capacity
Definition: NvFlexExt.h:75
int * particleIndices
Simulation particle indices.
Definition: NvFlexExt.h:352
float mRadius
Radius of the force field.
Definition: NvFlexExt.h:752
int numTriangles
Number of triangles.
Definition: NvFlexExt.h:338
Calling thread will be blocked until buffer is ready for access, default.
Definition: NvFlex.h:69
float stiffness
Joint stiffness.
Definition: NvFlexExt.h:381
struct NvFlexSolver NvFlexSolver
Definition: NvFlex.h:57
NV_FLEX_API NvFlexExtAsset * NvFlexExtCreateClothFromMesh(const float *particles, int numParticles, const int *indices, int numTriangles, float stretchStiffness, float bendStiffness, float tetherStiffness, float tetherGive, float pressure)
Definition: NvFlexExt.h:749
int numShapeIndices
Total number of indices for shape constraints.
Definition: NvFlexExt.h:326
NV_FLEX_API void NvFlexExtDestroyTearingCloth(NvFlexExtAsset *asset)
float * rotations
Receives a pointer to the array quaternion rotation data in [x, y z, w] format.
Definition: NvFlexExt.h:629
NV_FLEX_API int NvFlexExtGetActiveList(NvFlexExtContainer *container, int *indices)
int shapeIndex
Index in the container's shape body constraints array.
Definition: NvFlexExt.h:356
Definition: NvFlexExt.h:45
NV_FLEX_API void NvFlexExtDestroyForceFieldCallback(NvFlexExtForceFieldCallback *callback)
NV_FLEX_API void * NvFlexMap(NvFlexBuffer *buffer, int flags)
NvFlexVector(NvFlexLibrary *l, int size=0, NvFlexBufferType type=eNvFlexBufferHost)
Definition: NvFlexExt.h:47
int * springIndices
Spring indices.
Definition: NvFlexExt.h:319
void reserve(int minCapacity)
Definition: NvFlexExt.h:174
~NvFlexVector()
Definition: NvFlexExt.h:65
int maxParticles
Maximum number of particles, allows extra space for tearable assets which duplicate particles...
Definition: NvFlexExt.h:316
void push_back(const T &t)
Definition: NvFlexExt.h:136
NV_FLEX_API void NvFlexExtDestroyContainer(NvFlexExtContainer *container)
float tau[3]
Definition: NvFlexExt.h:240
float omega[3]
Definition: NvFlexExt.h:237
NV_FLEX_API void NvFlexExtCreateSoftMeshSkinning(const float *vertices, int numVertices, const float *bones, int numBones, float falloff, float maxDistance, float *skinningWeights, int *skinningIndices)
bool empty() const
Definition: NvFlexExt.h:164
Definition: NvFlexExt.h:465
NV_FLEX_API NvFlexExtContainer * NvFlexExtCreateContainer(NvFlexLibrary *lib, NvFlexSolver *solver, int maxParticles)
NV_FLEX_API NvFlexExtInstance * NvFlexExtCreateInstance(NvFlexExtContainer *container, NvFlexExtParticleData *particleData, const NvFlexExtAsset *asset, const float *transform, float vx, float vy, float vz, int phase, float invMassScale)
float rotation[4]
Definition: NvFlexExt.h:234
float inflatableVolume
The rest volume for the inflatable constraint.
Definition: NvFlexExt.h:342
A host mappable buffer, pinned memory on CUDA, staging buffer on DX.
Definition: NvFlex.h:78
NV_FLEX_API void NvFlexExtUnmapShapeData(NvFlexExtContainer *container)
struct NvFlexBuffer NvFlexBuffer
Definition: NvFlex.h:62
NV_FLEX_API NvFlexExtShapeData NvFlexExtMapShapeData(NvFlexExtContainer *container)
Apply field value as an impulse.
Definition: NvFlexExt.h:740
float * particles
Receives a pointer to the particle position / mass data.
Definition: NvFlexExt.h:590
float * springCoefficients
Spring coefficients.
Definition: NvFlexExt.h:320
NV_FLEX_API NvFlexExtAsset * NvFlexExtCreateSoftFromMesh(const float *vertices, int numVertices, const int *indices, int numTriangleIndices, float particleSpacing, float volumeSampling, float surfaceSampling, float clusterSpacing, float clusterRadius, float clusterStiffness, float linkRadius, float linkStiffness, float globalStiffness, float clusterPlasticThreshold, float clusterPlasticCreep)
float * restParticles
Receives a pointer to the particle's rest position (used for self collision culling) ...
Definition: NvFlexExt.h:591
float * positions
Receives a pointer to an array of shape body translations in [x, y, z] format.
Definition: NvFlexExt.h:630
Definition: NvFlexExt.h:231
const T & operator[](int index) const
Definition: NvFlexExt.h:120
void unmap()
Definition: NvFlexExt.h:109
Definition: NvFlexExt.h:350
NV_FLEX_API void NvFlexExtUpdateInstances(NvFlexExtContainer *container)
bool initialized
Joint status flag.
Definition: NvFlexExt.h:383
float mPosition[3]
Center of force field.
Definition: NvFlexExt.h:751
int * indices
Receives a pointer to the array of triangle index data.
Definition: NvFlexExt.h:611
float * normals
Receives a pointer to an array of triangle normal data stored with 16 byte stride, i.e.: [nx, ny, nz].
Definition: NvFlexExt.h:612
NV_FLEX_API void NvFlexExtSoftJointSetTransform(NvFlexExtContainer *container, NvFlexExtSoftJoint *joint, const float *position, const float *rotation)
NV_FLEX_API void NvFlexExtTearClothMesh(NvFlexExtAsset *asset, float maxStrain, int maxSplits, NvFlexExtTearingParticleClone *particleCopies, int *numParticleCopies, int maxCopies, NvFlexExtTearingMeshEdit *triangleEdits, int *numTriangleEdits, int maxEdits)
float acceleration[3]
Definition: NvFlexExt.h:239
int * particleIndices
Global indices.
Definition: NvFlexExt.h:373
Apply field value as a force.
Definition: NvFlexExt.h:737
float inflatableStiffness
How stiff the inflatable is.
Definition: NvFlexExt.h:344
struct NvFlexLibrary NvFlexLibrary
Definition: NvFlex.h:52
int triIndex
Definition: NvFlexExt.h:467
float * normals
Receives a pointer to the particle normal data with 16 byte stride in format [nx, ny...
Definition: NvFlexExt.h:594
int numParticles
Number of particles in the joint.
Definition: NvFlexExt.h:376
NV_FLEX_API NvFlexExtTriangleData NvFlexExtMapTriangleData(NvFlexExtContainer *container)
int destIndex
Definition: NvFlexExt.h:455
float mStrength
Strength of the force field.
Definition: NvFlexExt.h:753
float position[3]
Definition: NvFlexExt.h:233
float shapeTranslations[3]
Joint shape matching group translations (vec3s)
Definition: NvFlexExt.h:378
void resize(int newCount)
Definition: NvFlexExt.h:201
Definition: NvFlexExt.h:311
int shapeIndex
Index in the container's shape body constraints array.
Definition: NvFlexExt.h:375
NV_FLEX_API void NvFlexExtPushToDevice(NvFlexExtContainer *container)
struct NvFlexExtForceFieldCallback NvFlexExtForceFieldCallback
Definition: NvFlexExt.h:762
int count
Definition: NvFlexExt.h:74
NvFlexExtForceMode
Definition: NvFlexExt.h:734
float * shapeCoefficients
The stiffness coefficient for each shape.
Definition: NvFlexExt.h:328
float shapeRotations[4]
Joint shape matching group rotations (quaternions)
Definition: NvFlexExt.h:379
void map(int flags=eNvFlexMapWait)
Definition: NvFlexExt.h:100
Apply field value as a velocity change.
Definition: NvFlexExt.h:743
NV_FLEX_API NvFlexExtAsset * NvFlexExtCreateTearingClothFromMesh(const float *particles, int numParticles, int maxParticles, const int *indices, int numTriangles, float stretchStiffness, float bendStiffness, float pressure)
Definition: NvFlexExt.h:627
NV_FLEX_API void NvFlexExtMovingFrameInit(NvFlexExtMovingFrame *frame, const float *worldTranslation, const float *worldRotation)
float inflatablePressure
How much over the rest volume the inflatable should attempt to maintain.
Definition: NvFlexExt.h:343
const float * upper
Receive a pointer to the particle upper bounds [x, y, z].
Definition: NvFlexExt.h:597
NV_FLEX_API NvFlexBuffer * NvFlexAllocBuffer(NvFlexLibrary *lib, int elementCount, int elementByteStride, NvFlexBufferType type)
int inflatableIndex
Index in the container's inflatables array.
Definition: NvFlexExt.h:357
NV_FLEX_API void NvFlexExtFreeParticles(NvFlexExtContainer *container, int n, const int *indices)
int * shapeIndices
The indices of the shape matching constraints.
Definition: NvFlexExt.h:325
NV_FLEX_API int NvFlexExtCreateWeldedMeshIndices(const float *vertices, int numVertices, int *uniqueVerts, int *originalToUniqueMap, float threshold)
NV_FLEX_API NvFlexExtParticleData NvFlexExtMapParticleData(NvFlexExtContainer *container)
void assign(const T *srcPtr, int newCount)
Definition: NvFlexExt.h:146
NV_FLEX_API void NvFlexExtDestroySoftJoint(NvFlexExtContainer *container, NvFlexExtSoftJoint *joint)
float * shapePlasticThresholds
The plastic threshold coefficient for each shape.
Definition: NvFlexExt.h:333
const NvFlexExtAsset * asset
Source asset used to create this instance.
Definition: NvFlexExt.h:362
T * mappedPtr
Definition: NvFlexExt.h:73
float delta[4][4]
Definition: NvFlexExt.h:242
const float * lower
Receive a pointer to the particle lower bounds [x, y, z].
Definition: NvFlexExt.h:596
int triangleIndex
Index in the container's triangle array.
Definition: NvFlexExt.h:355
Definition: NvFlexExt.h:609
NvFlexExtForceMode mMode
Mode of field application.
Definition: NvFlexExt.h:754
NV_FLEX_API int NvFlexExtAllocParticles(NvFlexExtContainer *container, int n, int *indices)
int * phases
Receives a pointer to the particle phase data.
Definition: NvFlexExt.h:593
NV_FLEX_API void NvFlexFreeBuffer(NvFlexBuffer *buf)
int numShapes
The number of shape matching constraints.
Definition: NvFlexExt.h:330
NV_FLEX_API void NvFlexExtUnmapTriangleData(NvFlexExtContainer *container)
void copyto(T *dest, int count)
Definition: NvFlexExt.h:155
NV_FLEX_API void NvFlexExtDestroyAsset(NvFlexExtAsset *asset)
float * shapePlasticCreeps
The plastic creep coefficient for each shape.
Definition: NvFlexExt.h:334
int srcIndex
Definition: NvFlexExt.h:454
float * shapeTranslations
Shape matching group translations (vec3s)
Definition: NvFlexExt.h:359
float velocity[3]
Definition: NvFlexExt.h:236
Definition: NvFlexExt.h:452
NvFlexBuffer * buffer
Definition: NvFlexExt.h:71
float * velocities
Receives a pointer to the particle velocity data.
Definition: NvFlexExt.h:592
const T & back() const
Definition: NvFlexExt.h:166
Definition: NvFlexExt.h:371
NV_FLEX_API NvFlexExtForceFieldCallback * NvFlexExtCreateForceFieldCallback(NvFlexSolver *solver)
bool inflatable
Whether an inflatable constraint should be added.
Definition: NvFlexExt.h:341
int numSprings
Number of springs.
Definition: NvFlexExt.h:322
float * particleLocalPositions
Relative offsets from the particles of the joint to the center.
Definition: NvFlexExt.h:374
NV_FLEX_API void NvFlexExtNotifyAssetChanged(NvFlexExtContainer *container, const NvFlexExtAsset *asset)
NvFlexBufferType
Definition: NvFlex.h:76