From 688b5f42e9bfe498d7af7075d4d8f4429867f3a3 Mon Sep 17 00:00:00 2001 From: Miles Macklin Date: Fri, 9 Jun 2017 13:41:15 +1200 Subject: 1.2.0.beta.1 --- doc/_static/api/_nv_flex_8h.html | 942 ++++++++++++++++++++++++++++++--------- 1 file changed, 737 insertions(+), 205 deletions(-) (limited to 'doc/_static/api/_nv_flex_8h.html') diff --git a/doc/_static/api/_nv_flex_8h.html b/doc/_static/api/_nv_flex_8h.html index 837b040..ca04c36 100644 --- a/doc/_static/api/_nv_flex_8h.html +++ b/doc/_static/api/_nv_flex_8h.html @@ -20,7 +20,7 @@ Logo
FLEX -  1.1.0 +  1.2.0
@@ -55,10 +55,14 @@ Data Structures   struct  NvFlexSolverCallbackParams   -struct  NvFlexInitDesc -  struct  NvFlexSolverCallback   +struct  NvFlexInitDesc +  +struct  NvFlexSolverDesc +  +struct  NvFlexCopyDesc +  struct  NvFlexSphereGeometry   struct  NvFlexCapsuleGeometry @@ -98,9 +102,7 @@ Enumerations enum  NvFlexMapFlags {
  eNvFlexMapWait = 0,
-  eNvFlexMapDoNotWait = 1, -
-  eNvFlexMapDiscard = 2 +  eNvFlexMapDoNotWait = 1
}   @@ -119,13 +121,35 @@ Enumerations }   enum  NvFlexPhase {
-  eNvFlexPhaseGroupMask = 0x00ffffff, +  eNvFlexPhaseGroupMask = 0x000fffff, +
+  eNvFlexPhaseFlagsMask = 0x00f00000, +
+  eNvFlexPhaseShapeChannelMask = 0xff000000, +
+  eNvFlexPhaseSelfCollide = 1 << 20, +
+  eNvFlexPhaseSelfCollideFilter = 1 << 21, +
+  eNvFlexPhaseFluid = 1 << 22, +
+  eNvFlexPhaseUnused = 1 << 23, +
+  eNvFlexPhaseShapeChannel0 = 1 << 24, +
+  eNvFlexPhaseShapeChannel1 = 1 << 25, +
+  eNvFlexPhaseShapeChannel2 = 1 << 26, +
+  eNvFlexPhaseShapeChannel3 = 1 << 27,
-  eNvFlexPhaseSelfCollide = 1 << 24, +  eNvFlexPhaseShapeChannel4 = 1 << 28,
-  eNvFlexPhaseSelfCollideFilter = 1 << 25, +  eNvFlexPhaseShapeChannel5 = 1 << 29,
-  eNvFlexPhaseFluid = 1 << 26 +  eNvFlexPhaseShapeChannel6 = 1 << 30, +
+  eNvFlexPhaseShapeChannel7 = 1 << 31
}   @@ -166,6 +190,15 @@ Enumerations
}   +enum  NvFlexFeatureMode {
+  eNvFlexFeatureModeDefault = 0, +
+  eNvFlexFeatureModeSimpleSolids = 1, +
+  eNvFlexFeatureModeSimpleFluids = 2 +
+ } +  enum  NvFlexCollisionShapeType {
  eNvFlexShapeSphere = 0,
@@ -184,9 +217,9 @@ Enumerations enum  NvFlexCollisionShapeFlags {
  eNvFlexShapeFlagTypeMask = 0x7,
-  eNvFlexShapeFlagDynamic = 8, +  eNvFlexShapeFlagDynamic = 0x8,
-  eNvFlexShapeFlagTrigger = 16, +  eNvFlexShapeFlagTrigger = 0x10,
  eNvFlexShapeFlagReserved = 0xffffff00
@@ -195,20 +228,26 @@ Enumerations - - + + + + - - + + + + + + @@ -217,42 +256,44 @@ Functions - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + @@ -271,10 +312,12 @@ Functions - - + + + + @@ -285,20 +328,22 @@ Functions - - - - - - + + + + + + + + - - + + @@ -329,6 +374,8 @@ Functions + +

Functions

NV_FLEX_API int NvFlexMakePhase (int group, int flags)
 
NV_FLEX_API int NvFlexMakePhaseWithChannels (int group, int particleFlags, int shapeChannels)
 
NV_FLEX_API int NvFlexMakePhase (int group, int particleFlags)
 
NV_FLEX_API NvFlexLibraryNvFlexInit (int version=NV_FLEX_VERSION, NvFlexErrorCallback errorFunc=0, NvFlexInitDesc *desc=0)
 
NV_FLEX_API void NvFlexShutdown (NvFlexLibrary *lib)
 
NV_FLEX_API int NvFlexGetVersion ()
 
NV_FLEX_API NvFlexSolverNvFlexCreateSolver (NvFlexLibrary *lib, int maxParticles, int maxDiffuseParticles, int maxNeighborsPerParticle=96)
 
NV_FLEX_API void NvFlexSetSolverDescDefaults (NvFlexSolverDesc *desc)
 
NV_FLEX_API NvFlexSolverNvFlexCreateSolver (NvFlexLibrary *lib, const NvFlexSolverDesc *desc)
 
NV_FLEX_API void NvFlexDestroySolver (NvFlexSolver *solver)
 
NV_FLEX_API NvFlexLibraryNvFlexGetSolverLibrary (NvFlexSolver *solver)
 
NV_FLEX_API void NvFlexGetSolverDesc (NvFlexSolver *solver, NvFlexSolverDesc *desc)
 
NV_FLEX_API NvFlexSolverCallback NvFlexRegisterSolverCallback (NvFlexSolver *solver, NvFlexSolverCallback function, NvFlexSolverCallbackStage stage)
 
NV_FLEX_API void NvFlexUpdateSolver (NvFlexSolver *solver, float dt, int substeps, bool enableTimers)
 
NV_FLEX_API void NvFlexGetParams (NvFlexSolver *solver, NvFlexParams *params)
 
NV_FLEX_API void NvFlexSetActive (NvFlexSolver *solver, NvFlexBuffer *indices, int n)
 
NV_FLEX_API void NvFlexGetActive (NvFlexSolver *solver, NvFlexBuffer *indices)
 
NV_FLEX_API void NvFlexSetActive (NvFlexSolver *solver, NvFlexBuffer *indices, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetActive (NvFlexSolver *solver, NvFlexBuffer *indices, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexSetActiveCount (NvFlexSolver *solver, int n)
 
NV_FLEX_API int NvFlexGetActiveCount (NvFlexSolver *solver)
 
NV_FLEX_API void NvFlexSetParticles (NvFlexSolver *solver, NvFlexBuffer *p, int n)
 
NV_FLEX_API void NvFlexGetParticles (NvFlexSolver *solver, NvFlexBuffer *p, int n)
 
NV_FLEX_API void NvFlexSetRestParticles (NvFlexSolver *solver, NvFlexBuffer *p, int n)
 
NV_FLEX_API void NvFlexGetRestParticles (NvFlexSolver *solver, NvFlexBuffer *p, int n)
 
NV_FLEX_API void NvFlexGetSmoothParticles (NvFlexSolver *solver, NvFlexBuffer *p, int n)
 
NV_FLEX_API void NvFlexSetVelocities (NvFlexSolver *solver, NvFlexBuffer *v, int n)
 
NV_FLEX_API void NvFlexGetVelocities (NvFlexSolver *solver, NvFlexBuffer *v, int n)
 
NV_FLEX_API void NvFlexSetPhases (NvFlexSolver *solver, NvFlexBuffer *phases, int n)
 
NV_FLEX_API void NvFlexGetPhases (NvFlexSolver *solver, NvFlexBuffer *phases, int n)
 
NV_FLEX_API void NvFlexSetNormals (NvFlexSolver *solver, NvFlexBuffer *normals, int n)
 
NV_FLEX_API void NvFlexGetNormals (NvFlexSolver *solver, NvFlexBuffer *normals, int n)
 
NV_FLEX_API void NvFlexSetParticles (NvFlexSolver *solver, NvFlexBuffer *p, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetParticles (NvFlexSolver *solver, NvFlexBuffer *p, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexSetRestParticles (NvFlexSolver *solver, NvFlexBuffer *p, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetRestParticles (NvFlexSolver *solver, NvFlexBuffer *p, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetSmoothParticles (NvFlexSolver *solver, NvFlexBuffer *p, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexSetVelocities (NvFlexSolver *solver, NvFlexBuffer *v, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetVelocities (NvFlexSolver *solver, NvFlexBuffer *v, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexSetPhases (NvFlexSolver *solver, NvFlexBuffer *phases, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetPhases (NvFlexSolver *solver, NvFlexBuffer *phases, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexSetNormals (NvFlexSolver *solver, NvFlexBuffer *normals, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetNormals (NvFlexSolver *solver, NvFlexBuffer *normals, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexSetSprings (NvFlexSolver *solver, NvFlexBuffer *indices, NvFlexBuffer *restLengths, NvFlexBuffer *stiffness, int numSprings)
 
NV_FLEX_API void NvFlexGetSprings (NvFlexSolver *solver, NvFlexBuffer *indices, NvFlexBuffer *restLengths, NvFlexBuffer *stiffness, int numSprings)
 
NV_FLEX_API void NvFlexSetRigids (NvFlexSolver *solver, NvFlexBuffer *offsets, NvFlexBuffer *indices, NvFlexBuffer *restPositions, NvFlexBuffer *restNormals, NvFlexBuffer *stiffness, NvFlexBuffer *rotations, NvFlexBuffer *translations, int numRigids, int numIndices)
 
NV_FLEX_API void NvFlexGetRigidTransforms (NvFlexSolver *solver, NvFlexBuffer *rotations, NvFlexBuffer *translations)
 
NV_FLEX_API void NvFlexSetRigids (NvFlexSolver *solver, NvFlexBuffer *offsets, NvFlexBuffer *indices, NvFlexBuffer *restPositions, NvFlexBuffer *restNormals, NvFlexBuffer *stiffness, NvFlexBuffer *thresholds, NvFlexBuffer *creeps, NvFlexBuffer *rotations, NvFlexBuffer *translations, int numRigids, int numIndices)
 
NV_FLEX_API void NvFlexGetRigids (NvFlexSolver *solver, NvFlexBuffer *offsets, NvFlexBuffer *indices, NvFlexBuffer *restPositions, NvFlexBuffer *restNormals, NvFlexBuffer *stiffness, NvFlexBuffer *thresholds, NvFlexBuffer *creeps, NvFlexBuffer *rotations, NvFlexBuffer *translations)
 
NV_FLEX_API NvFlexTriangleMeshId NvFlexCreateTriangleMesh (NvFlexLibrary *lib)
 
NV_FLEX_API void NvFlexDestroyTriangleMesh (NvFlexLibrary *lib, NvFlexTriangleMeshId mesh)
 
NV_FLEX_API void NvFlexDestroyConvexMesh (NvFlexLibrary *lib, NvFlexConvexMeshId convex)
 
NV_FLEX_API void NvFlexUpdateConvexMesh (NvFlexLibrary *lib, NvFlexConvexMeshId convex, NvFlexBuffer *planes, int numPlanes, float *lower, float *upper)
 
NV_FLEX_API void NvFlexUpdateConvexMesh (NvFlexLibrary *lib, NvFlexConvexMeshId convex, NvFlexBuffer *planes, int numPlanes, const float *lower, const float *upper)
 
NV_FLEX_API void NvFlexGetConvexMeshBounds (NvFlexLibrary *lib, NvFlexConvexMeshId mesh, float *lower, float *upper)
 
NV_FLEX_API int NvFlexMakeShapeFlagsWithChannels (NvFlexCollisionShapeType type, bool dynamic, int shapeChannels)
 
NV_FLEX_API int NvFlexMakeShapeFlags (NvFlexCollisionShapeType type, bool dynamic)
 
NV_FLEX_API void NvFlexSetShapes (NvFlexSolver *solver, NvFlexBuffer *geometry, NvFlexBuffer *shapePositions, NvFlexBuffer *shapeRotations, NvFlexBuffer *shapePrevPositions, NvFlexBuffer *shapePrevRotations, NvFlexBuffer *shapeFlags, int numShapes)
 
NV_FLEX_API void NvFlexSetInflatables (NvFlexSolver *solver, NvFlexBuffer *startTris, NvFlexBuffer *numTris, NvFlexBuffer *restVolumes, NvFlexBuffer *overPressures, NvFlexBuffer *constraintScales, int numInflatables)
 
NV_FLEX_API void NvFlexGetDensities (NvFlexSolver *solver, NvFlexBuffer *densities, int n)
 
NV_FLEX_API void NvFlexGetAnisotropy (NvFlexSolver *solver, NvFlexBuffer *q1, NvFlexBuffer *q2, NvFlexBuffer *q3)
 
NV_FLEX_API int NvFlexGetDiffuseParticles (NvFlexSolver *solver, NvFlexBuffer *p, NvFlexBuffer *v, NvFlexBuffer *indices)
 
NV_FLEX_API void NvFlexGetDensities (NvFlexSolver *solver, NvFlexBuffer *densities, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetAnisotropy (NvFlexSolver *solver, NvFlexBuffer *q1, NvFlexBuffer *q2, NvFlexBuffer *q3, const NvFlexCopyDesc *desc)
 
NV_FLEX_API void NvFlexGetDiffuseParticles (NvFlexSolver *solver, NvFlexBuffer *p, NvFlexBuffer *v, NvFlexBuffer *count)
 
NV_FLEX_API void NvFlexSetDiffuseParticles (NvFlexSolver *solver, NvFlexBuffer *p, NvFlexBuffer *v, int n)
 
NV_FLEX_API void NvFlexGetContacts (NvFlexSolver *solver, NvFlexBuffer *planes, NvFlexBuffer *velocities, NvFlexBuffer *indices, NvFlexBuffer *counts)
 
NV_FLEX_API void NvFlexGetNeighbors (NvFlexSolver *solver, NvFlexBuffer *neighbors, NvFlexBuffer *counts, NvFlexBuffer *remap)
 
NV_FLEX_API void NvFlexGetBounds (NvFlexSolver *solver, NvFlexBuffer *lower, NvFlexBuffer *upper)
 
NV_FLEX_API float NvFlexGetDeviceLatency (NvFlexSolver *solver)
 
NV_FLEX_API float NvFlexGetDeviceLatency (NvFlexSolver *solver, unsigned long long *begin, unsigned long long *end, unsigned long long *frequency)
 
NV_FLEX_API void NvFlexGetTimers (NvFlexSolver *solver, NvFlexTimers *timers)
 
NV_FLEX_API int NvFlexGetDetailTimers (NvFlexSolver *solver, NvFlexDetailTimer **timers)
 
NV_FLEX_API void NvFlexFlush (NvFlexLibrary *lib)
 
NV_FLEX_API void NvFlexWait (NvFlexLibrary *lib)
 

Detailed Description

The main include file for the core Flex solver.

@@ -460,12 +507,6 @@ lift Lift force applied to particles belonging to dynamic triangles, proportional to velocity^2*area in the direction perpendicular to velocity and (if possible), parallel to the plane normal. -bool - -fluid - -If true then particles with phase 0 are considered fluid particles and interact using the position based fluids method. - float cohesion @@ -494,7 +535,7 @@ Increases vorticity by applying rotational forces to particles. anisotropyScale -Control how much anisotropy is present in resulting ellipsoids for rendering, if zero then anisotropy will not be calculated, see NvFlexGetAnisotropy() +Control how much anisotropy is present in resulting ellipsoids for rendering, if zero then anisotropy will not be calculated, see NvFlexGetAnisotropy() float @@ -512,7 +553,7 @@ Clamp the anisotropy scale to this fraction of the radius. smoothing -Control the strength of Laplacian smoothing in particles for rendering, if zero then smoothed positions will not be calculated, see NvFlexGetSmoothParticles() +Control the strength of Laplacian smoothing in particles for rendering, if zero then smoothed positions will not be calculated, see NvFlexGetSmoothParticles() float @@ -556,30 +597,12 @@ diffuseBallistic The number of neighbors below which a diffuse particle is considered ballistic. -float - -diffuseSortAxis[3] - -Diffuse particles will be sorted by depth along this axis if non-zero. - float diffuseLifetime Time in seconds that a diffuse particle will live for after being spawned, particles will be spawned with a random lifetime in the range [0, diffuseLifetime]. -float - -plasticThreshold - -Particles belonging to rigid shapes that move with a position delta magnitude > threshold will be permanently deformed in the rest pose. - -float - -plasticCreep - -Controls the rate at which particles in the rest pose are deformed for particles passing the deformation threshold. - float collisionDistance @@ -895,8 +918,20 @@ Direct3D device to use for simulation, if none is specified a new device and con renderContext +Direct3D context that the app is using for rendering. In DirectX 12 this should be a ID3D12CommandQueue pointer. + +void * + +computeContext + Direct3D context to use for simulation, if none is specified a new context will be created, in DirectX 12 this should be a pointer to the ID3D12CommandQueue where compute operations will take place. +bool + +useComputeQueue + +If true, run Flex on a D3D12 compute queue, or vendor specific D3D11 compute queue. This allows compute and graphics to run in parallel on some GPUs. + NvFlexComputeType computeType @@ -904,6 +939,80 @@ computeType Set to eNvFlexD3D11 if DirectX 11 should be used, eNvFlexD3D12 for DirectX 12, this must match the libraries used to link the application. +
+ + +
+
+ + + + +
struct NvFlexSolverDesc
+
+

Describes the creation time parameters for the solver

+
+ + + + + + + + + + + + + +
Data Fields
+NvFlexFeatureMode +featureMode +Control which features are enabled.
+int +maxParticles +Maximum number of regular particles in the solver.
+int +maxDiffuseParticles +Maximum number of diffuse particles in the solver.
+int +maxNeighborsPerParticle +Maximum number of neighbors per-particle, for solids this can be around 32, for fluids up to 128 may be necessary depending on smoothing radius.
+ +
+
+ +
+
+ + + + +
struct NvFlexCopyDesc
+
+

Describes a source and destination buffer region for performing a copy operation.

+
+ + + + + + + + + + +
Data Fields
+int +srcOffset +
+int +dstOffset +
+int +elementCount +
+
@@ -1252,9 +1361,6 @@ time eNvFlexMapDoNotWait 

Calling thread will check if buffer is ready for access, if not ready then the method will return NULL immediately.

-eNvFlexMapDiscard  -

Buffer contents will be discarded, this allows for efficent buffer reuse.

- @@ -1271,10 +1377,10 @@ time

Controls memory space of a NvFlexBuffer, see NvFlexAllocBuffer()

Enumerator
eNvFlexBufferHost  -

Host mappable buffer, pinned memory on CUDA, staging buffer on DX.

+

A host mappable buffer, pinned memory on CUDA, staging buffer on DX.

eNvFlexBufferDevice  -

Device memory buffer, mapping this on CUDA will return a device memory pointer, and will return a buffer pointer on DX.

+

A device memory buffer, mapping this on CUDA will return a device memory pointer, and will return a buffer pointer on DX.

@@ -1310,20 +1416,53 @@ time
-

Flags that control the a particle's behavior and grouping, use NvFlexMakePhase() to construct a valid 32bit phase identifier

+

Flags that control a particle's behavior and grouping, use NvFlexMakePhase() to construct a valid 32bit phase identifier

+ + + + + + + + + + +
Enumerator
eNvFlexPhaseGroupMask  -

Low 24 bits represent the particle group for controlling collisions.

+

Bits [ 0, 19] represent the particle group for controlling collisions.

+
eNvFlexPhaseFlagsMask  +

Bits [20, 23] hold flags about how the particle behave.

+
eNvFlexPhaseShapeChannelMask  +

Bits [24, 31] hold flags representing what shape collision channels particles will collide with, see NvFlexMakeShapeFlags()

eNvFlexPhaseSelfCollide 

If set this particle will interact with particles of the same group.

eNvFlexPhaseSelfCollideFilter  -

If set this particle will ignore collisions with particles closer than the radius in the rest pose, this flag should not be specified unless valid rest positions have been specified using NvFlexSetRestParticles()

+

If set this particle will ignore collisions with particles closer than the radius in the rest pose, this flag should not be specified unless valid rest positions have been specified using NvFlexSetRestParticles()

eNvFlexPhaseFluid 

If set this particle will generate fluid density constraints for its overlapping neighbors.

eNvFlexPhaseUnused  +

Reserved.

+
eNvFlexPhaseShapeChannel0  +

Particle will collide with shapes with channel 0 set (see NvFlexMakeShapeFlags())

+
eNvFlexPhaseShapeChannel1  +

Particle will collide with shapes with channel 1 set (see NvFlexMakeShapeFlags())

+
eNvFlexPhaseShapeChannel2  +

Particle will collide with shapes with channel 2 set (see NvFlexMakeShapeFlags())

+
eNvFlexPhaseShapeChannel3  +

Particle will collide with shapes with channel 3 set (see NvFlexMakeShapeFlags())

+
eNvFlexPhaseShapeChannel4  +

Particle will collide with shapes with channel 4 set (see NvFlexMakeShapeFlags())

+
eNvFlexPhaseShapeChannel5  +

Particle will collide with shapes with channel 5 set (see NvFlexMakeShapeFlags())

+
eNvFlexPhaseShapeChannel6  +

Particle will collide with shapes with channel 6 set (see NvFlexMakeShapeFlags())

+
eNvFlexPhaseShapeChannel7  +

Particle will collide with shapes with channel 7 set (see NvFlexMakeShapeFlags())

+
@@ -1400,7 +1539,7 @@ time
-

Defines the different DirectX compute modes that Flex can use

+

Defines the different compute backends that Flex can use

Enumerator
eNvFlexCUDA 

Use CUDA compute for Flex, the application must link against the CUDA libraries.

@@ -1413,6 +1552,30 @@ time
+
+ + +
+
+ + + + +
enum NvFlexFeatureMode
+
+

Controls which features are enabled, choosing a simple option will disable features and can lead to better performance and reduced memory usage

+ + + + +
Enumerator
eNvFlexFeatureModeDefault  +

All features enabled.

+
eNvFlexFeatureModeSimpleSolids  +

Simple per-particle collision (no per-particle SDF normals, no fluids)

+
eNvFlexFeatureModeSimpleFluids  +

Simple single phase fluid-only particles (no solids)

+
+
@@ -1458,7 +1621,7 @@ time

Function Documentation

- + +
+
+
Enumerator
eNvFlexShapeFlagTypeMask  -

Lower 3 bits holds the type of the collision shape.

+

Lower 3 bits holds the type of the collision shape given by the NvFlexCollisionShapeType enum.

eNvFlexShapeFlagDynamic 

Indicates the shape is dynamic and should have lower priority over static collision shapes.

@@ -1473,7 +1636,56 @@ time
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
NV_FLEX_API int NvFlexMakePhaseWithChannels (int group,
int particleFlags,
int shapeChannels 
)
+
+inline
+
+

Generate a bit set for the particle phase, this is a helper method to simply combine the group id and bit flags into a single integer.

+
Parameters
+ + + + +
[in]groupThe index of the group for this particle, should be an integer < 2^20
[in]particleFlagsA combination of the phase flags which should be a combination of eNvFlexPhaseSelfCollide, eNvFlexPhaseSelfCollideFilter, and eNvFlexPhaseFluid
[in]shapeChannelsA combination of eNvFlexPhaseShapeChannel* flags that control which shapes will be collided against, particles will only collide against shapes that share at least one set channel, see NvFlexMakeShapeFlagsWithChannels()
+
+
+ +
+ +
@@ -1490,7 +1702,7 @@ time - + @@ -1504,7 +1716,7 @@ time
int flags particleFlags 
-

Generate a bit set for the particle phase, the group should be an integer < 2^24, and the flags should be a combination of FlexPhase enum values

+

Deprecated helper method to generates a phase with all shape channels set

@@ -1589,33 +1801,43 @@ time - +
- + - - - - - + + - - +
NV_FLEX_API NvFlexSolver* NvFlexCreateSolver NV_FLEX_API void NvFlexSetSolverDescDefaults (NvFlexLibrarylib,
NvFlexSolverDescdesc) int maxParticles,
+
+

Initialize the solver desc to its default values

Parameters
+ + +
[in]descPointer to a description structure that will be initialized to default values
+
+
+ +
+
+ +
+
+ - - - - + + + + - - + + @@ -1628,9 +1850,7 @@ time
Parameters
int maxDiffuseParticles, NV_FLEX_API NvFlexSolver* NvFlexCreateSolver (NvFlexLibrarylib,
int maxNeighborsPerParticle = 96 const NvFlexSolverDescdesc 
- - - +
[in]libThe library instance to use
[in]maxParticlesMaximum number of simulation particles possible for this solver
[in]maxDiffuseParticlesMaximum number of diffuse (non-simulation) particles possible for this solver
[in]maxNeighborsPerParticleMaximum number of neighbors per particle possible for this solver
[in]descPointer to a solver description structure used to create the solver
@@ -1653,7 +1873,7 @@ time

Delete a particle solver

Parameters
- +
[in]solverA valid solver pointer created from NvFlexCreateSolver()
[in]solverA valid solver pointer created from NvFlexCreateSolver()
@@ -1676,12 +1896,46 @@ time

Return the library associated with a solver

Parameters
- +
[in]solverA valid solver created with NvFlexCreateSolver()
[in]solverA valid solver created with NvFlexCreateSolver()
Returns
A library pointer
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
NV_FLEX_API void NvFlexGetSolverDesc (NvFlexSolversolver,
NvFlexSolverDescdesc 
)
+
+

Return the solver desc that was used to create a solver

+
Parameters
+ + + +
[in]solverPointer to a valid Flex solver
[in]descPointer to a desc structure
+
+
+
@@ -1763,7 +2017,7 @@ time

Integrate particle solver forward in time. Below is an example of how to step Flex in the context of a simple game loop:

-
NvFlexSolver* solver = NvFlexCreateSolver(library);
+
NvFlexSolver* solver = NvFlexCreateSolver(library);
NvFlexBuffer* particleBuffer = NvFlexAllocBuffer(library, n, sizeof(Vec4), eNvFlexBufferHost);
NvFlexBuffer* velocityBuffer = NvFlexAllocBuffer(library, n, sizeof(Vec4), eNvFlexBufferHost);
@@ -1788,17 +2042,17 @@ time
NvFlexUnmap(phaseBuffer);
// write to device (async)
-
NvFlexSetParticles(particleBuffer, n);
-
NvFlexSetVelocities(velocityBuffer, n);
-
NvFlexSetPhases(phaseBuffer, n);
+
NvFlexSetParticles(particleBuffer, n);
+
NvFlexSetVelocities(velocityBuffer, n);
+
NvFlexSetPhases(phaseBuffer, n);
// tick
NvFlexUpdateSolver(solver, dt, 1, NULL);
// read back (async)
-
NvFlexGetParticles(particleBuffer, n);
-
NvFlexGetVelocities(velocityBuffer, n);
-
NvFlexGetPhases(phaseBuffer, n);
+
NvFlexGetParticles(particleBuffer, n);
+
NvFlexGetVelocities(velocityBuffer, n);
+
NvFlexGetPhases(phaseBuffer, n);
}
NvFlexFreeBuffer(particleBuffer);
@@ -1887,7 +2141,7 @@ time
- +
@@ -1906,8 +2160,8 @@ time - - + + @@ -1921,14 +2175,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]indicesHolds the indices of particles that have been made active
[in]nNumber of particles to allocate
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -1942,7 +2196,13 @@ time - + + + + + + + @@ -1956,6 +2216,41 @@ time
NvFlexBufferindices indices,
const NvFlexCopyDescdesc 
+ +
[in]solverA valid solver
[out]indicesa buffer of indices at least activeCount in length
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
+ + + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
NV_FLEX_API void NvFlexSetActiveCount (NvFlexSolversolver,
int n 
)
+
+

Set the total number of active particles

+
Parameters
+ + +
[in]solverA valid solver
[in]nThe number of active particles, the first n indices in the active particles array will be used as the active count
@@ -1986,7 +2281,7 @@ time
- +
@@ -2005,8 +2300,8 @@ time - - + + @@ -2020,14 +2315,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]pPointer to a buffer of particle data, should be 4*n in length
[in]nThe number of particles to set
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2046,8 +2341,8 @@ time - - + + @@ -2061,14 +2356,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[out]pPointer to a buffer of 4*n floats that will be filled out with the particle data, can be either a host or device pointer
[in]nThe number of particles to get, must be less than max particles passed to NvFlexCreateSolver
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2087,8 +2382,8 @@ time - - + + @@ -2102,14 +2397,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]pPointer to a buffer of particle data, should be 4*n in length
[in]nThe number of particles to set
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2128,8 +2423,8 @@ time - - + + @@ -2143,14 +2438,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]pPointer to a buffer of particle data, should be 4*n in length
[in]nThe number of particles to set
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2169,8 +2464,8 @@ time - - + + @@ -2184,14 +2479,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[out]pPointer to a buffer of 4*n floats that will be filled out with the data, can be either a host or device pointer
[in]nThe number of smooth particles to return
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2210,8 +2505,8 @@ time - - + + @@ -2225,14 +2520,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]vPointer to a buffer of 3*n floats
[in]nThe number of velocities to set
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2251,8 +2546,8 @@ time - - + + @@ -2266,14 +2561,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[out]vPointer to a buffer of 3*n floats that will be filled out with the data, can be either a host or device pointer
[in]nThe number of velocities to get
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2292,8 +2587,8 @@ time - - + + @@ -2309,14 +2604,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]phasesPointer to a buffer of n integers containing the phases
[in]nThe number of phases to set
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2335,8 +2630,8 @@ time - - + + @@ -2350,14 +2645,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[out]phasesPointer to a buffer of n integers that will be filled with the phase data, can be either a host or device pointer
[in]nThe number of phases to get
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2376,8 +2671,8 @@ time - - + + @@ -2391,14 +2686,14 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]normalsPointer to a buffer of normals, should be 4*n in length
[in]nThe number of normals to set
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
- +
@@ -2417,8 +2712,8 @@ time - - + + @@ -2432,7 +2727,7 @@ time
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[out]normalsPointer to a buffer of normals, should be 4*n in length
[in]nThe number of normals to get
[in]descDescribes the copy region, if NULL the solver will try to access the entire buffer (maxParticles length)
@@ -2549,7 +2844,7 @@ time
- +
@@ -2589,6 +2884,18 @@ time + + + + + + + + + + + + @@ -2629,6 +2936,8 @@ time + + @@ -2639,16 +2948,58 @@ time - +
NvFlexBuffer stiffness,
NvFlexBufferthresholds,
NvFlexBuffercreeps,
[in]restPositionsPointer to a buffer of local space positions relative to the rigid's center of mass (average position), this should be at least 3*numIndices in length in the format x,y,z
[in]restNormalsPointer to a buffer of local space normals, this should be at least 4*numIndices in length in the format x,y,z,w where w is the (negative) signed distance of the particle inside its shape
[in]stiffnessPointer to a buffer of rigid stiffness coefficents, should be numRigids in length, valid values in range [0, 1]
[in]thresholdsPointer to a buffer of plastic deformation threshold coefficients, should be numRigids in length
[in]creepsPointer to a buffer of plastic deformation creep coefficients, should be numRigids in length, valid values in range [0, 1]
[in]rotationsPointer to a buffer of quaternions (4*numRigids in length)
[in]translationsPointer to a buffer of translations of the center of mass (3*numRigids in length)
[in]numRigidsThe number of rigid bodies to set
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2668,12 +3019,19 @@ time
NV_FLEX_API void NvFlexGetRigidTransforms NV_FLEX_API void NvFlexGetRigids ( NvFlexSolver solver,
NvFlexBufferoffsets,
NvFlexBufferindices,
NvFlexBufferrestPositions,
NvFlexBufferrestNormals,
NvFlexBufferstiffness,
NvFlexBufferthresholds,
NvFlexBuffercreeps,
-

Get the rotation matrices for the rigid bodies in the solver

+

Retrive the rigid body shape matching constraints and transforms, if any buffer pointers are NULL then they will be ignored This method supersedes the previous NvFlexGetRigidTransforms method and can be used to retrieve modified rest positions from plastic deformation.

Parameters
- - + + + + + + + + +
[in]solverA valid solver
[out]rotationsPointer to a buffer of quaternions, should be 4*numRigids floats in length
[out]translationsPointer to a buffer of vectors to hold the rigid translations, should be 3*numRigids floats in length
[in]offsetsPointer to a buffer of start offsets for a rigid in the indices array, should be numRigids+1 in length, the first entry must be 0
[in]indicesPointer to a buffer of indices for the rigid bodies, the indices for the jth rigid body start at indices[offsets[j]] and run to indices[offsets[j+1]] exclusive
[in]restPositionsPointer to a buffer of local space positions relative to the rigid's center of mass (average position), this should be at least 3*numIndices in length in the format x,y,z
[in]restNormalsPointer to a buffer of local space normals, this should be at least 4*numIndices in length in the format x,y,z,w where w is the (negative) signed distance of the particle inside its shape
[in]stiffnessPointer to a buffer of rigid stiffness coefficents, should be numRigids in length, valid values in range [0, 1]
[in]thresholdsPointer to a buffer of plastic deformation threshold coefficients, should be numRigids in length
[in]creepsPointer to a buffer of plastic deformation creep coefficients, should be numRigids in length, valid values in range [0, 1]
[in]rotationsPointer to a buffer of quaternions (4*numRigids in length with the imaginary elements in the x,y,z components)
[in]translationsPointer to a buffer of translations of the center of mass (3*numRigids in length)
@@ -2995,7 +3353,7 @@ time
-

Create a convex mesh collision shapes, see NvFlexConvexMeshId for details.

+

Create a convex mesh collision shape, see NvFlexConvexMeshId for details.

Parameters
@@ -3040,7 +3398,7 @@ time - +
[in]libThe library instance to use
@@ -3071,13 +3429,13 @@ time - + - + @@ -3093,7 +3451,7 @@ time - +
float * const float *  lower,
float * const float *  upper 
[in]libThe library instance to use
[in]convexA valid convex mesh shape created from NvFlexCreateConvexMesh()
[in]planesAn array of planes, each plane consists of 4 floats in the form a*x + b*y + c*z + d = 0
[in]numPlanesThe number of planes in the convex
[in]numPlanesThe number of planes in the convex, must be less than 64 planes per-convex
[in]lowerThe local space lower bound of the convex shape
[in]upperThe local space upper bound of the convex shape
@@ -3137,7 +3495,7 @@ time
-

Retrieve the local space bounds of the mesh, these are the same values specified to NvFlexUpdateConvexMesh()

+

Retrieve the local space bounds of the mesh, these are the same values specified to NvFlexUpdateConvexMesh()

Parameters
@@ -3148,6 +3506,55 @@ time + + + +
+
+
[in]libThe library instance to use
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
NV_FLEX_API int NvFlexMakeShapeFlagsWithChannels (NvFlexCollisionShapeType type,
bool dynamic,
int shapeChannels 
)
+
+inline
+
+

Helper function to combine shape type, flags, and phase/shape collision channels into a 32bit value

+
Parameters
+ + + + +
[in]typeThe type of the shape, see NvFlexCollisionShapeType
[in]dynamicSee eNvFlexShapeFlagDynamic
[in]shapeChannelsA combination of the eNvFlexPhaseShapeChannel* flags, collisions will only be processed between a particle and a shape if a channel is set on both the particle and shape, see NvFlexMakePhaseWithChannels()
+
+
+
@@ -3181,7 +3588,7 @@ time
-

Combines geometry type and static/dynamic flags

+

Deprecrated helper method that creates shape flags that by default have all collision channels enabled

@@ -3426,7 +3833,7 @@ time - +
@@ -3445,8 +3852,8 @@ time - - + + @@ -3459,15 +3866,15 @@ time
Parameters
int n const NvFlexCopyDescdesc 
- +
[in]solverA valid solver
[in]nThe number of particle densities to return
[out]densitiesPointer to a buffer of floats, should be maxParticles in length, density values are normalized between [0, 1] where 1 represents the rest density
[in]descPointer to a descriptor specifying the contents to read back
- +
@@ -3493,7 +3900,13 @@ time - + + + + + + + @@ -3510,18 +3923,19 @@ time +
NvFlexBufferq3 q3,
const NvFlexCopyDescdesc 
[out]q1Pointer to a buffer of floats that receive the first basis vector and scale, should be 4*maxParticles in length
[out]q2Pointer to a buffer of floats that receive the second basis vector and scale, should be 4*maxParticles in length
[out]q3Pointer to a buffer of floats that receive the third basis vector and scale, should be 4*maxParticles in length
[in]descPointer to a descriptor specifying the contents to read back
- +
- + @@ -3542,7 +3956,7 @@ time - + @@ -3557,7 +3971,7 @@ time - +
NV_FLEX_API int NvFlexGetDiffuseParticles NV_FLEX_API void NvFlexGetDiffuseParticles ( NvFlexSolver solver, NvFlexBufferindices count 
[in]solverA valid solver
[out]pPointer to a buffer of floats, should be 4*maxParticles in length, the w component represents the particles lifetime with 1 representing a new particle, and 0 representing an inactive particle
[out]vPointer to a buffer of floats, should be 4*maxParticles in length, the w component is not used
[out]indicesPointer to a buffer of ints that specify particle indices in depth sorted order, should be maxParticles in length, see NvFlexParams::mDiffuseSortDir
[out]countPointer to a buffer of a single int that holds the current particle count (this may be updated by the GPU which is why it is passed back in a buffer)
@@ -3605,7 +4019,7 @@ time [in]solverA valid solver [in]pPointer to a buffer of floats, should be 4*n in length, the w component represents the particles lifetime with 1 representing a new particle, and 0 representing an inactive particle [in]vPointer to a buffer of floats, should be 4*n in length, the w component is not used - [in]nNumber of diffuse particles to set + [in]nThe number of active diffuse particles @@ -3657,13 +4071,90 @@ time
Parameters
- - - - + + + + +
[in]solverA valid solver
[out]planesPointer to a destination buffer containing the contact planes for the particle, each particle can have up to 4 contact planes so this buffer should be 16*maxParticles in length
[out]velocitiesPointer to a destination buffer containing the velocity of the contact point on the shape in world space, the index of the shape (corresponding to the shape in NvFlexSetShapes() is stored in the w component), each particle can have up to 4 contact planes so this buffer should be 16*maxParticles in length
[out]indicesPointer to a buffer of indices into the contacts buffer, the first contact plane for the i'th particle is given by planes[indices[i]*sizeof(float)*4] and subsequent contacts for that particle are stored sequentially, this array should be maxParticles in length
[out]countsPointer to a buffer of contact counts for each particle (will be <= 4), this buffer should be maxParticles in length
[out]planesPointer to a destination buffer containing the contact planes for the particle, each particle can have up to 6 contact planes so this buffer should be 4*6*maxParticles floats in length
[out]velocitiesPointer to a destination buffer containing the velocity of the contact point on the shape in world space, the index of the shape (corresponding to the shape in NvFlexSetShapes() is stored in the w component), each particle can have up to 6 contact planes so this buffer should be 4*6*maxParticles floats in length
[out]indicesPointer to a buffer of indices into the contacts buffer, the first contact plane for the i'th particle is given by planes[indices[i]*sizeof(float)*4*6] and subsequent contact planes for that particle are stored sequentially, this array should be maxParticles in length
[out]countsPointer to a buffer of contact counts for each particle (will be <= 6), this buffer should be maxParticles in length
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NV_FLEX_API void NvFlexGetNeighbors (NvFlexSolversolver,
NvFlexBufferneighbors,
NvFlexBuffercounts,
NvFlexBufferremap 
)
+
+

Get the particle neighbor lists, these are stored in a strided format, and can be iterated in the following manner:

+
NvFlexGetNeighbors(solver, neighborsBuffer, countsBuffer, indicesBuffer);
+
+
int* neighbors = (int*)NvFlexMap(neighborsBuffer, 0);
+
int* counts = (int*)NvFlexMap(countsBuffer, 0);
+
int* remap = (int*)NvFlexMap(remapBuffer, 0);
+
+
// neighbors are stored in a strided format so that the first neighbor
+
// of each particle is stored sequentially, then the second, and so on
+
+
int stride = maxParticles;
+
+
for (int i=0; i < maxParticles; ++i)
+
{
+
// find offset in the neighbors buffer
+
int offset = remap[i];
+
int count = counts[offset];
+
+
for (int c=0; c < count; ++c)
+
{
+
int neighbor = remap[neighbors[c*stride + offset]];
+
+
printf("Particle %d's neighbor %d is particle %d\n", i, c, neighbor);
+
}
+
}
+
+
NvFlexUnmap(neighborsBuffer);
+
NvFlexUnmap(countsBuffer);
+
NvFlexUnmap(remapBuffer);
+
Parameters
+ + + + +
[in]solverA valid solver
[out]neighborsPointer to a destination buffer containing the the neighbors for all particles, this should be maxParticles*maxParticleNeighbors ints (passed to NvFlexInit() in length)
[out]countsPointer to a buffer of neighbor counts per-particle, should be maxParticles ints in length
[out]remapPointer to a buffer of indices, because Flex internally re-orders particles these are used to map from an API particle index to it internal index
+
Note
Neighbors are only valid after a call to NvFlexUpdateSolver() has completed, the returned neighbors correspond to the last substep of the last update
@@ -3708,7 +4199,7 @@ time - +
@@ -3716,14 +4207,39 @@ time - + + + + + + + + + + + + + + + + + + + + + + +
NV_FLEX_API float NvFlexGetDeviceLatency ( NvFlexSolversolver)solver,
unsigned long long * begin,
unsigned long long * end,
unsigned long long * frequency 
)
Parameters
+ + +
[in]solverA valid solver
[out]beginOptional pointer to a 64 bit unsigned to receive the value of the GPU clock when Flex update began (in cycles)
[out]endOptional pointer to a 64 bit unsigned to receive the value of the GPU clock when Flex update ended (in cycles)
[out]frequencyOptional pointer to a 64 bit unsigned to receive the frequency of the clock used to measure begin and end
@@ -3898,7 +4414,7 @@ time
-

Maps a buffer for reading and writing. When the buffer is created with NvFlexBufferType::eHost, then the returned pointer will be a host memory address that can be read/written. Mapping a buffer implicitly synchronizes with the GPU to ensure that any reads or writes from the buffer (e.g.: from the NvFlexGet*() or NvFlexSet*()) methods have completed.

+

Maps a buffer for reading and writing. When the buffer is created with NvFlexBufferType::eHost, then the returned pointer will be a host memory address that can be read/written. Mapping a buffer implicitly synchronizes with the GPU to ensure that any reads or writes from the buffer (e.g.: from the NvFlexGet*() or NvFlexSet*() methods) have completed.

Parameters
@@ -3980,7 +4496,7 @@ time
...
// copy directly from Flex into render buffer
-
NvFlexGetParticles(vboBuffer, n);
+
NvFlexGetParticles(vboBuffer, n);
// render
...
@@ -4217,12 +4733,28 @@ time + + + +
+
+
[in]bufferA buffer allocated with NvFlexAllocBuffer()
+ + + + + + + +
NV_FLEX_API void NvFlexWait (NvFlexLibrarylib)
+
+
-- cgit v1.2.3