105 mappedPtr = (T*)
NvFlexMap(buffer, flags);
122 assert(index < count);
124 return mappedPtr[index];
130 assert(index < count);
132 return mappedPtr[index];
137 assert(mappedPtr || !buffer);
142 mappedPtr[count++] = t;
145 void assign(
const T* srcPtr,
int newCount)
147 assert(mappedPtr || !buffer);
151 memcpy(mappedPtr, srcPtr, newCount*
sizeof(T));
158 memcpy(dest, mappedPtr,
sizeof(T)*count);
170 return mappedPtr[count-1];
175 if (minCapacity > capacity)
178 const int newCapacity = minCapacity*3/2;
184 memcpy(newPtr, mappedPtr, count*
sizeof(T));
194 mappedPtr = (T*)newPtr;
195 capacity = newCapacity;
202 assert(mappedPtr || !buffer);
212 assert(mappedPtr || !buffer);
214 const int startInit =
count;
215 const int endInit = newCount;
220 for (
int i=startInit; i < endInit; ++i)
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);
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);
514 NV_FLEX_API
void NvFlexExtCreateSoftMeshSkinning(
const float* vertices,
int numVertices,
const float* bones,
int numBones,
float falloff,
float maxDistance,
float* skinningWeights,
int* skinningIndices);
767 #endif // NV_FLEX_EXT_H
bool mLinearFalloff
Linear or no falloff.
Definition: NvFlexExt.h:729
void destroy()
Definition: NvFlexExt.h:85
int numParticles
Number of particles.
Definition: NvFlexExt.h:314
float * shapeCenters
The position of the center of mass of each shape, an array of vec3s mNumShapes in length...
Definition: NvFlexExt.h:328
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)
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 * shapeRotations
Shape matching group rotations (quaternions)
Definition: NvFlexExt.h:355
int n
Number of valid tranforms.
Definition: NvFlexExt.h:605
NvFlexLibrary * lib
Definition: NvFlexExt.h:70
float * particles
Local space particle positions, x,y,z,1/mass.
Definition: NvFlexExt.h:313
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
int newParticleIndex
Definition: NvFlexExt.h:444
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:78
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:320
int size() const
Definition: NvFlexExt.h:161
NV_FLEX_API void NvFlexExtTickContainer(NvFlexExtContainer *container, float dt, int numSubsteps, bool enableTimers=false)
Definition: NvFlexExt.h:562
int numParticles
Number of simulation particles.
Definition: NvFlexExt.h:348
NV_FLEX_API void NvFlexExtUnmapParticleData(NvFlexExtContainer *container)
struct NvFlexExtContainer NvFlexExtContainer
Definition: NvFlexExt.h:365
T & operator[](int index)
Definition: NvFlexExt.h:127
NvFlexVector(NvFlexLibrary *l, const T *ptr, int size)
Definition: NvFlexExt.h:58
void * userData
User data pointer.
Definition: NvFlexExt.h:359
NV_FLEX_API void NvFlexExtPullFromDevice(NvFlexExtContainer *container)
void resize(int newCount, const T &val)
Definition: NvFlexExt.h:210
int * triangleIndices
Indexed triangle mesh indices for clothing.
Definition: NvFlexExt.h:332
int capacity
Definition: NvFlexExt.h:75
int * particleIndices
Simulation particle indices.
Definition: NvFlexExt.h:347
float mRadius
Radius of the force field.
Definition: NvFlexExt.h:726
int numTriangles
Number of triangles.
Definition: NvFlexExt.h:333
Calling thread will be blocked until buffer is ready for access, default.
Definition: NvFlex.h:69
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:723
int numShapeIndices
Total number of indices for shape constraints.
Definition: NvFlexExt.h:325
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:603
NV_FLEX_API int NvFlexExtGetActiveList(NvFlexExtContainer *container, int *indices)
int shapeIndex
Index in the container's shape body constraints array.
Definition: NvFlexExt.h:351
Definition: NvFlexExt.h:45
NV_FLEX_API void NvFlexExtDestroyForceFieldCallback(NvFlexExtForceFieldCallback *callback)
NV_FLEX_API void * NvFlexMap(NvFlexBuffer *buffer, int flags)
int * springIndices
Spring indices.
Definition: NvFlexExt.h:318
void reserve(int minCapacity)
Definition: NvFlexExt.h:173
~NvFlexVector()
Definition: NvFlexExt.h:65
int maxParticles
Maximum number of particles, allows extra space for tearable assets which duplicate particles...
Definition: NvFlexExt.h:315
void push_back(const T &t)
Definition: NvFlexExt.h:135
NV_FLEX_API void NvFlexExtDestroyContainer(NvFlexExtContainer *container)
float tau[3]
Definition: NvFlexExt.h:239
float omega[3]
Definition: NvFlexExt.h:236
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:163
Definition: NvFlexExt.h:441
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:233
float inflatableVolume
The rest volume for the inflatable constraint.
Definition: NvFlexExt.h:337
Host mappable buffer, pinned memory on CUDA, staging buffer on DX.
Definition: NvFlex.h:79
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:714
float * particles
Receives a pointer to the particle position / mass data.
Definition: NvFlexExt.h:564
float * springCoefficients
Spring coefficients.
Definition: NvFlexExt.h:319
float * restParticles
Receives a pointer to the particle's rest position (used for self collision culling) ...
Definition: NvFlexExt.h:565
float * positions
Receives a pointer to an array of shape body translations in [x, y, z] format.
Definition: NvFlexExt.h:604
Definition: NvFlexExt.h:230
const T & operator[](int index) const
Definition: NvFlexExt.h:119
void unmap()
Definition: NvFlexExt.h:108
Definition: NvFlexExt.h:345
NV_FLEX_API void NvFlexExtUpdateInstances(NvFlexExtContainer *container)
float mPosition[3]
Center of force field.
Definition: NvFlexExt.h:725
int * indices
Receives a pointer to the array of triangle index data.
Definition: NvFlexExt.h:585
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
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:238
Apply field value as a force.
Definition: NvFlexExt.h:711
float inflatableStiffness
How stiff the inflatable is.
Definition: NvFlexExt.h:339
struct NvFlexLibrary NvFlexLibrary
Definition: NvFlex.h:52
int triIndex
Definition: NvFlexExt.h:443
float * normals
Receives a pointer to the particle normal data with 16 byte stride in format [nx, ny...
Definition: NvFlexExt.h:568
NV_FLEX_API NvFlexExtTriangleData NvFlexExtMapTriangleData(NvFlexExtContainer *container)
int destIndex
Definition: NvFlexExt.h:431
float mStrength
Strength of the force field.
Definition: NvFlexExt.h:727
float position[3]
Definition: NvFlexExt.h:232
void resize(int newCount)
Definition: NvFlexExt.h:200
Definition: NvFlexExt.h:310
NV_FLEX_API void NvFlexExtPushToDevice(NvFlexExtContainer *container)
struct NvFlexExtForceFieldCallback NvFlexExtForceFieldCallback
Definition: NvFlexExt.h:736
int count
Definition: NvFlexExt.h:74
NvFlexExtForceMode
Definition: NvFlexExt.h:708
float * shapeCoefficients
The stiffness coefficient for each shape.
Definition: NvFlexExt.h:327
void map(int flags=eNvFlexMapWait)
Definition: NvFlexExt.h:99
Apply field value as a velocity change.
Definition: NvFlexExt.h:717
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:601
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:338
const float * upper
Receive a pointer to the particle upper bounds [x, y, z].
Definition: NvFlexExt.h:571
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:352
NvFlexVector(NvFlexLibrary *l, int size=0)
Definition: NvFlexExt.h:47
NV_FLEX_API void NvFlexExtFreeParticles(NvFlexExtContainer *container, int n, const int *indices)
int * shapeIndices
The indices of the shape matching constraints.
Definition: NvFlexExt.h:324
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:145
const NvFlexExtAsset * asset
Source asset used to create this instance.
Definition: NvFlexExt.h:357
T * mappedPtr
Definition: NvFlexExt.h:73
float delta[4][4]
Definition: NvFlexExt.h:241
const float * lower
Receive a pointer to the particle lower bounds [x, y, z].
Definition: NvFlexExt.h:570
int triangleIndex
Index in the container's triangle array.
Definition: NvFlexExt.h:350
Definition: NvFlexExt.h:583
NvFlexExtForceMode mMode
Mode of field application.
Definition: NvFlexExt.h:728
NV_FLEX_API int NvFlexExtAllocParticles(NvFlexExtContainer *container, int n, int *indices)
int * phases
Receives a pointer to the particle phase data.
Definition: NvFlexExt.h:567
NV_FLEX_API void NvFlexFreeBuffer(NvFlexBuffer *buf)
int numShapes
The number of shape matching constraints.
Definition: NvFlexExt.h:329
NV_FLEX_API void NvFlexExtUnmapTriangleData(NvFlexExtContainer *container)
void copyto(T *dest, int count)
Definition: NvFlexExt.h:154
NV_FLEX_API void NvFlexExtDestroyAsset(NvFlexExtAsset *asset)
int srcIndex
Definition: NvFlexExt.h:430
float * shapeTranslations
Shape matching group translations (vec3s)
Definition: NvFlexExt.h:354
float velocity[3]
Definition: NvFlexExt.h:235
Definition: NvFlexExt.h:428
NvFlexBuffer * buffer
Definition: NvFlexExt.h:71
float * velocities
Receives a pointer to the particle velocity data.
Definition: NvFlexExt.h:566
const T & back() const
Definition: NvFlexExt.h:165
NV_FLEX_API NvFlexExtForceFieldCallback * NvFlexExtCreateForceFieldCallback(NvFlexSolver *solver)
bool inflatable
Whether an inflatable constraint should be added.
Definition: NvFlexExt.h:336
int numSprings
Number of springs.
Definition: NvFlexExt.h:321
NV_FLEX_API void NvFlexExtNotifyAssetChanged(NvFlexExtContainer *container, const NvFlexExtAsset *asset)