Main Page Class List Class Members

# sdk/extensions/physx/include/NvBlastExtSync.h

Go to the documentation of this file.

    00001 // This code contains NVIDIA Confidential Information and is disclosed to you
    00002 // under a form of NVIDIA software license agreement provided separately to you.
    00003 //
    00004 // Notice
    00005 // NVIDIA Corporation and its licensors retain all intellectual property and
    00006 // proprietary rights in and to this software and related documentation and
    00007 // any modifications thereto. Any use, reproduction, disclosure, or
    00008 // distribution of this software and related documentation without an express
    00009 // license agreement from NVIDIA Corporation is strictly prohibited.
    00010 //
    00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
    00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
    00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
    00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
    00015 //
    00016 // Information and code furnished is believed to be accurate and reliable.
    00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
    00018 // information or for any infringement of patents or other rights of third parties that may
    00019 // result from its use. No license is granted by implication or otherwise under any patent
    00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
    00021 // This code supersedes and replaces all information previously supplied.
    00022 // NVIDIA Corporation products are not authorized for use as critical
    00023 // components in life support devices or systems without express written approval of
    00024 // NVIDIA Corporation.
    00025 //
    00026 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
    00027
    00028
    00029 #ifndef NVBLASTEXTSYNC_H
    00030 #define NVBLASTEXTSYNC_H
    00031
    00032 #include "NvBlastTk.h"
    00033 #include "foundation/PxTransform.h"
    00034 #include "NvPreprocessor.h"
    00035 #include "NvBlastGlobals.h"
    00036
    00037
    00038 namespace Nv
    00039 {
    00040 namespace Blast
    00041 {
    00042
    00043 class ExtPxFamily;
    00044 class ExtPxManager;
    00045
    00046
    00050 struct ExtSyncEventType
    00051 {
    00052     enum Enum
    00053     {
    00054         Fracture = 0,
    00055         FamilySync,
    00056         Physics,
    00057
    00058         Count
    00059     };
    00060 };
    00061
    00062
    00066 struct NV_DLL_EXPORT ExtSyncEvent
    00067 {
    00068     ExtSyncEvent(ExtSyncEventType::Enum t) : type(t) {}
    00069     virtual ~ExtSyncEvent() {}
    00070
    00071     template<class T>
    00072     const T* getEvent() const { return reinterpret_cast<const T*>(this); }
    00073
    00079     virtual ExtSyncEvent* clone() const = 0;
    00080
    00081     void release();
    00082
    00083     ExtSyncEventType::Enum  type;
    00084     uint64_t                timestamp;
    00085     NvBlastID               familyID;
    00086 };
    00087
    00088
    00092 template <class T, ExtSyncEventType::Enum eventType>
    00093 struct ExtSyncEventInstance : public ExtSyncEvent
    00094 {
    00095     ExtSyncEventInstance() : ExtSyncEvent(eventType) {}
    00096
    00097     static const ExtSyncEventType::Enum EVENT_TYPE = eventType;
    00098
    00099     ExtSyncEvent* clone() const override
    00100     {
    00101         return NVBLAST_NEW (T) (*(T*)this);
    00102     }
    00103 };
    00104
    00105
    00109 struct ExtSyncEventFracture : public ExtSyncEventInstance<ExtSyncEventFracture, ExtSyncEventType::Fracture>
    00110 {
    00111     std::vector<NvBlastBondFractureData>    bondFractures;
    00112     std::vector<NvBlastChunkFractureData>   chunkFractures;
    00113 };
    00114
    00115
    00119 struct ExtSyncEventFamilySync : public ExtSyncEventInstance<ExtSyncEventFamilySync, ExtSyncEventType::FamilySync>
    00120 {
    00121     std::vector<char> family;
    00122 };
    00123
    00124
    00128 struct ExtSyncEventPhysicsSync : public ExtSyncEventInstance<ExtSyncEventPhysicsSync, ExtSyncEventType::Physics>
    00129 {
    00130     struct ActorData
    00131     {
    00132         uint32_t            actorIndex;
    00133         physx::PxTransform  transform;
    00134     };
    00135
    00136     std::vector<ActorData> data;
    00137 };
    00138
    00139
    00145 class NV_DLL_EXPORT ExtSync : public TkEventListener
    00146 {
    00147 public:
    00149
    00155     static ExtSync*     create();
    00156
    00157
    00159
    00163     virtual void        release() = 0;
    00164
    00165
    00167
    00174     virtual void        receive(const TkEvent* events, uint32_t eventCount)  = 0;
    00175
    00181     virtual void        syncFamily(const TkFamily& family) = 0;
    00182
    00188     virtual void        syncFamily(const ExtPxFamily& family) = 0;
    00189
    00195     virtual uint32_t    getSyncBufferSize() const = 0;
    00196
    00203     virtual void        acquireSyncBuffer(const ExtSyncEvent*const*& buffer, uint32_t& size) const = 0;
    00204
    00208     virtual void        releaseSyncBuffer() = 0;
    00209
    00210
    00212
    00223     virtual void        applySyncBuffer(TkFramework& framework, const ExtSyncEvent** buffer, uint32_t size, TkGroup* groupForNewActors, ExtPxManager* manager = nullptr) = 0;
    00224
    00225 };
    00226
    00227 } // namespace Blast
    00228 } // namespace Nv
    00229
    00230
    00231 #endif // ifndef NVBLASTEXTSYNC_H