00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #pragma once
00031
00032 #include "NvCloth/Range.h"
00033 #include <foundation/PxVec4.h>
00034 #include <foundation/PxVec3.h>
00035 #include "NvCloth/Allocator.h"
00036
00037 typedef struct CUctx_st* CUcontext;
00038
00039 namespace nv
00040 {
00041 namespace cloth
00042 {
00043 class DxContextManagerCallback;
00044 class Factory;
00045 }
00046 }
00047 NV_CLOTH_API(nv::cloth::Factory*) NvClothCreateFactoryCPU();
00048 NV_CLOTH_API(nv::cloth::Factory*) NvClothCreateFactoryCUDA(CUcontext);
00049 NV_CLOTH_API(nv::cloth::Factory*) NvClothCreateFactoryDX11(nv::cloth::DxContextManagerCallback*);
00050 NV_CLOTH_API(void) NvClothDestroyFactory(nv::cloth::Factory*);
00051
00053 NV_CLOTH_API(bool) NvClothCompiledWithCudaSupport();
00055 NV_CLOTH_API(bool) NvClothCompiledWithDxSupport();
00056
00057 namespace nv
00058 {
00059 namespace cloth
00060 {
00061
00062 class Fabric;
00063 class Cloth;
00064 class Solver;
00065
00066 enum struct Platform
00067 {
00068 CPU,
00069 CUDA,
00070 DX11
00071 };
00072
00075 class Factory : public UserAllocated
00076 {
00077 protected:
00078 Factory() {}
00079 Factory(const Factory&);
00080 Factory& operator = (const Factory&);
00081 virtual ~Factory() {}
00082
00083 friend NV_CLOTH_IMPORT void NV_CLOTH_CALL_CONV ::NvClothDestroyFactory(nv::cloth::Factory*);
00084
00085 public:
00086 virtual Platform getPlatform() const = 0;
00087
00098 virtual Fabric* createFabric(uint32_t numParticles, Range<const uint32_t> phaseIndices, Range<const uint32_t> sets,
00099 Range<const float> restvalues, Range<const float> stiffnessValues, Range<const uint32_t> indices,
00100 Range<const uint32_t> anchors, Range<const float> tetherLengths,
00101 Range<const uint32_t> triangles) = 0;
00102
00108 virtual Cloth* createCloth(Range<const physx::PxVec4> particles, Fabric& fabric) = 0;
00109
00113 virtual Solver* createSolver() = 0;
00114
00119 virtual Cloth* clone(const Cloth& cloth) = 0;
00120
00130 virtual void extractFabricData(const Fabric& fabric, Range<uint32_t> phaseIndices, Range<uint32_t> sets,
00131 Range<float> restvalues, Range<float> stiffnessValues, Range<uint32_t> indices, Range<uint32_t> anchors,
00132 Range<float> tetherLengths, Range<uint32_t> triangles) const = 0;
00133
00144 virtual void extractCollisionData(const Cloth& cloth, Range<physx::PxVec4> spheres, Range<uint32_t> capsules,
00145 Range<physx::PxVec4> planes, Range<uint32_t> convexes, Range<physx::PxVec3> triangles) const = 0;
00146
00153 virtual void extractMotionConstraints(const Cloth& cloth, Range<physx::PxVec4> destConstraints) const = 0;
00154
00160 virtual void extractSeparationConstraints(const Cloth& cloth, Range<physx::PxVec4> destConstraints) const = 0;
00161
00167 virtual void extractParticleAccelerations(const Cloth& cloth, Range<physx::PxVec4> destAccelerations) const = 0;
00168
00175 virtual void extractVirtualParticles(const Cloth& cloth, Range<uint32_t[4]> destIndices,
00176 Range<physx::PxVec3> destWeights) const = 0;
00177
00183 virtual void extractSelfCollisionIndices(const Cloth& cloth, Range<uint32_t> destIndices) const = 0;
00184
00190 virtual void extractRestPositions(const Cloth& cloth, Range<physx::PxVec4> destRestPositions) const = 0;
00191 };
00192
00193 }
00194 }