Main Page Class List Class Members

- Main Page
- User's Guide
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# sdk/toolkit/source/NvBlastTkActorImpl.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 NVBLASTTKACTORIMPL_H
    00030 #define NVBLASTTKACTORIMPL_H
    00031
    00032
    00033 #include "NvBlastTkCommon.h"
    00034
    00035 #include "NvBlastAssert.h"
    00036 #include "NvBlastDLink.h"
    00037 #include "NvBlastIteratorBase.h"
    00038
    00039 #include "NvBlastTkJointImpl.h"
    00040
    00041 #include "NvBlast.h"
    00042
    00043 #include "NvBlastTkActor.h"
    00044
    00045 #include "PxFlags.h"
    00046
    00047 namespace Nv
    00048 {
    00049 namespace Blast
    00050 {
    00051
    00052 // Forward declarations:
    00053 class TkGroupImpl;
    00054 class TkFamilyImpl;
    00055 class TkAssetImpl;
    00056 class TkJointImpl;
    00057
    00058
    00062 struct TkActorFlag
    00063 {
    00064     enum Enum
    00065     {
    00066         DAMAGED = (1 << 0),
    00067         PENDING = (1 << 1),
    00068     };
    00069 };
    00070
    00071
    00075 class TkActorImpl : public TkActor
    00076 {
    00077 public:
    00078     TkActorImpl();
    00079     ~TkActorImpl();
    00080
    00081     // Begin TkActor
    00082     virtual const NvBlastActor* getActorLL() const override;
    00083
    00084     virtual TkFamily&           getFamily() const override;
    00085
    00086     virtual uint32_t            getIndex() const override;
    00087
    00088     virtual TkGroup*            getGroup() const override;
    00089
    00090     virtual TkGroup*            removeFromGroup() override;
    00091
    00092     virtual const TkAsset*      getAsset() const override;
    00093
    00094     virtual uint32_t            getVisibleChunkCount() const override;
    00095
    00096     virtual uint32_t            getVisibleChunkIndices(uint32_t* visibleChunkIndices, uint32_t visibleChunkIndicesSize) const override;
    00097
    00098     virtual uint32_t            getGraphNodeCount() const override;
    00099
    00100     virtual uint32_t            getGraphNodeIndices(uint32_t* graphNodeIndices, uint32_t graphNodeIndicesSize) const override;
    00101
    00102     virtual const float*        getBondHealths() const override;
    00103
    00104     virtual uint32_t            getSplitMaxActorCount() const override;
    00105
    00106     virtual void                damage(const NvBlastDamageProgram& program, const void* programParams) override;
    00107
    00108     virtual bool                isPending() const override;
    00109
    00110     virtual void                generateFracture(NvBlastFractureBuffers* commands, const NvBlastDamageProgram& program, const void* programParams) const override;
    00111
    00112     virtual void                applyFracture(NvBlastFractureBuffers* eventBuffers, const NvBlastFractureBuffers* commands) override;
    00113
    00114     virtual uint32_t            getJointCount() const override;
    00115
    00116     virtual uint32_t            getJoints(TkJoint** joints, uint32_t jointsSize) const override;
    00117
    00118     virtual bool                isBoundToWorld() const override;
    00119     // End TkActor
    00120
    00121     // Begin TkObject
    00122     virtual void                release() override;
    00123     // End TkObject
    00124
    00125
    00126     // Public methods
    00127
    00135     static TkActorImpl*         create(const TkActorDesc& desc);
    00136
    00144     bool                        isActive() const;
    00145
    00151     NvBlastFamily*              getFamilyLL() const;
    00152
    00158     TkFamilyImpl&               getFamilyImpl() const;
    00159
    00163     uint32_t                    getIndexInternal() const;
    00164
    00170     TkGroupImpl*                getGroupImpl() const;
    00171
    00177     NvBlastActor*               getActorLLInternal() const;
    00178
    00182     uint32_t                    getJointCountInternal() const;
    00183
    00195     class JointIt : public DList::It
    00196     {
    00197     public:
    00199         JointIt(const TkActorImpl& actor, Direction dir = Forward);
    00200
    00202         TkJointImpl* operator * () const;
    00203     };
    00204
    00208     operator Nv::Blast::TkActorData() const;
    00209
    00210 private:
    00215     void                        markAsDamaged();
    00216     bool                        isDamaged() const;
    00217
    00222     void                        makePending();
    00223
    00227     void                        addJoint(TkJointLink& jointLink);
    00228     void                        removeJoint(TkJointLink& jointLink);
    00229
    00230     struct DamageData
    00231     {
    00232         NvBlastDamageProgram program;
    00233         const void*          programParams;
    00234     };
    00235
    00236     // Data
    00237
    00238     NvBlastActor*                           m_actorLL;
    00239     TkFamilyImpl*                           m_family;
    00240     TkGroupImpl*                            m_group;
    00241     uint32_t                                m_groupJobIndex;
    00242     physx::PxFlags<TkActorFlag::Enum, char> m_flags;
    00243     Array<DamageData>::type                 m_damageBuffer;
    00244     uint32_t                                m_jointCount;
    00245     DList                                   m_jointList;
    00246
    00247 //#if NV_PROFILE
    00248     NvBlastTimers                           m_timers;
    00249 //#endif
    00250
    00251     friend class TkWorker;                  // m_damageBuffer and m_flags
    00252     friend class TkGroupImpl;
    00253     friend class TkFamilyImpl;
    00254     friend class TkJointImpl;
    00255     friend class TkFrameworkImpl;
    00256 };
    00257
    00258
    00260
    00261 NV_INLINE TkFamilyImpl& TkActorImpl::getFamilyImpl() const
    00262 {
    00263     NVBLAST_ASSERT(m_family != nullptr);
    00264
    00265     return *m_family;
    00266 }
    00267
    00268
    00269 NV_INLINE uint32_t TkActorImpl::getIndexInternal() const
    00270 {
    00271     NVBLAST_ASSERT(isActive());
    00272     return NvBlastActorGetIndex(m_actorLL, logLL);
    00273 }
    00274
    00275
    00276 NV_INLINE NvBlastActor* TkActorImpl::getActorLLInternal() const
    00277 {
    00278     return m_actorLL;
    00279 }
    00280
    00281
    00282 NV_INLINE uint32_t TkActorImpl::getJointCountInternal() const
    00283 {
    00284     return m_jointCount;
    00285 }
    00286
    00287
    00288 NV_INLINE TkGroupImpl* TkActorImpl::getGroupImpl() const
    00289 {
    00290     return m_group;
    00291 }
    00292
    00293
    00294 NV_INLINE bool TkActorImpl::isActive() const
    00295 {
    00296     return m_actorLL != nullptr;
    00297 }
    00298
    00299
    00300 NV_INLINE bool TkActorImpl::isPending() const
    00301 {
    00302     return m_flags.isSet(TkActorFlag::PENDING);
    00303 }
    00304
    00305
    00306 NV_INLINE void TkActorImpl::addJoint(TkJointLink& jointLink)
    00307 {
    00308     NVBLAST_ASSERT(m_jointList.isSolitary(jointLink));
    00309
    00310     m_jointList.insertHead(jointLink);
    00311     ++m_jointCount;
    00312 }
    00313
    00314
    00315 NV_INLINE void TkActorImpl::removeJoint(TkJointLink& jointLink)
    00316 {
    00317     NVBLAST_ASSERT(!m_jointList.isSolitary(jointLink));
    00318     NVBLAST_ASSERT(m_jointCount > 0);
    00319     if (m_jointCount > 0)
    00320     {
    00321         --m_jointCount;
    00322         m_jointList.remove(jointLink);
    00323     }
    00324 }
    00325
    00326
    00328
    00329 NV_INLINE TkActorImpl::JointIt::JointIt(const TkActorImpl& actor, Direction dir) : DList::It(actor.m_jointList, dir) {}
    00330
    00331
    00332 NV_INLINE TkJointImpl* TkActorImpl::JointIt::operator * () const
    00333 {
    00334     const DLink* link = (const DLink*)(*this);
    00335     return reinterpret_cast<const TkJointLink*>(link)->m_joint;
    00336 }
    00337
    00338 } // namespace Blast
    00339 } // namespace Nv
    00340
    00341
    00342 #endif // ifndef NVBLASTTKACTORIMPL_H

Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com