From 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 Mon Sep 17 00:00:00 2001 From: git perforce import user Date: Tue, 25 Oct 2016 12:29:14 -0600 Subject: Initial commit: PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167] --- .../include/FieldSamplerPhysXMonitor.h | 171 +++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 APEX_1.4/module/fieldsampler/include/FieldSamplerPhysXMonitor.h (limited to 'APEX_1.4/module/fieldsampler/include/FieldSamplerPhysXMonitor.h') diff --git a/APEX_1.4/module/fieldsampler/include/FieldSamplerPhysXMonitor.h b/APEX_1.4/module/fieldsampler/include/FieldSamplerPhysXMonitor.h new file mode 100644 index 00000000..30ff79c4 --- /dev/null +++ b/APEX_1.4/module/fieldsampler/include/FieldSamplerPhysXMonitor.h @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#ifndef __FIELD__SAMPLER_PHYSX_MONITOR_H___ +#define __FIELD__SAMPLER_PHYSX_MONITOR_H___ + +#include "Apex.h" +#include + +#include "FieldSamplerSceneIntl.h" +#include "FieldSamplerPhysXMonitorParams.h" + +#if PX_PHYSICS_VERSION_MAJOR == 3 +#include +#endif + +namespace nvidia +{ +namespace apex +{ +class FieldSamplerQueryIntl; +} + +namespace fieldsampler +{ + +class FieldSamplerScene; +class FieldSamplerManager; + + +struct ShapeData : public UserAllocated +{ + uint32_t fdIndex; + uint32_t rbIndex; + float mass; + PxVec3 pos; + PxVec3 vel; + + static bool sortPredicate (ShapeData* sd1, ShapeData* sd2) + { + if (sd1 == 0) return false; + if (sd2 == 0) return true; + return sd1->fdIndex < sd2->fdIndex; + } +}; + + +class FieldSamplerPhysXMonitor : public UserAllocated +{ +private: + + +public: + FieldSamplerPhysXMonitor(FieldSamplerScene& scene); + virtual ~FieldSamplerPhysXMonitor(); + +#if PX_PHYSICS_VERSION_MAJOR == 3 + virtual void update(); + virtual void updatePhysX(); + + /* PhysX scene management */ + void setPhysXScene(PxScene* scene); + PX_INLINE PxScene* getPhysXScene() const + { + return mScene; + } + + /* Toggle PhysX Monitor on/off */ + PX_INLINE void enablePhysXMonitor(bool enable) + { + mEnable = enable; + } + + /* Is PhysX Monitor enabled */ + PX_INLINE bool isEnable() + { + return mEnable; + } + + PX_INLINE void FieldSamplerPhysXMonitor::setPhysXFilterData(physx::PxFilterData filterData) + { + mFilterData = filterData; + } + +private: + FieldSamplerPhysXMonitor& operator=(const FieldSamplerPhysXMonitor&); + + void getParticles(uint32_t taskId); + void updateParticles(); + void getRigidBodies(uint32_t taskId); + void updateRigidBodies(); + //void getCloth(PxTask& task, bool isDataOnDevice); + //void updateCloth(); + +protected: + + void commonInitArray(); + + FieldSamplerScene* mFieldSamplerScene; + FieldSamplerManager* mFieldSamplerManager; + + PxScene* mScene; + + FieldSamplerPhysXMonitorParams* mParams; + + PxFilterData mFilterData; + + //Particles + uint32_t mNumPS; //Number of particle systems + uint32_t mPCount; //Number of particles in buffer + Array mParticleSystems; + Array mPSMass; + Array mPSOutField; + Array mOutVelocities; + Array mOutIndices; + Array mParticleReadData; + Array mPSFieldSamplerQuery; + Array mPSFieldSamplerTaskID; + + + //Rigid bodies + uint32_t mNumRB; //Number of rigid bodies + Array mRBActors; + Array mRBIndex; + Array mRBInPosition; + Array mRBInVelocity; + Array mRBOutField; + Array mRBFilterData; + Array mRBFieldSamplerQuery; + + //Enable or disable PhysX Monitor + bool mEnable; + +public: + class RunAfterActorUpdateTask : public PxTask + { + public: + RunAfterActorUpdateTask(FieldSamplerPhysXMonitor& owner) : mOwner(owner) {} + const char* getName() const + { + return FSST_PHYSX_MONITOR_UPDATE; + } + void run() + { + mOwner.updatePhysX(); + } + + protected: + FieldSamplerPhysXMonitor& mOwner; + + private: + RunAfterActorUpdateTask operator=(const RunAfterActorUpdateTask&); + }; + RunAfterActorUpdateTask mTaskRunAfterActorUpdate; +#endif +}; + + +} +} // end namespace nvidia::apex + +#endif + -- cgit v1.2.3