diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/module/forcefield/include | |
| download | physx-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/forcefield/include')
18 files changed, 3897 insertions, 0 deletions
diff --git a/APEX_1.4/module/forcefield/include/ForceFieldActorImpl.h b/APEX_1.4/module/forcefield/include/ForceFieldActorImpl.h new file mode 100644 index 00000000..eefc5f7e --- /dev/null +++ b/APEX_1.4/module/forcefield/include/ForceFieldActorImpl.h @@ -0,0 +1,297 @@ +/* + * 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 __FORCEFIELD_ACTOR_IMPL_H__ +#define __FORCEFIELD_ACTOR_IMPL_H__ + +#include "Apex.h" + +#include "ForceFieldAsset.h" +#include "ForceFieldActor.h" +#include "ForceFieldAssetImpl.h" +#include "ApexActor.h" +#include "ApexString.h" +#include "ApexRWLockable.h" +#include "ReadCheck.h" +#include "WriteCheck.h" +#include "FieldSamplerIntl.h" + +#if APEX_CUDA_SUPPORT +#include "ApexCudaWrapper.h" +#endif + +#include "ForceFieldFSCommon.h" + +class ForceFieldAssetParams; + +namespace nvidia +{ +namespace forcefield +{ + +/* +PX_INLINE bool operator != (const GroupsMask64& d1, const GroupsMask64& d2) +{ + return d1.bits0 != d2.bits0 || d1.bits1 != d2.bits1; +}*/ +PX_INLINE bool operator != (const physx::PxFilterData& d1, const physx::PxFilterData& d2) +{ + //if (d1.word3 != d2.word3) return d1.word3 < d2.word3; + //if (d1.word2 != d2.word2) return d1.word2 < d2.word2; + //if (d1.word1 != d2.word1) return d1.word1 < d2.word1; + return d1.word0 != d2.word0 || d1.word1 != d2.word1 || d1.word2 != d2.word2 || d1.word3 != d2.word3; +} + +class ForceFieldAssetImpl; +class ForceFieldScene; + +/** +Union class to hold all kernel parameter types. Avoided the use of templates +for the getters, as that resulting code using traits for type safty +was about the same amount as the non-templated one. +*/ +class ForceFieldFSKernelParamsUnion +{ +public: + ForceFieldFSKernelParams& getForceFieldFSKernelParams() + { + return reinterpret_cast<ForceFieldFSKernelParams&>(params); + } + + const ForceFieldFSKernelParams& getForceFieldFSKernelParams() const + { + return reinterpret_cast<const ForceFieldFSKernelParams&>(params); + } + + const RadialForceFieldFSKernelParams& getRadialForceFieldFSKernelParams() const + { + PX_ASSERT(kernelType == ForceFieldKernelType::RADIAL); + return reinterpret_cast<const RadialForceFieldFSKernelParams&>(params); + } + + RadialForceFieldFSKernelParams& getRadialForceFieldFSKernelParams() + { + PX_ASSERT(kernelType == ForceFieldKernelType::RADIAL); + return reinterpret_cast<RadialForceFieldFSKernelParams&>(params); + } + + GenericForceFieldFSKernelParams& getGenericForceFieldFSKernelParams() + { + PX_ASSERT(kernelType == ForceFieldKernelType::GENERIC); + return reinterpret_cast<GenericForceFieldFSKernelParams&>(params); + } + + const GenericForceFieldFSKernelParams& getGenericForceFieldFSKernelParams() const + { + PX_ASSERT(kernelType == ForceFieldKernelType::GENERIC); + return reinterpret_cast<const GenericForceFieldFSKernelParams&>(params); + } + + ForceFieldKernelType::Enum kernelType; + +private: + + union + { + void* alignment; //makes data aligned to pointer size + uint8_t radial[sizeof(RadialForceFieldFSKernelParams)]; + uint8_t generic[sizeof(GenericForceFieldFSKernelParams)]; + } params; +}; + +class ForceFieldActorImpl : public ForceFieldActor, public ApexRWLockable, public ApexActor, public ApexActorSource, public ApexResourceInterface, public ApexResource, public FieldSamplerIntl +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + /* ForceFieldActorImpl methods */ + ForceFieldActorImpl(const ForceFieldActorDesc&, ForceFieldAssetImpl&, ResourceList&, ForceFieldScene&); + ~ForceFieldActorImpl() {} + ForceFieldAsset* getForceFieldAsset() const; + + bool disable(); + bool enable(); + bool isEnable() + { + READ_ZONE(); + return mEnable; + } + PxMat44 getPose() const; + void setPose(const PxMat44& pose); + + float getCurrentScale(void) const + { + READ_ZONE(); + return getScale(); + } + + void setCurrentScale(float scale) + { + WRITE_ZONE(); + setScale(scale); + } + + PX_DEPRECATED float getScale() const + { + READ_ZONE(); + return 0.0f; + } + + PX_DEPRECATED void setScale(float scale); + + const char* getName() const + { + READ_ZONE(); + return mName.c_str(); + } + void setName(const char* name) + { + WRITE_ZONE(); + mName = name; + } + + void setStrength(const float strength); + void setLifetime(const float lifetime); + + //kernel specific functionality + void setRadialFalloffType(const char* type); + void setRadialFalloffMultiplier(const float multiplier); + + // deprecated + void setFalloffType(const char* type); + void setFalloffMultiplier(const float multiplier); + + void updatePoseAndBounds(); // Called by ExampleScene::fetchResults() + + /* ApexResourceInterface, ApexResource */ + void release(); + uint32_t getListIndex() const + { + return m_listIndex; + } + void setListIndex(class ResourceList& list, uint32_t index) + { + m_list = &list; + m_listIndex = index; + } + + /* Actor, ApexActor */ + void destroy(); + Asset* getOwner() const; + + /* PhysX scene management */ + void setPhysXScene(PxScene*); + PxScene* getPhysXScene() const; + + void getLodRange(float& min, float& max, bool& intOnly) const; + float getActiveLod() const; + void forceLod(float lod); + /** + \brief Selectively enables/disables debug visualization of a specific APEX actor. Default value it true. + */ + virtual void setEnableDebugVisualization(bool state) + { + WRITE_ZONE(); + ApexActor::setEnableDebugVisualization(state); + } + + /* FieldSamplerIntl */ + virtual bool updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled); + + virtual PxVec3 queryFieldSamplerVelocity() const + { + return PxVec3(0.0f); + } + +protected: + void updateForceField(float dt); + void releaseForceField(); + +protected: + ForceFieldScene* mForceFieldScene; + + //not used, setters and getters deprecated + //float mScale; + + uint32_t mFlags; + + ApexSimpleString mName; + + ForceFieldAssetImpl* mAsset; + + bool mEnable; + float mElapsedTime; + + /* Force field actor parameters */ + float mLifetime; + void initActorParams(const PxMat44& initialPose); + + /* Field Sampler Stuff */ + bool mFieldSamplerChanged; + void initFieldSampler(const ForceFieldActorDesc& desc); + void releaseFieldSampler(); + + /* Debug Rendering Stuff */ + void visualize(); + void visualizeIncludeShape(); + void visualizeForces(); + + ForceFieldFSKernelParamsUnion mKernelParams; + ForceFieldFSKernelParamsUnion mKernelExecutionParams; //buffered data + + friend class ForceFieldScene; +}; + +class ForceFieldActorCPU : public ForceFieldActorImpl +{ +public: + ForceFieldActorCPU(const ForceFieldActorDesc& desc, ForceFieldAssetImpl& asset, ResourceList& list, ForceFieldScene& scene); + ~ForceFieldActorCPU(); + + /* FieldSamplerIntl */ + virtual void executeFieldSampler(const ExecuteData& data); + + /** + \brief Selectively enables/disables debug visualization of a specific APEX actor. Default value it true. + */ + virtual void setEnableDebugVisualization(bool state) + { + ApexActor::setEnableDebugVisualization(state); + } + + +private: +}; + +#if APEX_CUDA_SUPPORT + +class ForceFieldActorGPU : public ForceFieldActorCPU +{ +public: + ForceFieldActorGPU(const ForceFieldActorDesc& desc, ForceFieldAssetImpl& asset, ResourceList& list, ForceFieldScene& scene); + ~ForceFieldActorGPU(); + + /* FieldSamplerIntl */ + virtual bool updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled); + + virtual void getFieldSamplerCudaExecuteInfo(CudaExecuteInfo& info) const; + +private: + ApexCudaConstMemGroup mConstMemGroup; + InplaceHandle<RadialForceFieldFSKernelParams> mParamsHandle; +}; + +#endif + +} +} // end namespace nvidia + +#endif diff --git a/APEX_1.4/module/forcefield/include/ForceFieldAssetImpl.h b/APEX_1.4/module/forcefield/include/ForceFieldAssetImpl.h new file mode 100644 index 00000000..2d3adfec --- /dev/null +++ b/APEX_1.4/module/forcefield/include/ForceFieldAssetImpl.h @@ -0,0 +1,310 @@ +/* + * 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 FORCEFIELD_ASSET_IMPL_H +#define FORCEFIELD_ASSET_IMPL_H + +#include "Apex.h" +#include "ApexUsingNamespace.h" +#include "ForceFieldAsset.h" +#include "ForceFieldActor.h" +#include "ForceFieldPreview.h" +#include "ApexSDKHelpers.h" +#include "ModuleForceFieldImpl.h" +#include "ApexAssetAuthoring.h" +#include "ApexString.h" +#include "ApexAssetTracker.h" +#include "ApexAuthorableObject.h" +#include "ForceFieldAssetParams.h" +#include "ReadCheck.h" +#include "WriteCheck.h" +#include "ApexAuthorableObject.h" + +namespace nvidia +{ +namespace forcefield +{ + +class ForceFieldActorDesc : public ApexDesc +{ +public: + physx::PxFilterData samplerFilterData; + physx::PxFilterData boundaryFilterData; + + PxMat44 initialPose; + + //deprecated, has no effect + float scale; + PxActor* nxActor; + const char* actorName; + + /** + \brief constructor sets to default. + */ + PX_INLINE ForceFieldActorDesc() : ApexDesc() + { + init(); + } + + /** + \brief sets members to default values. + */ + PX_INLINE void setToDefault() + { + ApexDesc::setToDefault(); + init(); + } + + /** + \brief checks if this is a valid descriptor. + */ + PX_INLINE bool isValid() const + { + if (!ApexDesc::isValid()) + { + return false; + } + + return true; + } + +private: + PX_INLINE void init() + { + initialPose = PxMat44(PxIdentity); + scale = 1.0f; + nxActor = NULL; + actorName = NULL; + } +}; + +/** +\brief Descriptor for a ForceField Asset +*/ +class ForceFieldPreviewDesc +{ +public: + ForceFieldPreviewDesc() : + mPose(PxMat44()), + mIconScale(1.0f), + mPreviewDetail(APEX_FORCEFIELD::FORCEFIELD_DRAW_ICON) + { + mPose = PxMat44(PxIdentity); + }; + + /** + \brief The pose that translates from explosion preview coordinates to world coordinates. + */ + PxMat44 mPose; + /** + \brief The scale of the icon. + */ + float mIconScale; + /** + \brief The detail options of the preview drawing + */ + uint32_t mPreviewDetail; +}; + + +class ForceFieldActorImpl; + +class ForceFieldAssetImpl : public ForceFieldAsset, public ApexResourceInterface, public ApexResource, public ApexRWLockable +{ + friend class ForceFieldAssetDummyAuthoring; +public: + APEX_RW_LOCKABLE_BOILERPLATE + + ForceFieldAssetImpl(ModuleForceFieldImpl*, ResourceList&, const char* name); + ForceFieldAssetImpl(ModuleForceFieldImpl*, ResourceList&, NvParameterized::Interface*, const char*); + + ~ForceFieldAssetImpl(); + + /* Asset */ + const char* getName() const + { + return mName.c_str(); + } + AuthObjTypeID getObjTypeID() const + { + READ_ZONE(); + return mAssetTypeID; + } + const char* getObjTypeName() const + { + READ_ZONE(); + return getClassName(); + } + uint32_t forceLoadAssets(); + + /* ApexInterface */ + virtual void release() + { + mModule->mSdk->releaseAsset(*this); + } + + /* ApexResourceInterface, ApexResource */ + uint32_t getListIndex() const + { + return m_listIndex; + } + void setListIndex(class ResourceList& list, uint32_t index) + { + m_list = &list; + m_listIndex = index; + } + + /* ForceFieldAsset specific methods */ + void releaseForceFieldActor(ForceFieldActor&); + const ForceFieldAssetParams& getForceFieldParameters() const + { + return *mParams; + } + float getDefaultScale() const + { + READ_ZONE(); + return mParams->defScale; + } + void destroy(); + ForceFieldPreview* createForceFieldPreview(const ForceFieldPreviewDesc& desc, AssetPreviewScene* previewScene); + ForceFieldPreview* createForceFieldPreviewImpl(const ForceFieldPreviewDesc& desc, ForceFieldAssetImpl* forceFieldAsset, AssetPreviewScene* previewScene); + void releaseForceFieldPreview(ForceFieldPreview& preview); + + const NvParameterized::Interface* getAssetNvParameterized() const + { + return mParams; + } + /** + * \brief Releases the ApexAsset but returns the NvParameterized::Interface and *ownership* to the caller. + */ + virtual NvParameterized::Interface* releaseAndReturnNvParameterizedInterface(void) + { + NvParameterized::Interface* ret = mParams; + mParams = NULL; + release(); + return ret; + } + NvParameterized::Interface* getDefaultActorDesc(); + NvParameterized::Interface* getDefaultAssetPreviewDesc(); + virtual Actor* createApexActor(const NvParameterized::Interface& /*parms*/, Scene& /*apexScene*/); + virtual AssetPreview* createApexAssetPreview(const NvParameterized::Interface& params, AssetPreviewScene* previewScene); + + virtual bool isValidForActorCreation(const ::NvParameterized::Interface& /*parms*/, Scene& /*apexScene*/) const + { + READ_ZONE(); + return true; // TODO implement this method + } + + virtual bool isDirty() const + { + READ_ZONE(); + return false; + } + +protected: + static const char* getClassName() + { + return FORCEFIELD_AUTHORING_TYPE_NAME; + } + static AuthObjTypeID mAssetTypeID; + + ModuleForceFieldImpl* mModule; + + ResourceList mForceFieldActors; + ApexSimpleString mName; + ForceFieldAssetParams* mParams; + ForceFieldActorParams* mDefaultActorParams; + ForceFieldAssetPreviewParams* mDefaultPreviewParams; + + GenericForceFieldKernelParams* mGenericParams; + RadialForceFieldKernelParams* mRadialParams; + ForceFieldFalloffParams* mFalloffParams; + ForceFieldNoiseParams* mNoiseParams; + + void initializeAssetNameTable(); + + friend class ModuleForceFieldImpl; + friend class ForceFieldActorImpl; + template <class T_Module, class T_Asset, class T_AssetAuthoring> friend class nvidia::apex::ApexAuthorableObject; +}; + +#ifndef WITHOUT_APEX_AUTHORING +class ForceFieldAssetAuthoringImpl : public ForceFieldAssetImpl, public ApexAssetAuthoring, public ForceFieldAssetAuthoring +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + /* ForceFieldAssetAuthoring */ + ForceFieldAssetAuthoringImpl(ModuleForceFieldImpl* m, ResourceList& l) : + ForceFieldAssetImpl(m, l, "ForceFieldAssetAuthoringImpl") {} + + ForceFieldAssetAuthoringImpl(ModuleForceFieldImpl* m, ResourceList& l, const char* name) : + ForceFieldAssetImpl(m, l, name) {} + + ForceFieldAssetAuthoringImpl(ModuleForceFieldImpl* m, ResourceList& l, NvParameterized::Interface* params, const char* name) : + ForceFieldAssetImpl(m, l, params, name) {} + + ~ForceFieldAssetAuthoringImpl() {} + + void destroy() + { + delete this; + } + + /* AssetAuthoring */ + const char* getName(void) const + { + READ_ZONE(); + return ForceFieldAssetImpl::getName(); + } + const char* getObjTypeName() const + { + return ForceFieldAssetImpl::getClassName(); + } + virtual bool prepareForPlatform(nvidia::apex::PlatformTag) + { + APEX_INVALID_OPERATION("Not Implemented."); + return false; + } + + void setToolString(const char* toolName, const char* toolVersion, uint32_t toolChangelist) + { + ApexAssetAuthoring::setToolString(toolName, toolVersion, toolChangelist); + } + + /* ApexInterface */ + virtual void release() + { + mModule->mSdk->releaseAssetAuthoring(*this); + } + + NvParameterized::Interface* getNvParameterized() const + { + return (NvParameterized::Interface*)getAssetNvParameterized(); + } + /** + * \brief Releases the ApexAsset but returns the NvParameterized::Interface and *ownership* to the caller. + */ + virtual NvParameterized::Interface* releaseAndReturnNvParameterizedInterface(void) + { + WRITE_ZONE(); + NvParameterized::Interface* ret = mParams; + mParams = NULL; + release(); + return ret; + } +}; +#endif + +} +} // end namespace nvidia + +#endif // FORCEFIELD_ASSET_IMPL_H diff --git a/APEX_1.4/module/forcefield/include/ForceFieldAssetPreviewImpl.h b/APEX_1.4/module/forcefield/include/ForceFieldAssetPreviewImpl.h new file mode 100644 index 00000000..6a4c11d3 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/ForceFieldAssetPreviewImpl.h @@ -0,0 +1,100 @@ +/* + * 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 __FORCEFIELD_ASSET_PREVIEW_IMPL_H__ +#define __FORCEFIELD_ASSET_PREVIEW_IMPL_H__ + +#include "ApexPreview.h" + +#include "ApexSDKIntl.h" +#include "ForceFieldPreview.h" +#include "RenderDebugInterface.h" +#include "ForceFieldAssetImpl.h" + +#include "ApexRWLockable.h" +#include "ReadCheck.h" +#include "WriteCheck.h" + +namespace nvidia +{ +namespace forcefield +{ + +/* + APEX asset preview explosion asset. + Preview. +*/ +class ForceFieldAssetPreviewImpl : public ForceFieldPreview, public ApexResource, public ApexPreview, public ApexRWLockable +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + ForceFieldAssetPreviewImpl(const ForceFieldPreviewDesc& PreviewDesc, ApexSDK* myApexSDK, ForceFieldAssetImpl* myForceFieldAsset, AssetPreviewScene* previewScene); + void drawForceFieldPreview(void); + void drawForceFieldPreviewUnscaled(void); + void drawForceFieldPreviewScaled(void); + void drawForceFieldPreviewIcon(void); + void drawForceFieldBoundaries(void); + void drawForceFieldWithCylinder(); + void destroy(); + + void setPose(const PxMat44& pose); // Sets the preview instance's pose. This may include scaling. + const PxMat44 getPose() const; + + // from RenderDataProvider + void lockRenderResources(void); + void unlockRenderResources(void); + void updateRenderResources(bool rewriteBuffers = false, void* userRenderData = 0); + + // from Renderable.h + void dispatchRenderResources(UserRenderer& renderer); + PxBounds3 getBounds(void) const; + + // from ApexResource.h + void release(void); + + void setDetailLevel(uint32_t detail); + + typedef struct + { + float x, y; + } point2; + +private: + + ~ForceFieldAssetPreviewImpl(); + PxMat44 mPose; // the pose for the preview rendering + ApexSDK* mApexSDK; // pointer to the APEX SDK + ForceFieldAssetImpl* mAsset; // our parent ForceField Asset + RenderDebugInterface* mApexRenderDebug; // Pointer to the RenderLines class to draw the + // preview stuff + uint32_t mDrawGroupIconScaled; // the ApexDebugRenderer draw group for the Icon + uint32_t mDrawGroupCylinder; + uint32_t mPreviewDetail; // the detail options of the preview drawing + float mIconScale; // the scale for the icon + AssetPreviewScene* mPreviewScene; + + bool mDrawWithCylinder; + + void drawIcon(void); + void drawMultilinePoint2(const point2* pts, uint32_t numPoints, uint32_t color); + void setIconScale(float scale); + + void setPose(PxMat44 pose); + + void toggleDrawPreview(); + void setDrawGroupsPoseScaled(); +}; + +} +} // end namespace nvidia + +#endif // __FORCEFIELD_ASSET_PREVIEW_IMPL_H__ diff --git a/APEX_1.4/module/forcefield/include/ForceFieldFSCommon.h b/APEX_1.4/module/forcefield/include/ForceFieldFSCommon.h new file mode 100644 index 00000000..f2811f6d --- /dev/null +++ b/APEX_1.4/module/forcefield/include/ForceFieldFSCommon.h @@ -0,0 +1,554 @@ +/* + * 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 __FORCEFIELD_FS_COMMON_SRC_H__ +#define __FORCEFIELD_FS_COMMON_SRC_H__ + +#include "../../fieldsampler/include/FieldSamplerCommon.h" +#include "SimplexNoise.h" +#include "TableLookup.h" +#include "PxMat33.h" + +namespace nvidia +{ +namespace apex +{ + +template <> struct InplaceTypeTraits<TableLookup> +{ + template <int _inplace_offset_, typename R, typename RA> + APEX_CUDA_CALLABLE PX_INLINE static void reflectType(R& r, RA ra, TableLookup& t) + { + InplaceTypeHelper::reflectType<APEX_OFFSETOF(TableLookup, xVals) + _inplace_offset_>(r, ra, t.xVals, InplaceTypeMemberDefaultTraits()); + InplaceTypeHelper::reflectType<APEX_OFFSETOF(TableLookup, yVals) + _inplace_offset_>(r, ra, t.yVals, InplaceTypeMemberDefaultTraits()); + InplaceTypeHelper::reflectType<APEX_OFFSETOF(TableLookup, x1) + _inplace_offset_>(r, ra, t.x1, InplaceTypeMemberDefaultTraits()); + InplaceTypeHelper::reflectType<APEX_OFFSETOF(TableLookup, x2) + _inplace_offset_>(r, ra, t.x2, InplaceTypeMemberDefaultTraits()); + InplaceTypeHelper::reflectType<APEX_OFFSETOF(TableLookup, multiplier) + _inplace_offset_>(r, ra, t.multiplier, InplaceTypeMemberDefaultTraits()); + } +}; + +} +namespace forcefield +{ + +struct ForceFieldShapeType +{ + enum Enum + { + SPHERE = 0, + CAPSULE, + CYLINDER, + CONE, + BOX, + NONE, + }; +}; + +struct ForceFieldFalloffType +{ + enum Enum + { + LINEAR = 0, + STEEP, + SCURVE, + CUSTOM, + NONE, + }; +}; + +struct ForceFieldCoordinateSystemType +{ + enum Enum + { + CARTESIAN = 0, + SPHERICAL, + CYLINDRICAL, + TOROIDAL, + }; +}; + +struct ForceFieldKernelType +{ + enum Enum + { + RADIAL = 0, + GENERIC + }; +}; + +//struct ForceFieldShapeDesc +#define INPLACE_TYPE_STRUCT_NAME ForceFieldShapeDesc +#define INPLACE_TYPE_STRUCT_FIELDS \ + INPLACE_TYPE_FIELD(InplaceEnum<ForceFieldShapeType::Enum>, type) \ + INPLACE_TYPE_FIELD(PxMat44, forceFieldToShape) \ + INPLACE_TYPE_FIELD(PxVec3, dimensions) +#include INPLACE_TYPE_BUILD() + + +//struct NoiseParams +#define INPLACE_TYPE_STRUCT_NAME NoiseParams +#define INPLACE_TYPE_STRUCT_FIELDS \ + INPLACE_TYPE_FIELD(float, strength) \ + INPLACE_TYPE_FIELD(float, spaceScale) \ + INPLACE_TYPE_FIELD(float, timeScale) \ + INPLACE_TYPE_FIELD(uint32_t, octaves) +#include INPLACE_TYPE_BUILD() + +//struct ForceFieldCoordinateSystem +#define INPLACE_TYPE_STRUCT_NAME ForceFieldCoordinateSystem +#define INPLACE_TYPE_STRUCT_FIELDS \ + INPLACE_TYPE_FIELD(InplaceEnum<ForceFieldCoordinateSystemType::Enum>, type) \ + INPLACE_TYPE_FIELD(float, torusRadius) +#include INPLACE_TYPE_BUILD() + +//struct ForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_NAME ForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_FIELDS \ + INPLACE_TYPE_FIELD(PxMat44, pose) \ + INPLACE_TYPE_FIELD(float, strength) \ + INPLACE_TYPE_FIELD(ForceFieldShapeDesc, includeShape) +#include INPLACE_TYPE_BUILD() + +//struct GenericForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_NAME GenericForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_BASE ForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_FIELDS \ + INPLACE_TYPE_FIELD(ForceFieldCoordinateSystem, cs) \ + INPLACE_TYPE_FIELD(PxVec3, constant) \ + INPLACE_TYPE_FIELD(PxMat33, positionMultiplier) \ + INPLACE_TYPE_FIELD(PxVec3, positionTarget) \ + INPLACE_TYPE_FIELD(PxMat33, velocityMultiplier) \ + INPLACE_TYPE_FIELD(PxVec3, velocityTarget) \ + INPLACE_TYPE_FIELD(PxVec3, noise) \ + INPLACE_TYPE_FIELD(PxVec3, falloffLinear) \ + INPLACE_TYPE_FIELD(PxVec3, falloffQuadratic) +#include INPLACE_TYPE_BUILD() + +//struct RadialForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_NAME RadialForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_BASE ForceFieldFSKernelParams +#define INPLACE_TYPE_STRUCT_FIELDS \ + INPLACE_TYPE_FIELD(float, radius) \ + INPLACE_TYPE_FIELD(TableLookup, falloffTable) \ + INPLACE_TYPE_FIELD(NoiseParams, noiseParams) +#include INPLACE_TYPE_BUILD() + +APEX_CUDA_CALLABLE PX_INLINE bool isPosInShape(const ForceFieldShapeDesc& shapeParams, const PxVec3& pos) +{ + // Sphere: x = radius + // Capsule: x = radius, y = height + // Cylinder: x = radius, y = height + // Cone: x = top radius, y = height, z = bottom radius + // Box: x,y,z = half-dimensions + + // transform position from force field coordinates to local shape coordinates + PxVec3 shapePos = shapeParams.forceFieldToShape.transform(pos); + + switch (shapeParams.type) + { + case ForceFieldShapeType::SPHERE: + { + return (shapePos.magnitude() <= shapeParams.dimensions.x); + } + case ForceFieldShapeType::CAPSULE: + { + float halfHeight = shapeParams.dimensions.y / 2.0f; + + // check if y-position is within height of cylinder + if (shapePos.y >= -halfHeight && shapePos.y <= halfHeight) + { + // check if x and z positions is inside radius height of cylinder + if (PxSqrt(shapePos.x * shapePos.x + shapePos.z * shapePos.z) <= shapeParams.dimensions.x) + { + return true; + } + } + + // check if position falls inside top sphere in capsule + PxVec3 spherePos = shapePos - PxVec3(0, halfHeight, 0); + if (spherePos.magnitude() <= shapeParams.dimensions.x) + { + return true; + } + + // check if position falls inside bottom sphere in capsule + spherePos = shapePos + PxVec3(0, halfHeight, 0); + if (spherePos.magnitude() <= shapeParams.dimensions.x) + { + return true; + } + + return false; + } + case ForceFieldShapeType::CYLINDER: + { + float halfHeight = shapeParams.dimensions.y / 2.0f; + + // check if y-position is within height of cylinder + if (shapePos.y >= -halfHeight && shapePos.y <= halfHeight) + { + // check if x and z positions is inside radius height of cylinder + if (PxSqrt(shapePos.x * shapePos.x + shapePos.z * shapePos.z) <= shapeParams.dimensions.x) + { + return true; + } + } + return false; + } + case ForceFieldShapeType::CONE: + { + float halfHeight = shapeParams.dimensions.y / 2.0f; + + // check if y-position is within height of cone + if (shapePos.y >= -halfHeight && shapePos.y <= halfHeight) + { + // cone can be normal or inverted + float smallerBase; + float heightFromSmallerBase; + float radiusDiff; + if (shapeParams.dimensions.x > shapeParams.dimensions.z) + { + smallerBase = shapeParams.dimensions.z; + heightFromSmallerBase = shapePos.y + halfHeight; + radiusDiff = shapeParams.dimensions.x - shapeParams.dimensions.z; + } + else + { + smallerBase = shapeParams.dimensions.x; + heightFromSmallerBase = halfHeight - shapePos.y; + radiusDiff = shapeParams.dimensions.z - shapeParams.dimensions.x; + } + + // compute radius at y-position along height of cone + float radiusAlongCone = smallerBase + (heightFromSmallerBase / shapeParams.dimensions.y) * radiusDiff; + + // check if x and z positions is inside radius at a specific height of cone + if (PxSqrt(shapePos.x * shapePos.x + shapePos.z * shapePos.z) <= radiusAlongCone) + { + return true; + } + } + return false; + } + case ForceFieldShapeType::BOX: + { + return (PxAbs(shapePos.x) <= shapeParams.dimensions.x && + PxAbs(shapePos.y) <= shapeParams.dimensions.y && + PxAbs(shapePos.z) <= shapeParams.dimensions.z); + } + default: + { + return false; + } + } +} + +APEX_CUDA_CALLABLE PX_INLINE PxVec3 getNoise(const NoiseParams& params, const PxVec3& pos, const uint32_t& totalElapsedMS) +{ + PxVec3 point = params.spaceScale * pos; + float time = (params.timeScale * 1e-3f) * totalElapsedMS; + + PxVec4 dFx; + dFx.setZero(); + PxVec4 dFy; + dFy.setZero(); + PxVec4 dFz; + dFz.setZero(); + int seed = 0; + float amp = 1.0f; + for (uint32_t i = 0; i < params.octaves; ++i) + { + dFx += amp * SimplexNoise::eval4D(point.x, point.y, point.z, time, ++seed); + dFy += amp * SimplexNoise::eval4D(point.x, point.y, point.z, time, ++seed); + dFz += amp * SimplexNoise::eval4D(point.x, point.y, point.z, time, ++seed); + + point *= 2; + time *= 2; + amp *= 0.5f; + } + + //get rotor + PxVec3 rot; + rot.x = dFz.y - dFy.z; + rot.y = dFx.z - dFz.x; + rot.z = dFy.x - dFx.y; + + return params.strength * rot; +} + +APEX_CUDA_CALLABLE PX_INLINE PxVec3 executeForceFieldMainFS(const RadialForceFieldFSKernelParams& params, const PxVec3& pos, const uint32_t& totalElapsedMS) +{ + // bring pos to force field coordinate system + PxVec3 localPos = params.pose.inverseRT().transform(pos); + + if (isPosInShape(params.includeShape, localPos)) + { + PxVec3 result = localPos.getNormalized(); + result = result * params.strength; + + // apply falloff + result = result * params.falloffTable.lookupTableValue(localPos.magnitude() / params.radius); + + // apply noise + result = result + getNoise(params.noiseParams, localPos, totalElapsedMS); + + // rotate result back to world coordinate system + return params.pose.rotate(result); + } + + return PxVec3(0, 0, 0); +} + +// function to compute the Scalar falloff for the cylinderical, toroidal, cartesian and generic +// force fields so that the falloff does not make the direction of the force vector change. +APEX_CUDA_CALLABLE PX_INLINE float falloff(PxVec3 val, PxVec3 linearff, PxVec3 quadraticff) +{ + float magnitude = val.magnitude(); + float v = (linearff.x * magnitude + quadraticff.x * magnitude * magnitude) + + (linearff.y * magnitude + quadraticff.y * magnitude * magnitude) + + (linearff.z * magnitude + quadraticff.z * magnitude * magnitude); + v += 1.0f; + //PX_ASSERT(v>0); + return 1.0f/v; +} + +APEX_CUDA_CALLABLE PX_INLINE PxVec3 genericEvalLinearKernel(const PxVec3& localPos, const PxVec3& localVel, const GenericForceFieldFSKernelParams& params) +{ + const bool useFalloff = params.falloffLinear.magnitudeSquared() + + params.falloffQuadratic.magnitudeSquared() != 0; + + const bool useVelMul = !(params.velocityMultiplier.column0.isZero() && + params.velocityMultiplier.column1.isZero() && + params.velocityMultiplier.column2.isZero()); + + const bool usePosMul = !(params.positionMultiplier.column0.isZero() && + params.positionMultiplier.column1.isZero() && + params.positionMultiplier.column2.isZero()); + + + PxVec3 ffPosErr; + PxMat33 tangentFrame; + PxVec3 ffForce = params.constant; + switch(params.cs.type) + { + case ForceFieldCoordinateSystemType::CARTESIAN: + { + ffPosErr = params.positionTarget - (localPos); + } + break; + case ForceFieldCoordinateSystemType::SPHERICAL: + { + const float& r = localPos.x; + ffPosErr = PxVec3(params.positionTarget.x - r, 0, 0); + } + break; + case ForceFieldCoordinateSystemType::CYLINDRICAL: + { + const float& r = localPos.x; + ffPosErr = PxVec3(params.positionTarget.x - r, params.positionTarget.y - localPos.y, 0); + } + break; + case ForceFieldCoordinateSystemType::TOROIDAL: + { + float r = 0.0f; + PxVec3 t0; + PxVec3 circleDir(localPos.x, 0.0f, localPos.z); + float l2 = circleDir.magnitudeSquared(); + if(l2<1e-4f*1e-4f) + { + circleDir = PxVec3(0); + } + else + { + circleDir /= PxSqrt(l2); // Normalize circleDir + PxVec3 circlePoint = circleDir * params.cs.torusRadius; + t0 = localPos - circlePoint; + l2 = t0.magnitudeSquared(); + if(l2<1e-4f*1e-4f) + { + circleDir = PxVec3(0); + t0 = PxVec3(0); + } + else + { + r = PxSqrt(l2); + t0 /= r; // Normalize t0 + } + } + PxVec3 t1(-circleDir.z, 0.0f, circleDir.x); // PxVec3 t1 = circleDir.cross(PxVec3(0,1,0)); + tangentFrame.column0 = t0; + tangentFrame.column1 = t1; + tangentFrame.column2 = t0.cross(t1); + ffPosErr = PxVec3(params.positionTarget.x - r, 0, 0); + } + break; + } + + PxVec3 ffVel = (params.cs.type == ForceFieldCoordinateSystemType::TOROIDAL) ? tangentFrame.getInverse() * localVel : localVel; + + if(useVelMul) + { + ffForce += params.velocityMultiplier * (params.velocityTarget - ffVel); + } + + if(usePosMul) + { + ffForce += params.positionMultiplier * ffPosErr; + } + + //TODO, enable noise, with existing noise functionality + //applyNoise(ffForce, params.noise, NpPhysicsSDK::instance->getNpPhysicsTls()->mNpLinearKernelRnd); + //ffForce *= PxVec3(1) + params.noise * [-1, 1]^3 + + if(useFalloff) + { + ffForce *= falloff(ffPosErr, params.falloffLinear, params.falloffQuadratic); + } + + PxVec3 force = (params.cs.type == ForceFieldCoordinateSystemType::TOROIDAL) ? tangentFrame * ffForce : ffForce; + return force; +} + +APEX_CUDA_CALLABLE PX_INLINE void genericEvalCartesian(PxVec3& force, const PxVec3& localPos, const PxVec3& localVel, const GenericForceFieldFSKernelParams& params) +{ + // compute tangent frame + // -- none here + + // evaluate kernel + force = genericEvalLinearKernel(localPos, localVel, params); +} + +APEX_CUDA_CALLABLE PX_INLINE void genericEvalSpherical(PxVec3& force, const PxVec3& localPos, const PxVec3& localVel, const GenericForceFieldFSKernelParams& params) +{ + // compute tangent frame + PxMat33 tangentFrame(PxZero); + float l2 = localPos.magnitudeSquared(); + PxVec3 tangentPos; + if(l2>1e-4f*1e-4f) + { + float r = PxSqrt(l2); + PxVec3 t0 = localPos/r; + tangentFrame.column0 = t0; + tangentPos = PxVec3(r, 0, 0); + } + else + { + tangentPos = PxVec3(0); + } + + // compute tangent frame velocity + const PxVec3 tangentVel = tangentFrame.getInverse() * localVel; + + // evaluate kernel + force = genericEvalLinearKernel(tangentPos, tangentVel, params); + + // transform back to local space + force = tangentFrame * force; +} + +APEX_CUDA_CALLABLE PX_INLINE void genericEvalCylindrical(PxVec3& force, const PxVec3& localPos, const PxVec3& localVel, const GenericForceFieldFSKernelParams& params) +{ + // compute tangent frame + PxMat33 tangentFrame; + PxVec3 t0(localPos.x, 0, localPos.z); // Project to Cylindrical + const float len = t0.magnitude(); + PxVec3 tangentPos; + if(len > 1e-4f) + { + t0 /= len; + tangentPos = PxVec3(len, localPos.y, 0); + } + else + { + t0 = PxVec3(0); + tangentPos = PxVec3(0, localPos.y, 0); + } + tangentFrame.column0 = t0; + tangentFrame.column1 = PxVec3(0.0f, 1.0f, 0.0f); // t1 + tangentFrame.column2 = PxVec3(-t0.z, 0.0f, t0.x); // t0.cross(t1) + + // compute tangent frame velocity + const PxVec3 tangentVel = tangentFrame.getInverse() * localVel; + + // evaluate kernel + force = genericEvalLinearKernel(tangentPos, tangentVel, params); + + // transform back to local space + force = tangentFrame * force; +} + +APEX_CUDA_CALLABLE PX_INLINE void genericEvalToroidal(PxVec3& force, const PxVec3& localPos, const PxVec3& localVel, const GenericForceFieldFSKernelParams& params) +{ + // evaluate kernel + force = genericEvalLinearKernel(localPos, localVel, params); +} + +/** +This is more or less a 1:1 copy of PhysX 2.8.4/UE3 generic force fields. +Since 2.8.4 supported more flexible callbacks, we should probably optimize +this quite a bit. +*/ +APEX_CUDA_CALLABLE PX_INLINE PxVec3 executeForceFieldMainFS(const GenericForceFieldFSKernelParams& params, const PxVec3& pos, const PxVec3& vel, const uint32_t&) +{ + // bring pos to force field coordinate system + PxVec3 localPos = params.pose.inverseRT().transform(pos); + + if (isPosInShape(params.includeShape, localPos)) + { + PxVec3 localVel = params.pose.inverseRT().rotate(vel); + + PxVec3 result(0); + switch (params.cs.type) + { + case ForceFieldCoordinateSystemType::CARTESIAN: + genericEvalCartesian(result, localPos, localVel, params); + break; + case ForceFieldCoordinateSystemType::SPHERICAL: + genericEvalSpherical(result, localPos, localVel, params); + break; + case ForceFieldCoordinateSystemType::CYLINDRICAL: + genericEvalCylindrical(result, localPos, localVel, params); + break; + case ForceFieldCoordinateSystemType::TOROIDAL: + genericEvalToroidal(result, localPos, localVel, params); + break; + default: + break; + } + + // apply strength + result = result * params.strength; + + // rotate result back to world coordinate system + return params.pose.rotate(result); + } + + return PxVec3(0, 0, 0); +} + +APEX_CUDA_CALLABLE PX_INLINE PxVec3 executeForceFieldFS(const RadialForceFieldFSKernelParams& params, const PxVec3& pos, const uint32_t& totalElapsedMS) +{ + PxVec3 resultField(0, 0, 0); + resultField += executeForceFieldMainFS(params, pos, totalElapsedMS); + return resultField; +} + +APEX_CUDA_CALLABLE PX_INLINE PxVec3 executeForceFieldFS(const GenericForceFieldFSKernelParams& params, const PxVec3& pos, const PxVec3& vel, const uint32_t& totalElapsedMS) +{ + PxVec3 resultField(0, 0, 0); + resultField += executeForceFieldMainFS(params, pos, vel, totalElapsedMS); + return resultField; +} + +} +} // end namespace nvidia + +#endif diff --git a/APEX_1.4/module/forcefield/include/ForceFieldScene.h b/APEX_1.4/module/forcefield/include/ForceFieldScene.h new file mode 100644 index 00000000..1c751fed --- /dev/null +++ b/APEX_1.4/module/forcefield/include/ForceFieldScene.h @@ -0,0 +1,203 @@ +/* + * 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 __FORCEFIELD_SCENE_H__ +#define __FORCEFIELD_SCENE_H__ + +#include "Apex.h" + +#include "ModuleForceFieldImpl.h" + +#include "ApexResource.h" +#include "ApexContext.h" +#include "ApexSDKHelpers.h" + +#include "RenderDebugInterface.h" +#include "ApexSDKIntl.h" +#include "ModuleIntl.h" + +#include "DebugRenderParams.h" +#include "ForceFieldDebugRenderParams.h" + +#include "PxTask.h" + +#include "FieldSamplerSceneIntl.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<ForceFieldSceneGPU*>(scene)->APEX_CUDA_OBJ_NAME(name) +#define CUDA_OBJ(name) SCENE_CUDA_OBJ(mForceFieldScene, name) +#endif + +namespace nvidia +{ +namespace apex +{ +class SceneIntl; +class DebugRenderParams; +class FieldSamplerManagerIntl; +} +namespace forcefield +{ +class ModuleForceFieldImpl; +class ForceFieldActorImpl; +class ForceFieldActorDesc; + + +class ForceFieldScene : public FieldSamplerSceneIntl, public ApexContext, public ApexResourceInterface, public ApexResource +{ +public: + ForceFieldScene(ModuleForceFieldImpl& module, SceneIntl& scene, RenderDebugInterface* renderDebug, ResourceList& list); + ~ForceFieldScene(); + + /* ModuleSceneIntl */ + void updateActors(float deltaTime); + void submitTasks(float elapsedTime, float substepSize, uint32_t numSubSteps); + void setTaskDependencies(); + + virtual void visualize(void); + virtual void visualizeForceFieldForceFields(void); + virtual void visualizeForceFieldForces(void); + virtual void fetchResults(void); + + virtual void setModulePhysXScene(PxScene* s); + virtual PxScene* getModulePhysXScene() const + { + return mPhysXScene; + } + + virtual Module* getModule() + { + return mModule; + } + + bool lockRenderResources() + { + renderLockAllActors(); // Lock options not implemented yet + return true; + } + + bool unlockRenderResources() + { + renderUnLockAllActors(); // Lock options not implemented yet + return true; + } + + /* ApexResourceInterface */ + uint32_t getListIndex(void) const + { + return m_listIndex; + } + void setListIndex(ResourceList& list, uint32_t index) + { + m_listIndex = index; + m_list = &list; + } + virtual void release(void) + { + mModule->releaseModuleSceneIntl(*this); + } + + virtual ForceFieldActorImpl* createForceFieldActor(const ForceFieldActorDesc& desc, ForceFieldAssetImpl& asset, ResourceList& list) = 0; + + SceneIntl& getApexScene() const + { + return *mApexScene; + } + + FieldSamplerManagerIntl* getInternalFieldSamplerManager(); + + /* FieldSamplerSceneIntl */ + virtual void getFieldSamplerSceneDesc(FieldSamplerSceneDescIntl& ) const + { + } + +protected: + void destroy(); + + ModuleForceFieldImpl* mModule; + SceneIntl* mApexScene; + PxScene* mPhysXScene; + + RenderDebugInterface* mRenderDebug; + + DebugRenderParams* mDebugRenderParams; + ForceFieldDebugRenderParams* mForceFieldDebugRenderParams; + + FieldSamplerManagerIntl* mFieldSamplerManager; + +private: + class TaskUpdate : public PxTask + { + public: + TaskUpdate(ForceFieldScene& owner) : mOwner(owner) {} + const char* getName() const + { + return "ForceFieldScene::Update"; + } + void run(); + protected: + ForceFieldScene& mOwner; + private: + TaskUpdate& operator=(const TaskUpdate&); + }; + + TaskUpdate mUpdateTask; + + friend class ModuleForceFieldImpl; + friend class ForceFieldActorImpl; + friend class TaskUpdate; +}; + +class ForceFieldSceneCPU : public ForceFieldScene +{ +public: + ForceFieldSceneCPU(ModuleForceFieldImpl& module, SceneIntl& scene, RenderDebugInterface* renderDebug, ResourceList& list); + ~ForceFieldSceneCPU(); + + ForceFieldActorImpl* createForceFieldActor(const ForceFieldActorDesc& desc, ForceFieldAssetImpl& asset, ResourceList& list); + + /* FieldSamplerSceneIntl */ + +protected: +}; + +#if APEX_CUDA_SUPPORT +class ForceFieldSceneGPU : public ForceFieldScene, public CudaModuleScene +{ +public: + ForceFieldSceneGPU(ModuleForceFieldImpl& module, SceneIntl& scene, RenderDebugInterface* renderDebug, ResourceList& list); + ~ForceFieldSceneGPU(); + + ForceFieldActorImpl* createForceFieldActor(const ForceFieldActorDesc& desc, ForceFieldAssetImpl& asset, ResourceList& list); + +//CUDA module objects +#include "../cuda/include/ForceField.h" + + /* FieldSamplerSceneIntl */ + virtual ApexCudaConstStorage* getFieldSamplerCudaConstStorage(); + virtual bool launchFieldSamplerCudaKernel(const nvidia::fieldsampler::FieldSamplerKernelLaunchDataIntl&); + +protected: + /* keep a convenience pointer to the cuda context manager */ + PxCudaContextManager* mCtxMgr; +}; +#endif + +} +} // end namespace nvidia + +#endif diff --git a/APEX_1.4/module/forcefield/include/ModuleEventDefs.h b/APEX_1.4/module/forcefield/include/ModuleEventDefs.h new file mode 100644 index 00000000..fad8349b --- /dev/null +++ b/APEX_1.4/module/forcefield/include/ModuleEventDefs.h @@ -0,0 +1,29 @@ +/* + * 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 AgPerfMonEventSrcAPI.h +// and by AgPerfMonEventSrcAPI.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(ForceFieldModuleInit) +DEFINE_EVENT(ForceFieldSceneFetchResults) +DEFINE_EVENT(ForceFieldDrawIcon) +DEFINE_EVENT(ForceFieldDrawForceFieldPreview) diff --git a/APEX_1.4/module/forcefield/include/ModuleForceFieldImpl.h b/APEX_1.4/module/forcefield/include/ModuleForceFieldImpl.h new file mode 100644 index 00000000..f7b99b86 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/ModuleForceFieldImpl.h @@ -0,0 +1,136 @@ +/* + * 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_FORCEFIELD_IMPL_H__ +#define __MODULE_FORCEFIELD_IMPL_H__ + +#include "Apex.h" +#include "ModuleForceField.h" +#include "ApexSDKIntl.h" +#include "ModuleIntl.h" +#include "ModuleBase.h" + +#include "ApexSDKHelpers.h" +#include "ApexRWLockable.h" +#include "ReadCheck.h" +#include "WriteCheck.h" +#include "ModuleForceFieldRegistration.h" + +namespace nvidia +{ +namespace apex +{ +class SceneIntl; +class ModuleFieldSamplerIntl; +} +namespace forcefield +{ + +class ForceFieldAssetImpl; +class ForceFieldAssetAuthoringImpl; +class ForceFieldScene; + +class ModuleForceFieldDesc : public ApexDesc +{ +public: + + /** + \brief Constructor sets to default. + */ + PX_INLINE ModuleForceFieldDesc() + { + setToDefault(); + } + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault() + { + ApexDesc::setToDefault(); + moduleValue = 0; + } + + /** + Returns true if an object can be created using this descriptor. + */ + PX_INLINE bool isValid() const + { + return ApexDesc::isValid(); + } + + /** + ModuleBase configurable parameter. + */ + uint32_t moduleValue; +}; + + +class ModuleForceFieldImpl : public ModuleForceField, public ModuleIntl, public ModuleBase, public ApexRWLockable +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + ModuleForceFieldImpl(ApexSDKIntl* sdk); + ~ModuleForceFieldImpl(); + + void init(const ModuleForceFieldDesc& explosionDesc); + + // 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&); + uint32_t forceLoadAssets(); + AuthObjTypeID getModuleID() const; + RenderableIterator* createRenderableIterator(const Scene&); + + AuthObjTypeID getForceFieldAssetTypeID() const; + + uint32_t getModuleValue() const + { + READ_ZONE(); + return mModuleValue; + } + + ModuleFieldSamplerIntl* getInternalModuleFieldSampler(); + +protected: + ForceFieldScene* getForceFieldScene(const Scene& apexScene); + + ResourceList mAuthorableObjects; + + ResourceList mForceFieldScenes; + + uint32_t mModuleValue; + + ModuleFieldSamplerIntl* mFieldSamplerModule; + + friend class ForceFieldAssetImpl; + +private: + + ForceFieldModuleParams* mModuleParams; +}; + +} +} // end namespace nvidia + +#endif // __MODULE_FORCEFIELD_IMPL_H__ diff --git a/APEX_1.4/module/forcefield/include/ModulePerfScope.h b/APEX_1.4/module/forcefield/include/ModulePerfScope.h new file mode 100644 index 00000000..56e6adeb --- /dev/null +++ b/APEX_1.4/module/forcefield/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 forcefield +#include "ModuleProfileCommon.h" + +#endif
\ No newline at end of file diff --git a/APEX_1.4/module/forcefield/include/autogen/ForceFieldActorParams.h b/APEX_1.4/module/forcefield/include/autogen/ForceFieldActorParams.h new file mode 100644 index 00000000..12b6111a --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ForceFieldActorParams.h @@ -0,0 +1,233 @@ +// 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_ForceFieldActorParams_h +#define HEADER_ForceFieldActorParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace ForceFieldActorParamsNS +{ + + + +struct ParametersStruct +{ + + physx::PxTransform initialPose; + float scale; + NvParameterized::DummyStringStruct fieldBoundaryFilterDataName; + NvParameterized::DummyStringStruct fieldSamplerFilterDataName; + +}; + +static const uint32_t checksum[] = { 0xcc531b53, 0xf5e67337, 0x01ed51a1, 0x940acec1, }; + +} // namespace ForceFieldActorParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class ForceFieldActorParams : public NvParameterized::NvParameters, public ForceFieldActorParamsNS::ParametersStruct +{ +public: + ForceFieldActorParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~ForceFieldActorParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("ForceFieldActorParams"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)1; + + 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(ForceFieldActorParamsNS::checksum); + return ForceFieldActorParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const ForceFieldActorParamsNS::ParametersStruct& parameters(void) const + { + ForceFieldActorParams* tmpThis = const_cast<ForceFieldActorParams*>(this); + return *(static_cast<ForceFieldActorParamsNS::ParametersStruct*>(tmpThis)); + } + + ForceFieldActorParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<ForceFieldActorParamsNS::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 ForceFieldActorParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + ForceFieldActorParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(ForceFieldActorParams), ForceFieldActorParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, ForceFieldActorParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldActorParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(ForceFieldActorParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, ForceFieldActorParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, ForceFieldActorParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, ForceFieldActorParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldActorParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of ForceFieldActorParams 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 (ForceFieldActorParams*)bufObj; + } + + virtual const char* getClassName() + { + return (ForceFieldActorParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (ForceFieldActorParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (ForceFieldActorParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (ForceFieldActorParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/ForceFieldAssetParams.h b/APEX_1.4/module/forcefield/include/autogen/ForceFieldAssetParams.h new file mode 100644 index 00000000..658efd24 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ForceFieldAssetParams.h @@ -0,0 +1,243 @@ +// 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_ForceFieldAssetParams_h +#define HEADER_ForceFieldAssetParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace ForceFieldAssetParamsNS +{ + +struct IncludeShapeParameters_Type; + +struct IncludeShapeParameters_Type +{ + const char* shape; + physx::PxMat44 forceFieldToShape; + physx::PxVec3 dimensions; +}; + +struct ParametersStruct +{ + + NvParameterized::Interface* forceFieldKernelType; + float defScale; + float strength; + float lifetime; + IncludeShapeParameters_Type includeShapeParameters; + NvParameterized::DummyStringStruct fieldBoundaryFilterDataName; + NvParameterized::DummyStringStruct fieldSamplerFilterDataName; + +}; + +static const uint32_t checksum[] = { 0xe5a9b1aa, 0x3070d787, 0x1e3b66da, 0x094e7338, }; + +} // namespace ForceFieldAssetParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class ForceFieldAssetParams : public NvParameterized::NvParameters, public ForceFieldAssetParamsNS::ParametersStruct +{ +public: + ForceFieldAssetParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~ForceFieldAssetParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("ForceFieldAssetParams"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)1; + + 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(ForceFieldAssetParamsNS::checksum); + return ForceFieldAssetParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const ForceFieldAssetParamsNS::ParametersStruct& parameters(void) const + { + ForceFieldAssetParams* tmpThis = const_cast<ForceFieldAssetParams*>(this); + return *(static_cast<ForceFieldAssetParamsNS::ParametersStruct*>(tmpThis)); + } + + ForceFieldAssetParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<ForceFieldAssetParamsNS::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 ForceFieldAssetParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + ForceFieldAssetParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(ForceFieldAssetParams), ForceFieldAssetParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, ForceFieldAssetParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldAssetParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(ForceFieldAssetParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, ForceFieldAssetParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, ForceFieldAssetParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, ForceFieldAssetParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldAssetParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of ForceFieldAssetParams 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 (ForceFieldAssetParams*)bufObj; + } + + virtual const char* getClassName() + { + return (ForceFieldAssetParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (ForceFieldAssetParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (ForceFieldAssetParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (ForceFieldAssetParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/ForceFieldAssetPreviewParams.h b/APEX_1.4/module/forcefield/include/autogen/ForceFieldAssetPreviewParams.h new file mode 100644 index 00000000..17143b43 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ForceFieldAssetPreviewParams.h @@ -0,0 +1,234 @@ +// 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_ForceFieldAssetPreviewParams_h +#define HEADER_ForceFieldAssetPreviewParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace ForceFieldAssetPreviewParamsNS +{ + + + +struct ParametersStruct +{ + + physx::PxMat44 pose; + float iconScale; + bool drawIcon; + bool drawBoundaries; + bool drawBold; + +}; + +static const uint32_t checksum[] = { 0x7e31b030, 0x359317ac, 0x60fcab26, 0xe033ecb7, }; + +} // namespace ForceFieldAssetPreviewParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class ForceFieldAssetPreviewParams : public NvParameterized::NvParameters, public ForceFieldAssetPreviewParamsNS::ParametersStruct +{ +public: + ForceFieldAssetPreviewParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~ForceFieldAssetPreviewParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("ForceFieldAssetPreviewParams"); + } + + 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(ForceFieldAssetPreviewParamsNS::checksum); + return ForceFieldAssetPreviewParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const ForceFieldAssetPreviewParamsNS::ParametersStruct& parameters(void) const + { + ForceFieldAssetPreviewParams* tmpThis = const_cast<ForceFieldAssetPreviewParams*>(this); + return *(static_cast<ForceFieldAssetPreviewParamsNS::ParametersStruct*>(tmpThis)); + } + + ForceFieldAssetPreviewParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<ForceFieldAssetPreviewParamsNS::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 ForceFieldAssetPreviewParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + ForceFieldAssetPreviewParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(ForceFieldAssetPreviewParams), ForceFieldAssetPreviewParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, ForceFieldAssetPreviewParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldAssetPreviewParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(ForceFieldAssetPreviewParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, ForceFieldAssetPreviewParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, ForceFieldAssetPreviewParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, ForceFieldAssetPreviewParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldAssetPreviewParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of ForceFieldAssetPreviewParams 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 (ForceFieldAssetPreviewParams*)bufObj; + } + + virtual const char* getClassName() + { + return (ForceFieldAssetPreviewParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (ForceFieldAssetPreviewParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (ForceFieldAssetPreviewParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (ForceFieldAssetPreviewParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/ForceFieldDebugRenderParams.h b/APEX_1.4/module/forcefield/include/autogen/ForceFieldDebugRenderParams.h new file mode 100644 index 00000000..7372cb44 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ForceFieldDebugRenderParams.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_ForceFieldDebugRenderParams_h +#define HEADER_ForceFieldDebugRenderParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace ForceFieldDebugRenderParamsNS +{ + + + +struct ParametersStruct +{ + + bool VISUALIZE_FORCEFIELD_ACTOR; + +}; + +static const uint32_t checksum[] = { 0xe1b8703d, 0x1fdfe32b, 0xdfd01cd1, 0x8ba595b4, }; + +} // namespace ForceFieldDebugRenderParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class ForceFieldDebugRenderParams : public NvParameterized::NvParameters, public ForceFieldDebugRenderParamsNS::ParametersStruct +{ +public: + ForceFieldDebugRenderParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~ForceFieldDebugRenderParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("ForceFieldDebugRenderParams"); + } + + 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(ForceFieldDebugRenderParamsNS::checksum); + return ForceFieldDebugRenderParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const ForceFieldDebugRenderParamsNS::ParametersStruct& parameters(void) const + { + ForceFieldDebugRenderParams* tmpThis = const_cast<ForceFieldDebugRenderParams*>(this); + return *(static_cast<ForceFieldDebugRenderParamsNS::ParametersStruct*>(tmpThis)); + } + + ForceFieldDebugRenderParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<ForceFieldDebugRenderParamsNS::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 ForceFieldDebugRenderParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + ForceFieldDebugRenderParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(ForceFieldDebugRenderParams), ForceFieldDebugRenderParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, ForceFieldDebugRenderParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldDebugRenderParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(ForceFieldDebugRenderParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, ForceFieldDebugRenderParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, ForceFieldDebugRenderParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, ForceFieldDebugRenderParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldDebugRenderParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of ForceFieldDebugRenderParams 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 (ForceFieldDebugRenderParams*)bufObj; + } + + virtual const char* getClassName() + { + return (ForceFieldDebugRenderParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (ForceFieldDebugRenderParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (ForceFieldDebugRenderParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (ForceFieldDebugRenderParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/ForceFieldFalloffParams.h b/APEX_1.4/module/forcefield/include/autogen/ForceFieldFalloffParams.h new file mode 100644 index 00000000..be2c3f24 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ForceFieldFalloffParams.h @@ -0,0 +1,233 @@ +// 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_ForceFieldFalloffParams_h +#define HEADER_ForceFieldFalloffParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace ForceFieldFalloffParamsNS +{ + + + +struct ParametersStruct +{ + + const char* type; + float multiplier; + float start; + float end; + +}; + +static const uint32_t checksum[] = { 0x6c2d91a1, 0xd148985c, 0xcfbee3bb, 0xefb2f190, }; + +} // namespace ForceFieldFalloffParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class ForceFieldFalloffParams : public NvParameterized::NvParameters, public ForceFieldFalloffParamsNS::ParametersStruct +{ +public: + ForceFieldFalloffParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~ForceFieldFalloffParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("ForceFieldFalloffParams"); + } + + 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(ForceFieldFalloffParamsNS::checksum); + return ForceFieldFalloffParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const ForceFieldFalloffParamsNS::ParametersStruct& parameters(void) const + { + ForceFieldFalloffParams* tmpThis = const_cast<ForceFieldFalloffParams*>(this); + return *(static_cast<ForceFieldFalloffParamsNS::ParametersStruct*>(tmpThis)); + } + + ForceFieldFalloffParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<ForceFieldFalloffParamsNS::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 ForceFieldFalloffParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + ForceFieldFalloffParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(ForceFieldFalloffParams), ForceFieldFalloffParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, ForceFieldFalloffParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldFalloffParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(ForceFieldFalloffParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, ForceFieldFalloffParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, ForceFieldFalloffParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, ForceFieldFalloffParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldFalloffParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of ForceFieldFalloffParams 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 (ForceFieldFalloffParams*)bufObj; + } + + virtual const char* getClassName() + { + return (ForceFieldFalloffParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (ForceFieldFalloffParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (ForceFieldFalloffParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (ForceFieldFalloffParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/ForceFieldModuleParams.h b/APEX_1.4/module/forcefield/include/autogen/ForceFieldModuleParams.h new file mode 100644 index 00000000..eb7f8c9e --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ForceFieldModuleParams.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_ForceFieldModuleParams_h +#define HEADER_ForceFieldModuleParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace ForceFieldModuleParamsNS +{ + + + +struct ParametersStruct +{ + + uint32_t unused; + +}; + +static const uint32_t checksum[] = { 0x3c8f0dec, 0x042ae5c4, 0xd5557fc3, 0x0c637e85, }; + +} // namespace ForceFieldModuleParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class ForceFieldModuleParams : public NvParameterized::NvParameters, public ForceFieldModuleParamsNS::ParametersStruct +{ +public: + ForceFieldModuleParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~ForceFieldModuleParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("ForceFieldModuleParams"); + } + + 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(ForceFieldModuleParamsNS::checksum); + return ForceFieldModuleParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const ForceFieldModuleParamsNS::ParametersStruct& parameters(void) const + { + ForceFieldModuleParams* tmpThis = const_cast<ForceFieldModuleParams*>(this); + return *(static_cast<ForceFieldModuleParamsNS::ParametersStruct*>(tmpThis)); + } + + ForceFieldModuleParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<ForceFieldModuleParamsNS::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 ForceFieldModuleParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + ForceFieldModuleParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(ForceFieldModuleParams), ForceFieldModuleParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, ForceFieldModuleParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldModuleParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(ForceFieldModuleParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, ForceFieldModuleParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, ForceFieldModuleParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, ForceFieldModuleParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldModuleParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of ForceFieldModuleParams 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 (ForceFieldModuleParams*)bufObj; + } + + virtual const char* getClassName() + { + return (ForceFieldModuleParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (ForceFieldModuleParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (ForceFieldModuleParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (ForceFieldModuleParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/ForceFieldNoiseParams.h b/APEX_1.4/module/forcefield/include/autogen/ForceFieldNoiseParams.h new file mode 100644 index 00000000..1d843a84 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ForceFieldNoiseParams.h @@ -0,0 +1,233 @@ +// 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_ForceFieldNoiseParams_h +#define HEADER_ForceFieldNoiseParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace ForceFieldNoiseParamsNS +{ + + + +struct ParametersStruct +{ + + float strength; + float spaceScale; + float timeScale; + uint32_t octaves; + +}; + +static const uint32_t checksum[] = { 0x0bfb1c14, 0xbcb9bf7a, 0xb02be14c, 0x582b638f, }; + +} // namespace ForceFieldNoiseParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class ForceFieldNoiseParams : public NvParameterized::NvParameters, public ForceFieldNoiseParamsNS::ParametersStruct +{ +public: + ForceFieldNoiseParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~ForceFieldNoiseParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("ForceFieldNoiseParams"); + } + + 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(ForceFieldNoiseParamsNS::checksum); + return ForceFieldNoiseParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const ForceFieldNoiseParamsNS::ParametersStruct& parameters(void) const + { + ForceFieldNoiseParams* tmpThis = const_cast<ForceFieldNoiseParams*>(this); + return *(static_cast<ForceFieldNoiseParamsNS::ParametersStruct*>(tmpThis)); + } + + ForceFieldNoiseParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<ForceFieldNoiseParamsNS::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 ForceFieldNoiseParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + ForceFieldNoiseParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(ForceFieldNoiseParams), ForceFieldNoiseParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, ForceFieldNoiseParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldNoiseParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(ForceFieldNoiseParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, ForceFieldNoiseParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, ForceFieldNoiseParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, ForceFieldNoiseParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class ForceFieldNoiseParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of ForceFieldNoiseParams 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 (ForceFieldNoiseParams*)bufObj; + } + + virtual const char* getClassName() + { + return (ForceFieldNoiseParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (ForceFieldNoiseParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (ForceFieldNoiseParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (ForceFieldNoiseParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/GenericForceFieldKernelParams.h b/APEX_1.4/module/forcefield/include/autogen/GenericForceFieldKernelParams.h new file mode 100644 index 00000000..a542471a --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/GenericForceFieldKernelParams.h @@ -0,0 +1,244 @@ +// 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_GenericForceFieldKernelParams_h +#define HEADER_GenericForceFieldKernelParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace GenericForceFieldKernelParamsNS +{ + +struct CoordinateSystemParameters_Type; + +struct CoordinateSystemParameters_Type +{ + const char* type; + float torusRadius; +}; + +struct ParametersStruct +{ + + CoordinateSystemParameters_Type coordinateSystemParameters; + physx::PxVec3 constant; + physx::PxMat33 positionMultiplier; + physx::PxVec3 positionTarget; + physx::PxMat33 velocityMultiplier; + physx::PxVec3 velocityTarget; + physx::PxVec3 noise; + physx::PxVec3 falloffLinear; + physx::PxVec3 falloffQuadratic; + +}; + +static const uint32_t checksum[] = { 0xff6bc966, 0x041661be, 0x3110753d, 0x08c8332e, }; + +} // namespace GenericForceFieldKernelParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class GenericForceFieldKernelParams : public NvParameterized::NvParameters, public GenericForceFieldKernelParamsNS::ParametersStruct +{ +public: + GenericForceFieldKernelParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~GenericForceFieldKernelParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("GenericForceFieldKernelParams"); + } + + const char* className(void) const + { + return(staticClassName()); + } + + static const uint32_t ClassVersion = ((uint32_t)0 << 16) + (uint32_t)1; + + 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(GenericForceFieldKernelParamsNS::checksum); + return GenericForceFieldKernelParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const GenericForceFieldKernelParamsNS::ParametersStruct& parameters(void) const + { + GenericForceFieldKernelParams* tmpThis = const_cast<GenericForceFieldKernelParams*>(this); + return *(static_cast<GenericForceFieldKernelParamsNS::ParametersStruct*>(tmpThis)); + } + + GenericForceFieldKernelParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<GenericForceFieldKernelParamsNS::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 GenericForceFieldKernelParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + GenericForceFieldKernelParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(GenericForceFieldKernelParams), GenericForceFieldKernelParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, GenericForceFieldKernelParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class GenericForceFieldKernelParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(GenericForceFieldKernelParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, GenericForceFieldKernelParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, GenericForceFieldKernelParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, GenericForceFieldKernelParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class GenericForceFieldKernelParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of GenericForceFieldKernelParams 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 (GenericForceFieldKernelParams*)bufObj; + } + + virtual const char* getClassName() + { + return (GenericForceFieldKernelParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (GenericForceFieldKernelParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (GenericForceFieldKernelParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (GenericForceFieldKernelParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/ModuleForceFieldRegistration.h b/APEX_1.4/module/forcefield/include/autogen/ModuleForceFieldRegistration.h new file mode 100644 index 00000000..6954a256 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/ModuleForceFieldRegistration.h @@ -0,0 +1,138 @@ +/* + * 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_MODULEFORCEFIELDREGISTRATIONH_H +#define MODULE_MODULEFORCEFIELDREGISTRATIONH_H + +#include "PsAllocator.h" +#include "NvRegistrationsForTraitsBase.h" +#include "nvparameterized/NvParameterizedTraits.h" +#include "PxAssert.h" +#include <stdint.h> + +// INCLUDE GENERATED FACTORIES +#include "ForceFieldActorParams.h" +#include "ForceFieldAssetParams.h" +#include "ForceFieldAssetPreviewParams.h" +#include "ForceFieldDebugRenderParams.h" +#include "ForceFieldFalloffParams.h" +#include "ForceFieldNoiseParams.h" +#include "GenericForceFieldKernelParams.h" +#include "RadialForceFieldKernelParams.h" +#include "ForceFieldModuleParams.h" + + +// INCLUDE GENERATED CONVERSION + + +namespace nvidia { +namespace forcefield { + + +class ModuleForceFieldRegistration : public NvParameterized::RegistrationsForTraitsBase +{ +public: + static void invokeRegistration(NvParameterized::Traits* parameterizedTraits) + { + if (parameterizedTraits) + { + ModuleForceFieldRegistration().registerAll(*parameterizedTraits); + } + } + + static void invokeUnregistration(NvParameterized::Traits* parameterizedTraits) + { + if (parameterizedTraits) + { + ModuleForceFieldRegistration().unregisterAll(*parameterizedTraits); + } + } + + void registerAvailableFactories(NvParameterized::Traits& parameterizedTraits) + { + ::NvParameterized::Factory* factoriesToRegister[] = { +// REGISTER GENERATED FACTORIES + new nvidia::forcefield::ForceFieldActorParamsFactory(), + new nvidia::forcefield::ForceFieldAssetParamsFactory(), + new nvidia::forcefield::ForceFieldAssetPreviewParamsFactory(), + new nvidia::forcefield::ForceFieldDebugRenderParamsFactory(), + new nvidia::forcefield::ForceFieldFalloffParamsFactory(), + new nvidia::forcefield::ForceFieldNoiseParamsFactory(), + new nvidia::forcefield::GenericForceFieldKernelParamsFactory(), + new nvidia::forcefield::RadialForceFieldKernelParamsFactory(), + new nvidia::forcefield::ForceFieldModuleParamsFactory(), + + }; + + 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::forcefield::ForceFieldActorParamsFactory(), + new nvidia::forcefield::ForceFieldAssetParamsFactory(), + new nvidia::forcefield::ForceFieldAssetPreviewParamsFactory(), + new nvidia::forcefield::ForceFieldDebugRenderParamsFactory(), + new nvidia::forcefield::ForceFieldFalloffParamsFactory(), + new nvidia::forcefield::ForceFieldNoiseParamsFactory(), + new nvidia::forcefield::GenericForceFieldKernelParamsFactory(), + new nvidia::forcefield::RadialForceFieldKernelParamsFactory(), + new nvidia::forcefield::ForceFieldModuleParamsFactory(), + + }; + + 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(¶meterizedTraits); + delete removedFactory; + delete factoriesToUnregister[i]; + } + } + } + + virtual void unregisterAvailableConverters(NvParameterized::Traits& parameterizedTraits) + { +// UNREGISTER GENERATED CONVERSION +PX_UNUSED(parameterizedTraits); + + } + +}; + + +} +} //nvidia::forcefield + +#endif diff --git a/APEX_1.4/module/forcefield/include/autogen/RadialForceFieldKernelParams.h b/APEX_1.4/module/forcefield/include/autogen/RadialForceFieldKernelParams.h new file mode 100644 index 00000000..3eff9c46 --- /dev/null +++ b/APEX_1.4/module/forcefield/include/autogen/RadialForceFieldKernelParams.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_RadialForceFieldKernelParams_h +#define HEADER_RadialForceFieldKernelParams_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 forcefield +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +namespace RadialForceFieldKernelParamsNS +{ + + + +struct ParametersStruct +{ + + NvParameterized::Interface* falloffParameters; + NvParameterized::Interface* noiseParameters; + float radius; + +}; + +static const uint32_t checksum[] = { 0xa0410ec7, 0x17712202, 0x427b07d4, 0xa8ce4d70, }; + +} // namespace RadialForceFieldKernelParamsNS + +#ifndef NV_PARAMETERIZED_ONLY_LAYOUTS +class RadialForceFieldKernelParams : public NvParameterized::NvParameters, public RadialForceFieldKernelParamsNS::ParametersStruct +{ +public: + RadialForceFieldKernelParams(NvParameterized::Traits* traits, void* buf = 0, int32_t* refCount = 0); + + virtual ~RadialForceFieldKernelParams(); + + virtual void destroy(); + + static const char* staticClassName(void) + { + return("RadialForceFieldKernelParams"); + } + + 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(RadialForceFieldKernelParamsNS::checksum); + return RadialForceFieldKernelParamsNS::checksum; + } + + static void freeParameterDefinitionTable(NvParameterized::Traits* traits); + + const uint32_t* checksum(uint32_t& bits) const + { + return staticChecksum(bits); + } + + const RadialForceFieldKernelParamsNS::ParametersStruct& parameters(void) const + { + RadialForceFieldKernelParams* tmpThis = const_cast<RadialForceFieldKernelParams*>(this); + return *(static_cast<RadialForceFieldKernelParamsNS::ParametersStruct*>(tmpThis)); + } + + RadialForceFieldKernelParamsNS::ParametersStruct& parameters(void) + { + return *(static_cast<RadialForceFieldKernelParamsNS::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 RadialForceFieldKernelParamsFactory : public NvParameterized::Factory +{ + static const char* const vptr; + +public: + + virtual void freeParameterDefinitionTable(NvParameterized::Traits* traits) + { + RadialForceFieldKernelParams::freeParameterDefinitionTable(traits); + } + + virtual NvParameterized::Interface* create(NvParameterized::Traits* paramTraits) + { + // placement new on this class using mParameterizedTraits + + void* newPtr = paramTraits->alloc(sizeof(RadialForceFieldKernelParams), RadialForceFieldKernelParams::ClassAlignment); + if (!NvParameterized::IsAligned(newPtr, RadialForceFieldKernelParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class RadialForceFieldKernelParams"); + paramTraits->free(newPtr); + return 0; + } + + memset(newPtr, 0, sizeof(RadialForceFieldKernelParams)); // always initialize memory allocated to zero for default values + return NV_PARAM_PLACEMENT_NEW(newPtr, RadialForceFieldKernelParams)(paramTraits); + } + + virtual NvParameterized::Interface* finish(NvParameterized::Traits* paramTraits, void* bufObj, void* bufStart, int32_t* refCount) + { + if (!NvParameterized::IsAligned(bufObj, RadialForceFieldKernelParams::ClassAlignment) + || !NvParameterized::IsAligned(bufStart, RadialForceFieldKernelParams::ClassAlignment)) + { + NV_PARAM_TRAITS_WARNING(paramTraits, "Unaligned memory allocation for class RadialForceFieldKernelParams"); + return 0; + } + + // Init NvParameters-part + // We used to call empty constructor of RadialForceFieldKernelParams 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 (RadialForceFieldKernelParams*)bufObj; + } + + virtual const char* getClassName() + { + return (RadialForceFieldKernelParams::staticClassName()); + } + + virtual uint32_t getVersion() + { + return (RadialForceFieldKernelParams::staticVersion()); + } + + virtual uint32_t getAlignment() + { + return (RadialForceFieldKernelParams::ClassAlignment); + } + + virtual const uint32_t* getChecksum(uint32_t& bits) + { + return (RadialForceFieldKernelParams::staticChecksum(bits)); + } +}; +#endif // NV_PARAMETERIZED_ONLY_LAYOUTS + +} // namespace forcefield +} // namespace nvidia + +#if PX_VC +#pragma warning(pop) +#endif + +#endif |