sdk/extensions/authoringCommon/include/NvBlastExtAuthoringTypes.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 NVBLASTAUTHORINGTYPES_H
00030 #define NVBLASTAUTHORINGTYPES_H
00031 
00032 #include "NvBlastTypes.h"
00033 #include "NvCTypes.h"
00034 
00035 namespace Nv
00036 {
00037 namespace Blast
00038 {
00042 const uint32_t kMaterialInteriorId       = 1000;
00043 
00047 const uint32_t kSmoothingGroupInteriorId = 1000;
00048 
00052 const uint32_t kNotValidVertexIndex      = UINT32_MAX;
00053 
00057 struct Edge
00058 {
00059     Edge(uint32_t s = kNotValidVertexIndex, uint32_t e = kNotValidVertexIndex) : s(s), e(e) {}
00060     uint32_t s;
00061     uint32_t e;
00062 };
00063 
00067 struct Vertex
00068 {
00069     Vertex() {};
00070     Vertex(const NvcVec3& p, const NvcVec3& n, const NvcVec2& _uv) : p(p), n(n) { uv[0] = _uv; }
00071     NvcVec3 p;      // Position
00072     NvcVec3 n;      // Normal
00073     NvcVec2 uv[1];  // UV-coordinates array, currently supported only one UV coordinate.
00074 };
00075 
00079 struct Triangle
00080 {
00081     Triangle() {};
00082     Triangle(const Vertex& a, const Vertex& b, const Vertex& c, int32_t ud = 0, int32_t mid = 0, int32_t sid = 0) 
00083         : a(a), b(b), c(c), userData(ud), materialId(mid), smoothingGroup(sid) {}
00084     Vertex a, b, c;
00085     int32_t userData;
00086     int32_t materialId;
00087     int32_t smoothingGroup;
00088 };
00089 
00093 struct TriangleIndexed
00094 {
00095     TriangleIndexed(uint32_t ea, uint32_t eb, uint32_t ec, int32_t mid = 0, int32_t sid = 0, int32_t ud = 0)
00096     : ea(ea), eb(eb), ec(ec), materialId(mid), smoothingGroup(sid), userData(ud) {}
00097     uint32_t ea, eb, ec;
00098     int32_t materialId;
00099     int32_t smoothingGroup;
00100     int32_t userData;
00101 };
00102 
00106 struct Facet
00107 {
00108     Facet(int32_t fen = 0, uint32_t ec = 0, int64_t ud = 0, int32_t mid = 0, int32_t sid = 0) 
00109         : firstEdgeNumber(fen), edgesCount(ec), userData(ud), materialId(mid), smoothingGroup(sid) {}
00110     int32_t firstEdgeNumber;
00111     uint32_t edgesCount;
00112     int64_t userData;
00113     int32_t materialId;
00114     int32_t smoothingGroup;
00115 };
00116 
00120 struct HullPolygon
00121 {
00122     // Polygon base plane
00123     float plane[4];
00124     // Number vertices in polygon
00125     uint16_t vertexCount;
00126     // First index in CollisionHull.indices array for this polygon
00127     uint16_t indexBase;
00128 };
00129 
00133 struct CollisionHull
00134 {
00135     uint32_t pointsCount;
00136     uint32_t indicesCount;
00137     uint32_t polygonDataCount;
00138     NvcVec3* points;
00139     uint32_t* indices;
00140     HullPolygon* polygonData;
00141 };
00142 
00148 struct AuthoringResult
00149 {
00150     uint32_t chunkCount;  // Number of chunks in Blast asset
00151 
00152     uint32_t bondCount;  // Number of bonds in Blast asset
00153 
00154     NvBlastAsset* asset;  // Blast asset
00155 
00160     uint32_t* assetToFractureChunkIdMap;
00161 
00167     uint32_t* geometryOffset;
00168 
00169     Triangle* geometry;  // Raw array of Triangle for all chunks
00170 
00171     NvBlastChunkDesc* chunkDescs;  // Array of chunk descriptors. Contains chunkCount elements
00172 
00173     NvBlastBondDesc* bondDescs;  // Array of bond descriptors. Contains bondCount elements
00174 
00180     uint32_t* collisionHullOffset;
00181 
00182     CollisionHull** collisionHull;  // Raw array of pointers to collision hull for all chunks.
00183 
00187     const char** materialNames;
00192     uint32_t materialCount;
00193 };
00194 
00195 struct ConvexDecompositionParams
00196 {
00197     uint32_t maximumNumberOfHulls = 8;  // Maximum number of convex hull generated for one chunk. If equal to 1 convex
00198                                         // decomposition is disabled.
00199     uint32_t maximumNumberOfVerticesPerHull = 64;  // Controls the maximum number of triangles per convex-hull
00200                                                    // (default=64, range=4-1024)
00201     uint32_t voxelGridResolution = 1000000;        // Voxel grid resolution used for chunk convex decomposition
00202                                                    // (default=1,000,000, range=10,000-16,000,000).
00203     float concavity = 0.0025f;                     // Value between 0 and 1, controls how accurate hull generation is
00204 };
00205 
00206 }  // namespace Blast
00207 }  // namespace Nv
00208 
00209 
00210 #endif  // ifndef NVBLASTAUTHORINGTYPES_H