sdk/extensions/exporter/include/NvBlastExtExporter.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) 2020 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 #ifndef NVBLASTEXTEXPORTER_H
00030 #define NVBLASTEXTEXPORTER_H
00031 
00032 #include "NvBlastTypes.h"
00033 #include "NvCTypes.h"
00034 
00035 struct NvBlastAsset;
00036 
00037 namespace Nv
00038 {
00039 namespace Blast
00040 {
00041 struct AuthoringResult;
00042 struct CollisionHull;
00043 
00044 struct Material
00045 {
00046     const char* name;
00047     const char* diffuse_tex;
00048 };
00049 
00050 struct ExporterMeshData
00051 {
00052     NvBlastAsset* asset; //Blast asset
00053 
00054     uint32_t positionsCount; //Number of positions
00055 
00056     uint32_t normalsCount; //Number of normals
00057 
00058     uint32_t uvsCount; //Number of textures uv
00059 
00060     NvcVec3* positions; //Array of positions
00061 
00062     NvcVec3* normals;  // Array of normals
00063 
00064     NvcVec2* uvs;  // Array of textures uv
00065 
00066     uint32_t meshCount; //Number of meshes (chunks)
00067 
00068     uint32_t submeshCount; //Number of submeshes
00069 
00070     Material* submeshMats; 
00071 
00072 
00078     uint32_t* submeshOffsets;
00079 
00080     uint32_t* posIndex; //Array of position indices
00081 
00082     uint32_t* normIndex; //Array of normals indices
00083 
00084     uint32_t* texIndex; //Array of texture indices
00085 
00086 
00092     uint32_t* hullsOffsets;
00093 
00094     CollisionHull** hulls; //Array of pointers to hull for all meshes
00095 };
00096 
00100 class IMeshFileReader
00101 {
00102 public:
00103     
00107     virtual void            release() = 0;
00108 
00109     /*
00110         Load from the specified file path
00111     */
00112     virtual void            loadFromFile(const char* filename) = 0;
00113 
00117     virtual uint32_t        getVerticesCount() const = 0;
00118 
00122     virtual uint32_t        getIndicesCount() const = 0;
00123 
00127     virtual NvcVec3*    getPositionArray() = 0;
00128 
00132     virtual NvcVec3*    getNormalsArray() = 0;
00133 
00137     virtual NvcVec2*    getUvArray() = 0;
00138 
00142     virtual int32_t*        getMaterialIds() = 0;
00143 
00147     virtual int32_t*        getSmoothingGroups() = 0;
00148 
00152     virtual const char*     getMaterialName(int32_t id) = 0;
00153 
00157     virtual int32_t         getMaterialCount() = 0;
00158 
00159 
00160 
00164     virtual uint32_t*       getIndexArray() = 0;
00165 
00166 
00170     virtual bool            isCollisionLoaded() = 0;
00171 
00180     virtual uint32_t        getCollision(uint32_t*& hullsOffset, CollisionHull**& hulls) = 0;
00181 
00182 };
00183 
00187 class IFbxFileReader : public IMeshFileReader
00188 {
00189 public:
00197     virtual uint32_t getBoneInfluences(uint32_t*& out) = 0;
00198 
00202     virtual uint32_t getBoneCount() = 0;
00203 };
00204 
00208 class IMeshFileWriter
00209 {
00210 public:
00211 
00215     virtual void release() = 0;
00216 
00220     virtual bool appendMesh(const AuthoringResult& aResult, const char* assetName, bool nonSkinned = false) = 0;
00221 
00225     virtual bool appendMesh(const ExporterMeshData& meshData, const char* assetName, bool nonSkinned = false) = 0;
00226 
00230     virtual bool saveToFile(const char* assetName, const char* outputPath) = 0;
00231 
00235     virtual void setInteriorIndex(int32_t index) = 0;
00236 };
00237 
00238 }
00239 }
00240 
00244 NVBLAST_API Nv::Blast::IMeshFileReader* NvBlastExtExporterCreateObjFileReader();
00245 
00249 NVBLAST_API Nv::Blast::IFbxFileReader* NvBlastExtExporterCreateFbxFileReader();
00250 
00254 NVBLAST_API Nv::Blast::IMeshFileWriter* NvBlastExtExporterCreateObjFileWriter();
00255 
00261 NVBLAST_API Nv::Blast::IMeshFileWriter* NvBlastExtExporterCreateFbxFileWriter(bool outputFBXAscii = false);
00262 
00263 #endif //NVBLASTEXTEXPORTER_H