| FLEX 1.1.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-2017 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>
45 struct NvFlexVector
46 {
47 NvFlexVector(NvFlexLibrary* l, int size=0) : lib(l), buffer(NULL), mappedPtr(NULL), count(0), capacity(0)
48 {
49 if (size)
50 {
51 resize(size);
52
53 // resize implicitly maps, unmap initial allocation
54 unmap();
55 }
56 }
57
58 NvFlexVector(NvFlexLibrary* l, const T* ptr, int size) : lib(l), buffer(NULL), mappedPtr(NULL), count(0), capacity(0)
59 {
60 assign(ptr, size);
61 unmap();
62 }
63
64
65 ~NvFlexVector()
66 {
67 destroy();
68 }
69
70 NvFlexLibrary* lib;
71 NvFlexBuffer* buffer;
72
73 T* mappedPtr;
74 int count;
75 int capacity;
76
77 // reinitialize the vector leaving it unmapped
78 void init(int size)
79 {
80 destroy();
81 resize(size);
82 unmap();
83 }
84
85 void destroy()
86 {
87 if (mappedPtr)
88 NvFlexUnmap(buffer);
89
90 if (buffer)
91 NvFlexFreeBuffer(buffer);
92
93 mappedPtr = NULL;
94 buffer = NULL;
95 capacity = 0;
96 count = 0;
97 }
98
99 void map(int flags=eNvFlexMapWait)
100 {
101 if (!buffer)
102 return;
103
104 assert(!mappedPtr);
105 mappedPtr = (T*)NvFlexMap(buffer, flags);
106 }
107
108 void unmap()
109 {
110 if (!buffer)
111 return;
112
113 assert(mappedPtr);
114
115 NvFlexUnmap(buffer);
116 mappedPtr = 0;
117 }
118
119 const T& operator[](int index) const
120 {
121 assert(mappedPtr);
122 assert(index < count);
123
124 return mappedPtr[index];
125 }
126
127 T& operator[](int index)
128 {
129 assert(mappedPtr);
130 assert(index < count);
131
132 return mappedPtr[index];
133 }
134
135 void push_back(const T& t)
136 {
137 assert(mappedPtr || !buffer);
138
139 reserve(count+1);
140
141 // copy element
142 mappedPtr[count++] = t;
143 }
144
145 void assign(const T* srcPtr, int newCount)
146 {
147 assert(mappedPtr || !buffer);
148
149 resize(newCount);
150
151 memcpy(mappedPtr, srcPtr, newCount*sizeof(T));
152 }
153
154 void copyto(T* dest, int count)
155 {
156 assert(mappedPtr);
157
158 memcpy(dest, mappedPtr, sizeof(T)*count);
159 }
160
161 int size() const { return count; }
162
163 bool empty() const { return size() == 0; }
164
165 const T& back() const
166 {
167 assert(mappedPtr);
168 assert(!empty());
169
170 return mappedPtr[count-1];
171 }
172
173 void reserve(int minCapacity)
174 {
175 if (minCapacity > capacity)
176 {
177 // growth factor of 1.5
178 const int newCapacity = minCapacity*3/2;
179
180 NvFlexBuffer* newBuf = NvFlexAllocBuffer(lib, newCapacity, sizeof(T), eNvFlexBufferHost);
181
182 // copy contents to new buffer
183 void* newPtr = NvFlexMap(newBuf, eNvFlexMapWait);
184 memcpy(newPtr, mappedPtr, count*sizeof(T));
185
186 // unmap old buffer, but leave new buffer mapped
187 unmap();
188
189 if (buffer)
190 NvFlexFreeBuffer(buffer);
191
192 // swap
193 buffer = newBuf;
194 mappedPtr = (T*)newPtr;
195 capacity = newCapacity;
196 }
197 }
198
199 // resizes mapped buffer and leaves new buffer mapped
200 void resize(int newCount)
201 {
202 assert(mappedPtr || !buffer);
203
204 reserve(newCount);
205
206 // resize but do not initialize new entries
207 count = newCount;
208 }
209
210 void resize(int newCount, const T& val)
211 {
212 assert(mappedPtr || !buffer);
213
214 const int startInit = count;
215 const int endInit = newCount;
216
217 resize(newCount);
218
219 // init any new entries
220 for (int i=startInit; i < endInit; ++i)
221 mappedPtr[i] = val;
222 }
223 };
224
225 extern "C" {
226
230 struct NvFlexExtMovingFrame
231 {
232 float position[3];
233 float rotation[4];
234
235 float velocity[3];
236 float omega[3];
237
238 float acceleration[3];
239 float tau[3];
240
241 float delta[4][4];
242 };
243
280 NV_FLEX_API void NvFlexExtMovingFrameInit(NvFlexExtMovingFrame* frame, const float* worldTranslation, const float* worldRotation);
281
282 /* Update a frame to a new position, this will automatically update the velocity and acceleration of
283 * the frame, which can then be used to calculate inertial forces. This should be called once per-frame
284 * with the new position and time-step used when moving the frame.
285 *
286 * @param[in] frame A pointer to a user-allocated NvFlexExtMovingFrame struct
287 * @param[in] worldTranslation A pointer to a vec3 storing the frame's initial translation in world space
288 * @param[in] worldRotation A pointer to a quaternion storing the frame's initial rotation in world space
289 * @param[in] dt The time that elapsed since the last call to the frame update
290 */
291 NV_FLEX_API void NvFlexExtMovingFrameUpdate(NvFlexExtMovingFrame* frame, const float* worldTranslation, const float* worldRotation, float dt);
292
293 /* Teleport particles to the frame's new position and apply the inertial forces
294 *
295 * @param[in] frame A pointer to a user-allocated NvFlexExtMovingFrame struct
296 * @param[in] positions A pointer to an array of particle positions in (x, y, z, 1/m) format
297 * @param[in] velocities A pointer to an array of particle velocities in (vx, vy, vz) format
298 * @param[in] numParticles The number of particles to update
299 * @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
300 * @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
301 * @param[in] dt The time that elapsed since the last call to the frame update, should match the value passed to NvFlexExtMovingFrameUpdate()
302 */
303 NV_FLEX_API void NvFlexExtMovingFrameApply(NvFlexExtMovingFrame* frame, float* positions, float* velocities, int numParticles, float linearScale, float angularScale, float dt);
304
305
310 struct NvFlexExtAsset
311 {
312 // particles
313 float* particles;
314 int numParticles;
315 int maxParticles;
316
317 // springs
318 int* springIndices;
319 float* springCoefficients;
320 float* springRestLengths;
321 int numSprings;
322
323 // shapes
324 int* shapeIndices;
325 int numShapeIndices;
326 int* shapeOffsets;
327 float* shapeCoefficients;
328 float* shapeCenters;
329 int numShapes;
330
331 // faces for cloth
332 int* triangleIndices;
333 int numTriangles;
334
335 // inflatable params
336 bool inflatable;
337 float inflatableVolume;
338 float inflatablePressure;
339 float inflatableStiffness;
340 };
341
345 struct NvFlexExtInstance
346 {
347 int* particleIndices;
348 int numParticles;
349
350 int triangleIndex;
351 int shapeIndex;
352 int inflatableIndex;
353
354 float* shapeTranslations;
355 float* shapeRotations;
356
357 const NvFlexExtAsset* asset;
358
359 void* userData;
360 };
361
365 typedef struct NvFlexExtContainer NvFlexExtContainer;
366
378 NV_FLEX_API int NvFlexExtCreateWeldedMeshIndices(const float* vertices, int numVertices, int* uniqueVerts, int* originalToUniqueMap, float threshold);
379
395 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);
396
415 NV_FLEX_API NvFlexExtAsset* NvFlexExtCreateTearingClothFromMesh(const float* particles, int numParticles, int maxParticles, const int* indices, int numTriangles, float stretchStiffness, float bendStiffness, float pressure);
416
421 NV_FLEX_API void NvFlexExtDestroyTearingCloth(NvFlexExtAsset* asset);
422
428 struct NvFlexExtTearingParticleClone
429 {
430 int srcIndex;
431 int destIndex;
432 };
433
441 struct NvFlexExtTearingMeshEdit
442 {
443 int triIndex; // index into the triangle indices array to update
444 int newParticleIndex; // new value for the index
445 };
446
461 NV_FLEX_API void NvFlexExtTearClothMesh(NvFlexExtAsset* asset, float maxStrain, int maxSplits, NvFlexExtTearingParticleClone* particleCopies, int* numParticleCopies, int maxCopies, NvFlexExtTearingMeshEdit* triangleEdits, int* numTriangleEdits, int maxEdits);
462
474 NV_FLEX_API NvFlexExtAsset* NvFlexExtCreateRigidFromMesh(const float* vertices, int numVertices, const int* indices, int numTriangleIndices, float radius, float expand);
475
494 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);
495
500 NV_FLEX_API void NvFlexExtDestroyAsset(NvFlexExtAsset* asset);
501
514 NV_FLEX_API void NvFlexExtCreateSoftMeshSkinning(const float* vertices, int numVertices, const float* bones, int numBones, float falloff, float maxDistance, float* skinningWeights, int* skinningIndices);
515
524 NV_FLEX_API NvFlexExtContainer* NvFlexExtCreateContainer(NvFlexLibrary* lib, NvFlexSolver* solver, int maxParticles);
525
531 NV_FLEX_API void NvFlexExtDestroyContainer(NvFlexExtContainer* container);
532
540 NV_FLEX_API int NvFlexExtAllocParticles(NvFlexExtContainer* container, int n, int* indices);
541
549 NV_FLEX_API void NvFlexExtFreeParticles(NvFlexExtContainer* container, int n, const int* indices);
550
551
559 NV_FLEX_API int NvFlexExtGetActiveList(NvFlexExtContainer* container, int* indices);
560
561
562 struct NvFlexExtParticleData
563 {
564 float* particles;
565 float* restParticles;
566 float* velocities;
567 int* phases;
568 float* normals;
569
570 const float* lower;
571 const float* upper;
572 };
573
580 NV_FLEX_API NvFlexExtParticleData NvFlexExtMapParticleData(NvFlexExtContainer* container);
581 NV_FLEX_API void NvFlexExtUnmapParticleData(NvFlexExtContainer* container);
582
583 struct NvFlexExtTriangleData
584 {
585 int* indices;
586 float* normals;
587 };
588
594 NV_FLEX_API NvFlexExtTriangleData NvFlexExtMapTriangleData(NvFlexExtContainer* container);
595
599 NV_FLEX_API void NvFlexExtUnmapTriangleData(NvFlexExtContainer* container);
600
601 struct NvFlexExtShapeData
602 {
603 float* rotations;
604 float* positions;
605 int n;
606 };
607
613 NV_FLEX_API NvFlexExtShapeData NvFlexExtMapShapeData(NvFlexExtContainer* container);
614
618 NV_FLEX_API void NvFlexExtUnmapShapeData(NvFlexExtContainer* container);
619
635 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);
636
642 NV_FLEX_API void NvFlexExtDestroyInstance(NvFlexExtContainer* container, const NvFlexExtInstance* instance);
643
650 NV_FLEX_API void NvFlexExtNotifyAssetChanged(NvFlexExtContainer* container, const NvFlexExtAsset* asset);
651
681 NV_FLEX_API void NvFlexExtTickContainer(NvFlexExtContainer* container, float dt, int numSubsteps, bool enableTimers=false);
682
688 NV_FLEX_API void NvFlexExtPushToDevice(NvFlexExtContainer* container);
689
695 NV_FLEX_API void NvFlexExtPullFromDevice(NvFlexExtContainer* container);
696
702 NV_FLEX_API void NvFlexExtUpdateInstances(NvFlexExtContainer* container);
703
704
708 enum NvFlexExtForceMode
709 {
711 eNvFlexExtModeForce = 0,
712
714 eNvFlexExtModeImpulse = 1,
715
717 eNvFlexExtModeVelocityChange = 2,
718 };
719
723 struct NvFlexExtForceField
724 {
725 float mPosition[3];
726 float mRadius;
727 float mStrength;
728 NvFlexExtForceMode mMode;
729 bool mLinearFalloff;
730 };
731
736 typedef struct NvFlexExtForceFieldCallback NvFlexExtForceFieldCallback;
737
745 NV_FLEX_API NvFlexExtForceFieldCallback* NvFlexExtCreateForceFieldCallback(NvFlexSolver* solver);
746
752 NV_FLEX_API void NvFlexExtDestroyForceFieldCallback(NvFlexExtForceFieldCallback* callback);
753
761 NV_FLEX_API void NvFlexExtSetForceFields(NvFlexExtForceFieldCallback* callback, const NvFlexExtForceField* forceFields, int numForceFields);
762
763
764
765 } // extern "C"
766
767 #endif // NV_FLEX_EXT_H
768
NvFlexExtForceField::mLinearFalloff
bool mLinearFalloff
Linear or no falloff.
Definition: NvFlexExt.h:729
NvFlexVector::destroy
void destroy()
Definition: NvFlexExt.h:85
NvFlexExtAsset::numParticles
int numParticles
Number of particles.
Definition: NvFlexExt.h:314
NvFlexExtAsset::shapeCenters
float * shapeCenters
The position of the center of mass of each shape, an array of vec3s mNumShapes in length...
Definition: NvFlexExt.h:328
NvFlexExtSetForceFields
NV_FLEX_API void NvFlexExtSetForceFields(NvFlexExtForceFieldCallback *callback, const NvFlexExtForceField *forceFields, int numForceFields)
NvFlexExtMovingFrameApply
NV_FLEX_API void NvFlexExtMovingFrameApply(NvFlexExtMovingFrame *frame, float *positions, float *velocities, int numParticles, float linearScale, float angularScale, float dt)
NvFlexExtCreateSoftFromMesh
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)
NvFlexExtInstance::shapeRotations
float * shapeRotations
Shape matching group rotations (quaternions)
Definition: NvFlexExt.h:355
NvFlexExtShapeData::n
int n
Number of valid tranforms.
Definition: NvFlexExt.h:605
NvFlexVector::lib
NvFlexLibrary * lib
Definition: NvFlexExt.h:70
NvFlexExtAsset::particles
float * particles
Local space particle positions, x,y,z,1/mass.
Definition: NvFlexExt.h:313
NvFlexExtAsset::shapeOffsets
int * shapeOffsets
Each entry stores the end of the shape's indices in the indices array (exclusive prefix sum of shape ...
Definition: NvFlexExt.h:326
NvFlexExtTearingMeshEdit::newParticleIndex
int newParticleIndex
Definition: NvFlexExt.h:444
NvFlexUnmap
NV_FLEX_API void NvFlexUnmap(NvFlexBuffer *buffer)
NvFlexExtDestroyInstance
NV_FLEX_API void NvFlexExtDestroyInstance(NvFlexExtContainer *container, const NvFlexExtInstance *instance)
NvFlexExtMovingFrameUpdate
NV_FLEX_API void NvFlexExtMovingFrameUpdate(NvFlexExtMovingFrame *frame, const float *worldTranslation, const float *worldRotation, float dt)
NvFlexVector::init
void init(int size)
Definition: NvFlexExt.h:78
NvFlexExtCreateRigidFromMesh
NV_FLEX_API NvFlexExtAsset * NvFlexExtCreateRigidFromMesh(const float *vertices, int numVertices, const int *indices, int numTriangleIndices, float radius, float expand)
NvFlexExtAsset::springRestLengths
float * springRestLengths
Spring rest-lengths.
Definition: NvFlexExt.h:320
NvFlexVector::size
int size() const
Definition: NvFlexExt.h:161
NvFlexExtTickContainer
NV_FLEX_API void NvFlexExtTickContainer(NvFlexExtContainer *container, float dt, int numSubsteps, bool enableTimers=false)
NvFlexExtParticleData
Definition: NvFlexExt.h:562
NvFlexExtInstance::numParticles
int numParticles
Number of simulation particles.
Definition: NvFlexExt.h:348
NvFlexExtUnmapParticleData
NV_FLEX_API void NvFlexExtUnmapParticleData(NvFlexExtContainer *container)
NvFlexExtContainer
struct NvFlexExtContainer NvFlexExtContainer
Definition: NvFlexExt.h:365
NvFlexVector::operator[]
T & operator[](int index)
Definition: NvFlexExt.h:127
NvFlexVector::NvFlexVector
NvFlexVector(NvFlexLibrary *l, const T *ptr, int size)
Definition: NvFlexExt.h:58
NvFlexExtInstance::userData
void * userData
User data pointer.
Definition: NvFlexExt.h:359
NvFlexExtPullFromDevice
NV_FLEX_API void NvFlexExtPullFromDevice(NvFlexExtContainer *container)
NvFlexVector::resize
void resize(int newCount, const T &val)
Definition: NvFlexExt.h:210
NvFlexExtAsset::triangleIndices
int * triangleIndices
Indexed triangle mesh indices for clothing.
Definition: NvFlexExt.h:332
NvFlexVector::capacity
int capacity
Definition: NvFlexExt.h:75
NvFlexExtInstance::particleIndices
int * particleIndices
Simulation particle indices.
Definition: NvFlexExt.h:347
NvFlexExtForceField::mRadius
float mRadius
Radius of the force field.
Definition: NvFlexExt.h:726
NvFlexExtAsset::numTriangles
int numTriangles
Number of triangles.
Definition: NvFlexExt.h:333
eNvFlexMapWait
Calling thread will be blocked until buffer is ready for access, default.
Definition: NvFlex.h:69
NvFlexSolver
struct NvFlexSolver NvFlexSolver
Definition: NvFlex.h:57
NvFlexExtCreateClothFromMesh
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)
NvFlexExtForceField
Definition: NvFlexExt.h:723
NvFlexExtAsset::numShapeIndices
int numShapeIndices
Total number of indices for shape constraints.
Definition: NvFlexExt.h:325
NvFlexExtDestroyTearingCloth
NV_FLEX_API void NvFlexExtDestroyTearingCloth(NvFlexExtAsset *asset)
NvFlexExtShapeData::rotations
float * rotations
Receives a pointer to the array quaternion rotation data in [x, y z, w] format.
Definition: NvFlexExt.h:603
NvFlexExtGetActiveList
NV_FLEX_API int NvFlexExtGetActiveList(NvFlexExtContainer *container, int *indices)
NvFlexExtInstance::shapeIndex
int shapeIndex
Index in the container's shape body constraints array.
Definition: NvFlexExt.h:351
NvFlexVector
Definition: NvFlexExt.h:45
NvFlexExtDestroyForceFieldCallback
NV_FLEX_API void NvFlexExtDestroyForceFieldCallback(NvFlexExtForceFieldCallback *callback)
NvFlexMap
NV_FLEX_API void * NvFlexMap(NvFlexBuffer *buffer, int flags)
NvFlexExtAsset::springIndices
int * springIndices
Spring indices.
Definition: NvFlexExt.h:318
NvFlexVector::reserve
void reserve(int minCapacity)
Definition: NvFlexExt.h:173
NvFlexVector::~NvFlexVector
~NvFlexVector()
Definition: NvFlexExt.h:65
NvFlexExtAsset::maxParticles
int maxParticles
Maximum number of particles, allows extra space for tearable assets which duplicate particles...
Definition: NvFlexExt.h:315
NvFlexVector::push_back
void push_back(const T &t)
Definition: NvFlexExt.h:135
NvFlexExtDestroyContainer
NV_FLEX_API void NvFlexExtDestroyContainer(NvFlexExtContainer *container)
NvFlexExtMovingFrame::tau
float tau[3]
Definition: NvFlexExt.h:239
NvFlexExtMovingFrame::omega
float omega[3]
Definition: NvFlexExt.h:236
NvFlexExtCreateSoftMeshSkinning
NV_FLEX_API void NvFlexExtCreateSoftMeshSkinning(const float *vertices, int numVertices, const float *bones, int numBones, float falloff, float maxDistance, float *skinningWeights, int *skinningIndices)
NvFlexVector::empty
bool empty() const
Definition: NvFlexExt.h:163
NvFlexExtTearingMeshEdit
Definition: NvFlexExt.h:441
NvFlexExtCreateContainer
NV_FLEX_API NvFlexExtContainer * NvFlexExtCreateContainer(NvFlexLibrary *lib, NvFlexSolver *solver, int maxParticles)
NvFlexExtCreateInstance
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)
NvFlexExtMovingFrame::rotation
float rotation[4]
Definition: NvFlexExt.h:233
NvFlexExtAsset::inflatableVolume
float inflatableVolume
The rest volume for the inflatable constraint.
Definition: NvFlexExt.h:337
eNvFlexBufferHost
Host mappable buffer, pinned memory on CUDA, staging buffer on DX.
Definition: NvFlex.h:79
NvFlexExtUnmapShapeData
NV_FLEX_API void NvFlexExtUnmapShapeData(NvFlexExtContainer *container)
NvFlexBuffer
struct NvFlexBuffer NvFlexBuffer
Definition: NvFlex.h:62
NvFlexExtMapShapeData
NV_FLEX_API NvFlexExtShapeData NvFlexExtMapShapeData(NvFlexExtContainer *container)
eNvFlexExtModeImpulse
Apply field value as an impulse.
Definition: NvFlexExt.h:714
NvFlexExtParticleData::particles
float * particles
Receives a pointer to the particle position / mass data.
Definition: NvFlexExt.h:564
NvFlexExtAsset::springCoefficients
float * springCoefficients
Spring coefficients.
Definition: NvFlexExt.h:319
NvFlexExtParticleData::restParticles
float * restParticles
Receives a pointer to the particle's rest position (used for self collision culling) ...
Definition: NvFlexExt.h:565
NvFlexExtShapeData::positions
float * positions
Receives a pointer to an array of shape body translations in [x, y, z] format.
Definition: NvFlexExt.h:604
NvFlexExtMovingFrame
Definition: NvFlexExt.h:230
NvFlexVector::operator[]
const T & operator[](int index) const
Definition: NvFlexExt.h:119
NvFlexVector::unmap
void unmap()
Definition: NvFlexExt.h:108
NvFlexExtInstance
Definition: NvFlexExt.h:345
NvFlexExtUpdateInstances
NV_FLEX_API void NvFlexExtUpdateInstances(NvFlexExtContainer *container)
NvFlexExtForceField::mPosition
float mPosition[3]
Center of force field.
Definition: NvFlexExt.h:725
NvFlexExtTriangleData::indices
int * indices
Receives a pointer to the array of triangle index data.
Definition: NvFlexExt.h:585
NvFlexExtTriangleData::normals
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:586
NvFlex.h
NvFlexExtTearClothMesh
NV_FLEX_API void NvFlexExtTearClothMesh(NvFlexExtAsset *asset, float maxStrain, int maxSplits, NvFlexExtTearingParticleClone *particleCopies, int *numParticleCopies, int maxCopies, NvFlexExtTearingMeshEdit *triangleEdits, int *numTriangleEdits, int maxEdits)
NvFlexExtMovingFrame::acceleration
float acceleration[3]
Definition: NvFlexExt.h:238
eNvFlexExtModeForce
Apply field value as a force.
Definition: NvFlexExt.h:711
NvFlexExtAsset::inflatableStiffness
float inflatableStiffness
How stiff the inflatable is.
Definition: NvFlexExt.h:339
NvFlexLibrary
struct NvFlexLibrary NvFlexLibrary
Definition: NvFlex.h:52
NvFlexExtTearingMeshEdit::triIndex
int triIndex
Definition: NvFlexExt.h:443
NvFlexExtParticleData::normals
float * normals
Receives a pointer to the particle normal data with 16 byte stride in format [nx, ny...
Definition: NvFlexExt.h:568
NvFlexExtMapTriangleData
NV_FLEX_API NvFlexExtTriangleData NvFlexExtMapTriangleData(NvFlexExtContainer *container)
NvFlexExtTearingParticleClone::destIndex
int destIndex
Definition: NvFlexExt.h:431
NvFlexExtForceField::mStrength
float mStrength
Strength of the force field.
Definition: NvFlexExt.h:727
NvFlexExtMovingFrame::position
float position[3]
Definition: NvFlexExt.h:232
NvFlexVector::resize
void resize(int newCount)
Definition: NvFlexExt.h:200
NvFlexExtAsset
Definition: NvFlexExt.h:310
NvFlexExtPushToDevice
NV_FLEX_API void NvFlexExtPushToDevice(NvFlexExtContainer *container)
NvFlexExtForceFieldCallback
struct NvFlexExtForceFieldCallback NvFlexExtForceFieldCallback
Definition: NvFlexExt.h:736
NvFlexVector::count
int count
Definition: NvFlexExt.h:74
NvFlexExtForceMode
NvFlexExtForceMode
Definition: NvFlexExt.h:708
NvFlexExtAsset::shapeCoefficients
float * shapeCoefficients
The stiffness coefficient for each shape.
Definition: NvFlexExt.h:327
NvFlexVector::map
void map(int flags=eNvFlexMapWait)
Definition: NvFlexExt.h:99
eNvFlexExtModeVelocityChange
Apply field value as a velocity change.
Definition: NvFlexExt.h:717
NvFlexExtCreateTearingClothFromMesh
NV_FLEX_API NvFlexExtAsset * NvFlexExtCreateTearingClothFromMesh(const float *particles, int numParticles, int maxParticles, const int *indices, int numTriangles, float stretchStiffness, float bendStiffness, float pressure)
NvFlexExtShapeData
Definition: NvFlexExt.h:601
NvFlexExtMovingFrameInit
NV_FLEX_API void NvFlexExtMovingFrameInit(NvFlexExtMovingFrame *frame, const float *worldTranslation, const float *worldRotation)
NvFlexExtAsset::inflatablePressure
float inflatablePressure
How much over the rest volume the inflatable should attempt to maintain.
Definition: NvFlexExt.h:338
NvFlexExtParticleData::upper
const float * upper
Receive a pointer to the particle upper bounds [x, y, z].
Definition: NvFlexExt.h:571
NvFlexAllocBuffer
NV_FLEX_API NvFlexBuffer * NvFlexAllocBuffer(NvFlexLibrary *lib, int elementCount, int elementByteStride, NvFlexBufferType type)
NvFlexExtInstance::inflatableIndex
int inflatableIndex
Index in the container's inflatables array.
Definition: NvFlexExt.h:352
NvFlexVector::NvFlexVector
NvFlexVector(NvFlexLibrary *l, int size=0)
Definition: NvFlexExt.h:47
NvFlexExtFreeParticles
NV_FLEX_API void NvFlexExtFreeParticles(NvFlexExtContainer *container, int n, const int *indices)
NvFlexExtAsset::shapeIndices
int * shapeIndices
The indices of the shape matching constraints.
Definition: NvFlexExt.h:324
NvFlexExtCreateWeldedMeshIndices
NV_FLEX_API int NvFlexExtCreateWeldedMeshIndices(const float *vertices, int numVertices, int *uniqueVerts, int *originalToUniqueMap, float threshold)
NvFlexExtMapParticleData
NV_FLEX_API NvFlexExtParticleData NvFlexExtMapParticleData(NvFlexExtContainer *container)
NvFlexVector::assign
void assign(const T *srcPtr, int newCount)
Definition: NvFlexExt.h:145
NvFlexExtInstance::asset
const NvFlexExtAsset * asset
Source asset used to create this instance.
Definition: NvFlexExt.h:357
NvFlexVector::mappedPtr
T * mappedPtr
Definition: NvFlexExt.h:73
NvFlexExtMovingFrame::delta
float delta[4][4]
Definition: NvFlexExt.h:241
NvFlexExtParticleData::lower
const float * lower
Receive a pointer to the particle lower bounds [x, y, z].
Definition: NvFlexExt.h:570
NvFlexExtInstance::triangleIndex
int triangleIndex
Index in the container's triangle array.
Definition: NvFlexExt.h:350
NvFlexExtTriangleData
Definition: NvFlexExt.h:583
NvFlexExtForceField::mMode
NvFlexExtForceMode mMode
Mode of field application.
Definition: NvFlexExt.h:728
NvFlexExtAllocParticles
NV_FLEX_API int NvFlexExtAllocParticles(NvFlexExtContainer *container, int n, int *indices)
NvFlexExtParticleData::phases
int * phases
Receives a pointer to the particle phase data.
Definition: NvFlexExt.h:567
NvFlexFreeBuffer
NV_FLEX_API void NvFlexFreeBuffer(NvFlexBuffer *buf)
NvFlexExtAsset::numShapes
int numShapes
The number of shape matching constraints.
Definition: NvFlexExt.h:329
NvFlexExtUnmapTriangleData
NV_FLEX_API void NvFlexExtUnmapTriangleData(NvFlexExtContainer *container)
NvFlexVector::copyto
void copyto(T *dest, int count)
Definition: NvFlexExt.h:154
NvFlexExtDestroyAsset
NV_FLEX_API void NvFlexExtDestroyAsset(NvFlexExtAsset *asset)
NvFlexExtTearingParticleClone::srcIndex
int srcIndex
Definition: NvFlexExt.h:430
NvFlexExtInstance::shapeTranslations
float * shapeTranslations
Shape matching group translations (vec3s)
Definition: NvFlexExt.h:354
NvFlexExtMovingFrame::velocity
float velocity[3]
Definition: NvFlexExt.h:235
NvFlexExtTearingParticleClone
Definition: NvFlexExt.h:428
NvFlexVector::buffer
NvFlexBuffer * buffer
Definition: NvFlexExt.h:71
NvFlexExtParticleData::velocities
float * velocities
Receives a pointer to the particle velocity data.
Definition: NvFlexExt.h:566
NvFlexVector::back
const T & back() const
Definition: NvFlexExt.h:165
NvFlexExtCreateForceFieldCallback
NV_FLEX_API NvFlexExtForceFieldCallback * NvFlexExtCreateForceFieldCallback(NvFlexSolver *solver)
NvFlexExtAsset::inflatable
bool inflatable
Whether an inflatable constraint should be added.
Definition: NvFlexExt.h:336
NvFlexExtAsset::numSprings
int numSprings
Number of springs.
Definition: NvFlexExt.h:321
NvFlexExtNotifyAssetChanged
NV_FLEX_API void NvFlexExtNotifyAssetChanged(NvFlexExtContainer *container, const NvFlexExtAsset *asset)