Main Page Class List Class Members

NvBlastExtExporterFbxWriter.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
27
28
29 #ifndef NVBLASTEXTEXPORTERFBXWRITER_H
30 #define NVBLASTEXTEXPORTERFBXWRITER_H
31
32 #include "NvBlastExtExporter.h"
33 #include <memory>
34 #include <vector>
35 #include <map>
36
37 namespace fbxsdk
38 {
39 class FbxScene;
40 class FbxNode;
41 class FbxMesh;
42 class FbxSkin;
43 class FbxManager;
44 class FbxSurfaceMaterial;
45 class FbxDisplayLayer;
46 }
47
48 struct NvBlastAsset;
49
50 namespace Nv
51 {
52 namespace Blast
53 {
54 class Mesh;
55 struct Triangle;
56 struct CollisionHull;
57
58 class FbxFileWriter : public IMeshFileWriter
59 {
60 public:
61
65 FbxFileWriter();
66 //~FbxFileWriter() = default;
67
68 virtual void release() override;
69
73 fbxsdk::FbxScene* getScene();
74
78 virtual bool appendMesh(const AuthoringResult& aResult, const char* assetName, bool nonSkinned) override;
79
84 virtual bool appendMesh(const ExporterMeshData& meshData, const char* assetName, bool nonSkinned) override;
85
89 virtual bool saveToFile(const char* assetName, const char* outputPath) override;
90
94 virtual void setInteriorIndex(int32_t index) override;
95
99 bool bOutputFBXAscii;
100
101 private:
102 std::vector<fbxsdk::FbxSurfaceMaterial*> mMaterials;
103 fbxsdk::FbxScene* mScene;
104 fbxsdk::FbxDisplayLayer* mRenderLayer;
105
106 //TODO we should track for every memory allocation and deallocate it not only for sdkManager
107 std::shared_ptr<fbxsdk::FbxManager> sdkManager;
108 std::map<uint32_t, fbxsdk::FbxNode*> chunkNodes;
109 std::map<uint32_t, NvcVec3> worldChunkPivots;
110
111 bool appendNonSkinnedMesh(const AuthoringResult& aResult, const char* assetName);
112 bool appendNonSkinnedMesh(const ExporterMeshData& meshData, const char* assetName);
113 void createMaterials(const ExporterMeshData& meshData);
114 void createMaterials(const AuthoringResult& aResult);
115
120 bool appendCollisionMesh(uint32_t meshCount, uint32_t* offsets, CollisionHull** hulls, const char* assetName);
121
122 uint32_t addCollisionHulls(uint32_t chunkIndex, fbxsdk::FbxDisplayLayer* displayLayer, fbxsdk::FbxNode* parentNode, uint32_t hullsCount, CollisionHull** hulls);
123 uint32_t createChunkRecursive(uint32_t currentCpIdx, uint32_t chunkIndex, fbxsdk::FbxNode *meshNode, fbxsdk::FbxNode* parentNode, fbxsdk::FbxSkin* skin, const AuthoringResult& aResult);
124 uint32_t createChunkRecursive(uint32_t currentCpIdx, uint32_t chunkIndex, fbxsdk::FbxNode *meshNode, fbxsdk::FbxNode* parentNode, fbxsdk::FbxSkin* skin, const ExporterMeshData& meshData);
125
126 void createChunkRecursiveNonSkinned(const std::string& meshName, uint32_t chunkIndex, fbxsdk::FbxNode* parentNode,
127 const std::vector<fbxsdk::FbxSurfaceMaterial*>& materials, const AuthoringResult& aResult);
128
129 void createChunkRecursiveNonSkinned(const std::string& meshName, uint32_t chunkIndex, fbxsdk::FbxNode* parentNode,
130 const std::vector<fbxsdk::FbxSurfaceMaterial*>& materials, const ExporterMeshData& meshData);
131
132 void addControlPoints(fbxsdk::FbxMesh* mesh, const ExporterMeshData& meshData);
133 void addBindPose();
134
135 void generateSmoothingGroups(fbxsdk::FbxMesh* mesh, FbxSkin* skin);
136 void removeDuplicateControlPoints(fbxsdk::FbxMesh* mesh, FbxSkin* skin);
137
138 int32_t mInteriorIndex;
139 };
140
141 }
142 }
143
144 #endif // NVBLASTEXTEXPORTERFBXWRITER_H
Nv::Blast::FbxFileWriter
Definition: NvBlastExtExporterFbxWriter.h:58
NvBlastExtExporter.h
fbxsdk
Definition: NvBlastExtExporterFbxWriter.h:37
Nv::Blast::CollisionHull
Definition: NvBlastExtAuthoringTypes.h:133
Nv::Blast::AuthoringResult
Definition: NvBlastExtAuthoringTypes.h:148
Nv::Blast::ExporterMeshData
Definition: NvBlastExtExporter.h:50
Nv::Blast::IMeshFileWriter
Definition: NvBlastExtExporter.h:208
NvBlastAsset
Definition: NvBlastTypes.h:286
Nv::Blast::FbxFileWriter::bOutputFBXAscii
bool bOutputFBXAscii
Definition: NvBlastExtExporterFbxWriter.h:99
Nv
Definition: NvBlastArray.h:37