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) 2018 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 #ifndef NVBLASTEXTEXPORTER_H
00030 #define NVBLASTEXTEXPORTER_H
00031 
00032 #include "NvBlastTypes.h"
00033 
00034 struct NvBlastAsset;
00035 
00036 namespace physx
00037 {
00038 class PxVec2;
00039 class PxVec3;
00040 }
00041 
00042 namespace Nv
00043 {
00044 namespace Blast
00045 {
00046 struct AuthoringResult;
00047 struct CollisionHull;
00048 
00049 struct Material
00050 {
00051     const char* name;
00052     const char* diffuse_tex;
00053 };
00054 
00055 struct ExporterMeshData
00056 {
00057     NvBlastAsset* asset; //Blast asset
00058 
00059     uint32_t positionsCount; //Number of positions
00060 
00061     uint32_t normalsCount; //Number of normals
00062 
00063     uint32_t uvsCount; //Number of textures uv
00064 
00065     physx::PxVec3* positions; //Array of positions
00066 
00067     physx::PxVec3* normals; //Array of normals
00068 
00069     physx::PxVec2* uvs; //Array of textures uv
00070 
00071     uint32_t meshCount; //Number of meshes (chunks)
00072 
00073     uint32_t submeshCount; //Number of submeshes
00074 
00075     Material* submeshMats; 
00076 
00077 
00083     uint32_t* submeshOffsets;
00084 
00085     uint32_t* posIndex; //Array of position indices
00086 
00087     uint32_t* normIndex; //Array of normals indices
00088 
00089     uint32_t* texIndex; //Array of texture indices
00090 
00091 
00097     uint32_t* hullsOffsets;
00098 
00099     CollisionHull** hulls; //Array of pointers to hull for all meshes
00100 };
00101 
00105 class IMeshFileReader
00106 {
00107 public:
00108     
00112     virtual void            release() = 0;
00113 
00114     /*
00115         Load from the specified file path
00116     */
00117     virtual void            loadFromFile(const char* filename) = 0;
00118 
00122     virtual uint32_t        getVerticesCount() const = 0;
00123 
00127     virtual uint32_t        getIndicesCount() const = 0;
00128 
00132     virtual physx::PxVec3*  getPositionArray() = 0;
00133 
00137     virtual physx::PxVec3*  getNormalsArray() = 0;
00138 
00142     virtual physx::PxVec2*  getUvArray() = 0;
00143 
00147     virtual int32_t*        getMaterialIds() = 0;
00148 
00152     virtual int32_t*        getSmoothingGroups() = 0;
00153 
00157     virtual const char*     getMaterialName(int32_t id) = 0;
00158 
00162     virtual int32_t         getMaterialCount() = 0;
00163 
00164 
00165 
00169     virtual uint32_t*       getIndexArray() = 0;
00170 
00171 
00175     virtual bool            isCollisionLoaded() = 0;
00176 
00185     virtual uint32_t        getCollision(uint32_t*& hullsOffset, CollisionHull**& hulls) = 0;
00186 
00187 };
00188 
00192 class IFbxFileReader : public IMeshFileReader
00193 {
00194 public:
00202     virtual uint32_t getBoneInfluences(uint32_t*& out) = 0;
00203 
00207     virtual uint32_t getBoneCount() = 0;
00208 };
00209 
00213 class IMeshFileWriter
00214 {
00215 public:
00216 
00220     virtual void release() = 0;
00221 
00225     virtual bool appendMesh(const AuthoringResult& aResult, const char* assetName, bool nonSkinned = false) = 0;
00226 
00230     virtual bool appendMesh(const ExporterMeshData& meshData, const char* assetName, bool nonSkinned = false) = 0;
00231 
00235     virtual bool saveToFile(const char* assetName, const char* outputPath) = 0;
00236 
00240     virtual void setInteriorIndex(int32_t index) = 0;
00241 };
00242 
00243 }
00244 }
00245 
00249 NVBLAST_API Nv::Blast::IMeshFileReader* NvBlastExtExporterCreateObjFileReader();
00250 
00254 NVBLAST_API Nv::Blast::IFbxFileReader* NvBlastExtExporterCreateFbxFileReader();
00255 
00259 NVBLAST_API Nv::Blast::IMeshFileWriter* NvBlastExtExporterCreateObjFileWriter();
00260 
00266 NVBLAST_API Nv::Blast::IMeshFileWriter* NvBlastExtExporterCreateFbxFileWriter(bool outputFBXAscii = false);
00267 
00268 #endif //NVBLASTEXTEXPORTER_H