aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/module/fieldsampler/include
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/module/fieldsampler/include
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'APEX_1.4/module/fieldsampler/include')
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldBoundaryWrapper.h85
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldSamplerCommon.h386
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldSamplerManager.h133
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldSamplerPhysXMonitor.h171
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldSamplerQuery.h308
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldSamplerScene.h218
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldSamplerSceneWrapper.h206
-rw-r--r--APEX_1.4/module/fieldsampler/include/FieldSamplerWrapper.h149
-rw-r--r--APEX_1.4/module/fieldsampler/include/ModuleEventDefs.h26
-rw-r--r--APEX_1.4/module/fieldsampler/include/ModuleFieldSamplerImpl.h98
-rw-r--r--APEX_1.4/module/fieldsampler/include/ModuleGpuEventDefs.h26
-rw-r--r--APEX_1.4/module/fieldsampler/include/ModulePerfScope.h18
-rw-r--r--APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerModuleParameters.h230
-rw-r--r--APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerPhysXMonitorParams.h232
-rw-r--r--APEX_1.4/module/fieldsampler/include/autogen/ModuleFieldSamplerRegistration.h117
15 files changed, 2403 insertions, 0 deletions
diff --git a/APEX_1.4/module/fieldsampler/include/FieldBoundaryWrapper.h b/APEX_1.4/module/fieldsampler/include/FieldBoundaryWrapper.h
new file mode 100644
index 00000000..fbaf10f5
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/FieldBoundaryWrapper.h
@@ -0,0 +1,85 @@
+/*
+ * 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_BOUNDARY_WRAPPER_H__
+#define __FIELD_BOUNDARY_WRAPPER_H__
+
+#include "Apex.h"
+#include "ApexSDKHelpers.h"
+#include "ApexActor.h"
+#include "FieldBoundaryIntl.h"
+
+#if APEX_CUDA_SUPPORT
+#include "ApexCudaWrapper.h"
+#endif
+
+#include "FieldSamplerCommon.h"
+
+
+namespace nvidia
+{
+namespace fieldsampler
+{
+
+class FieldSamplerManager;
+
+
+class FieldBoundaryWrapper : public ApexResourceInterface, public ApexResource
+{
+public:
+ // ApexResourceInterface methods
+ void release();
+ void setListIndex(ResourceList& list, uint32_t index)
+ {
+ m_listIndex = index;
+ m_list = &list;
+ }
+ uint32_t getListIndex() const
+ {
+ return m_listIndex;
+ }
+
+ FieldBoundaryWrapper(ResourceList& list, FieldSamplerManager* manager, FieldBoundaryIntl* fieldBoundary, const FieldBoundaryDescIntl& fieldBoundaryDesc);
+
+ FieldBoundaryIntl* getInternalFieldBoundary() const
+ {
+ return mFieldBoundary;
+ }
+ PX_INLINE const FieldBoundaryDescIntl& getInternalFieldBoundaryDesc() const
+ {
+ return mFieldBoundaryDesc;
+ }
+
+ void update();
+
+ const nvidia::Array<FieldShapeDescIntl>& getFieldShapes() const
+ {
+ return mFieldShapes;
+ }
+ bool getFieldShapesChanged() const
+ {
+ return mFieldShapesChanged;
+ }
+
+protected:
+ FieldSamplerManager* mManager;
+
+ FieldBoundaryIntl* mFieldBoundary;
+ FieldBoundaryDescIntl mFieldBoundaryDesc;
+
+ nvidia::Array<FieldShapeDescIntl> mFieldShapes;
+ bool mFieldShapesChanged;
+};
+
+}
+} // end namespace nvidia::apex
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/FieldSamplerCommon.h b/APEX_1.4/module/fieldsampler/include/FieldSamplerCommon.h
new file mode 100644
index 00000000..8ef0b770
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/FieldSamplerCommon.h
@@ -0,0 +1,386 @@
+/*
+ * 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_COMMON_H__
+#define __FIELD_SAMPLER_COMMON_H__
+
+#include "PxVec3.h"
+#include "PxVec4.h"
+#include <PxMat44.h>
+
+#include <FieldSamplerIntl.h>
+#include <FieldBoundaryIntl.h>
+
+#include "PsArray.h"
+
+#if APEX_CUDA_SUPPORT
+#pragma warning(push)
+#pragma warning(disable:4201)
+#pragma warning(disable:4408)
+
+#include <vector_types.h>
+
+#pragma warning(pop)
+#endif
+
+#define FIELD_SAMPLER_MULTIPLIER_VALUE 1
+#define FIELD_SAMPLER_MULTIPLIER_WEIGHT 2
+//0, FIELD_SAMPLER_MULTIPLIER_VALUE or FIELD_SAMPLER_MULTIPLIER_WEIGHT
+#define FIELD_SAMPLER_MULTIPLIER FIELD_SAMPLER_MULTIPLIER_WEIGHT
+
+namespace nvidia
+{
+namespace apex
+{
+ class ApexCudaArray;
+}
+
+namespace fieldsampler
+{
+
+#define VELOCITY_WEIGHT_THRESHOLD 0.00001f
+
+struct FieldSamplerExecuteArgs
+{
+ physx::PxVec3 position;
+ float mass;
+ physx::PxVec3 velocity;
+
+ float elapsedTime;
+ uint32_t totalElapsedMS;
+};
+
+//struct FieldShapeParams
+#define INPLACE_TYPE_STRUCT_NAME FieldShapeParams
+#define INPLACE_TYPE_STRUCT_BASE FieldShapeDescIntl
+#define INPLACE_TYPE_STRUCT_FIELDS \
+ INPLACE_TYPE_FIELD(float, fade)
+#include INPLACE_TYPE_BUILD()
+
+
+//struct FieldShapeGroupParams
+#define INPLACE_TYPE_STRUCT_NAME FieldShapeGroupParams
+#define INPLACE_TYPE_STRUCT_FIELDS \
+ INPLACE_TYPE_FIELD(InplaceArray<FieldShapeParams>, shapeArray)
+#include INPLACE_TYPE_BUILD()
+
+
+//struct FieldSamplerParams
+#define INPLACE_TYPE_STRUCT_NAME FieldSamplerParams
+#define INPLACE_TYPE_STRUCT_FIELDS \
+ INPLACE_TYPE_FIELD(uint32_t, executeType) \
+ INPLACE_TYPE_FIELD(InplaceHandleBase, executeParamsHandle) \
+ INPLACE_TYPE_FIELD(InplaceEnum<FieldSamplerTypeIntl::Enum>, type) \
+ INPLACE_TYPE_FIELD(InplaceEnum<FieldSamplerGridSupportTypeIntl::Enum>, gridSupportType) \
+ INPLACE_TYPE_FIELD(float, dragCoeff) \
+ INPLACE_TYPE_FIELD(FieldShapeParams, includeShape) \
+ INPLACE_TYPE_FIELD(InplaceArray<InplaceHandle<FieldShapeGroupParams> >, excludeShapeGroupHandleArray)
+#include INPLACE_TYPE_BUILD()
+
+
+//struct FieldSamplerQueryParams
+#define INPLACE_TYPE_STRUCT_NAME FieldSamplerQueryParams
+#include INPLACE_TYPE_BUILD()
+
+
+//struct FieldSamplerParams
+#define INPLACE_TYPE_STRUCT_NAME FieldSamplerParamsEx
+#define INPLACE_TYPE_STRUCT_FIELDS \
+ INPLACE_TYPE_FIELD(InplaceHandle<FieldSamplerParams>, paramsHandle) \
+ INPLACE_TYPE_FIELD(float, multiplier)
+#include INPLACE_TYPE_BUILD()
+
+typedef InplaceArray< FieldSamplerParamsEx, false > FieldSamplerParamsExArray;
+
+
+#if APEX_CUDA_SUPPORT || defined(__CUDACC__)
+
+struct FieldSamplerKernelType
+{
+ enum Enum
+ {
+ POINTS,
+ GRID
+ };
+};
+
+struct FieldSamplerKernelParams
+{
+ float elapsedTime;
+ physx::PxVec3 cellSize;
+ uint32_t totalElapsedMS;
+};
+
+struct FieldSamplerGridKernelParams
+{
+ uint32_t numX, numY, numZ;
+
+ PxMat44 gridToWorld;
+
+ float mass;
+};
+
+
+struct FieldSamplerKernelArgs : FieldSamplerKernelParams
+{
+};
+
+struct FieldSamplerPointsKernelArgs : FieldSamplerKernelArgs
+{
+ float4* accumField;
+ float4* accumVelocity;
+ const float4* positionMass;
+ const float4* velocity;
+};
+
+struct FieldSamplerGridKernelArgs : FieldSamplerKernelArgs, FieldSamplerGridKernelParams
+{
+};
+
+struct FieldSamplerKernelMode
+{
+ enum Enum
+ {
+ DEFAULT = 0,
+ FINISH_PRIMARY = 1,
+ FINISH_SECONDARY = 2
+ };
+};
+
+#endif
+
+class FieldSamplerWrapper;
+
+struct FieldSamplerInfo
+{
+ FieldSamplerWrapper* mFieldSamplerWrapper;
+ float mMultiplier;
+};
+
+#if APEX_CUDA_SUPPORT
+
+struct FieldSamplerKernelLaunchDataIntl
+{
+ CUstream stream;
+ FieldSamplerKernelType::Enum kernelType;
+ const FieldSamplerKernelArgs* kernelArgs;
+ InplaceHandle<FieldSamplerQueryParams> queryParamsHandle;
+ InplaceHandle<FieldSamplerParamsExArray> paramsExArrayHandle;
+ const nvidia::Array<FieldSamplerInfo>* fieldSamplerArray;
+ uint32_t activeFieldSamplerCount;
+ FieldSamplerKernelMode::Enum kernelMode;
+};
+
+struct FieldSamplerPointsKernelLaunchDataIntl : FieldSamplerKernelLaunchDataIntl
+{
+ uint32_t threadCount;
+ uint32_t memRefSize;
+};
+
+struct FieldSamplerGridKernelLaunchDataIntl : FieldSamplerKernelLaunchDataIntl
+{
+ uint32_t threadCountX;
+ uint32_t threadCountY;
+ uint32_t threadCountZ;
+ ApexCudaArray* accumArray;
+};
+
+#endif
+
+APEX_CUDA_CALLABLE PX_INLINE float evalFade(float dist, float fade)
+{
+ float x = (1 - dist) / (fade + 1e-5f);
+ return physx::PxClamp<float>(x, 0, 1);
+}
+
+APEX_CUDA_CALLABLE PX_INLINE float evalFadeAntialiasing(float dist, float fade, float cellRadius)
+{
+ const float f = fade;
+ const float r = cellRadius;
+ const float x = dist - 1.0f;
+
+ float res = 0.0f;
+ //linear part
+ //if (x - r < -f)
+ {
+ const float a = PxMin(x - r, -f);
+ const float b = PxMin(x + r, -f);
+
+ res += (b - a);
+ }
+ //quadratic part
+ if (f >= 1e-5f)
+ {
+ //if (x - r < 0.0f && x + r > -f)
+ {
+ const float a = physx::PxClamp(x - r, -f, 0.0f);
+ const float b = physx::PxClamp(x + r, -f, 0.0f);
+
+ res += (a*a - b*b) / (2 * f);
+ }
+ }
+ return res / (2 * r);
+}
+
+
+APEX_CUDA_CALLABLE PX_INLINE float evalDistInShapeNONE(const FieldShapeDescIntl& /*shapeParams*/, const physx::PxVec3& /*worldPos*/)
+{
+ return 0.0f; //always inside
+}
+
+APEX_CUDA_CALLABLE PX_INLINE float evalDistInShapeSPHERE(const FieldShapeDescIntl& shapeParams, const physx::PxVec3& worldPos)
+{
+ const physx::PxVec3 shapePos = shapeParams.worldToShape.transform(worldPos);
+ const float radius = shapeParams.dimensions.x;
+ return shapePos.magnitude() / radius;
+}
+
+APEX_CUDA_CALLABLE PX_INLINE float evalDistInShapeBOX(const FieldShapeDescIntl& shapeParams, const physx::PxVec3& worldPos)
+{
+ const physx::PxVec3 shapePos = shapeParams.worldToShape.transform(worldPos);
+ const physx::PxVec3& halfSize = shapeParams.dimensions;
+ physx::PxVec3 unitPos(shapePos.x / halfSize.x, shapePos.y / halfSize.y, shapePos.z / halfSize.z);
+ return physx::PxVec3(physx::PxAbs(unitPos.x), physx::PxAbs(unitPos.y), physx::PxAbs(unitPos.z)).maxElement();
+}
+
+APEX_CUDA_CALLABLE PX_INLINE float evalDistInShapeCAPSULE(const FieldShapeDescIntl& shapeParams, const physx::PxVec3& worldPos)
+{
+ const physx::PxVec3 shapePos = shapeParams.worldToShape.transform(worldPos);
+ const float radius = shapeParams.dimensions.x;
+ const float halfHeight = shapeParams.dimensions.y * 0.5f;
+
+ physx::PxVec3 clampPos = shapePos;
+ clampPos.y -= physx::PxClamp(shapePos.y, -halfHeight, +halfHeight);
+
+ return clampPos.magnitude() / radius;
+}
+
+APEX_CUDA_CALLABLE PX_INLINE float evalDistInShape(const FieldShapeDescIntl& shapeParams, const physx::PxVec3& worldPos)
+{
+ switch (shapeParams.type)
+ {
+ case FieldShapeTypeIntl::NONE:
+ return evalDistInShapeNONE(shapeParams, worldPos);
+ case FieldShapeTypeIntl::SPHERE:
+ return evalDistInShapeSPHERE(shapeParams, worldPos);
+ case FieldShapeTypeIntl::BOX:
+ return evalDistInShapeBOX(shapeParams, worldPos);
+ case FieldShapeTypeIntl::CAPSULE:
+ return evalDistInShapeCAPSULE(shapeParams, worldPos);
+ default:
+ return 1.0f; //always outside
+ };
+}
+
+APEX_CUDA_CALLABLE PX_INLINE physx::PxVec3 scaleToShape(const FieldShapeDescIntl& shapeParams, const physx::PxVec3& worldVec)
+{
+ switch (shapeParams.type)
+ {
+ case FieldShapeTypeIntl::SPHERE:
+ case FieldShapeTypeIntl::CAPSULE:
+ {
+ const float radius = shapeParams.dimensions.x;
+ return physx::PxVec3(worldVec.x / radius, worldVec.y / radius, worldVec.z / radius);
+ }
+ case FieldShapeTypeIntl::BOX:
+ {
+ const physx::PxVec3& halfSize = shapeParams.dimensions;
+ return physx::PxVec3(worldVec.x / halfSize.x, worldVec.y / halfSize.y, worldVec.z / halfSize.z);
+ }
+ default:
+ return worldVec;
+ };
+}
+
+
+APEX_CUDA_CALLABLE PX_INLINE float evalWeightInShape(const FieldShapeParams& shapeParams, const physx::PxVec3& position)
+{
+ float dist = nvidia::fieldsampler::evalDistInShape(shapeParams, position);
+ return nvidia::fieldsampler::evalFade(dist, shapeParams.fade) * shapeParams.weight;
+}
+
+APEX_CUDA_CALLABLE PX_INLINE void accumFORCE(const FieldSamplerExecuteArgs& args,
+ const physx::PxVec3& field, float fieldW,
+ physx::PxVec4& accumAccel, physx::PxVec4& accumVelocity)
+{
+ PX_UNUSED(accumVelocity);
+
+ physx::PxVec3 newAccel = ((1 - accumAccel.w) * fieldW * args.elapsedTime / args.mass) * field;
+ accumAccel.x += newAccel.x;
+ accumAccel.y += newAccel.y;
+ accumAccel.z += newAccel.z;
+}
+
+APEX_CUDA_CALLABLE PX_INLINE void accumACCELERATION(const FieldSamplerExecuteArgs& args,
+ const physx::PxVec3& field, float fieldW,
+ physx::PxVec4& accumAccel, physx::PxVec4& accumVelocity)
+{
+ PX_UNUSED(accumVelocity);
+
+ physx::PxVec3 newAccel = ((1 - accumAccel.w) * fieldW * args.elapsedTime) * field;
+ accumAccel.x += newAccel.x;
+ accumAccel.y += newAccel.y;
+ accumAccel.z += newAccel.z;
+}
+
+APEX_CUDA_CALLABLE PX_INLINE void accumVELOCITY_DIRECT(const FieldSamplerExecuteArgs& args,
+ const physx::PxVec3& field, float fieldW,
+ physx::PxVec4& accumAccel, physx::PxVec4& accumVelocity)
+{
+ PX_UNUSED(args);
+
+ physx::PxVec3 newVelocity = ((1 - accumAccel.w) * fieldW) * field;
+ accumVelocity.x += newVelocity.x;
+ accumVelocity.y += newVelocity.y;
+ accumVelocity.z += newVelocity.z;
+ accumVelocity.w = PxMax(accumVelocity.w, fieldW);
+}
+
+APEX_CUDA_CALLABLE PX_INLINE void accumVELOCITY_DRAG(const FieldSamplerExecuteArgs& args, float dragCoeff,
+ const physx::PxVec3& field, float fieldW,
+ physx::PxVec4& accumAccel, physx::PxVec4& accumVelocity)
+{
+#if 1
+ const float dragFieldW = PxMin(fieldW * dragCoeff * args.elapsedTime / args.mass, 1.0f);
+ accumVELOCITY_DIRECT(args, field, dragFieldW, accumAccel, accumVelocity);
+#else
+ const physx::PxVec3 dragForce = (field - args.velocity) * dragCoeff;
+ accumFORCE(args, dragForce, fieldW, accumAccel, accumVelocity);
+#endif
+}
+
+
+} // namespace apex
+}
+#ifdef __CUDACC__
+
+template <int queryType>
+struct FieldSamplerExecutor;
+/*
+{
+ INPLACE_TEMPL_ARGS_DEF
+ static inline __device__ physx::PxVec3 func(const nvidia::fieldsampler::FieldSamplerParams* params, const nvidia::fieldsampler::FieldSamplerExecuteArgs& args, float& fieldWeight);
+};
+*/
+
+template <int queryType>
+struct FieldSamplerIncludeWeightEvaluator
+{
+ INPLACE_TEMPL_ARGS_DEF
+ static inline __device__ float func(const nvidia::fieldsampler::FieldSamplerParams* params, const physx::PxVec3& position, const physx::PxVec3& cellSize)
+ {
+ return nvidia::fieldsampler::evalWeightInShape(params->includeShape, position);
+ }
+};
+
+#endif
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/FieldSamplerManager.h b/APEX_1.4/module/fieldsampler/include/FieldSamplerManager.h
new file mode 100644
index 00000000..887a50c7
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/FieldSamplerManager.h
@@ -0,0 +1,133 @@
+/*
+ * 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_MANAGER_H__
+#define __FIELD_SAMPLER_MANAGER_H__
+
+#include "FieldSamplerManagerIntl.h"
+#include "FieldSamplerScene.h"
+#include "ApexGroupsFiltering.h"
+
+#if APEX_CUDA_SUPPORT
+#define CUDA_OBJ(name) SCENE_CUDA_OBJ(mManager->getScene(), name)
+#endif
+
+namespace nvidia
+{
+namespace fieldsampler
+{
+
+PX_INLINE bool operator != (const PxFilterData& d1, const PxFilterData& d2)
+{
+ return d1.word0 != d2.word0 || d1.word1 != d2.word1 || d1.word2 != d2.word2 || d1.word3 != d2.word3;
+}
+
+class FieldSamplerScene;
+
+class FieldSamplerQuery;
+class FieldSamplerSceneWrapper;
+class FieldSamplerWrapper;
+class FieldBoundaryWrapper;
+
+class FieldSamplerManager : public FieldSamplerManagerIntl, public UserAllocated
+{
+public:
+ FieldSamplerManager(FieldSamplerScene* scene);
+ virtual ~FieldSamplerManager() {}
+
+ void submitTasks();
+ void setTaskDependencies();
+ void fetchResults();
+
+ /* FieldSamplerManager */
+ FieldSamplerQueryIntl* createFieldSamplerQuery(const FieldSamplerQueryDescIntl&);
+
+ void registerFieldSampler(FieldSamplerIntl* , const FieldSamplerDescIntl& , FieldSamplerSceneIntl*);
+ void unregisterFieldSampler(FieldSamplerIntl*);
+
+ void registerFieldBoundary(FieldBoundaryIntl* , const FieldBoundaryDescIntl&);
+ void unregisterFieldBoundary(FieldBoundaryIntl*);
+
+ void registerUnhandledParticleSystem(physx::PxActor*);
+ void unregisterUnhandledParticleSystem(physx::PxActor*);
+ bool isUnhandledParticleSystem(physx::PxActor*);
+
+ FieldSamplerScene* getScene() const
+ {
+ return mScene;
+ }
+ SceneIntl& getApexScene() const
+ {
+ return *mScene->mApexScene;
+ }
+
+ bool getFieldSamplerGroupsFiltering(const PxFilterData &o1,const PxFilterData &o2,float &weight) const;
+ void setFieldSamplerWeightedCollisionFilterCallback(FieldSamplerWeightedCollisionFilterCallback *callback)
+ {
+ mWeightedCallback = callback;
+ }
+
+ virtual bool doFieldSamplerFiltering(const PxFilterData &o1, const PxFilterData &o2, float &weight) const
+ {
+ return getFieldSamplerGroupsFiltering(o1, o2, weight);
+ }
+
+protected:
+ virtual FieldSamplerQuery* allocateFieldSamplerQuery(const FieldSamplerQueryDescIntl&) = 0;
+ virtual FieldSamplerSceneWrapper* allocateFieldSamplerSceneWrapper(FieldSamplerSceneIntl*) = 0;
+ virtual FieldSamplerWrapper* allocateFieldSamplerWrapper(FieldSamplerIntl* , const FieldSamplerDescIntl& , FieldSamplerSceneWrapper*) = 0;
+
+ static PX_INLINE void addFieldSamplerToQuery(FieldSamplerWrapper* fieldSamplerWrapper, FieldSamplerQuery* query);
+ void addAllFieldSamplersToQuery(FieldSamplerQuery*) const;
+
+ FieldSamplerScene* mScene;
+
+ ResourceList mFieldSamplerQueryList;
+ ResourceList mFieldSamplerSceneWrapperList;
+ ResourceList mFieldSamplerWrapperList;
+ ResourceList mFieldBoundaryWrapperList;
+
+ nvidia::Array<physx::PxActor*> mUnhandledParticleSystems;
+ FieldSamplerWeightedCollisionFilterCallback *mWeightedCallback;
+
+ bool mFieldSamplerGroupsFilteringChanged;
+
+ friend class FieldSamplerSceneWrapperGPU;
+};
+
+class FieldSamplerManagerCPU : public FieldSamplerManager
+{
+public:
+ FieldSamplerManagerCPU(FieldSamplerScene* scene) : FieldSamplerManager(scene) {}
+
+protected:
+ FieldSamplerQuery* allocateFieldSamplerQuery(const FieldSamplerQueryDescIntl&);
+ FieldSamplerSceneWrapper* allocateFieldSamplerSceneWrapper(FieldSamplerSceneIntl*);
+ FieldSamplerWrapper* allocateFieldSamplerWrapper(FieldSamplerIntl* , const FieldSamplerDescIntl& , FieldSamplerSceneWrapper*);
+};
+
+#if APEX_CUDA_SUPPORT
+class FieldSamplerManagerGPU : public FieldSamplerManager
+{
+public:
+ FieldSamplerManagerGPU(FieldSamplerScene* scene) : FieldSamplerManager(scene) {}
+
+protected:
+ FieldSamplerQuery* allocateFieldSamplerQuery(const FieldSamplerQueryDescIntl&);
+ FieldSamplerSceneWrapper* allocateFieldSamplerSceneWrapper(FieldSamplerSceneIntl*);
+ FieldSamplerWrapper* allocateFieldSamplerWrapper(FieldSamplerIntl* , const FieldSamplerDescIntl& , FieldSamplerSceneWrapper*);
+};
+#endif // APEX_CUDA_SUPPORT
+
+
+} // end namespace nvidia::apex
+}
+#endif // __FIELD_SAMPLER_MANAGER_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 <PsArray.h>
+
+#include "FieldSamplerSceneIntl.h"
+#include "FieldSamplerPhysXMonitorParams.h"
+
+#if PX_PHYSICS_VERSION_MAJOR == 3
+#include <PxScene.h>
+#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<PxActor*> mParticleSystems;
+ Array<float> mPSMass;
+ Array<PxVec4> mPSOutField;
+ Array<PxVec3> mOutVelocities;
+ Array<uint32_t> mOutIndices;
+ Array<physx::PxParticleReadData*> mParticleReadData;
+ Array<FieldSamplerQueryIntl*> mPSFieldSamplerQuery;
+ Array<PxTaskID> mPSFieldSamplerTaskID;
+
+
+ //Rigid bodies
+ uint32_t mNumRB; //Number of rigid bodies
+ Array<PxActor*> mRBActors;
+ Array<ShapeData*> mRBIndex;
+ Array<PxVec4> mRBInPosition;
+ Array<PxVec4> mRBInVelocity;
+ Array<PxVec4> mRBOutField;
+ Array<PxFilterData> mRBFilterData;
+ Array<FieldSamplerQueryIntl*> 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
+
diff --git a/APEX_1.4/module/fieldsampler/include/FieldSamplerQuery.h b/APEX_1.4/module/fieldsampler/include/FieldSamplerQuery.h
new file mode 100644
index 00000000..65d2ba58
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/FieldSamplerQuery.h
@@ -0,0 +1,308 @@
+/*
+ * 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_QUERY_H__
+#define __FIELD_SAMPLER_QUERY_H__
+
+#include "Apex.h"
+#include "ApexSDKHelpers.h"
+#include "FieldSamplerQueryIntl.h"
+#include "FieldSamplerIntl.h"
+
+#if APEX_CUDA_SUPPORT
+#include "ApexCudaWrapper.h"
+#endif
+
+#include "FieldSamplerCommon.h"
+
+namespace nvidia
+{
+namespace fieldsampler
+{
+
+class FieldSamplerManager;
+class FieldSamplerSceneWrapper;
+class FieldSamplerWrapper;
+
+class FieldSamplerQuery : public FieldSamplerQueryIntl, public ApexResourceInterface, public ApexResource
+{
+protected:
+
+ class SceneInfo : public ApexResourceInterface, public ApexResource
+ {
+ protected:
+ FieldSamplerQuery* mQuery;
+ FieldSamplerSceneWrapper* mSceneWrapper;
+ nvidia::Array<FieldSamplerInfo> mFieldSamplerArray;
+ bool mFieldSamplerArrayChanged;
+
+ uint32_t mEnabledFieldSamplerCount;
+
+ SceneInfo(ResourceList& list, FieldSamplerQuery* query, FieldSamplerSceneWrapper* sceneWrapper)
+ : mQuery(query), mSceneWrapper(sceneWrapper), mFieldSamplerArrayChanged(false), mEnabledFieldSamplerCount(0)
+ {
+ list.add(*this);
+ }
+
+ public:
+ FieldSamplerSceneWrapper* getSceneWrapper() const
+ {
+ return mSceneWrapper;
+ }
+
+ void addFieldSampler(FieldSamplerWrapper* fieldSamplerWrapper, float multiplier)
+ {
+ FieldSamplerInfo fsInfo;
+ fsInfo.mFieldSamplerWrapper = fieldSamplerWrapper;
+ fsInfo.mMultiplier = multiplier;
+ mFieldSamplerArray.pushBack(fsInfo);
+ mFieldSamplerArrayChanged = true;
+ }
+ bool removeFieldSampler(FieldSamplerWrapper* fieldSamplerWrapper)
+ {
+ const uint32_t size = mFieldSamplerArray.size();
+ for (uint32_t index = 0; index < size; ++index)
+ {
+ if (mFieldSamplerArray[index].mFieldSamplerWrapper == fieldSamplerWrapper)
+ {
+ mFieldSamplerArray.replaceWithLast(index);
+ mFieldSamplerArrayChanged = true;
+ return true;
+ }
+ }
+ return false;
+ }
+ void clearAllFieldSamplers()
+ {
+ mFieldSamplerArray.clear();
+ mFieldSamplerArrayChanged = true;
+ }
+ uint32_t getEnabledFieldSamplerCount() const
+ {
+ return mEnabledFieldSamplerCount;
+ }
+ const nvidia::Array<FieldSamplerInfo>& getFieldSamplerArray() const
+ {
+ return mFieldSamplerArray;
+ }
+
+ virtual bool update();
+
+ // ApexResourceInterface methods
+ void release()
+ {
+ delete this;
+ }
+ void setListIndex(ResourceList& list, uint32_t index)
+ {
+ m_listIndex = index;
+ m_list = &list;
+ }
+ uint32_t getListIndex() const
+ {
+ return m_listIndex;
+ }
+ };
+
+ SceneInfo* findSceneInfo(FieldSamplerSceneWrapper* sceneWrapper) const;
+
+ virtual SceneInfo* createSceneInfo(FieldSamplerSceneWrapper* sceneWrapper) = 0;
+
+ FieldSamplerQuery(const FieldSamplerQueryDescIntl& desc, ResourceList& list, FieldSamplerManager* manager);
+
+public:
+ virtual void update();
+
+ PX_INLINE void setOnStartCallback(FieldSamplerCallbackIntl* callback)
+ {
+ if (mOnStartCallback)
+ {
+ PX_DELETE(mOnStartCallback);
+ }
+ mOnStartCallback = callback;
+ }
+ PX_INLINE void setOnFinishCallback(FieldSamplerCallbackIntl* callback)
+ {
+ if (mOnFinishCallback)
+ {
+ PX_DELETE(mOnFinishCallback);
+ }
+ mOnFinishCallback = callback;
+ }
+
+ virtual void submitTasks() {}
+ virtual void setTaskDependencies() {}
+ virtual void fetchResults() {}
+
+ void release();
+ void destroy();
+
+ // ApexResourceInterface methods
+ void setListIndex(ResourceList& list, uint32_t index)
+ {
+ m_listIndex = index;
+ m_list = &list;
+ }
+ uint32_t getListIndex() const
+ {
+ return m_listIndex;
+ }
+
+ void setPhysXScene(PxScene*) {}
+ PxScene* getPhysXScene() const
+ {
+ return NULL;
+ }
+
+ bool addFieldSampler(FieldSamplerWrapper*);
+ bool removeFieldSampler(FieldSamplerWrapper*);
+ void clearAllFieldSamplers();
+
+ const FieldSamplerQueryDescIntl& getQueryDesc() const
+ {
+ return mQueryDesc;
+ }
+
+protected:
+ void submitFieldSamplerQuery(const FieldSamplerQueryDataIntl& data, PxTask*, PxTask* );
+
+ FieldSamplerManager* mManager;
+
+ FieldSamplerQueryDescIntl mQueryDesc;
+ FieldSamplerQueryDataIntl mQueryData;
+
+ ResourceList mSceneList;
+
+ nvidia::Array<SceneInfo*> mPrimarySceneList;
+ nvidia::Array<SceneInfo*> mSecondarySceneList;
+
+ ApexMirroredArray<PxVec4> mAccumVelocity;
+
+ FieldSamplerCallbackIntl* mOnStartCallback;
+ FieldSamplerCallbackIntl* mOnFinishCallback;
+
+ friend class FieldSamplerManager;
+};
+
+
+class FieldSamplerQueryCPU : public FieldSamplerQuery
+{
+public:
+ FieldSamplerQueryCPU(const FieldSamplerQueryDescIntl& desc, ResourceList& list, FieldSamplerManager* manager);
+ ~FieldSamplerQueryCPU();
+
+ // FieldSamplerQueryIntl methods
+ PxTaskID submitFieldSamplerQuery(const FieldSamplerQueryDataIntl& data, PxTaskID taskID);
+
+protected:
+ void execute();
+ void executeScene( const SceneInfo* sceneInfo,
+ const FieldSamplerIntl::ExecuteData& executeData,
+ PxVec4* accumField,
+ PxVec4* accumVelocity,
+ uint32_t positionStride,
+ uint32_t velocityStride,
+ uint32_t massStride);
+
+ uint32_t mExecuteCount;
+ nvidia::Array<PxVec3> mResultField;
+ nvidia::Array<float> mWeights;
+
+ PxTask* mTaskExecute;
+
+ friend class TaskExecute;
+
+ class SceneInfoCPU : public SceneInfo
+ {
+ public:
+ SceneInfoCPU(ResourceList& list, FieldSamplerQuery* query, FieldSamplerSceneWrapper* sceneWrapper)
+ : SceneInfo(list, query, sceneWrapper)
+ {
+ }
+ };
+
+ virtual SceneInfo* createSceneInfo(FieldSamplerSceneWrapper* sceneWrapper)
+ {
+ return PX_NEW(SceneInfoCPU)(mSceneList, this, sceneWrapper);
+ }
+
+};
+
+#if APEX_CUDA_SUPPORT
+
+class FieldSamplerQueryGPU : public FieldSamplerQueryCPU
+{
+public:
+ FieldSamplerQueryGPU(const FieldSamplerQueryDescIntl& desc, ResourceList& list, FieldSamplerManager* manager);
+ ~FieldSamplerQueryGPU();
+
+ // FieldSamplerQueryIntl methods
+ PxTaskID submitFieldSamplerQuery(const FieldSamplerQueryDataIntl& data, PxTaskID taskID);
+
+ PxVec3 executeFieldSamplerQueryOnGrid(const FieldSamplerQueryGridDataIntl&);
+
+protected:
+ bool launch(CUstream stream, int kernelIndex);
+ void prepare();
+ bool copy(CUstream stream, int kernelIndex);
+ void fetch();
+
+ PxTask* mTaskLaunch;
+ PxTask* mTaskPrepare;
+ PxTask* mTaskCopy;
+ PxTask* mTaskFetch;
+
+ ApexMirroredArray<PxVec4> mPositionMass;
+ ApexMirroredArray<PxVec4> mVelocity;
+ ApexMirroredArray<PxVec4> mAccumField;
+ PxGpuCopyDescQueue mCopyQueue;
+
+ friend class FieldSamplerQueryLaunchTask;
+ friend class FieldSamplerQueryPrepareTask;
+ friend class FieldSamplerQueryCopyTask;
+ friend class FieldSamplerQueryFetchTask;
+
+ class SceneInfoGPU : public SceneInfo
+ {
+ public:
+ SceneInfoGPU(ResourceList& list, FieldSamplerQuery* query, FieldSamplerSceneWrapper* sceneWrapper);
+
+ virtual bool update();
+
+ PX_INLINE InplaceHandle<nvidia::fieldsampler::FieldSamplerParamsExArray> getParamsHandle() const
+ {
+ PX_ASSERT(mParamsExArrayHandle.isNull() == false);
+ return mParamsExArrayHandle;
+ }
+ PX_INLINE InplaceHandle<nvidia::fieldsampler::FieldSamplerQueryParams> getQueryParamsHandle() const
+ {
+ PX_ASSERT(mQueryParamsHandle.isNull() == false);
+ return mQueryParamsHandle;
+ }
+
+ private:
+ ApexCudaConstMemGroup mConstMemGroup;
+ InplaceHandle<nvidia::fieldsampler::FieldSamplerParamsExArray> mParamsExArrayHandle;
+ InplaceHandle<nvidia::fieldsampler::FieldSamplerQueryParams> mQueryParamsHandle;
+ };
+
+ virtual SceneInfo* createSceneInfo(FieldSamplerSceneWrapper* sceneWrapper)
+ {
+ return PX_NEW(SceneInfoGPU)(mSceneList, this, sceneWrapper);
+ }
+};
+
+#endif
+
+}
+} // end namespace nvidia::apex
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/FieldSamplerScene.h b/APEX_1.4/module/fieldsampler/include/FieldSamplerScene.h
new file mode 100644
index 00000000..1c63501f
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/FieldSamplerScene.h
@@ -0,0 +1,218 @@
+/*
+ * 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_SCENE_H__
+#define __FIELD_SAMPLER_SCENE_H__
+
+#include "Apex.h"
+
+#include "ModuleFieldSamplerImpl.h"
+#include "FieldSamplerSceneIntl.h"
+#include "FieldSamplerQueryIntl.h"
+#include "ApexSDKIntl.h"
+#include "ModuleIntl.h"
+#include "ApexContext.h"
+#include "ApexSDKHelpers.h"
+#include "PsArray.h"
+
+#include "PxTask.h"
+
+#if APEX_CUDA_SUPPORT
+#include "ApexCudaWrapper.h"
+#include "ApexCuda.h"
+#include "CudaModuleScene.h"
+
+#include "../cuda/include/common.h"
+
+#define SCENE_CUDA_OBJ(scene, name) static_cast<FieldSamplerSceneGPU*>(scene)->APEX_CUDA_OBJ_NAME(name)
+#endif
+
+
+namespace nvidia
+{
+namespace apex
+{
+class SceneIntl;
+}
+namespace fieldsampler
+{
+
+class ModuleFieldSamplerImpl;
+class FieldSamplerPhysXMonitor;
+class FieldSamplerManager;
+class FieldSamplerQuery;
+
+class FieldSamplerScene : public ModuleSceneIntl, public ApexContext, public ApexResourceInterface, public ApexResource
+{
+public:
+ FieldSamplerScene(ModuleFieldSamplerImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list);
+ ~FieldSamplerScene();
+
+ /* ModuleSceneIntl */
+ void visualize();
+
+ PxScene* getModulePhysXScene() const
+ {
+ return mPhysXScene;
+ }
+ void setModulePhysXScene(PxScene*);
+ PxScene* mPhysXScene;
+
+ void submitTasks(float elapsedTime, float substepSize, uint32_t numSubSteps);
+ void setTaskDependencies();
+ void fetchResults();
+
+ virtual Module* getModule()
+ {
+ return mModule;
+ }
+
+ virtual SceneStats* getStats()
+ {
+ return 0;
+ }
+
+ bool lockRenderResources()
+ {
+ renderLockAllActors(); // Lock options not implemented yet
+ return true;
+ }
+
+ bool unlockRenderResources()
+ {
+ renderUnLockAllActors(); // Lock options not implemented yet
+ return true;
+ }
+
+ /* ApexResourceInterface */
+ uint32_t getListIndex() const
+ {
+ return m_listIndex;
+ }
+ void setListIndex(ResourceList& list, uint32_t index)
+ {
+ m_listIndex = index;
+ m_list = &list;
+ }
+ void release()
+ {
+ mModule->releaseModuleSceneIntl(*this);
+ }
+ SceneIntl& getApexScene() const
+ {
+ return *mApexScene;
+ }
+
+ FieldSamplerManagerIntl* getManager();
+
+ uint32_t createForceSampleBatch(uint32_t maxCount, const physx::PxFilterData filterData);
+ void releaseForceSampleBatch(uint32_t batchId);
+ void submitForceSampleBatch( uint32_t batchId, PxVec4* forces, const uint32_t forcesStride,
+ const PxVec3* positions, const uint32_t positionsStride,
+ const PxVec3* velocities, const uint32_t velocitiesStride,
+ const float* mass, const uint32_t massStride,
+ const uint32_t* indices, const uint32_t numIndices);
+
+ /* Toggle PhysX Monitor on/off */
+ void enablePhysXMonitor(bool enable);
+
+ void setPhysXFilterData(physx::PxFilterData filterData);
+
+protected:
+ void destroy();
+
+ virtual FieldSamplerManager* createManager() = 0;
+
+ class TaskPhysXMonitorLoad : public PxTask
+ {
+ public:
+ TaskPhysXMonitorLoad() {}
+ const char* getName() const
+ {
+ return FSST_PHYSX_MONITOR_LOAD;
+ }
+ void run() {/* void task */};
+ };
+ TaskPhysXMonitorLoad mPhysXMonitorLoadTask;
+ class TaskPhysXMonitorFetch : public PxTask
+ {
+ public:
+ TaskPhysXMonitorFetch() {}
+ const char* getName() const
+ {
+ return FSST_PHYSX_MONITOR_FETCH;
+ }
+ void run() {/* void task */};
+ };
+ TaskPhysXMonitorFetch mPhysXMonitorFetchTask;
+
+ ModuleFieldSamplerImpl* mModule;
+ SceneIntl* mApexScene;
+ RenderDebugInterface* mDebugRender;
+ FieldSamplerPhysXMonitor* mPhysXMonitor;
+
+ FieldSamplerManager* mManager;
+
+ uint32_t mForceSampleBatchBufferSize;
+ uint32_t mForceSampleBatchBufferPos;
+ Array <FieldSamplerQuery*> mForceSampleBatchQuery;
+ Array <FieldSamplerQueryDataIntl> mForceSampleBatchQueryData;
+ Array <PxVec4> mForceSampleBatchPosition;
+ Array <PxVec4> mForceSampleBatchVelocity;
+ Array <float> mForceSampleBatchMass;
+
+ friend class ModuleFieldSamplerImpl;
+ friend class FieldSamplerManager;
+};
+
+class FieldSamplerSceneCPU : public FieldSamplerScene
+{
+public:
+ FieldSamplerSceneCPU(ModuleFieldSamplerImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list);
+ ~FieldSamplerSceneCPU();
+
+protected:
+ virtual FieldSamplerManager* createManager();
+
+};
+
+#if APEX_CUDA_SUPPORT
+class FieldSamplerSceneGPU : public FieldSamplerScene, public CudaModuleScene
+{
+public:
+ FieldSamplerSceneGPU(ModuleFieldSamplerImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list);
+ ~FieldSamplerSceneGPU();
+
+ void* getHeadCudaObj()
+ {
+ return CudaModuleScene::getHeadCudaObj();
+ }
+
+//CUDA module objects
+#include "../cuda/include/fieldsampler.h"
+
+ PxCudaContextManager* getCudaContext() const
+ {
+ return mCtxMgr;
+ }
+
+protected:
+ virtual FieldSamplerManager* createManager();
+
+ /* keep a convenience pointer to the cuda context manager */
+ PxCudaContextManager* mCtxMgr;
+};
+#endif
+
+}
+} // end namespace nvidia::apex
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/FieldSamplerSceneWrapper.h b/APEX_1.4/module/fieldsampler/include/FieldSamplerSceneWrapper.h
new file mode 100644
index 00000000..dce7f529
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/FieldSamplerSceneWrapper.h
@@ -0,0 +1,206 @@
+/*
+ * 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_SCENE_WRAPPER_H__
+#define __FIELD_SAMPLER_SCENE_WRAPPER_H__
+
+#include "Apex.h"
+#include "ApexSDKHelpers.h"
+#include "ApexActor.h"
+#include "FieldSamplerSceneIntl.h"
+
+#if APEX_CUDA_SUPPORT
+#include "ApexCudaWrapper.h"
+#endif
+
+#include "FieldSamplerCommon.h"
+
+namespace nvidia
+{
+namespace fieldsampler
+{
+
+class FieldSamplerManager;
+class FieldSamplerWrapper;
+class FieldBoundaryWrapper;
+
+class FieldSamplerSceneWrapper : public ApexResourceInterface, public ApexResource
+{
+public:
+ // ApexResourceInterface methods
+ void release();
+ void setListIndex(ResourceList& list, uint32_t index)
+ {
+ m_listIndex = index;
+ m_list = &list;
+ }
+ uint32_t getListIndex() const
+ {
+ return m_listIndex;
+ }
+
+ FieldSamplerSceneWrapper(ResourceList& list, FieldSamplerManager* manager, FieldSamplerSceneIntl* fieldSamplerScene);
+
+ FieldSamplerSceneIntl* getInternalFieldSamplerScene() const
+ {
+ return mFieldSamplerScene;
+ }
+ const FieldSamplerSceneDescIntl& getInternalFieldSamplerSceneDesc() const
+ {
+ return mFieldSamplerSceneDesc;
+ }
+
+ virtual void update();
+ virtual void postUpdate() = 0;
+
+ class FieldBoundaryInfo;
+
+ FieldBoundaryInfo* addFieldBoundary(FieldBoundaryWrapper* fieldBoundaryWrapper);
+ void removeFieldBoundary(FieldBoundaryInfo* fieldBoundaryInfo);
+
+protected:
+ virtual FieldBoundaryInfo* createFieldBoundaryInfo(FieldBoundaryWrapper* fieldBoundaryWrapper) = 0;
+
+protected:
+ FieldSamplerManager* mManager;
+ FieldSamplerSceneIntl* mFieldSamplerScene;
+ FieldSamplerSceneDescIntl mFieldSamplerSceneDesc;
+
+ ResourceList mFieldBoundaryList;
+ bool mFieldBoundaryListChanged;
+};
+
+class FieldSamplerSceneWrapper::FieldBoundaryInfo : public ApexResourceInterface, public ApexResource
+{
+protected:
+ FieldBoundaryWrapper* mFieldBoundaryWrapper;
+ uint32_t mRefCount;
+
+ FieldBoundaryInfo(ResourceList& list, FieldBoundaryWrapper* fieldBoundaryWrapper)
+ : mFieldBoundaryWrapper(fieldBoundaryWrapper), mRefCount(0)
+ {
+ list.add(*this);
+ }
+
+public:
+ FieldBoundaryWrapper* getFieldBoundaryWrapper() const
+ {
+ return mFieldBoundaryWrapper;
+ }
+
+ virtual void update() {}
+
+ void addRef()
+ {
+ ++mRefCount;
+ }
+ bool releaseRef()
+ {
+ if (--mRefCount == 0)
+ {
+ release();
+ return true;
+ }
+ return false;
+ }
+
+ // ApexResourceInterface methods
+ void release()
+ {
+ delete this;
+ }
+ void setListIndex(ResourceList& list, uint32_t index)
+ {
+ m_listIndex = index;
+ m_list = &list;
+ }
+ uint32_t getListIndex() const
+ {
+ return m_listIndex;
+ }
+};
+
+/******************************** CPU Version ********************************/
+
+class FieldSamplerSceneWrapperCPU : public FieldSamplerSceneWrapper
+{
+public:
+ FieldSamplerSceneWrapperCPU(ResourceList& list, FieldSamplerManager* manager, FieldSamplerSceneIntl* fieldSamplerScene);
+
+ virtual void postUpdate() {}
+
+ class FieldBoundaryInfoCPU : public FieldBoundaryInfo
+ {
+ public:
+ FieldBoundaryInfoCPU(ResourceList& list, FieldBoundaryWrapper* fieldBoundaryWrapper)
+ : FieldBoundaryInfo(list, fieldBoundaryWrapper)
+ {
+ }
+ };
+
+protected:
+ virtual FieldBoundaryInfo* createFieldBoundaryInfo(FieldBoundaryWrapper* fieldBoundaryWrapper)
+ {
+ return PX_NEW(FieldBoundaryInfoCPU)(mFieldBoundaryList, fieldBoundaryWrapper);
+ }
+
+};
+
+/******************************** GPU Version ********************************/
+
+#if APEX_CUDA_SUPPORT
+class FieldSamplerSceneWrapperGPU : public FieldSamplerSceneWrapper
+{
+public:
+ FieldSamplerSceneWrapperGPU(ResourceList& list, FieldSamplerManager* manager, FieldSamplerSceneIntl* fieldSamplerScene);
+
+ virtual void postUpdate();
+
+ PX_INLINE ApexCudaConstStorage& getConstStorage()
+ {
+ return mConstStorage;
+ }
+
+ class FieldBoundaryInfoGPU : public FieldBoundaryInfo
+ {
+ public:
+ FieldBoundaryInfoGPU(ResourceList& list, FieldBoundaryWrapper* fieldBoundaryWrapper, ApexCudaConstStorage& constStorage);
+
+ virtual void update();
+
+ PX_INLINE InplaceHandle<FieldShapeGroupParams> getShapeGroupParamsHandle() const
+ {
+ PX_ASSERT(mFieldShapeGroupParamsHandle.isNull() == false);
+ return mFieldShapeGroupParamsHandle;
+ }
+
+ private:
+ ApexCudaConstMemGroup mConstMemGroup;
+ InplaceHandle<FieldShapeGroupParams> mFieldShapeGroupParamsHandle;
+ };
+
+protected:
+ virtual FieldBoundaryInfo* createFieldBoundaryInfo(FieldBoundaryWrapper* fieldBoundaryWrapper)
+ {
+ return PX_NEW(FieldBoundaryInfoGPU)(mFieldBoundaryList, fieldBoundaryWrapper, getConstStorage());
+ }
+
+private:
+ FieldSamplerSceneWrapperGPU& operator=(const FieldSamplerSceneWrapperGPU&);
+
+ ApexCudaConstStorage& mConstStorage;
+};
+#endif // APEX_CUDA_SUPPORT
+
+}
+} // end namespace nvidia::apex
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/FieldSamplerWrapper.h b/APEX_1.4/module/fieldsampler/include/FieldSamplerWrapper.h
new file mode 100644
index 00000000..4eebc10b
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/FieldSamplerWrapper.h
@@ -0,0 +1,149 @@
+/*
+ * 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_WRAPPER_H__
+#define __FIELD_SAMPLER_WRAPPER_H__
+
+#include "Apex.h"
+#include "ApexSDKHelpers.h"
+#include "ApexActor.h"
+#include "FieldSamplerIntl.h"
+
+#if APEX_CUDA_SUPPORT
+#include "ApexCudaWrapper.h"
+#endif
+
+#include "FieldSamplerSceneWrapper.h"
+#include "FieldSamplerCommon.h"
+
+namespace nvidia
+{
+namespace fieldsampler
+{
+
+class FieldSamplerManager;
+
+class FieldBoundaryWrapper;
+
+class FieldSamplerWrapper : public ApexResourceInterface, public ApexResource
+{
+public:
+ // ApexResourceInterface methods
+ void release();
+ void setListIndex(ResourceList& list, uint32_t index)
+ {
+ m_listIndex = index;
+ m_list = &list;
+ }
+ uint32_t getListIndex() const
+ {
+ return m_listIndex;
+ }
+
+ FieldSamplerWrapper(ResourceList& list, FieldSamplerManager* manager, FieldSamplerIntl* fieldSampler, const FieldSamplerDescIntl& fieldSamplerDesc, FieldSamplerSceneWrapper* fieldSamplerSceneWrapper);
+
+ virtual void update();
+
+ PX_INLINE FieldSamplerIntl* getInternalFieldSampler() const
+ {
+ return mFieldSampler;
+ }
+ PX_INLINE const FieldSamplerDescIntl& getInternalFieldSamplerDesc() const
+ {
+ return mFieldSamplerDesc;
+ }
+ PX_INLINE FieldSamplerSceneWrapper* getFieldSamplerSceneWrapper() const
+ {
+ return mSceneWrapper;
+ }
+
+ bool addFieldBoundary(FieldBoundaryWrapper* wrapper);
+ bool removeFieldBoundary(FieldBoundaryWrapper* wrapper);
+
+ uint32_t getFieldBoundaryCount() const
+ {
+ return mFieldBoundaryInfoArray.size();
+ }
+ FieldBoundaryWrapper* getFieldBoundaryWrapper(uint32_t index) const
+ {
+ return mFieldBoundaryInfoArray[index]->getFieldBoundaryWrapper();
+ }
+
+ PX_INLINE const FieldShapeDescIntl& getInternalFieldSamplerShape() const
+ {
+ return mFieldSamplerShape;
+ }
+ PX_INLINE bool isFieldSamplerChanged() const
+ {
+ return mFieldSamplerShapeChanged;
+ }
+ PX_INLINE bool isEnabled() const
+ {
+ return mIsEnabled;
+ }
+ PX_INLINE bool isEnabledChanged() const
+ {
+ return (mIsEnabled != mIsEnabledLast);
+ }
+
+protected:
+ FieldSamplerManager* mManager;
+ FieldSamplerIntl* mFieldSampler;
+ FieldSamplerDescIntl mFieldSamplerDesc;
+
+ FieldShapeDescIntl mFieldSamplerShape;
+ bool mFieldSamplerShapeChanged;
+
+ FieldSamplerSceneWrapper* mSceneWrapper;
+ uint32_t mQueryRefCount;
+
+ nvidia::Array<FieldSamplerSceneWrapper::FieldBoundaryInfo*> mFieldBoundaryInfoArray;
+ bool mFieldBoundaryInfoArrayChanged;
+
+ bool mIsEnabled;
+ bool mIsEnabledLast;
+
+ friend class FieldSamplerManager;
+};
+
+
+class FieldSamplerWrapperCPU : public FieldSamplerWrapper
+{
+public:
+ FieldSamplerWrapperCPU(ResourceList& list, FieldSamplerManager* manager, FieldSamplerIntl* fieldSampler, const FieldSamplerDescIntl& fieldSamplerDesc, FieldSamplerSceneWrapper* fieldSamplerSceneWrapper);
+
+private:
+};
+
+#if APEX_CUDA_SUPPORT
+class FieldSamplerWrapperGPU : public FieldSamplerWrapperCPU
+{
+public:
+ FieldSamplerWrapperGPU(ResourceList& list, FieldSamplerManager* manager, FieldSamplerIntl* fieldSampler, const FieldSamplerDescIntl& fieldSamplerDesc, FieldSamplerSceneWrapper* fieldSamplerSceneWrapper);
+
+ virtual void update();
+
+ PX_INLINE InplaceHandle<FieldSamplerParams> getParamsHandle() const
+ {
+ PX_ASSERT(mFieldSamplerParamsHandle.isNull() == false);
+ return mFieldSamplerParamsHandle;
+ }
+
+private:
+ ApexCudaConstMemGroup mConstMemGroup;
+ InplaceHandle<FieldSamplerParams> mFieldSamplerParamsHandle;
+};
+#endif
+
+}
+} // end namespace nvidia::apex
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/ModuleEventDefs.h b/APEX_1.4/module/fieldsampler/include/ModuleEventDefs.h
new file mode 100644
index 00000000..583b50d1
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/ModuleEventDefs.h
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+
+// This file is used to define a list of AgPerfMon events.
+//
+// This file is included exclusively by ModulePerfScope.h
+// and by ModuleFoo.cpp, for the purpose of building
+// an enumeration (enum xx) and an array of strings ()
+// that contain the list of events.
+//
+// This file should only contain event definitions, using the
+// DEFINE_EVENT macro. E.g.:
+//
+// DEFINE_EVENT(sample_name_1)
+// DEFINE_EVENT(sample_name_2)
+// DEFINE_EVENT(sample_name_3)
+
+DEFINE_EVENT(FieldSamplerSceneFetchResults)
diff --git a/APEX_1.4/module/fieldsampler/include/ModuleFieldSamplerImpl.h b/APEX_1.4/module/fieldsampler/include/ModuleFieldSamplerImpl.h
new file mode 100644
index 00000000..b15f5189
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/ModuleFieldSamplerImpl.h
@@ -0,0 +1,98 @@
+/*
+ * 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 __MODULE_FIELD_SAMPLER_IMPL_H__
+#define __MODULE_FIELD_SAMPLER_IMPL_H__
+
+#include "Apex.h"
+#include "ModuleFieldSampler.h"
+#include "ApexSDKIntl.h"
+#include "ModuleIntl.h"
+#include "ModuleBase.h"
+
+#include "ApexSDKHelpers.h"
+#include "ApexRWLockable.h"
+#include "ModuleFieldSamplerRegistration.h"
+
+#include "ModuleFieldSamplerIntl.h"
+
+namespace nvidia
+{
+namespace apex
+{
+class SceneIntl;
+}
+
+namespace fieldsampler
+{
+
+class FieldSamplerScene;
+
+class ModuleFieldSamplerImpl : public ModuleFieldSampler, public ModuleFieldSamplerIntl, public ModuleBase, public ApexRWLockable
+{
+public:
+ APEX_RW_LOCKABLE_BOILERPLATE
+
+ ModuleFieldSamplerImpl(ApexSDKIntl* sdk);
+ ~ModuleFieldSamplerImpl();
+
+ FieldSamplerManagerIntl* getInternalFieldSamplerManager(const Scene& apexScene);
+
+ bool setFieldSamplerWeightedCollisionFilterCallback(const Scene& apexScene,FieldSamplerWeightedCollisionFilterCallback *callback);
+
+#if PX_PHYSICS_VERSION_MAJOR == 3
+ void enablePhysXMonitor(const Scene& apexScene, bool enable);
+ void setPhysXMonitorFilterData(const Scene& apexScene, physx::PxFilterData filterData);
+#endif
+
+ uint32_t createForceSampleBatch(const Scene& apexScene, uint32_t maxCount, const physx::PxFilterData filterData);
+ void releaseForceSampleBatch(const Scene& apexScene, uint32_t batchId);
+ void submitForceSampleBatch(const Scene& apexScene, uint32_t batchId,
+ PxVec4* forces, const uint32_t forcesStride,
+ const PxVec3* positions, const uint32_t positionsStride,
+ const PxVec3* velocities, const uint32_t velocitiesStride,
+ const float* mass, const uint32_t massStride,
+ const uint32_t* indices, const uint32_t numIndices);
+
+
+ // base class methods
+ void init(NvParameterized::Interface&);
+ NvParameterized::Interface* getDefaultModuleDesc();
+ void release()
+ {
+ ModuleBase::release();
+ }
+ void destroy();
+ const char* getName() const
+ {
+ return ModuleBase::getName();
+ }
+
+ ModuleSceneIntl* createInternalModuleScene(SceneIntl&, RenderDebugInterface*);
+ void releaseModuleSceneIntl(ModuleSceneIntl&);
+ AuthObjTypeID getModuleID() const;
+ RenderableIterator* createRenderableIterator(const Scene&);
+
+
+protected:
+ FieldSamplerScene* getFieldSamplerScene(const Scene& apexScene) const;
+
+ ResourceList mFieldSamplerScenes;
+
+private:
+
+ FieldSamplerModuleParameters* mModuleParams;
+};
+
+}
+} // end namespace nvidia::apex
+
+#endif // __MODULE_FIELD_SAMPLER_IMPL_H__
diff --git a/APEX_1.4/module/fieldsampler/include/ModuleGpuEventDefs.h b/APEX_1.4/module/fieldsampler/include/ModuleGpuEventDefs.h
new file mode 100644
index 00000000..faa6b9d4
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/ModuleGpuEventDefs.h
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+
+// This file is used to define a list of AgPerfMon events.
+//
+// This file is included exclusively by ModulePerfScope.h
+// and by ModuleFoo.cpp, for the purpose of building
+// an enumeration (enum xx) and an array of strings ()
+// that contain the list of events.
+//
+// This file should only contain event definitions, using the
+// DEFINE_EVENT macro. E.g.:
+//
+// DEFINE_GPU_EVENT(kernel_name_1)
+// DEFINE_GPU_EVENT(kernel_name_2)
+// DEFINE_GPU_EVENT(copy_name_1)
+
+DEFINE_GPU_EVENT(FieldSamplerKernel)
diff --git a/APEX_1.4/module/fieldsampler/include/ModulePerfScope.h b/APEX_1.4/module/fieldsampler/include/ModulePerfScope.h
new file mode 100644
index 00000000..2692f4ba
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/ModulePerfScope.h
@@ -0,0 +1,18 @@
+/*
+ * 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 __MODULE_PERF_SCOPE_H___
+#define __MODULE_PERF_SCOPE_H___
+
+#define MODULE_NAMESPACE fieldsampler
+#include "ModuleProfileCommon.h"
+
+#endif \ No newline at end of file
diff --git a/APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerModuleParameters.h b/APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerModuleParameters.h
new file mode 100644
index 00000000..4267524c
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerModuleParameters.h
@@ -0,0 +1,230 @@
+// 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-2015 NVIDIA Corporation. All rights reserved.
+
+// This file was generated by NvParameterized/scripts/GenParameterized.pl
+
+
+#ifndef HEADER_FieldSamplerModuleParameters_h
+#define HEADER_FieldSamplerModuleParameters_h
+
+#include "NvParametersTypes.h"
+
+#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "NvParameters.h"
+#include "NvTraitsInternal.h"
+#endif
+
+namespace nvidia
+{
+namespace fieldsampler
+{
+
+#if PX_VC
+#pragma warning(push)
+#pragma warning(disable: 4324) // structure was padded due to __declspec(align())
+#endif
+
+namespace FieldSamplerModuleParametersNS
+{
+
+
+
+struct ParametersStruct
+{
+
+ uint32_t unused;
+
+};
+
+static const uint32_t checksum[] = { 0xe3bea6f1, 0xd89e4c54, 0x40faae3e, 0x35941431, };
+
+} // namespace FieldSamplerModuleParametersNS
+
+#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS
+class FieldSamplerModuleParameters : public NvParameterized::NvParameters, public FieldSamplerModuleParametersNS::ParametersStruct
+{
+public:
+ FieldSamplerModuleParameters(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0);
+
+ virtual ~FieldSamplerModuleParameters();
+
+ virtual void destroy();
+
+ static const char* staticClassName(void)
+ {
+ return("FieldSamplerModuleParameters");
+ }
+
+ const char* className(void) const
+ {
+ return(staticClassName());
+ }
+
+ static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0;
+
+ static uint32_t staticVersion(void)
+ {
+ return ClassVersion;
+ }
+
+ uint32_t version(void) const
+ {
+ return(staticVersion());
+ }
+
+ static const uint32_t ClassAlignment = 8;
+
+ static const uint32_t* staticChecksum(uint32_t& bits)
+ {
+ bits = 8 * sizeof(FieldSamplerModuleParametersNS::checksum);
+ return FieldSamplerModuleParametersNS::checksum;
+ }
+
+ static void freeParameterDefinitionTable(NvParameterized::Traits* traits);
+
+ const uint32_t* checksum(uint32_t& bits) const
+ {
+ return staticChecksum(bits);
+ }
+
+ const FieldSamplerModuleParametersNS::ParametersStruct& parameters(void) const
+ {
+ FieldSamplerModuleParameters* tmpThis = const_cast<FieldSamplerModuleParameters*>(this);
+ return *(static_cast<FieldSamplerModuleParametersNS::ParametersStruct*>(tmpThis));
+ }
+
+ FieldSamplerModuleParametersNS::ParametersStruct& parameters(void)
+ {
+ return *(static_cast<FieldSamplerModuleParametersNS::ParametersStruct*>(this));
+ }
+
+ virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const;
+ virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle);
+
+ void initDefaults(void);
+
+protected:
+
+ virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void);
+ virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const;
+
+
+ virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const;
+
+private:
+
+ void buildTree(void);
+ void initDynamicArrays(void);
+ void initStrings(void);
+ void initReferences(void);
+ void freeDynamicArrays(void);
+ void freeStrings(void);
+ void freeReferences(void);
+
+ static bool mBuiltFlag;
+ static NvParameterized::MutexType mBuiltFlagMutex;
+};
+
+class FieldSamplerModuleParametersFactory : public NvParameterized::Factory
+{
+ static const char* const vptr;
+
+public:
+
+ virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits)
+ {
+ FieldSamplerModuleParameters::freeParameterDefinitionTable(traits);
+ }
+
+ virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits)
+ {
+ // placement new on this class using mParameterizedTraits
+
+ void* newPtr = paramTraits->alloc(sizeof(FieldSamplerModuleParameters), FieldSamplerModuleParameters::ClassAlignment);
+ if (!NvParameterized::IsAligned(newPtr, FieldSamplerModuleParameters::ClassAlignment))
+ {
+ NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class FieldSamplerModuleParameters");
+ paramTraits->free(newPtr);
+ return 0;
+ }
+
+ memset(newPtr, 0, sizeof(FieldSamplerModuleParameters)); // always initialize memory allocated to zero for default values
+ return NV_PARAM_PLACEMENT_NEW(newPtr, FieldSamplerModuleParameters)(paramTraits);
+ }
+
+ virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount)
+ {
+ if (!NvParameterized::IsAligned(bufObj, FieldSamplerModuleParameters::ClassAlignment)
+ || !NvParameterized::IsAligned(bufStart, FieldSamplerModuleParameters::ClassAlignment))
+ {
+ NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class FieldSamplerModuleParameters");
+ return 0;
+ }
+
+ // Init NvParameters-part
+ // We used to call empty constructor of FieldSamplerModuleParameters here
+ // but it may call default constructors of members and spoil the data
+ NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount);
+
+ // Init vtable (everything else is already initialized)
+ *(const char**)bufObj = vptr;
+
+ return (FieldSamplerModuleParameters*)bufObj;
+ }
+
+ virtual const char* getClassName()
+ {
+ return (FieldSamplerModuleParameters::staticClassName());
+ }
+
+ virtual uint32_t getVersion()
+ {
+ return (FieldSamplerModuleParameters::staticVersion());
+ }
+
+ virtual uint32_t getAlignment()
+ {
+ return (FieldSamplerModuleParameters::ClassAlignment);
+ }
+
+ virtual const uint32_t* getChecksum(uint32_t& bits)
+ {
+ return (FieldSamplerModuleParameters::staticChecksum(bits));
+ }
+};
+#endif // NV_PARAMETERIZED_ONLY_LAYOUTS
+
+} // namespace fieldsampler
+} // namespace nvidia
+
+#if PX_VC
+#pragma warning(pop)
+#endif
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerPhysXMonitorParams.h b/APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerPhysXMonitorParams.h
new file mode 100644
index 00000000..037d7b3b
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/autogen/FieldSamplerPhysXMonitorParams.h
@@ -0,0 +1,232 @@
+// 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-2015 NVIDIA Corporation. All rights reserved.
+
+// This file was generated by NvParameterized/scripts/GenParameterized.pl
+
+
+#ifndef HEADER_FieldSamplerPhysXMonitorParams_h
+#define HEADER_FieldSamplerPhysXMonitorParams_h
+
+#include "NvParametersTypes.h"
+
+#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS
+#include "nvparameterized/NvParameterized.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "NvParameters.h"
+#include "NvTraitsInternal.h"
+#endif
+
+namespace nvidia
+{
+namespace fieldsampler
+{
+
+#if PX_VC
+#pragma warning(push)
+#pragma warning(disable: 4324) // structure was padded due to __declspec(align())
+#endif
+
+namespace FieldSamplerPhysXMonitorParamsNS
+{
+
+
+
+struct ParametersStruct
+{
+
+ uint32_t maxRBCount;
+ uint32_t maxPSCount;
+ uint32_t maxParticleCount;
+
+};
+
+static const uint32_t checksum[] = { 0x357a67e3, 0x9ed0cf4f, 0xd9fe5e4e, 0x532febb8, };
+
+} // namespace FieldSamplerPhysXMonitorParamsNS
+
+#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS
+class FieldSamplerPhysXMonitorParams : public NvParameterized::NvParameters, public FieldSamplerPhysXMonitorParamsNS::ParametersStruct
+{
+public:
+ FieldSamplerPhysXMonitorParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0);
+
+ virtual ~FieldSamplerPhysXMonitorParams();
+
+ virtual void destroy();
+
+ static const char* staticClassName(void)
+ {
+ return("FieldSamplerPhysXMonitorParams");
+ }
+
+ const char* className(void) const
+ {
+ return(staticClassName());
+ }
+
+ static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)0;
+
+ static uint32_t staticVersion(void)
+ {
+ return ClassVersion;
+ }
+
+ uint32_t version(void) const
+ {
+ return(staticVersion());
+ }
+
+ static const uint32_t ClassAlignment = 8;
+
+ static const uint32_t* staticChecksum(uint32_t& bits)
+ {
+ bits = 8 * sizeof(FieldSamplerPhysXMonitorParamsNS::checksum);
+ return FieldSamplerPhysXMonitorParamsNS::checksum;
+ }
+
+ static void freeParameterDefinitionTable(NvParameterized::Traits* traits);
+
+ const uint32_t* checksum(uint32_t& bits) const
+ {
+ return staticChecksum(bits);
+ }
+
+ const FieldSamplerPhysXMonitorParamsNS::ParametersStruct& parameters(void) const
+ {
+ FieldSamplerPhysXMonitorParams* tmpThis = const_cast<FieldSamplerPhysXMonitorParams*>(this);
+ return *(static_cast<FieldSamplerPhysXMonitorParamsNS::ParametersStruct*>(tmpThis));
+ }
+
+ FieldSamplerPhysXMonitorParamsNS::ParametersStruct& parameters(void)
+ {
+ return *(static_cast<FieldSamplerPhysXMonitorParamsNS::ParametersStruct*>(this));
+ }
+
+ virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle) const;
+ virtual NvParameterized::ErrorType getParameterHandle(const char* long_name, NvParameterized::Handle& handle);
+
+ void initDefaults(void);
+
+protected:
+
+ virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void);
+ virtual const NvParameterized::DefinitionImpl* getParameterDefinitionTree(void) const;
+
+
+ virtual void getVarPtr(const NvParameterized::Handle& handle, void*& ptr, size_t& offset) const;
+
+private:
+
+ void buildTree(void);
+ void initDynamicArrays(void);
+ void initStrings(void);
+ void initReferences(void);
+ void freeDynamicArrays(void);
+ void freeStrings(void);
+ void freeReferences(void);
+
+ static bool mBuiltFlag;
+ static NvParameterized::MutexType mBuiltFlagMutex;
+};
+
+class FieldSamplerPhysXMonitorParamsFactory : public NvParameterized::Factory
+{
+ static const char* const vptr;
+
+public:
+
+ virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits)
+ {
+ FieldSamplerPhysXMonitorParams::freeParameterDefinitionTable(traits);
+ }
+
+ virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits)
+ {
+ // placement new on this class using mParameterizedTraits
+
+ void* newPtr = paramTraits->alloc(sizeof(FieldSamplerPhysXMonitorParams), FieldSamplerPhysXMonitorParams::ClassAlignment);
+ if (!NvParameterized::IsAligned(newPtr, FieldSamplerPhysXMonitorParams::ClassAlignment))
+ {
+ NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class FieldSamplerPhysXMonitorParams");
+ paramTraits->free(newPtr);
+ return 0;
+ }
+
+ memset(newPtr, 0, sizeof(FieldSamplerPhysXMonitorParams)); // always initialize memory allocated to zero for default values
+ return NV_PARAM_PLACEMENT_NEW(newPtr, FieldSamplerPhysXMonitorParams)(paramTraits);
+ }
+
+ virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount)
+ {
+ if (!NvParameterized::IsAligned(bufObj, FieldSamplerPhysXMonitorParams::ClassAlignment)
+ || !NvParameterized::IsAligned(bufStart, FieldSamplerPhysXMonitorParams::ClassAlignment))
+ {
+ NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class FieldSamplerPhysXMonitorParams");
+ return 0;
+ }
+
+ // Init NvParameters-part
+ // We used to call empty constructor of FieldSamplerPhysXMonitorParams here
+ // but it may call default constructors of members and spoil the data
+ NV_PARAM_PLACEMENT_NEW(bufObj, NvParameterized::NvParameters)(paramTraits, bufStart, refCount);
+
+ // Init vtable (everything else is already initialized)
+ *(const char**)bufObj = vptr;
+
+ return (FieldSamplerPhysXMonitorParams*)bufObj;
+ }
+
+ virtual const char* getClassName()
+ {
+ return (FieldSamplerPhysXMonitorParams::staticClassName());
+ }
+
+ virtual uint32_t getVersion()
+ {
+ return (FieldSamplerPhysXMonitorParams::staticVersion());
+ }
+
+ virtual uint32_t getAlignment()
+ {
+ return (FieldSamplerPhysXMonitorParams::ClassAlignment);
+ }
+
+ virtual const uint32_t* getChecksum(uint32_t& bits)
+ {
+ return (FieldSamplerPhysXMonitorParams::staticChecksum(bits));
+ }
+};
+#endif // NV_PARAMETERIZED_ONLY_LAYOUTS
+
+} // namespace fieldsampler
+} // namespace nvidia
+
+#if PX_VC
+#pragma warning(pop)
+#endif
+
+#endif
diff --git a/APEX_1.4/module/fieldsampler/include/autogen/ModuleFieldSamplerRegistration.h b/APEX_1.4/module/fieldsampler/include/autogen/ModuleFieldSamplerRegistration.h
new file mode 100644
index 00000000..62baddf6
--- /dev/null
+++ b/APEX_1.4/module/fieldsampler/include/autogen/ModuleFieldSamplerRegistration.h
@@ -0,0 +1,117 @@
+/*
+ * 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 MODULE_MODULEFIELDSAMPLERREGISTRATIONH_H
+#define MODULE_MODULEFIELDSAMPLERREGISTRATIONH_H
+
+#include "PsAllocator.h"
+#include "NvRegistrationsForTraitsBase.h"
+#include "nvparameterized/NvParameterizedTraits.h"
+#include "PxAssert.h"
+#include <stdint.h>
+
+// INCLUDE GENERATED FACTORIES
+#include "FieldSamplerPhysXMonitorParams.h"
+#include "FieldSamplerModuleParameters.h"
+
+
+// INCLUDE GENERATED CONVERSION
+
+
+namespace nvidia {
+namespace fieldsampler {
+
+
+class ModuleFieldSamplerRegistration : public NvParameterized::RegistrationsForTraitsBase
+{
+public:
+ static void invokeRegistration(NvParameterized::Traits* parameterizedTraits)
+ {
+ if (parameterizedTraits)
+ {
+ ModuleFieldSamplerRegistration().registerAll(*parameterizedTraits);
+ }
+ }
+
+ static void invokeUnregistration(NvParameterized::Traits* parameterizedTraits)
+ {
+ if (parameterizedTraits)
+ {
+ ModuleFieldSamplerRegistration().unregisterAll(*parameterizedTraits);
+ }
+ }
+
+ void registerAvailableFactories(NvParameterized::Traits& parameterizedTraits)
+ {
+ ::NvParameterized::Factory* factoriesToRegister[] = {
+// REGISTER GENERATED FACTORIES
+ new nvidia::fieldsampler::FieldSamplerPhysXMonitorParamsFactory(),
+ new nvidia::fieldsampler::FieldSamplerModuleParametersFactory(),
+
+ };
+
+ for (size_t i = 0; i < sizeof(factoriesToRegister)/sizeof(factoriesToRegister[0]); ++i)
+ {
+ parameterizedTraits.registerFactory(*factoriesToRegister[i]);
+ }
+ }
+
+ virtual void registerAvailableConverters(NvParameterized::Traits& parameterizedTraits)
+ {
+// REGISTER GENERATED CONVERSION
+PX_UNUSED(parameterizedTraits);
+
+ }
+
+ void unregisterAvailableFactories(NvParameterized::Traits& parameterizedTraits)
+ {
+ struct FactoryDesc
+ {
+ const char* name;
+ uint32_t version;
+ };
+
+ ::NvParameterized::Factory* factoriesToUnregister[] = {
+// UNREGISTER GENERATED FACTORIES
+ new nvidia::fieldsampler::FieldSamplerPhysXMonitorParamsFactory(),
+ new nvidia::fieldsampler::FieldSamplerModuleParametersFactory(),
+
+ };
+
+ for (size_t i = 0; i < sizeof(factoriesToUnregister)/sizeof(factoriesToUnregister[0]); ++i)
+ {
+ ::NvParameterized::Factory* removedFactory = parameterizedTraits.removeFactory(factoriesToUnregister[i]->getClassName(), factoriesToUnregister[i]->getVersion());
+ if (!removedFactory)
+ {
+ PX_ASSERT_WITH_MESSAGE(0, "Factory can not be removed!");
+ }
+ else
+ {
+ removedFactory->freeParameterDefinitionTable(&parameterizedTraits);
+ delete removedFactory;
+ delete factoriesToUnregister[i];
+ }
+ }
+ }
+
+ virtual void unregisterAvailableConverters(NvParameterized::Traits& parameterizedTraits)
+ {
+// UNREGISTER GENERATED CONVERSION
+PX_UNUSED(parameterizedTraits);
+
+ }
+
+};
+
+
+}
+} //nvidia::fieldsampler
+
+#endif