// This code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2020 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #pragma once #include "NvCloth/Range.h" #include "NvCloth/PhaseConfig.h" #include "MovingAverage.h" #include "IndexPair.h" #include "Vec4T.h" #include #include #include #include "SwFactory.h" #include "SwFabric.h" #include "ClothImpl.h" namespace nv { namespace cloth { struct SwConstraints { void pop() { if (!mTarget.empty()) { mStart.swap(mTarget); mTarget.resize(0); } } Vector::Type mStart; Vector::Type mTarget; }; struct SwContextLock { SwContextLock(const SwFactory&) { } }; class SwCloth; template<> class ClothTraits { public: typedef SwFactory FactoryType; typedef SwFabric FabricType; typedef SwContextLock ContextLockType; }; class SwCloth : public ClothImpl { SwCloth& operator = (const SwCloth&); // not implemented public: typedef SwFactory FactoryType; typedef SwFabric FabricType; typedef SwContextLock ContextLockType; typedef Vector::Type& MappedVec3fVectorType; typedef Vector::Type& MappedVec4fVectorType; typedef Vector::Type& MappedIndexVectorType; typedef Vector::Type& MappedMaskVectorType; SwCloth(SwFactory&, SwFabric&, Range); SwCloth(SwFactory&, const SwCloth&); ~SwCloth(); // not virtual on purpose public: virtual Cloth* clone(Factory& factory) const; uint32_t getNumParticles() const; void lockParticles() const; void unlockParticles() const; MappedRange getCurrentParticles(); MappedRange getCurrentParticles() const; MappedRange getPreviousParticles(); MappedRange getPreviousParticles() const; GpuParticles getGpuParticles(); void setPhaseConfig(Range configs); void setSelfCollisionIndices(Range indices); uint32_t getNumVirtualParticles() const; Range getParticleAccelerations(); void clearParticleAccelerations(); void setVirtualParticles(Range indices, Range weights); void notifyChanged() { } void setParticleBounds(const float*); Range push(SwConstraints&); static void clear(SwConstraints&); static Range clampTriangleCount(Range, uint32_t); public: SwFactory& mFactory; SwFabric& mFabric; bool mClothCostDirty; // current and previous-iteration particle positions Vector::Type mCurParticles; Vector::Type mPrevParticles; Vector::Type mPhaseConfigs; // transformed! // tether constraints stuff float mTetherConstraintLogStiffness; float mTetherConstraintScale; // motion constraints stuff SwConstraints mMotionConstraints; float mMotionConstraintScale; float mMotionConstraintBias; float mMotionConstraintLogStiffness; // separation constraints stuff SwConstraints mSeparationConstraints; // particle acceleration stuff Vector::Type mParticleAccelerations; // collision stuff Vector::Type mCapsuleIndices; Vector::Type mStartCollisionSpheres; Vector::Type mTargetCollisionSpheres; Vector::Type mConvexMasks; Vector::Type mStartCollisionPlanes; Vector::Type mTargetCollisionPlanes; Vector::Type mStartCollisionTriangles; Vector::Type mTargetCollisionTriangles; bool mEnableContinuousCollision; float mCollisionMassScale; float mFriction; // virtual particles Vector::Type mVirtualParticleIndices; Vector::Type mVirtualParticleWeights; uint32_t mNumVirtualParticles; // self collision float mSelfCollisionDistance; float mSelfCollisionLogStiffness; Vector::Type mSelfCollisionIndices; Vector::Type mRestPositions; // unused for CPU simulation void* mUserData; }; } // namespace cloth }