Main Page   Class List   Class Members  

  • Main Page
  • User's Guide
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

sdk/extensions/import/include/NvBlastExtApexImportTool.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 NVBLASTEXTAPEXIMPORTTOOL_H
00030 #define NVBLASTEXTAPEXIMPORTTOOL_H
00031 
00032 #include "NvBlast.h"
00033 #include <vector>
00034 #include <string>
00035 #include "NvBlastExtPxAsset.h"
00036 #include "NvBlastExtPxCollisionBuilder.h"
00037 #include <nvparameterized\NvSerializer.h>
00038 #include <NvBlastExtExporter.h>
00039 
00040 namespace physx
00041 {
00042     class PxFoundation;
00043     class PxPhysics;
00044     class PxCooking;
00045 
00046 namespace general_PxIOStream2
00047 {
00048 class PxFileBuf;
00049 }
00050 }
00051 
00052 namespace NvParameterized
00053 {
00054     class Interface;
00055 }
00056 
00057 namespace nvidia
00058 {
00059 namespace apex
00060 {
00061 class ApexSDK;
00062 class ModuleDestructible;
00063 class DestructibleAsset;
00064 }
00065 using namespace physx::general_PxIOStream2;
00066 }
00067 
00068 
00069 namespace Nv
00070 {
00071 namespace Blast
00072 {
00073 
00074 struct CollisionHull;
00075 class TkFramework;
00076 
00077 namespace ApexImporter
00078 {
00079 
00080 struct ApexImporterConfig
00081 {
00091     enum InterfaceSearchMode { EXACT, FORCED, MODE_COUNT };
00092 
00093     ApexImporterConfig()
00094     {
00095         setDefaults();
00096     }
00097 
00098     void setDefaults()
00099     {
00100         infSearchMode               =   EXACT;
00101     }
00102     InterfaceSearchMode infSearchMode;
00103 };
00104 
00105 
00106 class ApexDestruction;
00107 
00108 
00112 class ApexImportTool
00113 {
00114 public:
00115     ApexImportTool();
00116     ~ApexImportTool();
00117     
00123     bool    loadAssetFromFile(nvidia::PxFileBuf* stream, NvParameterized::Serializer::DeserializedData& data);
00124 
00125 
00136     bool                                importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00137                                             std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags);
00138 
00150     bool                                importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00151                                             std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags,
00152                                             const ApexImporterConfig& config);
00153 
00157     bool                                importRendermesh(const std::vector<uint32_t>& chunkReorderInvMap, const NvParameterized::Interface* assetNvIfc, Nv::Blast::ExporterMeshData* outputData, const char* materialsDir);
00158 
00159 
00166     bool                                saveAsset(const NvBlastAsset* asset, nvidia::PxFileBuf* stream);
00167 
00179     bool                                getCollisionGeometry(const NvParameterized::Interface* assetPrm, uint32_t chunkCount, std::vector<uint32_t>& chunkReorderInvMap,
00180                                                 const std::vector<uint32_t>& apexChunkFlags, std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks,
00181                                                 std::vector<ExtPxAssetDesc::SubchunkDesc>& physicsSubchunks, std::vector<std::vector<CollisionHull*> >& hullsDesc);
00182 
00183     const ExtPxCollisionBuilder* getCollisionBuilder() const
00184     {
00185         return m_collisionBuilder;
00186     }
00187 
00189 
00190     bool isValid();
00191 
00192     physx::PxPhysics*       getPxSdk() { return m_PhysxSDK; }
00193     physx::PxCooking*       getCooking() { return m_Cooking; };
00194 
00195 private:
00196     bool                                importApexAssetInternal(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00197                                             std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDesc, std::vector<uint32_t>& flags,
00198                                             const ApexImporterConfig& configDesc);
00199 
00200 protected:
00201     ApexImportTool(const ApexImportTool&);
00202     ApexImportTool& operator=(const ApexImportTool&);
00203 
00204     physx::PxFoundation*    m_Foundation;
00205     physx::PxPhysics*       m_PhysxSDK;
00206     physx::PxCooking*       m_Cooking;
00207 
00208     ExtPxCollisionBuilder*  m_collisionBuilder;
00209 };
00210 
00211 } // namespace ApexImporter
00212 
00213 } // namespace Blast
00214 } // namespace Nv
00215 
00216 #endif // NVBLASTEXTAPEXIMPORTTOOL_H
Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com