Main Page Class List Class Members

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

- File List
- File Members

# sdk/toolkit/source/NvBlastTkFrameworkImpl.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 NVBLASTTKFRAMEWORKIMPL_H
    00030 #define NVBLASTTKFRAMEWORKIMPL_H
    00031
    00032 #include "NvBlastTkFramework.h"
    00033 #include "NvBlastProfilerInternal.h"
    00034
    00035 #include "NvBlastTkCommon.h"
    00036
    00037 #include "NvBlastArray.h"
    00038 #include "NvBlastHashMap.h"
    00039 #include "NvBlastHashSet.h"
    00040
    00041
    00042 namespace Nv
    00043 {
    00044 namespace Blast
    00045 {
    00046
    00047 // Forward declarations
    00048 class TkTypeImpl;
    00049 class TkJointImpl;
    00050
    00054 class TkFrameworkImpl : public TkFramework
    00055 {
    00056 public:
    00057                                         TkFrameworkImpl();
    00058                                         ~TkFrameworkImpl();
    00059
    00060     // Begin TkFramework
    00061     virtual void                        release() override;
    00062
    00063     virtual const TkType*               getType(TkTypeIndex::Enum typeIndex) const override;
    00064
    00065     virtual TkIdentifiable*             findObjectByID(const NvBlastID& id) const override;
    00066
    00067     virtual uint32_t                    getObjectCount(const TkType& type) const override;
    00068
    00069     virtual uint32_t                    getObjects(TkIdentifiable** buffer, uint32_t bufferSize, const TkType& type, uint32_t indexStart = 0) const override;
    00070
    00071     virtual bool                        reorderAssetDescChunks(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, NvBlastBondDesc* bondDescs, uint32_t bondCount, uint32_t* chunkReorderMap = nullptr, bool keepBondNormalChunkOrder = false) const override;
    00072
    00073     virtual bool                        ensureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount) const override;
    00074
    00075     virtual TkAsset*                    createAsset(const TkAssetDesc& desc) override;
    00076
    00077     virtual TkAsset*                    createAsset(const NvBlastAsset* assetLL, Nv::Blast::TkAssetJointDesc* jointDescs = nullptr, uint32_t jointDescCount = 0, bool ownsAsset = false) override;
    00078
    00079     virtual TkGroup*                    createGroup(const TkGroupDesc& desc) override;
    00080
    00081     virtual TkActor*                    createActor(const TkActorDesc& desc) override;
    00082
    00083     virtual TkJoint*                    createJoint(const TkJointDesc& desc) override;
    00084     // End TkFramework
    00085
    00086     // Public methods
    00090     void                                onCreate(TkIdentifiable& object);
    00091
    00095     void                                onDestroy(TkIdentifiable& object);
    00096
    00100     void                                onCreate(TkJointImpl& joint);
    00101
    00105     void                                onDestroy(TkJointImpl& joint);
    00106
    00110     void                                onIDChange(TkIdentifiable& object, const NvBlastID& IDPrev, const NvBlastID& IDCurr);
    00111
    00115     TkIdentifiable*                     findObjectByIDInternal(const NvBlastID& id) const;
    00116
    00117     // Access to singleton
    00118
    00120     static TkFrameworkImpl*             get();
    00121
    00123     static bool                         set(TkFrameworkImpl* framework);
    00124
    00125 private:
    00126     // Enums
    00127     enum { ClassID = NVBLAST_FOURCC('T', 'K', 'F', 'W') };
    00128
    00129     // Static data
    00130     static TkFrameworkImpl*                                                     s_framework;
    00131
    00132     // Types
    00133     InlineArray<const TkTypeImpl*, TkTypeIndex::TypeCount>::type                m_types;
    00134     HashMap<uint32_t, uint32_t>::type                                           m_typeIDToIndex;
    00135
    00136     // Objects and object names
    00137     HashMap<NvBlastID, TkIdentifiable*>::type                                   m_IDToObject;
    00138     InlineArray<Array<TkIdentifiable*>::type, TkTypeIndex::TypeCount>::type     m_objects;
    00139
    00140     // Track external joints (to do: make this a pool)
    00141     HashSet<TkJointImpl*>::type                                                 m_joints;
    00142 };
    00143
    00144
    00146
    00147 NV_INLINE TkIdentifiable* TkFrameworkImpl::findObjectByIDInternal(const NvBlastID& id) const
    00148 {
    00149     const auto entry = m_IDToObject.find(id);
    00150     if (entry == nullptr)
    00151     {
    00152         return nullptr;
    00153     }
    00154
    00155     return entry->second;
    00156 }
    00157
    00158 } // namespace Blast
    00159 } // namespace Nv
    00160
    00161
    00162 #endif // ifndef NVBLASTTKFRAMEWORKIMPL_H

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