diff options
| author | Bryan Galdrikian <[email protected]> | 2018-05-31 11:36:08 -0700 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2018-05-31 11:36:08 -0700 |
| commit | 7115f60b91b5717d90f643fd692010905c7004db (patch) | |
| tree | effd68c6978751c517d54c2f2bb5bb6e7dc93e18 /sdk/extensions/authoring/include | |
| parent | Updating BlastTool zip (diff) | |
| download | blast-7115f60b91b5717d90f643fd692010905c7004db.tar.xz blast-7115f60b91b5717d90f643fd692010905c7004db.zip | |
Blast 1.1.3. See docs/release_notes.txt.v1.1.3_rc1
Diffstat (limited to 'sdk/extensions/authoring/include')
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoring.h | 506 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h | 348 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h | 276 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoringCutout.h | 197 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h | 974 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h | 308 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoringMeshCleaner.h | 140 | ||||
| -rwxr-xr-x[-rw-r--r--] | sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h | 574 |
8 files changed, 1659 insertions, 1664 deletions
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoring.h b/sdk/extensions/authoring/include/NvBlastExtAuthoring.h index f85f127..d25ded3 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoring.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoring.h @@ -1,253 +1,253 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTAUTHORING_H -#define NVBLASTAUTHORING_H - -#include "NvBlastExtAuthoringTypes.h" - -namespace physx -{ - class PxCooking; - class PxPhysicsInsertionCallback; -} - -namespace Nv -{ - namespace Blast - { - class Mesh; - class VoronoiSitesGenerator; - class CutoutSet; - class FractureTool; - class ConvexMeshBuilder; - class BlastBondGenerator; - class MeshCleaner; - struct CollisionParams; - struct CollisionHull; - } -} - -struct NvBlastExtAssetUtilsBondDesc; - -/** -Constructs mesh object from array of triangles. -User should call release() after usage. - -\param[in] positions Array for vertex positions, 3 * verticesCount floats will be read -\param[in] normals Array for vertex normals, 3 * verticesCount floats will be read -\param[in] uv Array for vertex uv coordinates, 2 * verticesCount floats will be read -\param[in] verticesCount Number of vertices in mesh -\param[in] indices Array of vertex indices. Indices contain vertex index triplets which form a mesh triangle. -\param[in] indicesCount Indices count (should be equal to numberOfTriangles * 3) - -\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr -*/ -NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMesh(const physx::PxVec3* positions, const physx::PxVec3* normals, - const physx::PxVec2* uv, uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount); - -/** -Constructs mesh object from array of vertices, edges and facets. -User should call release() after usage. - -\param[in] vertices Array for Nv::Blast::Vertex -\param[in] edges Array for Nv::Blast::Edge -\param[in] facets Array for Nv::Blast::Facet -\param[in] verticesCount Number of vertices in mesh -\param[in] edgesCount Number of edges in mesh -\param[in] facetsCount Number of facets in mesh - -\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr -*/ -NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMeshFromFacets(const void* vertices, const void* edges, const void* facets, - uint32_t verticesCount, uint32_t edgesCount, uint32_t facetsCount); - -/** -Voronoi sites should not be generated outside of the fractured mesh, so VoronoiSitesGenerator -should be supplied with fracture mesh. -\param[in] mesh Fracture mesh -\param[in] rnd User supplied random value generator. -\return Pointer to VoronoiSitesGenerator. User's code should release it after usage. -*/ -NVBLAST_API Nv::Blast::VoronoiSitesGenerator* NvBlastExtAuthoringCreateVoronoiSitesGenerator(Nv::Blast::Mesh* mesh, - Nv::Blast::RandomGeneratorBase* rng); - -/** Instantiates a blank CutoutSet */ -NVBLAST_API Nv::Blast::CutoutSet* NvBlastExtAuthoringCreateCutoutSet(); - -/** -Builds a cutout set (which must have been initially created by createCutoutSet()). -Uses a bitmap described by pixelBuffer, bufferWidth, and bufferHeight. Each pixel is represented -by one byte in the buffer. - -\param cutoutSet the CutoutSet to build -\param pixelBuffer pointer to be beginning of the pixel buffer -\param bufferWidth the width of the buffer in pixels -\param bufferHeight the height of the buffer in pixels -\param segmentationErrorThreshold Reduce the number of vertices on curve untill segmentation error is smaller then specified. By default set it to 0.001. -\param snapThreshold the pixel distance at which neighboring cutout vertices and segments may be fudged into alignment. By default set it to 1. -\param periodic whether or not to use periodic boundary conditions when creating cutouts from the map -\param expandGaps expand cutout regions to gaps or keep it as is - -*/ -NVBLAST_API void NvBlastExtAuthoringBuildCutoutSet(Nv::Blast::CutoutSet& cutoutSet, const uint8_t* pixelBuffer, - uint32_t bufferWidth, uint32_t bufferHeight, float segmentationErrorThreshold, float snapThreshold, bool periodic, bool expandGaps); - -/** -Create FractureTool object. -\return Pointer to create FractureTool. User's code should release it after usage. -*/ -NVBLAST_API Nv::Blast::FractureTool* NvBlastExtAuthoringCreateFractureTool(); - -/** -Create BlastBondGenerator -\return Pointer to created BlastBondGenerator. User's code should release it after usage. -*/ -NVBLAST_API Nv::Blast::BlastBondGenerator* NvBlastExtAuthoringCreateBondGenerator(physx::PxCooking* cooking, - physx::PxPhysicsInsertionCallback* insertionCallback); - -/** -Create ConvexMeshBuilder -\return Pointer to created ConvexMeshBuilder. User's code should release it after usage. -*/ -NVBLAST_API Nv::Blast::ConvexMeshBuilder* NvBlastExtAuthoringCreateConvexMeshBuilder(physx::PxCooking* cooking, - physx::PxPhysicsInsertionCallback* insertionCallback); - - -/** -Transforms collision hull in place using scale, rotation, transform. -\param[in, out] hull Pointer to the hull to be transformed (modified). -\param[in] scale Pointer to scale to be applied. Can be nullptr. -\param[in] rotation Pointer to rotation to be applied. Can be nullptr. -\param[in] translation Pointer to translation to be applied. Can be nullptr. -*/ -NVBLAST_API void NvBlastExtAuthoringTransformCollisionHullInPlace -( - Nv::Blast::CollisionHull* hull, - const physx::PxVec3* scaling, - const physx::PxQuat* rotation, - const physx::PxVec3* translation -); - -/** -Transforms collision hull in place using scale, rotation, transform. -\param[in] hull Pointer to the hull to be transformed (modified). -\param[in] scale Pointer to scale to be applied. Can be nullptr. -\param[in] rotation Pointer to rotation to be applied. Can be nullptr. -\param[in] translation Pointer to translation to be applied. Can be nullptr. -*/ -NVBLAST_API Nv::Blast::CollisionHull* NvBlastExtAuthoringTransformCollisionHull -( - const Nv::Blast::CollisionHull* hull, - const physx::PxVec3* scaling, - const physx::PxQuat* rotation, - const physx::PxVec3* translation -); - -/** -Performs pending fractures and generates fractured asset, render and collision geometry - -\param[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool -\param[in] bondGenerator Bond generator created by NvBlastExtAuthoringCreateBondGenerator -\param[in] collisionBuilder Collision builder created by NvBlastExtAuthoringCreateConvexMeshBuilder -\param[in] defaultSupportDepth All new chunks will be marked as support if its depth equal to defaultSupportDepth. - By default leaves (chunks without children) marked as support. -\param[in] collisionParam Parameters of collision hulls generation. -\return Authoring result -*/ -NVBLAST_API Nv::Blast::AuthoringResult* NvBlastExtAuthoringProcessFracture(Nv::Blast::FractureTool& fTool, - Nv::Blast::BlastBondGenerator& bondGenerator, Nv::Blast::ConvexMeshBuilder& collisionBuilder, const Nv::Blast::CollisionParams& collisionParam, int32_t defaultSupportDepth = -1); - -/** -Updates graphics mesh only - -\param[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool -\param[out] ares AuthoringResult object which contains chunks, for which rendermeshes will be updated (e.g. to tweak UVs). Initially should be created by NvBlastExtAuthoringProcessFracture. -*/ -NVBLAST_API void NvBlastExtAuthoringUpdateGraphicsMesh(Nv::Blast::FractureTool& fTool, Nv::Blast::AuthoringResult& ares); - -/** -Build collision meshes - -\param[in,out] ares AuthoringResult object which contains chunks, for which collision meshes will be built. -\param[in] collisionBuilder Reference to ConvexMeshBuilder instance. -\param[in] collisionParam Parameters of collision hulls generation. -\param[in] chunksToProcessCount Number of chunk indices in chunksToProcess memory buffer. -\param[in] chunksToProcess Chunk indices for which collision mesh should be built. -*/ -NVBLAST_API void NvBlastExtAuthoringBuildCollisionMeshes -( - Nv::Blast::AuthoringResult& ares, - Nv::Blast::ConvexMeshBuilder& collisionBuilder, - const Nv::Blast::CollisionParams& collisionParam, - uint32_t chunksToProcessCount, - uint32_t* chunksToProcess -); - -/** - Creates MeshCleaner object - \return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr -*/ -NVBLAST_API Nv::Blast::MeshCleaner* NvBlastExtAuthoringCreateMeshCleaner(); - -/** -Finds bonds connecting chunks in a list of assets - -New bond descriptors may be given to bond support chunks from different components. - -An NvBlastAsset may appear more than once in the components array. - -NOTE: This function allocates memory using the allocator in NvBlastGlobals, to create the new bond -descriptor arrays returned. The user must free this memory after use with NVBLAST_FREE - -\param[in] components An array of assets to merge, of size componentCount. -\param[in] scales If not NULL, an array of size componentCount of scales to apply to the geometric data in the chunks and bonds. If NULL, no scaling is applied. -\param[in] rotations If not NULL, an array of size componentCount of rotations to apply to the geometric data in the chunks and bonds. The quaternions MUST be normalized. - If NULL, no rotations are applied. -\param[in] translations If not NULL, an array of of size componentCount of translations to apply to the geometric data in the chunks and bonds. If NULL, no translations are applied. -\param[in] convexHullOffsets For each component, an array of chunkSize+1 specifying the start of the convex hulls for that chunk inside the chunkHulls array for that component. -\param[in] chunkHulls For each component, an array of CollisionHull* specifying the collision geometry for the chunks in that component. -\param[in] componentCount The size of the components and relativeTransforms arrays. -\param[out] newBondDescs Descriptors of type NvBlastExtAssetUtilsBondDesc for new bonds between components. -\param[in] maxSeparation Maximal distance between chunks which can be connected by bond. -\return the number of bonds in newBondDescs -*/ -NVBLAST_API uint32_t NvBlastExtAuthoringFindAssetConnectingBonds -( - const NvBlastAsset** components, - const physx::PxVec3* scales, - const physx::PxQuat* rotations, - const physx::PxVec3* translations, - const uint32_t** convexHullOffsets, - const Nv::Blast::CollisionHull*** chunkHulls, - uint32_t componentCount, - NvBlastExtAssetUtilsBondDesc*& newBondDescs, - float maxSeparation = 0.0f -); - -#endif // ifndef NVBLASTAUTHORING_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef NVBLASTAUTHORING_H
+#define NVBLASTAUTHORING_H
+
+#include "NvBlastExtAuthoringTypes.h"
+
+namespace physx
+{
+ class PxCooking;
+ class PxPhysicsInsertionCallback;
+}
+
+namespace Nv
+{
+ namespace Blast
+ {
+ class Mesh;
+ class VoronoiSitesGenerator;
+ class CutoutSet;
+ class FractureTool;
+ class ConvexMeshBuilder;
+ class BlastBondGenerator;
+ class MeshCleaner;
+ struct CollisionParams;
+ struct CollisionHull;
+ }
+}
+
+struct NvBlastExtAssetUtilsBondDesc;
+
+/**
+Constructs mesh object from array of triangles.
+User should call release() after usage.
+
+\param[in] positions Array for vertex positions, 3 * verticesCount floats will be read
+\param[in] normals Array for vertex normals, 3 * verticesCount floats will be read
+\param[in] uv Array for vertex uv coordinates, 2 * verticesCount floats will be read
+\param[in] verticesCount Number of vertices in mesh
+\param[in] indices Array of vertex indices. Indices contain vertex index triplets which form a mesh triangle.
+\param[in] indicesCount Indices count (should be equal to numberOfTriangles * 3)
+
+\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr
+*/
+NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMesh(const physx::PxVec3* positions, const physx::PxVec3* normals,
+ const physx::PxVec2* uv, uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
+
+/**
+Constructs mesh object from array of vertices, edges and facets.
+User should call release() after usage.
+
+\param[in] vertices Array for Nv::Blast::Vertex
+\param[in] edges Array for Nv::Blast::Edge
+\param[in] facets Array for Nv::Blast::Facet
+\param[in] verticesCount Number of vertices in mesh
+\param[in] edgesCount Number of edges in mesh
+\param[in] facetsCount Number of facets in mesh
+
+\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr
+*/
+NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMeshFromFacets(const void* vertices, const void* edges, const void* facets,
+ uint32_t verticesCount, uint32_t edgesCount, uint32_t facetsCount);
+
+/**
+Voronoi sites should not be generated outside of the fractured mesh, so VoronoiSitesGenerator
+should be supplied with fracture mesh.
+\param[in] mesh Fracture mesh
+\param[in] rnd User supplied random value generator.
+\return Pointer to VoronoiSitesGenerator. User's code should release it after usage.
+*/
+NVBLAST_API Nv::Blast::VoronoiSitesGenerator* NvBlastExtAuthoringCreateVoronoiSitesGenerator(Nv::Blast::Mesh* mesh,
+ Nv::Blast::RandomGeneratorBase* rng);
+
+/** Instantiates a blank CutoutSet */
+NVBLAST_API Nv::Blast::CutoutSet* NvBlastExtAuthoringCreateCutoutSet();
+
+/**
+Builds a cutout set (which must have been initially created by createCutoutSet()).
+Uses a bitmap described by pixelBuffer, bufferWidth, and bufferHeight. Each pixel is represented
+by one byte in the buffer.
+
+\param cutoutSet the CutoutSet to build
+\param pixelBuffer pointer to be beginning of the pixel buffer
+\param bufferWidth the width of the buffer in pixels
+\param bufferHeight the height of the buffer in pixels
+\param segmentationErrorThreshold Reduce the number of vertices on curve untill segmentation error is smaller then specified. By default set it to 0.001.
+\param snapThreshold the pixel distance at which neighboring cutout vertices and segments may be fudged into alignment. By default set it to 1.
+\param periodic whether or not to use periodic boundary conditions when creating cutouts from the map
+\param expandGaps expand cutout regions to gaps or keep it as is
+
+*/
+NVBLAST_API void NvBlastExtAuthoringBuildCutoutSet(Nv::Blast::CutoutSet& cutoutSet, const uint8_t* pixelBuffer,
+ uint32_t bufferWidth, uint32_t bufferHeight, float segmentationErrorThreshold, float snapThreshold, bool periodic, bool expandGaps);
+
+/**
+Create FractureTool object.
+\return Pointer to create FractureTool. User's code should release it after usage.
+*/
+NVBLAST_API Nv::Blast::FractureTool* NvBlastExtAuthoringCreateFractureTool();
+
+/**
+Create BlastBondGenerator
+\return Pointer to created BlastBondGenerator. User's code should release it after usage.
+*/
+NVBLAST_API Nv::Blast::BlastBondGenerator* NvBlastExtAuthoringCreateBondGenerator(physx::PxCooking* cooking,
+ physx::PxPhysicsInsertionCallback* insertionCallback);
+
+/**
+Create ConvexMeshBuilder
+\return Pointer to created ConvexMeshBuilder. User's code should release it after usage.
+*/
+NVBLAST_API Nv::Blast::ConvexMeshBuilder* NvBlastExtAuthoringCreateConvexMeshBuilder(physx::PxCooking* cooking,
+ physx::PxPhysicsInsertionCallback* insertionCallback);
+
+
+/**
+Transforms collision hull in place using scale, rotation, transform.
+\param[in, out] hull Pointer to the hull to be transformed (modified).
+\param[in] scale Pointer to scale to be applied. Can be nullptr.
+\param[in] rotation Pointer to rotation to be applied. Can be nullptr.
+\param[in] translation Pointer to translation to be applied. Can be nullptr.
+*/
+NVBLAST_API void NvBlastExtAuthoringTransformCollisionHullInPlace
+(
+ Nv::Blast::CollisionHull* hull,
+ const physx::PxVec3* scaling,
+ const physx::PxQuat* rotation,
+ const physx::PxVec3* translation
+);
+
+/**
+Transforms collision hull in place using scale, rotation, transform.
+\param[in] hull Pointer to the hull to be transformed (modified).
+\param[in] scale Pointer to scale to be applied. Can be nullptr.
+\param[in] rotation Pointer to rotation to be applied. Can be nullptr.
+\param[in] translation Pointer to translation to be applied. Can be nullptr.
+*/
+NVBLAST_API Nv::Blast::CollisionHull* NvBlastExtAuthoringTransformCollisionHull
+(
+ const Nv::Blast::CollisionHull* hull,
+ const physx::PxVec3* scaling,
+ const physx::PxQuat* rotation,
+ const physx::PxVec3* translation
+);
+
+/**
+Performs pending fractures and generates fractured asset, render and collision geometry
+
+\param[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool
+\param[in] bondGenerator Bond generator created by NvBlastExtAuthoringCreateBondGenerator
+\param[in] collisionBuilder Collision builder created by NvBlastExtAuthoringCreateConvexMeshBuilder
+\param[in] defaultSupportDepth All new chunks will be marked as support if its depth equal to defaultSupportDepth.
+ By default leaves (chunks without children) marked as support.
+\param[in] collisionParam Parameters of collision hulls generation.
+\return Authoring result
+*/
+NVBLAST_API Nv::Blast::AuthoringResult* NvBlastExtAuthoringProcessFracture(Nv::Blast::FractureTool& fTool,
+ Nv::Blast::BlastBondGenerator& bondGenerator, Nv::Blast::ConvexMeshBuilder& collisionBuilder, const Nv::Blast::CollisionParams& collisionParam, int32_t defaultSupportDepth = -1);
+
+/**
+Updates graphics mesh only
+
+\param[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool
+\param[out] ares AuthoringResult object which contains chunks, for which rendermeshes will be updated (e.g. to tweak UVs). Initially should be created by NvBlastExtAuthoringProcessFracture.
+*/
+NVBLAST_API void NvBlastExtAuthoringUpdateGraphicsMesh(Nv::Blast::FractureTool& fTool, Nv::Blast::AuthoringResult& ares);
+
+/**
+Build collision meshes
+
+\param[in,out] ares AuthoringResult object which contains chunks, for which collision meshes will be built.
+\param[in] collisionBuilder Reference to ConvexMeshBuilder instance.
+\param[in] collisionParam Parameters of collision hulls generation.
+\param[in] chunksToProcessCount Number of chunk indices in chunksToProcess memory buffer.
+\param[in] chunksToProcess Chunk indices for which collision mesh should be built.
+*/
+NVBLAST_API void NvBlastExtAuthoringBuildCollisionMeshes
+(
+ Nv::Blast::AuthoringResult& ares,
+ Nv::Blast::ConvexMeshBuilder& collisionBuilder,
+ const Nv::Blast::CollisionParams& collisionParam,
+ uint32_t chunksToProcessCount,
+ uint32_t* chunksToProcess
+);
+
+/**
+ Creates MeshCleaner object
+ \return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr
+*/
+NVBLAST_API Nv::Blast::MeshCleaner* NvBlastExtAuthoringCreateMeshCleaner();
+
+/**
+Finds bonds connecting chunks in a list of assets
+
+New bond descriptors may be given to bond support chunks from different components.
+
+An NvBlastAsset may appear more than once in the components array.
+
+NOTE: This function allocates memory using the allocator in NvBlastGlobals, to create the new bond
+descriptor arrays returned. The user must free this memory after use with NVBLAST_FREE
+
+\param[in] components An array of assets to merge, of size componentCount.
+\param[in] scales If not NULL, an array of size componentCount of scales to apply to the geometric data in the chunks and bonds. If NULL, no scaling is applied.
+\param[in] rotations If not NULL, an array of size componentCount of rotations to apply to the geometric data in the chunks and bonds. The quaternions MUST be normalized.
+ If NULL, no rotations are applied.
+\param[in] translations If not NULL, an array of of size componentCount of translations to apply to the geometric data in the chunks and bonds. If NULL, no translations are applied.
+\param[in] convexHullOffsets For each component, an array of chunkSize+1 specifying the start of the convex hulls for that chunk inside the chunkHulls array for that component.
+\param[in] chunkHulls For each component, an array of CollisionHull* specifying the collision geometry for the chunks in that component.
+\param[in] componentCount The size of the components and relativeTransforms arrays.
+\param[out] newBondDescs Descriptors of type NvBlastExtAssetUtilsBondDesc for new bonds between components.
+\param[in] maxSeparation Maximal distance between chunks which can be connected by bond.
+\return the number of bonds in newBondDescs
+*/
+NVBLAST_API uint32_t NvBlastExtAuthoringFindAssetConnectingBonds
+(
+ const NvBlastAsset** components,
+ const physx::PxVec3* scales,
+ const physx::PxQuat* rotations,
+ const physx::PxVec3* translations,
+ const uint32_t** convexHullOffsets,
+ const Nv::Blast::CollisionHull*** chunkHulls,
+ uint32_t componentCount,
+ NvBlastExtAssetUtilsBondDesc*& newBondDescs,
+ float maxSeparation = 0.0f
+);
+
+#endif // ifndef NVBLASTAUTHORING_H
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h index 5f3fe33..f4bd754 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringBondGenerator.h @@ -1,175 +1,175 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTAUTHORINGBONDGENERATOR_H -#define NVBLASTEXTAUTHORINGBONDGENERATOR_H - -#include "NvBlastExtAuthoringTypes.h" - -namespace physx -{ -class PxPlane; -class PxCooking; -class PxPhysicsInsertionCallback; -} - -struct NvBlastBondDesc; -struct NvBlastChunkDesc; -struct NvBlastBond; - -namespace Nv -{ -namespace Blast -{ - -// Forward declarations -class FractureTool; -class TriangleProcessor; -struct PlaneChunkIndexer; - -/** - Bond interface generation configuration - EXACT - common surface will be searched - AVERAGE - Inerface is approximated by projections or intersecitons with midplane - maxSeparation - for AVERAGE mode. Maximum distance between chunks and midplane used in decision whether create bond or chunks are too far from each other. -*/ -struct BondGenerationConfig -{ - enum BondGenMode { EXACT, AVERAGE }; - float maxSeparation; - BondGenMode bondMode; -}; - - -struct PlaneChunkIndexer -{ - PlaneChunkIndexer(int32_t chunkId, int32_t trId, physx::PxPlane pl) : chunkId(chunkId), trId(trId), plane(pl) {} - int32_t chunkId; - int32_t trId; - physx::PxPlane plane; -}; - - -/** - Tool for gathering bond information from provided mesh geometry -*/ - -class BlastBondGenerator -{ -public: - virtual ~BlastBondGenerator() {} - - /** - Release BlastBondGenerator memory - */ - virtual void release() = 0; - - /** - This method based on marking triangles during fracture process, so can be used only with internally fractured meshes. - \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore - \param[in] tool FractureTool which contains chunks representation, tool->finalizeFracturing() should be called before. - \param[in] chunkIsSupport Pointer to array of flags, if true - chunk is support. Array size should be equal to chunk count in tool. - \param[out] resultBondDescs Pointer to array of created bond descriptors. - \param[out] resultChunkDescriptors Pointer to array of created chunk descriptors. - \return Number of created bonds - */ - virtual int32_t buildDescFromInternalFracture(FractureTool* tool, const bool* chunkIsSupport, - NvBlastBondDesc*& resultBondDescs, NvBlastChunkDesc*& resultChunkDescriptors) = 0; - - - /** - Creates bond description between two meshes - \param[in] meshACount Number of triangles in mesh A - \param[in] meshA Pointer to array of triangles of mesh A. - \param[in] meshBCount Number of triangles in mesh B - \param[in] meshB Pointer to array of triangles of mesh B. - \param[out] resultBond Result bond description. - \param[in] conf Bond creation mode. - \return 0 if success - */ - virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB, - NvBlastBond& resultBond, BondGenerationConfig conf = BondGenerationConfig()) = 0; - - /** - Creates bond description between number of meshes - \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore - \param[in] meshCount Number of meshes - \param[in] geometryOffset Pointer to array of triangle offsets for each mesh. - Containts meshCount + 1 element, last one is total number of triangles in geometry - \param[in] geometry Pointer to array of triangles. - Triangles from geometryOffset[i] to geometryOffset[i+1] correspond to i-th mesh. - \param[in] overlapsCount Number of overlaps - \param[in] overlaps Pointer to array of pairs - indexes of chunks, for which bond should be created. - \param[out] resultBond Pointer to array of result bonds. - \param[in] cfg Bond creation mode. - \return Number of created bonds - */ - virtual int32_t createBondBetweenMeshes(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry, - uint32_t overlapsCount, const uint32_t* overlapsA, const uint32_t* overlapsB, - NvBlastBondDesc*& resultBond, BondGenerationConfig cfg) = 0; - - - /** - Creates bond description for prefractured meshes, when there is no info about which chunks should be connected with bond. - \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore - \param[in] meshCount Number of meshes - \param[in] geometryOffset Pointer to array of triangle offsets for each mesh. - Containts meshCount + 1 element, last one is total number of triangles in geometry - \param[in] geometry Pointer to array of triangles. - Triangles from geometryOffset[i] to geometryOffset[i+1] correspond to i-th mesh. - \param[in] chunkIsSupport Pointer to array of flags, if true - chunk is support. Array size should be equal to chunk count in tool. - \param[out] resultBondDescs Pointer to array of result bonds. - \param[in] conf Bond creation mode. - \return Number of created bonds - */ - virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry, - const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs, - BondGenerationConfig conf = BondGenerationConfig()) = 0; - - /** - Creates bond description for prefractured meshes, when there is no info about which chunks should be connected with bond. - This uses the same process as bondsFromPrefractured using the BondGenMode::AVERAGE mode however the existing collision data is used. - \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore. - \param[in] meshCount Number of meshes - \param[in] convexHullOffset Pointer to array of convex hull offsets for each mesh. - Containts meshCount + 1 element, last one is total number of hulls in the geometry - \param[in] chunkHulls Pointer to array of convex hulls. - Hulls from convexHullOffset[i] to convexHullOffset[i+1] correspond to i-th mesh. - \param[in] chunkIsSupport Pointer to array of flags, if true - chunk is support. Array size should be equal to chunk count in tool. - \param[in] meshGroups Pointer to array of group ids for each mesh, bonds will not be generated between meshs of the same group. If null each mesh is assumed to be in it's own group. - \param[out] resultBondDescs Pointer to array of result bonds. - \return Number of created bonds - */ - virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls, - const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) = 0; -}; - -} // namespace Blast -} // namespace Nv - +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef NVBLASTEXTAUTHORINGBONDGENERATOR_H
+#define NVBLASTEXTAUTHORINGBONDGENERATOR_H
+
+#include "NvBlastExtAuthoringTypes.h"
+
+namespace physx
+{
+class PxPlane;
+class PxCooking;
+class PxPhysicsInsertionCallback;
+}
+
+struct NvBlastBondDesc;
+struct NvBlastChunkDesc;
+struct NvBlastBond;
+
+namespace Nv
+{
+namespace Blast
+{
+
+// Forward declarations
+class FractureTool;
+class TriangleProcessor;
+struct PlaneChunkIndexer;
+
+/**
+ Bond interface generation configuration
+ EXACT - common surface will be searched
+ AVERAGE - Inerface is approximated by projections or intersecitons with midplane
+ maxSeparation - for AVERAGE mode. Maximum distance between chunks and midplane used in decision whether create bond or chunks are too far from each other.
+*/
+struct BondGenerationConfig
+{
+ enum BondGenMode { EXACT, AVERAGE };
+ float maxSeparation;
+ BondGenMode bondMode;
+};
+
+
+struct PlaneChunkIndexer
+{
+ PlaneChunkIndexer(int32_t chunkId, int32_t trId, physx::PxPlane pl) : chunkId(chunkId), trId(trId), plane(pl) {}
+ int32_t chunkId;
+ int32_t trId;
+ physx::PxPlane plane;
+};
+
+
+/**
+ Tool for gathering bond information from provided mesh geometry
+*/
+
+class BlastBondGenerator
+{
+public:
+ virtual ~BlastBondGenerator() {}
+
+ /**
+ Release BlastBondGenerator memory
+ */
+ virtual void release() = 0;
+
+ /**
+ This method based on marking triangles during fracture process, so can be used only with internally fractured meshes.
+ \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore
+ \param[in] tool FractureTool which contains chunks representation, tool->finalizeFracturing() should be called before.
+ \param[in] chunkIsSupport Pointer to array of flags, if true - chunk is support. Array size should be equal to chunk count in tool.
+ \param[out] resultBondDescs Pointer to array of created bond descriptors.
+ \param[out] resultChunkDescriptors Pointer to array of created chunk descriptors.
+ \return Number of created bonds
+ */
+ virtual int32_t buildDescFromInternalFracture(FractureTool* tool, const bool* chunkIsSupport,
+ NvBlastBondDesc*& resultBondDescs, NvBlastChunkDesc*& resultChunkDescriptors) = 0;
+
+
+ /**
+ Creates bond description between two meshes
+ \param[in] meshACount Number of triangles in mesh A
+ \param[in] meshA Pointer to array of triangles of mesh A.
+ \param[in] meshBCount Number of triangles in mesh B
+ \param[in] meshB Pointer to array of triangles of mesh B.
+ \param[out] resultBond Result bond description.
+ \param[in] conf Bond creation mode.
+ \return 0 if success
+ */
+ virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB,
+ NvBlastBond& resultBond, BondGenerationConfig conf = BondGenerationConfig()) = 0;
+
+ /**
+ Creates bond description between number of meshes
+ \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore
+ \param[in] meshCount Number of meshes
+ \param[in] geometryOffset Pointer to array of triangle offsets for each mesh.
+ Containts meshCount + 1 element, last one is total number of triangles in geometry
+ \param[in] geometry Pointer to array of triangles.
+ Triangles from geometryOffset[i] to geometryOffset[i+1] correspond to i-th mesh.
+ \param[in] overlapsCount Number of overlaps
+ \param[in] overlaps Pointer to array of pairs - indexes of chunks, for which bond should be created.
+ \param[out] resultBond Pointer to array of result bonds.
+ \param[in] cfg Bond creation mode.
+ \return Number of created bonds
+ */
+ virtual int32_t createBondBetweenMeshes(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
+ uint32_t overlapsCount, const uint32_t* overlapsA, const uint32_t* overlapsB,
+ NvBlastBondDesc*& resultBond, BondGenerationConfig cfg) = 0;
+
+
+ /**
+ Creates bond description for prefractured meshes, when there is no info about which chunks should be connected with bond.
+ \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore
+ \param[in] meshCount Number of meshes
+ \param[in] geometryOffset Pointer to array of triangle offsets for each mesh.
+ Containts meshCount + 1 element, last one is total number of triangles in geometry
+ \param[in] geometry Pointer to array of triangles.
+ Triangles from geometryOffset[i] to geometryOffset[i+1] correspond to i-th mesh.
+ \param[in] chunkIsSupport Pointer to array of flags, if true - chunk is support. Array size should be equal to chunk count in tool.
+ \param[out] resultBondDescs Pointer to array of result bonds.
+ \param[in] conf Bond creation mode.
+ \return Number of created bonds
+ */
+ virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
+ const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs,
+ BondGenerationConfig conf = BondGenerationConfig()) = 0;
+
+ /**
+ Creates bond description for prefractured meshes, when there is no info about which chunks should be connected with bond.
+ This uses the same process as bondsFromPrefractured using the BondGenMode::AVERAGE mode however the existing collision data is used.
+ \note User should call NVBLAST_FREE for resultBondDescs when it not needed anymore.
+ \param[in] meshCount Number of meshes
+ \param[in] convexHullOffset Pointer to array of convex hull offsets for each mesh.
+ Containts meshCount + 1 element, last one is total number of hulls in the geometry
+ \param[in] chunkHulls Pointer to array of convex hulls.
+ Hulls from convexHullOffset[i] to convexHullOffset[i+1] correspond to i-th mesh.
+ \param[in] chunkIsSupport Pointer to array of flags, if true - chunk is support. Array size should be equal to chunk count in tool.
+ \param[in] meshGroups Pointer to array of group ids for each mesh, bonds will not be generated between meshs of the same group. If null each mesh is assumed to be in it's own group.
+ \param[out] resultBondDescs Pointer to array of result bonds.
+ \return Number of created bonds
+ */
+ virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls,
+ const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) = 0;
+};
+
+} // namespace Blast
+} // namespace Nv
+
#endif // NVBLASTEXTAUTHORINGBONDGENERATOR_H
\ No newline at end of file diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h index 03ef8a8..cde115a 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringCollisionBuilder.h @@ -1,138 +1,138 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDER_H -#define NVBLASTEXTAUTHORINGCOLLISIONBUILDER_H - -#include "NvBlastTypes.h" - -namespace physx -{ -class PxCooking; -class PxPhysicsInsertionCallback; -class PxVec3; -class PxConvexMesh; -} - - -namespace Nv -{ -namespace Blast -{ - -struct CollisionHull; -struct Triangle; - -struct CollisionParams -{ - CollisionParams() - { - setDefault(); - } - void setDefault() - { - maximumNumberOfHulls = 8; - maximumNumberOfVerticesPerHull = 64; - voxelGridResolution = 1000000; - concavity = 0.0025f; - } - uint32_t maximumNumberOfHulls; // Maximum number of convex hull generated for one chunk. If equal to 1 convex decomposition is disabled. - uint32_t maximumNumberOfVerticesPerHull; // Controls the maximum number of triangles per convex-hull (default=64, range=4-1024) - uint32_t voxelGridResolution; // Voxel grid resolution used for chunk convex decomposition (default=1,000,000, range=10,000-16,000,000). - float concavity; // Value between 0 and 1, controls how accurate hull generation is -}; - -/** - ConvexMeshBuilder provides routine to build collision hulls from array of vertices. - Collision hull is built as convex hull of provided point set. - If due to some reason building of convex hull is failed, collision hull is built as bounding box of vertex set. -*/ -class ConvexMeshBuilder -{ -public: - virtual ~ConvexMeshBuilder() {} - - /** - Release ConvexMeshBuilder memory - */ - virtual void release() = 0; - - /** - Method creates CollisionHull from provided array of vertices. - \param[in] verticesCount Number of vertices - \param[in] vertexData Vertex array of some object, for which collision geometry should be built - \param[out] output Reference on CollisionHull object in which generated geometry should be saved - */ - virtual CollisionHull* buildCollisionGeometry(uint32_t verticesCount, const physx::PxVec3* vertexData) = 0; - - /** - Method creates PxConvexMesh from provided array of vertices. - \param[in] verticesCount Number of vertices - \param[in] vertexData Vertex array of some object, for which collision geometry should be built - - \return pointer to the PxConvexMesh object if it was built successfully, 'nullptr' otherwise. - */ - virtual physx::PxConvexMesh* buildConvexMesh(uint32_t verticesCount, const physx::PxVec3* vertexData) = 0; - - - /** - Method creates PxConvexMesh from provided ConvexHull geometry - \param[in] hull ConvexHull geometry - - \return pointer to the PxConvexMesh object if it was built successfully, 'nullptr' otherwise. - */ - virtual physx::PxConvexMesh* buildConvexMesh(const CollisionHull& hull) = 0; - - - /** - Convex geometry trimming. - Using slicing with noised slicing surface can result in intersecting collision geometry. - It leads to unstable behaviour of rigid body simulation. - This method trims all intersecting parts of collision geometry. - As a drawback, trimming collision geometry can lead to penetrating render meshes during simulation. - - \param[in] chunksCount Number of chunks - \param[in,out] in ConvexHull geometry which should be clipped. - \param[in] chunkDepth Array of depth levels of convex hulls corresponding chunks. - - */ - virtual void trimCollisionGeometry(uint32_t chunksCount, CollisionHull** in, const uint32_t* chunkDepth) = 0; - - - /** - Create mesh convex decomposition - */ - virtual int32_t buildMeshConvexDecomposition(const Nv::Blast::Triangle* mesh, uint32_t triangleCount, const CollisionParams& params, CollisionHull** &convexes) = 0; - -}; - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDER_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDER_H
+#define NVBLASTEXTAUTHORINGCOLLISIONBUILDER_H
+
+#include "NvBlastTypes.h"
+
+namespace physx
+{
+class PxCooking;
+class PxPhysicsInsertionCallback;
+class PxVec3;
+class PxConvexMesh;
+}
+
+
+namespace Nv
+{
+namespace Blast
+{
+
+struct CollisionHull;
+struct Triangle;
+
+struct CollisionParams
+{
+ CollisionParams()
+ {
+ setDefault();
+ }
+ void setDefault()
+ {
+ maximumNumberOfHulls = 8;
+ maximumNumberOfVerticesPerHull = 64;
+ voxelGridResolution = 1000000;
+ concavity = 0.0025f;
+ }
+ uint32_t maximumNumberOfHulls; // Maximum number of convex hull generated for one chunk. If equal to 1 convex decomposition is disabled.
+ uint32_t maximumNumberOfVerticesPerHull; // Controls the maximum number of triangles per convex-hull (default=64, range=4-1024)
+ uint32_t voxelGridResolution; // Voxel grid resolution used for chunk convex decomposition (default=1,000,000, range=10,000-16,000,000).
+ float concavity; // Value between 0 and 1, controls how accurate hull generation is
+};
+
+/**
+ ConvexMeshBuilder provides routine to build collision hulls from array of vertices.
+ Collision hull is built as convex hull of provided point set.
+ If due to some reason building of convex hull is failed, collision hull is built as bounding box of vertex set.
+*/
+class ConvexMeshBuilder
+{
+public:
+ virtual ~ConvexMeshBuilder() {}
+
+ /**
+ Release ConvexMeshBuilder memory
+ */
+ virtual void release() = 0;
+
+ /**
+ Method creates CollisionHull from provided array of vertices.
+ \param[in] verticesCount Number of vertices
+ \param[in] vertexData Vertex array of some object, for which collision geometry should be built
+ \param[out] output Reference on CollisionHull object in which generated geometry should be saved
+ */
+ virtual CollisionHull* buildCollisionGeometry(uint32_t verticesCount, const physx::PxVec3* vertexData) = 0;
+
+ /**
+ Method creates PxConvexMesh from provided array of vertices.
+ \param[in] verticesCount Number of vertices
+ \param[in] vertexData Vertex array of some object, for which collision geometry should be built
+
+ \return pointer to the PxConvexMesh object if it was built successfully, 'nullptr' otherwise.
+ */
+ virtual physx::PxConvexMesh* buildConvexMesh(uint32_t verticesCount, const physx::PxVec3* vertexData) = 0;
+
+
+ /**
+ Method creates PxConvexMesh from provided ConvexHull geometry
+ \param[in] hull ConvexHull geometry
+
+ \return pointer to the PxConvexMesh object if it was built successfully, 'nullptr' otherwise.
+ */
+ virtual physx::PxConvexMesh* buildConvexMesh(const CollisionHull& hull) = 0;
+
+
+ /**
+ Convex geometry trimming.
+ Using slicing with noised slicing surface can result in intersecting collision geometry.
+ It leads to unstable behaviour of rigid body simulation.
+ This method trims all intersecting parts of collision geometry.
+ As a drawback, trimming collision geometry can lead to penetrating render meshes during simulation.
+
+ \param[in] chunksCount Number of chunks
+ \param[in,out] in ConvexHull geometry which should be clipped.
+ \param[in] chunkDepth Array of depth levels of convex hulls corresponding chunks.
+
+ */
+ virtual void trimCollisionGeometry(uint32_t chunksCount, CollisionHull** in, const uint32_t* chunkDepth) = 0;
+
+
+ /**
+ Create mesh convex decomposition
+ */
+ virtual int32_t buildMeshConvexDecomposition(const Nv::Blast::Triangle* mesh, uint32_t triangleCount, const CollisionParams& params, CollisionHull** &convexes) = 0;
+
+};
+
+} // namespace Blast
+} // namespace Nv
+
+
+#endif // ifndef NVBLASTEXTAUTHORINGCOLLISIONBUILDER_H
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringCutout.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringCutout.h index 44ed12f..0702afd 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringCutout.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringCutout.h @@ -1,106 +1,91 @@ -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved. - -#ifndef NVBLASTAUTHORINGCUTOUT_H -#define NVBLASTAUTHORINGCUTOUT_H - -#include "NvBlastExtAuthoringTypes.h" - - -namespace Nv -{ -namespace Blast -{ - -/** -Interface to a "cutout set," used with chippable fracturing. A cutout set is created from a bitmap. The -result is turned into cutouts which are applied to the mesh. For example, a bitmap which looks like a brick -pattern will generate a cutout for each "brick," forming the cutout set. - -Each cutout is a 2D entity, meant to be projected onto various faces of a mesh. They are represented -by a set of 2D vertices, which form closed loops. More than one loop may represent a single cutout, if -the loops are forced to be convex. Otherwise, a cutout is represented by a single loop. -*/ -class CutoutSet -{ -public: - /** Returns the number of cutouts in the set. */ - virtual uint32_t getCutoutCount() const = 0; - - /** - Applies to the cutout indexed by cutoutIndex: - Returns the number of vertices in the cutout. - */ - virtual uint32_t getCutoutVertexCount(uint32_t cutoutIndex) const = 0; - - /** - Applies to the cutout indexed by cutoutIndex: - Returns the number of loops in this cutout. - */ - virtual uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const = 0; - - /** - Applies to the cutout indexed by cutoutIndex: - Returns the vertex indexed by vertexIndex. (Only the X and Y coordinates are used.) - */ - virtual const physx::PxVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t vertexIndex) const = 0; - - /** - Applies to the cutout indexed by cutoutIndex: - Returns the number of vertices in the loop indexed by loopIndex. - */ - virtual uint32_t getCutoutLoopSize(uint32_t coutoutIndex, uint32_t loopIndex) const = 0; - - /** - Applies to the cutout indexed by cutoutIndex: - Returns the vertex index of the vertex indexed by vertexNum, in the loop - indexed by loopIndex. - */ - virtual uint32_t getCutoutLoopVertexIndex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexNum) const = 0; - - /** - Applies to the cutout indexed by cutoutIndex: - Returns the flags of the vertex indexed by vertexNum, in the loop - indexed by loopIndex. - */ - virtual uint32_t getCutoutLoopVertexFlags(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexNum) const = 0; - - /** - Whether or not this cutout set is to be tiled. - */ - virtual bool isPeriodic() const = 0; - - /** - The dimensions of the fracture map used to create the cutout set. - */ - virtual const physx::PxVec2& getDimensions() const = 0; - - /** Serialization */ - //virtual void serialize(physx::PxFileBuf& stream) const = 0; - //virtual void deserialize(physx::PxFileBuf& stream) = 0; - - /** Releases all memory and deletes itself. */ - virtual void release() = 0; - -protected: - /** Protected destructor. Use the release() method. */ - virtual ~CutoutSet() {} -}; - -} // namespace Blast -} // namespace Nv - - -#endif // idndef NVBLASTAUTHORINGCUTOUT_H +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+#ifndef NVBLASTAUTHORINGCUTOUT_H
+#define NVBLASTAUTHORINGCUTOUT_H
+
+#include "NvBlastExtAuthoringTypes.h"
+
+
+namespace Nv
+{
+namespace Blast
+{
+
+/**
+Interface to a "cutout set," used with chippable fracturing. A cutout set is created from a bitmap. The
+result is turned into cutouts which are applied to the mesh. For example, a bitmap which looks like a brick
+pattern will generate a cutout for each "brick," forming the cutout set.
+
+Each cutout is a 2D entity, meant to be projected onto various faces of a mesh. They are represented
+by a set of 2D vertices, which form closed loops. More than one loop may represent a single cutout, if
+the loops are forced to be convex. Otherwise, a cutout is represented by a single loop.
+*/
+class CutoutSet
+{
+public:
+ /** Returns the number of cutouts in the set. */
+ virtual uint32_t getCutoutCount() const = 0;
+
+ /**
+ Applies to the cutout indexed by cutoutIndex:
+ Returns the number of vertices in the cutout.
+ */
+ virtual uint32_t getCutoutVertexCount(uint32_t cutoutIndex, uint32_t loopIndex) const = 0;
+
+ /**
+ Applies to the cutout indexed by cutoutIndex:
+ Returns the number of loops in this cutout.
+ */
+ virtual uint32_t getCutoutLoopCount(uint32_t cutoutIndex) const = 0;
+
+ /**
+ Applies to the cutout indexed by cutoutIndex:
+ Returns the vertex indexed by vertexIndex. (Only the X and Y coordinates are used.)
+ */
+ virtual const physx::PxVec3& getCutoutVertex(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const = 0;
+
+ /**
+ If smoothing group should be changed for adjacent to this vertex faces return true
+ */
+ virtual bool isCutoutVertexToggleSmoothingGroup(uint32_t cutoutIndex, uint32_t loopIndex, uint32_t vertexIndex) const = 0;
+
+ /**
+ Whether or not this cutout set is to be tiled.
+ */
+ virtual bool isPeriodic() const = 0;
+
+ /**
+ The dimensions of the fracture map used to create the cutout set.
+ */
+ virtual const physx::PxVec2& getDimensions() const = 0;
+
+ /** Serialization */
+ //virtual void serialize(physx::PxFileBuf& stream) const = 0;
+ //virtual void deserialize(physx::PxFileBuf& stream) = 0;
+
+ /** Releases all memory and deletes itself. */
+ virtual void release() = 0;
+
+protected:
+ /** Protected destructor. Use the release() method. */
+ virtual ~CutoutSet() {}
+};
+
+} // namespace Blast
+} // namespace Nv
+
+
+#endif // idndef NVBLASTAUTHORINGCUTOUT_H
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h index ca36806..b75073a 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h @@ -1,482 +1,492 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTAUTHORINGFRACTURETOOL_H -#define NVBLASTAUTHORINGFRACTURETOOL_H - -#include "NvBlastExtAuthoringTypes.h" - -namespace Nv -{ -namespace Blast -{ - -class SpatialAccelerator; -class Triangulator; -class Mesh; -class CutoutSet; - -/* - Chunk data, chunk with chunkId == 0 is always source mesh. -*/ -struct ChunkInfo -{ - Mesh* meshData; - int32_t parent; - int32_t chunkId; - bool isLeaf; - bool isChanged; -}; - -/* - Noise fracturing configuration for chunks's faces -*/ -struct NoiseConfiguration -{ - /** - Noisy slicing configutaion: - - Amplitude of cutting surface noise. If it is 0 - noise is disabled. - */ - float amplitude = 0.f; - - /** - Frequencey of cutting surface noise. - */ - float frequency = 1.f; - - /** - Octave number in slicing surface noise. - */ - uint32_t octaveNumber = 1; - - /** - Cutting surface resolution. - */ - uint32_t surfaceResolution = 1; -}; - -/* - Slicing fracturing configuration -*/ -struct SlicingConfiguration -{ - /** - Number of slices in each direction - */ - int32_t x_slices = 1, y_slices = 1, z_slices = 1; - - /** - Offset variation, value in [0, 1] - */ - float offset_variations = 0.f; - - /** - Angle variation, value in [0, 1] - */ - float angle_variations = 0.f; - - /* - Noise parameters for faces between sliced chunks - */ - NoiseConfiguration noise; -}; - -/** - Cutout fracturing configuration -*/ -struct CutoutConfiguration -{ - /** - Set of grouped convex loop patterns for cutout in normal direction. - Not required for PLANE_ONLY mode - */ - CutoutSet* cutoutSet = nullptr; - - /** - Transform for initial pattern position and orientation. - By default 2d pattern lies in XY plane (Y is up) the center of pattern is (0, 0) - */ - physx::PxTransform transform = physx::PxTransform(physx::PxIdentity); - - /** - Scale for pattern. Unscaled pattern has size (1, 1). - For negative scale pattern will be placed at the center of chunk and scaled with max distance between points of its AABB - */ - physx::PxVec2 scale = physx::PxVec2(-1, -1); - - /** - If relative transform is set - position will be displacement vector from chunk's center. Otherwise from global origin. - */ - bool isRelativeTransform = true; - - /** - Noise parameters for cutout surface, see NoiseConfiguration. - */ - NoiseConfiguration noise; -}; - -/** - Class for voronoi sites generation inside supplied mesh. -*/ -class VoronoiSitesGenerator -{ -public: - virtual ~VoronoiSitesGenerator() {} - - /** - Release VoronoiSitesGenerator memory - */ - virtual void release() = 0; - - /** - Set base fracture mesh - */ - virtual void setBaseMesh(const Mesh* mesh) = 0; - - /** - Access to generated voronoi sites. - \param[out] Pointer to generated voronoi sites - \return Count of generated voronoi sites. - */ - virtual uint32_t getVoronoiSites(const physx::PxVec3*& sites) = 0; - - /** - Add site in particular point - \param[in] site Site coordinates - */ - virtual void addSite(const physx::PxVec3& site) = 0; - /** - Uniformly generate sites inside the mesh - \param[in] numberOfSites Number of generated sites - */ - virtual void uniformlyGenerateSitesInMesh(uint32_t numberOfSites) = 0; - - /** - Generate sites in clustered fashion - \param[in] numberOfClusters Number of generated clusters - \param[in] sitesPerCluster Number of sites in each cluster - \param[in] clusterRadius Voronoi cells cluster radius - */ - virtual void clusteredSitesGeneration(uint32_t numberOfClusters, uint32_t sitesPerCluster, float clusterRadius) = 0; - - /** - Radial pattern of sites generation - \param[in] center Center of generated pattern - \param[in] normal Normal to plane in which sites are generated - \param[in] radius Pattern radius - \param[in] angularSteps Number of angular steps - \param[in] radialSteps Number of radial steps - \param[in] angleOffset Angle offset at each radial step - \param[in] variability Randomness of sites distribution - */ - virtual void radialPattern(const physx::PxVec3& center, const physx::PxVec3& normal, float radius, int32_t angularSteps, int32_t radialSteps, float angleOffset = 0.0f, float variability = 0.0f) = 0; - - /** - Generate sites inside sphere - \param[in] count Count of generated sites - \param[in] radius Radius of sphere - \param[in] center Center of sphere - */ - virtual void generateInSphere(const uint32_t count, const float radius, const physx::PxVec3& center) = 0; - - /** - Set stencil mesh. With stencil mesh sites are generated only inside both of fracture and stencil meshes. - \param[in] stencil Stencil mesh. - */ - virtual void setStencil(const Mesh* stencil) = 0; - - /** - Removes stencil mesh - */ - virtual void clearStencil() = 0; - - /** - Deletes sites inside supplied sphere - \param[in] radius Radius of sphere - \param[in] center Center of sphere - \param[in] eraserProbability Probability of removing some particular site - */ - virtual void deleteInSphere(const float radius, const physx::PxVec3& center, const float eraserProbability = 1) = 0; -}; - -/** - FractureTool class provides methods to fracture provided mesh and generate Blast asset data -*/ -class FractureTool -{ - -public: - virtual ~FractureTool() {} - - /** - Release FractureTool memory - */ - virtual void release() = 0; - - /** - Reset FractureTool state. - */ - virtual void reset() = 0; - - - /** - Set input mesh which will be fractured, FractureTool will be reseted. - */ - virtual void setSourceMesh(const Mesh* mesh) = 0; - - /** - Set chunk mesh, parentId should be valid, return id of new chunk. - */ - virtual int32_t setChunkMesh(const Mesh* mesh, int32_t parentId) = 0; - - /** - Set the material id to use for new interior faces. Defaults to MATERIAL_INTERIOR - */ - virtual void setInteriorMaterialId(int32_t materialId) = 0; - - /** - Gets the material id to use for new interior faces - */ - virtual int32_t getInteriorMaterialId() const = 0; - - /** - Replaces an material id on faces with a new one - */ - virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0; - - /** - Get chunk mesh in polygonal representation. User's code should release it after usage. - */ - virtual Mesh* createChunkMesh(int32_t chunkId) = 0; - - /** - Input mesh is scaled and transformed internally to fit unit cube centered in origin. - Method provides offset vector and scale parameter; - */ - virtual void getTransformation(physx::PxVec3& offset, float& scale) = 0; - - - /** - Fractures specified chunk with voronoi method. - \param[in] chunkId Chunk to fracture - \param[in] cellPoints Array of voronoi sites - \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them. - Case replaceChunk == true && chunkId == 0 considered as wrong input parameters - \return If 0, fracturing is successful. - */ - virtual int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const physx::PxVec3* cellPoints, bool replaceChunk) = 0; - - /** - Fractures specified chunk with voronoi method. Cells can be scaled along x,y,z axes. - \param[in] chunkId Chunk to fracture - \param[in] cellPoints Array of voronoi sites - \param[in] cellPoints Array of voronoi sites - \param[in] scale Voronoi cells scaling factor - \param[in] rotation Voronoi cells rotation. Has no effect without cells scale factor - \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them. - Case replaceChunk == true && chunkId == 0 considered as wrong input parameters - \return If 0, fracturing is successful. - */ - virtual int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const physx::PxVec3* cellPoints, const physx::PxVec3& scale, const physx::PxQuat& rotation, bool replaceChunk) = 0; - - - /** - Fractures specified chunk with slicing method. - \param[in] chunkId Chunk to fracture - \param[in] conf Slicing parameters, see SlicingConfiguration. - \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them. - Case replaceChunk == true && chunkId == 0 considered as wrong input parameters - \param[in] rnd User supplied random number generator - - \return If 0, fracturing is successful. - */ - virtual int32_t slicing(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0; - - /** - Cut chunk with plane. - \param[in] chunkId Chunk to fracture - \param[in] normal Plane normal - \param[in] position Point on plane - \param[in] noise Noise configuration for plane-chunk intersection, see NoiseConfiguration. - \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them. - Case replaceChunk == true && chunkId == 0 considered as wrong input parameters - \param[in] rnd User supplied random number generator - - \return If 0, fracturing is successful. - */ - virtual int32_t cut(uint32_t chunkId, const physx::PxVec3& normal, const physx::PxVec3& position, const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd) = 0; - - /** - Cutout fracture for specified chunk. - \param[in] chunkId Chunk to fracture - \param[in] conf Cutout parameters, see CutoutConfiguration. - \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them. - Case replaceChunk == true && chunkId == 0 considered as wrong input parameters - \param[in] rnd User supplied random number generator - - \return If 0, fracturing is successful. - */ - virtual int32_t cutout(uint32_t chunkId, CutoutConfiguration conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0; - - - /** - Creates resulting fractured mesh geometry from intermediate format - */ - virtual void finalizeFracturing() = 0; - - /** - Returns overall number of chunks in fracture. - */ - virtual uint32_t getChunkCount() const = 0; - - /** - Get chunk information - */ - virtual const ChunkInfo& getChunkInfo(int32_t chunkIndex) = 0; - - /** - Get percentage of mesh overlap. - percentage computed as volume(intersection(meshA , meshB)) / volume (meshA) - \param[in] meshA Mesh A - \param[in] meshB Mesh B - \return mesh overlap percentage - */ - virtual float getMeshOverlap(const Mesh& meshA, const Mesh& meshB) = 0; - - /** - Get chunk base mesh - \param[in] chunkIndex Chunk index - \param[out] output Array of triangles to be filled - \return number of triangles in base mesh - */ - virtual uint32_t getBaseMesh(int32_t chunkIndex, Triangle*& output) = 0; - - /** - Update chunk base mesh - \note Doesn't allocates output array, Triangle* output should be preallocated by user - \param[in] chunkIndex Chunk index - \param[out] output Array of triangles to be filled - \return number of triangles in base mesh - */ - virtual uint32_t updateBaseMesh(int32_t chunkIndex, Triangle* output) = 0; - - /** - Return index of chunk with specified chunkId - \param[in] chunkId Chunk ID - \return Chunk index in internal buffer, if not exist -1 is returned. - */ - virtual int32_t getChunkIndex(int32_t chunkId) = 0; - - /** - Return id of chunk with specified index. - \param[in] chunkIndex Chunk index - \return Chunk id or -1 if there is no such chunk. - */ - virtual int32_t getChunkId(int32_t chunkIndex) = 0; - - /** - Return depth level of the given chunk - \param[in] chunkId Chunk ID - \return Chunk depth or -1 if there is no such chunk. - */ - virtual int32_t getChunkDepth(int32_t chunkId) = 0; - - /** - Return array of chunks IDs with given depth. - \param[in] depth Chunk depth - \param[out] Pointer to array of chunk IDs - \return Number of chunks in array - */ - virtual uint32_t getChunksIdAtDepth(uint32_t depth, int32_t*& chunkIds) = 0; - - /** - Get result geometry without noise as vertex and index buffers, where index buffers contain series of triplets - which represent triangles. - \param[out] vertexBuffer Array of vertices to be filled - \param[out] indexBuffer Array of indices to be filled - \param[out] indexBufferOffsets Array of offsets in indexBuffer for each base mesh. - Contains getChunkCount() + 1 elements. Last one is indexBuffer size - \return Number of vertices in vertexBuffer - */ - virtual uint32_t getBufferedBaseMeshes(Vertex*& vertexBuffer, uint32_t*& indexBuffer, uint32_t*& indexBufferOffsets) = 0; - - /** - Set automatic islands removing. May cause instabilities. - \param[in] isRemoveIslands Flag whether remove or not islands. - */ - virtual void setRemoveIslands(bool isRemoveIslands) = 0; - - /** - Try find islands and remove them on some specifical chunk. If chunk has childs, island removing can lead to wrong results! Apply it before further chunk splitting. - \param[in] chunkId Chunk ID which should be checked for islands - \return Number of found islands is returned - */ - virtual int32_t islandDetectionAndRemoving(int32_t chunkId) = 0; - - /** - Check if input mesh contains open edges. Open edges can lead to wrong fracturing results. - \return true if mesh contains open edges - */ - virtual bool isMeshContainOpenEdges(const Mesh* input) = 0; - - /** - Delete all children for specified chunk (also recursively delete chidren of children). - \param[in] chunkId Chunk ID which children should be deleted - \return true if one or more chunks were removed - */ - virtual bool deleteAllChildrenOfChunk(int32_t chunkId) = 0; - - /** - Optimize chunk hierarhy for better runtime performance. - It tries to unite chunks to groups of some size in order to transform flat hierarchy (all chunks are children of single root) - to tree like hieracrhy with limited number of children for each chunk. - \param[in] maxAtLevel If number of children of some chunk less then maxAtLevel then it would be considered as already optimized and skipped. - \param[in] maxGroupSize Max number of children for processed chunks. - */ - virtual void uniteChunks(uint32_t maxAtLevel, uint32_t maxGroupSize) = 0; - - /** - Rescale interior uv coordinates of given chunk to fit square of given size. - \param[in] side Size of square side - \param[in] chunkId Chunk ID for which UVs should be scaled. - */ - virtual void fitUvToRect(float side, uint32_t chunkId) = 0; - - /** - Rescale interior uv coordinates of all existing chunks to fit square of given size, relative sizes will be preserved. - \param[in] side Size of square side - */ - virtual void fitAllUvToRect(float side) = 0; - -}; - -} // namespace Blast -} // namespace Nv - -#endif // ifndef NVBLASTAUTHORINGFRACTURETOOL_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef NVBLASTAUTHORINGFRACTURETOOL_H
+#define NVBLASTAUTHORINGFRACTURETOOL_H
+
+#include "NvBlastExtAuthoringTypes.h"
+
+namespace Nv
+{
+namespace Blast
+{
+
+class SpatialAccelerator;
+class Triangulator;
+class Mesh;
+class CutoutSet;
+
+/*
+ Chunk data, chunk with chunkId == 0 is always source mesh.
+*/
+struct ChunkInfo
+{
+ Mesh* meshData;
+ int32_t parent;
+ int32_t chunkId;
+ bool isLeaf;
+ bool isChanged;
+};
+
+/*
+ Noise fracturing configuration for chunks's faces
+*/
+struct NoiseConfiguration
+{
+ /**
+ Noisy slicing configutaion:
+
+ Amplitude of cutting surface noise. If it is 0 - noise is disabled.
+ */
+ float amplitude = 0.f;
+
+ /**
+ Frequencey of cutting surface noise.
+ */
+ float frequency = 1.f;
+
+ /**
+ Octave number in slicing surface noise.
+ */
+ uint32_t octaveNumber = 1;
+
+ /**
+ Sampling interval for surface grid.
+ */
+ physx::PxVec3 samplingInterval = physx::PxVec3(1.f);
+};
+
+/*
+ Slicing fracturing configuration
+*/
+struct SlicingConfiguration
+{
+ /**
+ Number of slices in each direction
+ */
+ int32_t x_slices = 1, y_slices = 1, z_slices = 1;
+
+ /**
+ Offset variation, value in [0, 1]
+ */
+ float offset_variations = 0.f;
+
+ /**
+ Angle variation, value in [0, 1]
+ */
+ float angle_variations = 0.f;
+
+ /*
+ Noise parameters for faces between sliced chunks
+ */
+ NoiseConfiguration noise;
+};
+
+/**
+ Cutout fracturing configuration
+*/
+struct CutoutConfiguration
+{
+ /**
+ Set of grouped convex loop patterns for cutout in normal direction.
+ Not required for PLANE_ONLY mode
+ */
+ CutoutSet* cutoutSet = nullptr;
+
+ /**
+ Transform for initial pattern position and orientation.
+ By default 2d pattern lies in XY plane (Y is up) the center of pattern is (0, 0)
+ */
+ physx::PxTransform transform = physx::PxTransform(physx::PxIdentity);
+
+ /**
+ Scale for pattern. Unscaled pattern has size (1, 1).
+ For negative scale pattern will be placed at the center of chunk and scaled with max distance between points of its AABB
+ */
+ physx::PxVec2 scale = physx::PxVec2(-1, -1);
+
+ /**
+ Conic aperture in degree, for cylindric cutout set it to 0.
+ */
+ float aperture = 0.f;
+
+ /**
+ If relative transform is set - position will be displacement vector from chunk's center. Otherwise from global origin.
+ */
+ bool isRelativeTransform = true;
+
+ /**
+ Add generatad faces to the same smoothing group as original face without noise
+ */
+ bool useSmoothing = false;
+
+ /**
+ Noise parameters for cutout surface, see NoiseConfiguration.
+ */
+ NoiseConfiguration noise;
+};
+
+/**
+ Class for voronoi sites generation inside supplied mesh.
+*/
+class VoronoiSitesGenerator
+{
+public:
+ virtual ~VoronoiSitesGenerator() {}
+
+ /**
+ Release VoronoiSitesGenerator memory
+ */
+ virtual void release() = 0;
+
+ /**
+ Set base fracture mesh
+ */
+ virtual void setBaseMesh(const Mesh* mesh) = 0;
+
+ /**
+ Access to generated voronoi sites.
+ \param[out] Pointer to generated voronoi sites
+ \return Count of generated voronoi sites.
+ */
+ virtual uint32_t getVoronoiSites(const physx::PxVec3*& sites) = 0;
+
+ /**
+ Add site in particular point
+ \param[in] site Site coordinates
+ */
+ virtual void addSite(const physx::PxVec3& site) = 0;
+ /**
+ Uniformly generate sites inside the mesh
+ \param[in] numberOfSites Number of generated sites
+ */
+ virtual void uniformlyGenerateSitesInMesh(uint32_t numberOfSites) = 0;
+
+ /**
+ Generate sites in clustered fashion
+ \param[in] numberOfClusters Number of generated clusters
+ \param[in] sitesPerCluster Number of sites in each cluster
+ \param[in] clusterRadius Voronoi cells cluster radius
+ */
+ virtual void clusteredSitesGeneration(uint32_t numberOfClusters, uint32_t sitesPerCluster, float clusterRadius) = 0;
+
+ /**
+ Radial pattern of sites generation
+ \param[in] center Center of generated pattern
+ \param[in] normal Normal to plane in which sites are generated
+ \param[in] radius Pattern radius
+ \param[in] angularSteps Number of angular steps
+ \param[in] radialSteps Number of radial steps
+ \param[in] angleOffset Angle offset at each radial step
+ \param[in] variability Randomness of sites distribution
+ */
+ virtual void radialPattern(const physx::PxVec3& center, const physx::PxVec3& normal, float radius, int32_t angularSteps, int32_t radialSteps, float angleOffset = 0.0f, float variability = 0.0f) = 0;
+
+ /**
+ Generate sites inside sphere
+ \param[in] count Count of generated sites
+ \param[in] radius Radius of sphere
+ \param[in] center Center of sphere
+ */
+ virtual void generateInSphere(const uint32_t count, const float radius, const physx::PxVec3& center) = 0;
+
+ /**
+ Set stencil mesh. With stencil mesh sites are generated only inside both of fracture and stencil meshes.
+ \param[in] stencil Stencil mesh.
+ */
+ virtual void setStencil(const Mesh* stencil) = 0;
+
+ /**
+ Removes stencil mesh
+ */
+ virtual void clearStencil() = 0;
+
+ /**
+ Deletes sites inside supplied sphere
+ \param[in] radius Radius of sphere
+ \param[in] center Center of sphere
+ \param[in] eraserProbability Probability of removing some particular site
+ */
+ virtual void deleteInSphere(const float radius, const physx::PxVec3& center, const float eraserProbability = 1) = 0;
+};
+
+/**
+ FractureTool class provides methods to fracture provided mesh and generate Blast asset data
+*/
+class FractureTool
+{
+
+public:
+ virtual ~FractureTool() {}
+
+ /**
+ Release FractureTool memory
+ */
+ virtual void release() = 0;
+
+ /**
+ Reset FractureTool state.
+ */
+ virtual void reset() = 0;
+
+
+ /**
+ Set input mesh which will be fractured, FractureTool will be reseted.
+ */
+ virtual void setSourceMesh(const Mesh* mesh) = 0;
+
+ /**
+ Set chunk mesh, parentId should be valid, return id of new chunk.
+ */
+ virtual int32_t setChunkMesh(const Mesh* mesh, int32_t parentId) = 0;
+
+ /**
+ Set the material id to use for new interior faces. Defaults to MATERIAL_INTERIOR
+ */
+ virtual void setInteriorMaterialId(int32_t materialId) = 0;
+
+ /**
+ Gets the material id to use for new interior faces
+ */
+ virtual int32_t getInteriorMaterialId() const = 0;
+
+ /**
+ Replaces an material id on faces with a new one
+ */
+ virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0;
+
+ /**
+ Get chunk mesh in polygonal representation. User's code should release it after usage.
+ */
+ virtual Mesh* createChunkMesh(int32_t chunkId) = 0;
+
+ /**
+ Input mesh is scaled and transformed internally to fit unit cube centered in origin.
+ Method provides offset vector and scale parameter;
+ */
+ virtual void getTransformation(physx::PxVec3& offset, float& scale) = 0;
+
+
+ /**
+ Fractures specified chunk with voronoi method.
+ \param[in] chunkId Chunk to fracture
+ \param[in] cellPoints Array of voronoi sites
+ \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them.
+ Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
+ \return If 0, fracturing is successful.
+ */
+ virtual int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const physx::PxVec3* cellPoints, bool replaceChunk) = 0;
+
+ /**
+ Fractures specified chunk with voronoi method. Cells can be scaled along x,y,z axes.
+ \param[in] chunkId Chunk to fracture
+ \param[in] cellPoints Array of voronoi sites
+ \param[in] cellPoints Array of voronoi sites
+ \param[in] scale Voronoi cells scaling factor
+ \param[in] rotation Voronoi cells rotation. Has no effect without cells scale factor
+ \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them.
+ Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
+ \return If 0, fracturing is successful.
+ */
+ virtual int32_t voronoiFracturing(uint32_t chunkId, uint32_t cellCount, const physx::PxVec3* cellPoints, const physx::PxVec3& scale, const physx::PxQuat& rotation, bool replaceChunk) = 0;
+
+
+ /**
+ Fractures specified chunk with slicing method.
+ \param[in] chunkId Chunk to fracture
+ \param[in] conf Slicing parameters, see SlicingConfiguration.
+ \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them.
+ Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
+ \param[in] rnd User supplied random number generator
+
+ \return If 0, fracturing is successful.
+ */
+ virtual int32_t slicing(uint32_t chunkId, const SlicingConfiguration& conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
+
+ /**
+ Cut chunk with plane.
+ \param[in] chunkId Chunk to fracture
+ \param[in] normal Plane normal
+ \param[in] position Point on plane
+ \param[in] noise Noise configuration for plane-chunk intersection, see NoiseConfiguration.
+ \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them.
+ Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
+ \param[in] rnd User supplied random number generator
+
+ \return If 0, fracturing is successful.
+ */
+ virtual int32_t cut(uint32_t chunkId, const physx::PxVec3& normal, const physx::PxVec3& position, const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
+
+ /**
+ Cutout fracture for specified chunk.
+ \param[in] chunkId Chunk to fracture
+ \param[in] conf Cutout parameters, see CutoutConfiguration.
+ \param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly generated chunks will be at next depth level, source chunk will be parent for them.
+ Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
+ \param[in] rnd User supplied random number generator
+
+ \return If 0, fracturing is successful.
+ */
+ virtual int32_t cutout(uint32_t chunkId, CutoutConfiguration conf, bool replaceChunk, RandomGeneratorBase* rnd) = 0;
+
+
+ /**
+ Creates resulting fractured mesh geometry from intermediate format
+ */
+ virtual void finalizeFracturing() = 0;
+
+ /**
+ Returns overall number of chunks in fracture.
+ */
+ virtual uint32_t getChunkCount() const = 0;
+
+ /**
+ Get chunk information
+ */
+ virtual const ChunkInfo& getChunkInfo(int32_t chunkIndex) = 0;
+
+ /**
+ Get percentage of mesh overlap.
+ percentage computed as volume(intersection(meshA , meshB)) / volume (meshA)
+ \param[in] meshA Mesh A
+ \param[in] meshB Mesh B
+ \return mesh overlap percentage
+ */
+ virtual float getMeshOverlap(const Mesh& meshA, const Mesh& meshB) = 0;
+
+ /**
+ Get chunk base mesh
+ \param[in] chunkIndex Chunk index
+ \param[out] output Array of triangles to be filled
+ \return number of triangles in base mesh
+ */
+ virtual uint32_t getBaseMesh(int32_t chunkIndex, Triangle*& output) = 0;
+
+ /**
+ Update chunk base mesh
+ \note Doesn't allocates output array, Triangle* output should be preallocated by user
+ \param[in] chunkIndex Chunk index
+ \param[out] output Array of triangles to be filled
+ \return number of triangles in base mesh
+ */
+ virtual uint32_t updateBaseMesh(int32_t chunkIndex, Triangle* output) = 0;
+
+ /**
+ Return index of chunk with specified chunkId
+ \param[in] chunkId Chunk ID
+ \return Chunk index in internal buffer, if not exist -1 is returned.
+ */
+ virtual int32_t getChunkIndex(int32_t chunkId) = 0;
+
+ /**
+ Return id of chunk with specified index.
+ \param[in] chunkIndex Chunk index
+ \return Chunk id or -1 if there is no such chunk.
+ */
+ virtual int32_t getChunkId(int32_t chunkIndex) = 0;
+
+ /**
+ Return depth level of the given chunk
+ \param[in] chunkId Chunk ID
+ \return Chunk depth or -1 if there is no such chunk.
+ */
+ virtual int32_t getChunkDepth(int32_t chunkId) = 0;
+
+ /**
+ Return array of chunks IDs with given depth.
+ \param[in] depth Chunk depth
+ \param[out] Pointer to array of chunk IDs
+ \return Number of chunks in array
+ */
+ virtual uint32_t getChunksIdAtDepth(uint32_t depth, int32_t*& chunkIds) = 0;
+
+ /**
+ Get result geometry without noise as vertex and index buffers, where index buffers contain series of triplets
+ which represent triangles.
+ \param[out] vertexBuffer Array of vertices to be filled
+ \param[out] indexBuffer Array of indices to be filled
+ \param[out] indexBufferOffsets Array of offsets in indexBuffer for each base mesh.
+ Contains getChunkCount() + 1 elements. Last one is indexBuffer size
+ \return Number of vertices in vertexBuffer
+ */
+ virtual uint32_t getBufferedBaseMeshes(Vertex*& vertexBuffer, uint32_t*& indexBuffer, uint32_t*& indexBufferOffsets) = 0;
+
+ /**
+ Set automatic islands removing. May cause instabilities.
+ \param[in] isRemoveIslands Flag whether remove or not islands.
+ */
+ virtual void setRemoveIslands(bool isRemoveIslands) = 0;
+
+ /**
+ Try find islands and remove them on some specifical chunk. If chunk has childs, island removing can lead to wrong results! Apply it before further chunk splitting.
+ \param[in] chunkId Chunk ID which should be checked for islands
+ \return Number of found islands is returned
+ */
+ virtual int32_t islandDetectionAndRemoving(int32_t chunkId) = 0;
+
+ /**
+ Check if input mesh contains open edges. Open edges can lead to wrong fracturing results.
+ \return true if mesh contains open edges
+ */
+ virtual bool isMeshContainOpenEdges(const Mesh* input) = 0;
+
+ /**
+ Delete all children for specified chunk (also recursively delete chidren of children).
+ \param[in] chunkId Chunk ID which children should be deleted
+ \return true if one or more chunks were removed
+ */
+ virtual bool deleteAllChildrenOfChunk(int32_t chunkId) = 0;
+
+ /**
+ Optimize chunk hierarhy for better runtime performance.
+ It tries to unite chunks to groups of some size in order to transform flat hierarchy (all chunks are children of single root)
+ to tree like hieracrhy with limited number of children for each chunk.
+ \param[in] maxAtLevel If number of children of some chunk less then maxAtLevel then it would be considered as already optimized and skipped.
+ \param[in] maxGroupSize Max number of children for processed chunks.
+ */
+ virtual void uniteChunks(uint32_t maxAtLevel, uint32_t maxGroupSize) = 0;
+
+ /**
+ Rescale interior uv coordinates of given chunk to fit square of given size.
+ \param[in] side Size of square side
+ \param[in] chunkId Chunk ID for which UVs should be scaled.
+ */
+ virtual void fitUvToRect(float side, uint32_t chunkId) = 0;
+
+ /**
+ Rescale interior uv coordinates of all existing chunks to fit square of given size, relative sizes will be preserved.
+ \param[in] side Size of square side
+ */
+ virtual void fitAllUvToRect(float side) = 0;
+
+};
+
+} // namespace Blast
+} // namespace Nv
+
+#endif // ifndef NVBLASTAUTHORINGFRACTURETOOL_H
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h index d3196e4..b523dcd 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringMesh.h @@ -1,154 +1,154 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTAUTHORINGMESH_H -#define NVBLASTAUTHORINGMESH_H - -#include "NvBlastExtAuthoringTypes.h" - -namespace Nv -{ -namespace Blast -{ - -/** - Class for internal mesh representation -*/ -class Mesh -{ -public: - virtual ~Mesh() {} - - /** - Release Mesh memory - */ - virtual void release() = 0; - - /** - Return true if mesh is valid - */ - virtual bool isValid() const = 0; - - /** - Return writable pointer on vertices array - */ - virtual Vertex* getVerticesWritable() = 0; - - /** - Return pointer on vertices array - */ - virtual const Vertex* getVertices() const = 0; - - - /** - Return writable pointer on edges array - */ - virtual Edge* getEdgesWritable() = 0; - - /** - Return pointer on edges array - */ - virtual const Edge* getEdges() const = 0; - - /** - Return writable pointer on facets array - */ - virtual Facet* getFacetsBufferWritable() = 0; - - /** - Return pointer on facets array - */ - virtual const Facet* getFacetsBuffer() const = 0; - - /** - Return writable pointer on specified facet - */ - virtual Facet* getFacetWritable(int32_t facet) = 0; - /** - Return pointer on specified facet - */ - virtual const Facet* getFacet(int32_t facet) const = 0; - - /** - Return edges count - */ - virtual uint32_t getEdgesCount() const = 0; - - /** - Return vertices count - */ - virtual uint32_t getVerticesCount() const = 0; - - /** - Return facet count - */ - virtual uint32_t getFacetCount() const = 0; - - /** - Return reference on mesh bounding box. - */ - virtual const physx::PxBounds3& getBoundingBox() const = 0; - - /** - Return writable reference on mesh bounding box. - */ - virtual physx::PxBounds3& getBoundingBoxWritable() = 0; - - - /** - Set per-facet material id. - */ - virtual void setMaterialId(const int32_t* materialIds) = 0; - - /** - Replaces an material id on faces with a new one - */ - virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0; - - /** - Set per-facet smoothing group. - */ - virtual void setSmoothingGroup(const int32_t* smoothingGroups) = 0; - - /** - Recalculate bounding box - */ - virtual void recalculateBoundingBox() = 0; - - /** - Compute mesh volume. Can be used only for triangulated meshes. - Return mesh volume. If mesh is not triangulated return 0. - */ - virtual float getMeshVolume() = 0; -}; - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTAUTHORINGMESH_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef NVBLASTAUTHORINGMESH_H
+#define NVBLASTAUTHORINGMESH_H
+
+#include "NvBlastExtAuthoringTypes.h"
+
+namespace Nv
+{
+namespace Blast
+{
+
+/**
+ Class for internal mesh representation
+*/
+class Mesh
+{
+public:
+ virtual ~Mesh() {}
+
+ /**
+ Release Mesh memory
+ */
+ virtual void release() = 0;
+
+ /**
+ Return true if mesh is valid
+ */
+ virtual bool isValid() const = 0;
+
+ /**
+ Return writable pointer on vertices array
+ */
+ virtual Vertex* getVerticesWritable() = 0;
+
+ /**
+ Return pointer on vertices array
+ */
+ virtual const Vertex* getVertices() const = 0;
+
+
+ /**
+ Return writable pointer on edges array
+ */
+ virtual Edge* getEdgesWritable() = 0;
+
+ /**
+ Return pointer on edges array
+ */
+ virtual const Edge* getEdges() const = 0;
+
+ /**
+ Return writable pointer on facets array
+ */
+ virtual Facet* getFacetsBufferWritable() = 0;
+
+ /**
+ Return pointer on facets array
+ */
+ virtual const Facet* getFacetsBuffer() const = 0;
+
+ /**
+ Return writable pointer on specified facet
+ */
+ virtual Facet* getFacetWritable(int32_t facet) = 0;
+ /**
+ Return pointer on specified facet
+ */
+ virtual const Facet* getFacet(int32_t facet) const = 0;
+
+ /**
+ Return edges count
+ */
+ virtual uint32_t getEdgesCount() const = 0;
+
+ /**
+ Return vertices count
+ */
+ virtual uint32_t getVerticesCount() const = 0;
+
+ /**
+ Return facet count
+ */
+ virtual uint32_t getFacetCount() const = 0;
+
+ /**
+ Return reference on mesh bounding box.
+ */
+ virtual const physx::PxBounds3& getBoundingBox() const = 0;
+
+ /**
+ Return writable reference on mesh bounding box.
+ */
+ virtual physx::PxBounds3& getBoundingBoxWritable() = 0;
+
+
+ /**
+ Set per-facet material id.
+ */
+ virtual void setMaterialId(const int32_t* materialIds) = 0;
+
+ /**
+ Replaces an material id on faces with a new one
+ */
+ virtual void replaceMaterialId(int32_t oldMaterialId, int32_t newMaterialId) = 0;
+
+ /**
+ Set per-facet smoothing group.
+ */
+ virtual void setSmoothingGroup(const int32_t* smoothingGroups) = 0;
+
+ /**
+ Recalculate bounding box
+ */
+ virtual void recalculateBoundingBox() = 0;
+
+ /**
+ Compute mesh volume. Can be used only for triangulated meshes.
+ Return mesh volume. If mesh is not triangulated return 0.
+ */
+ virtual float getMeshVolume() = 0;
+};
+
+} // namespace Blast
+} // namespace Nv
+
+
+#endif // ifndef NVBLASTAUTHORINGMESH_H
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringMeshCleaner.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringMeshCleaner.h index f6880dd..6a9ab56 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringMeshCleaner.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringMeshCleaner.h @@ -1,71 +1,71 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H -#define NVBLASTEXTAUTHORINGMESHCLEANER_H - -#include "NvBlastExtAuthoringTypes.h" - -/** - FractureTool has requirements to input meshes to fracture them successfully: - 1) Mesh should be closed (watertight) - 2) There should not be self-intersections and open-edges. -*/ - -/** - Mesh cleaner input is closed mesh with self-intersections and open-edges (only in the interior). - It tries to track outer hull to make input mesh solid and meet requierements of FractureTool. If mesh contained some internal cavities they will be removed. -*/ - -namespace Nv -{ -namespace Blast -{ - -class Mesh; - -class MeshCleaner -{ -public: - virtual ~MeshCleaner() {} - - /** - Tries to remove self intersections and open edges in interior of mesh. - \param[in] mesh Mesh to be cleaned. - \return Cleaned mesh or nullptr if failed. - */ - virtual Mesh* cleanMesh(const Mesh* mesh) = 0; - - virtual void release() = 0; -}; - - -} // namespace Blast -} // namespace Nv - +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
+#define NVBLASTEXTAUTHORINGMESHCLEANER_H
+
+#include "NvBlastExtAuthoringTypes.h"
+
+/**
+ FractureTool has requirements to input meshes to fracture them successfully:
+ 1) Mesh should be closed (watertight)
+ 2) There should not be self-intersections and open-edges.
+*/
+
+/**
+ Mesh cleaner input is closed mesh with self-intersections and open-edges (only in the interior).
+ It tries to track outer hull to make input mesh solid and meet requierements of FractureTool. If mesh contained some internal cavities they will be removed.
+*/
+
+namespace Nv
+{
+namespace Blast
+{
+
+class Mesh;
+
+class MeshCleaner
+{
+public:
+ virtual ~MeshCleaner() {}
+
+ /**
+ Tries to remove self intersections and open edges in interior of mesh.
+ \param[in] mesh Mesh to be cleaned.
+ \return Cleaned mesh or nullptr if failed.
+ */
+ virtual Mesh* cleanMesh(const Mesh* mesh) = 0;
+
+ virtual void release() = 0;
+};
+
+
+} // namespace Blast
+} // namespace Nv
+
#endif // ifndef NVBLASTEXTAUTHORINGMESHCLEANER_H
\ No newline at end of file diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h index 8d5d3e2..fe5cef2 100644..100755 --- a/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h +++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h @@ -1,287 +1,287 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved. - - -#ifndef NVBLASTAUTHORINGTYPES_H -#define NVBLASTAUTHORINGTYPES_H - -#include <PxVec3.h> -#include <PxVec2.h> -#include <PxBounds3.h> -#include "NvBlastTypes.h" - -#define NOT_VALID_VERTEX INT32_MAX - -namespace Nv -{ -namespace Blast -{ - -/** - Edge representation -*/ -struct Edge -{ - uint32_t s, e; - Edge() : s(NOT_VALID_VERTEX), e(NOT_VALID_VERTEX){} - Edge(int s, int e) : s(s), e(e) {} - bool operator<(const Edge& b) const - { - if (s == b.s) - return e < b.e; - else - return s < b.s; - } -}; - -/** - Mesh vertex representation -*/ -struct Vertex -{ - physx::PxVec3 p; // Position - physx::PxVec3 n; // Normal - physx::PxVec2 uv[1]; // UV-coordinates array, currently supported only one UV coordinate. -}; - - -// Interior material ID -#define MATERIAL_INTERIOR 1000 -#define SMOOTHING_GROUP_INTERIOR 1000 - - - -/** - Mesh triangle representation -*/ -struct Triangle -{ - Triangle() {}; - Triangle(Vertex a, Vertex b, Vertex c) : a(a), b(b), c(c) {}; - Vertex a, b, c; - int32_t userData; - int32_t materialId; - int32_t smoothingGroup; - physx::PxVec3 getNormal() const - { - return ((b.p - a.p).cross(c.p - a.p)); - } - inline Vertex& getVertex(uint32_t index) - { - return (&a)[index]; - } - inline const Vertex& getVertex(uint32_t index) const - { - return (&a)[index]; - } -}; - - -/** - Index based triangle -*/ -struct TriangleIndexed -{ - TriangleIndexed() {}; - TriangleIndexed(uint32_t a, uint32_t b, uint32_t c) : ea(a), eb(b), ec(c) {}; - - uint32_t getOpposite(uint32_t a, uint32_t b) - { - if (ea != a && ea != b) - return ea; - if (eb != a && eb != b) - return eb; - if (ec != a && ec != b) - return ec; - return NOT_VALID_VERTEX; - } - - bool isContainEdge(uint32_t a, uint32_t b) - { - return (a == ea || a == eb || a == ec) && (b == ea || b == eb || b == ec); - } - - Triangle convertToTriangle(Vertex* vertices) - { - Triangle tr; - tr.a = vertices[ea]; - tr.b = vertices[eb]; - tr.c = vertices[ec]; - - tr.userData = userData; - tr.materialId = materialId; - tr.smoothingGroup = smoothingGroup; - return tr; - } - - uint32_t ea, eb, ec; - int32_t materialId; - int32_t smoothingGroup; - int32_t userData; -}; - - - - -/** - Mesh facet representation -*/ -struct Facet -{ - int32_t firstEdgeNumber; - uint32_t edgesCount; - int64_t userData; - int32_t materialId; - int32_t smoothingGroup; - - Facet(int32_t fEdge = 0, uint32_t eCount = 0, int32_t materialId = 0, int64_t userData = 0, int32_t smoothingGroup = 0) : firstEdgeNumber(fEdge), edgesCount(eCount), userData(userData), materialId(materialId), smoothingGroup(smoothingGroup) {} -}; - -/** - Abstract base class for user-defined random value generator. -*/ -class RandomGeneratorBase -{ -public: - // Generates uniformly distributed value in [0, 1] range. - virtual float getRandomValue() = 0; - // Seeds random value generator - virtual void seed(int32_t seed) = 0; - virtual ~RandomGeneratorBase() {}; -}; - -/** - Collision hull geometry format. -*/ -struct CollisionHull -{ - /** - Collision hull polygon format. - */ - struct HullPolygon - { - // Polygon base plane - float mPlane[4]; - // Number vertices in polygon - uint16_t mNbVerts; - // First index in CollisionHull.indices array for this polygon - uint16_t mIndexBase; - }; - ///** - - uint32_t pointsCount; - uint32_t indicesCount; - uint32_t polygonDataCount; - physx::PxVec3* points; - uint32_t* indices; - HullPolygon* polygonData; - - virtual ~CollisionHull() {} - - virtual void release() = 0; -}; - -/** - Authoring results. Which contains NvBlastAsset, render and collision meshes -*/ -struct AuthoringResult -{ - uint32_t chunkCount; //Number of chunks in Blast asset - - uint32_t bondCount; //Number of bonds in Blast asset - - NvBlastAsset* asset; //Blast asset - - /** - assetToFractureChunkIdMap used for getting internal FractureChunkId with FractureTool::getChunkId. - FractureChunkId = FractureTool.getChunkId(aResult.assetToFractureChunkIdMap(AssetChunkId); - */ - uint32_t* assetToFractureChunkIdMap; - - /** - Offsets for render mesh geometry. Contains chunkCount + 1 element. - First triangle for i-th chunk: aResult.geometry[aResult.geometryOffset[i]] - aResult.geometryOffset[chunkCount+1] is total number of triangles in geometry - */ - uint32_t* geometryOffset; - - Triangle* geometry; //Raw array of Triangle for all chunks - - NvBlastChunkDesc* chunkDescs; //Array of chunk descriptors. Contains chunkCount elements - - NvBlastBondDesc* bondDescs; //Array of bond descriptors. Contains bondCount elements - - /** - Collision hull offsets. Contains chunkCount + 1 element. - First collision hull for i-th chunk: aResult.collisionHull[aResult.collisionHullOffset[i]] - aResult.collisionHullOffset[chunkCount+1] is total number of collision hulls in collisionHull - */ - uint32_t* collisionHullOffset; - - CollisionHull** collisionHull; //Raw array of pointers to collision hull for all chunks. - - /** - Array of chunk physics parameters. Contains chunkCount elements - */ - struct ExtPxChunk* physicsChunks; - - /** - Array of phisics subchunks (convex mesh) descriptors. - Use collisionHullOffset for accessing elements. - */ - struct ExtPxSubchunk* physicsSubchunks; - - /** - Array of material names. - */ - const char** materialNames; - /** - Size of array of material names. - */ - - uint32_t materialCount; - - //// Member functions //// - virtual ~AuthoringResult() {} - - /** - Free collision hulls data - */ - virtual void releaseCollisionHulls() = 0; - - /** - Free all data and AuthoringResult - */ - virtual void release() = 0; -}; - - -} // namespace Blast -} // namespace Nv - - -#endif // ifndef NVBLASTAUTHORINGTYPES_H +// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef NVBLASTAUTHORINGTYPES_H
+#define NVBLASTAUTHORINGTYPES_H
+
+#include <PxVec3.h>
+#include <PxVec2.h>
+#include <PxBounds3.h>
+#include "NvBlastTypes.h"
+
+#define NOT_VALID_VERTEX INT32_MAX
+
+namespace Nv
+{
+namespace Blast
+{
+
+/**
+ Edge representation
+*/
+struct Edge
+{
+ uint32_t s, e;
+ Edge() : s(NOT_VALID_VERTEX), e(NOT_VALID_VERTEX){}
+ Edge(int s, int e) : s(s), e(e) {}
+ bool operator<(const Edge& b) const
+ {
+ if (s == b.s)
+ return e < b.e;
+ else
+ return s < b.s;
+ }
+};
+
+/**
+ Mesh vertex representation
+*/
+struct Vertex
+{
+ physx::PxVec3 p; // Position
+ physx::PxVec3 n; // Normal
+ physx::PxVec2 uv[1]; // UV-coordinates array, currently supported only one UV coordinate.
+};
+
+
+// Interior material ID
+#define MATERIAL_INTERIOR 1000
+#define SMOOTHING_GROUP_INTERIOR 1000
+
+
+
+/**
+ Mesh triangle representation
+*/
+struct Triangle
+{
+ Triangle() {};
+ Triangle(Vertex a, Vertex b, Vertex c) : a(a), b(b), c(c) {};
+ Vertex a, b, c;
+ int32_t userData;
+ int32_t materialId;
+ int32_t smoothingGroup;
+ physx::PxVec3 getNormal() const
+ {
+ return ((b.p - a.p).cross(c.p - a.p));
+ }
+ inline Vertex& getVertex(uint32_t index)
+ {
+ return (&a)[index];
+ }
+ inline const Vertex& getVertex(uint32_t index) const
+ {
+ return (&a)[index];
+ }
+};
+
+
+/**
+ Index based triangle
+*/
+struct TriangleIndexed
+{
+ TriangleIndexed() {};
+ TriangleIndexed(uint32_t a, uint32_t b, uint32_t c) : ea(a), eb(b), ec(c) {};
+
+ uint32_t getOpposite(uint32_t a, uint32_t b)
+ {
+ if (ea != a && ea != b)
+ return ea;
+ if (eb != a && eb != b)
+ return eb;
+ if (ec != a && ec != b)
+ return ec;
+ return NOT_VALID_VERTEX;
+ }
+
+ bool isContainEdge(uint32_t a, uint32_t b)
+ {
+ return (a == ea || a == eb || a == ec) && (b == ea || b == eb || b == ec);
+ }
+
+ Triangle convertToTriangle(Vertex* vertices)
+ {
+ Triangle tr;
+ tr.a = vertices[ea];
+ tr.b = vertices[eb];
+ tr.c = vertices[ec];
+
+ tr.userData = userData;
+ tr.materialId = materialId;
+ tr.smoothingGroup = smoothingGroup;
+ return tr;
+ }
+
+ uint32_t ea, eb, ec;
+ int32_t materialId;
+ int32_t smoothingGroup;
+ int32_t userData;
+};
+
+
+
+
+/**
+ Mesh facet representation
+*/
+struct Facet
+{
+ int32_t firstEdgeNumber;
+ uint32_t edgesCount;
+ int64_t userData;
+ int32_t materialId;
+ int32_t smoothingGroup;
+
+ Facet(int32_t fEdge = 0, uint32_t eCount = 0, int32_t materialId = 0, int64_t userData = 0, int32_t smoothingGroup = 0) : firstEdgeNumber(fEdge), edgesCount(eCount), userData(userData), materialId(materialId), smoothingGroup(smoothingGroup) {}
+};
+
+/**
+ Abstract base class for user-defined random value generator.
+*/
+class RandomGeneratorBase
+{
+public:
+ // Generates uniformly distributed value in [0, 1] range.
+ virtual float getRandomValue() = 0;
+ // Seeds random value generator
+ virtual void seed(int32_t seed) = 0;
+ virtual ~RandomGeneratorBase() {};
+};
+
+/**
+ Collision hull geometry format.
+*/
+struct CollisionHull
+{
+ /**
+ Collision hull polygon format.
+ */
+ struct HullPolygon
+ {
+ // Polygon base plane
+ float mPlane[4];
+ // Number vertices in polygon
+ uint16_t mNbVerts;
+ // First index in CollisionHull.indices array for this polygon
+ uint16_t mIndexBase;
+ };
+ ///**
+
+ uint32_t pointsCount;
+ uint32_t indicesCount;
+ uint32_t polygonDataCount;
+ physx::PxVec3* points;
+ uint32_t* indices;
+ HullPolygon* polygonData;
+
+ virtual ~CollisionHull() {}
+
+ virtual void release() = 0;
+};
+
+/**
+ Authoring results. Which contains NvBlastAsset, render and collision meshes
+*/
+struct AuthoringResult
+{
+ uint32_t chunkCount; //Number of chunks in Blast asset
+
+ uint32_t bondCount; //Number of bonds in Blast asset
+
+ NvBlastAsset* asset; //Blast asset
+
+ /**
+ assetToFractureChunkIdMap used for getting internal FractureChunkId with FractureTool::getChunkId.
+ FractureChunkId = FractureTool.getChunkId(aResult.assetToFractureChunkIdMap(AssetChunkId);
+ */
+ uint32_t* assetToFractureChunkIdMap;
+
+ /**
+ Offsets for render mesh geometry. Contains chunkCount + 1 element.
+ First triangle for i-th chunk: aResult.geometry[aResult.geometryOffset[i]]
+ aResult.geometryOffset[chunkCount+1] is total number of triangles in geometry
+ */
+ uint32_t* geometryOffset;
+
+ Triangle* geometry; //Raw array of Triangle for all chunks
+
+ NvBlastChunkDesc* chunkDescs; //Array of chunk descriptors. Contains chunkCount elements
+
+ NvBlastBondDesc* bondDescs; //Array of bond descriptors. Contains bondCount elements
+
+ /**
+ Collision hull offsets. Contains chunkCount + 1 element.
+ First collision hull for i-th chunk: aResult.collisionHull[aResult.collisionHullOffset[i]]
+ aResult.collisionHullOffset[chunkCount+1] is total number of collision hulls in collisionHull
+ */
+ uint32_t* collisionHullOffset;
+
+ CollisionHull** collisionHull; //Raw array of pointers to collision hull for all chunks.
+
+ /**
+ Array of chunk physics parameters. Contains chunkCount elements
+ */
+ struct ExtPxChunk* physicsChunks;
+
+ /**
+ Array of phisics subchunks (convex mesh) descriptors.
+ Use collisionHullOffset for accessing elements.
+ */
+ struct ExtPxSubchunk* physicsSubchunks;
+
+ /**
+ Array of material names.
+ */
+ const char** materialNames;
+ /**
+ Size of array of material names.
+ */
+
+ uint32_t materialCount;
+
+ //// Member functions ////
+ virtual ~AuthoringResult() {}
+
+ /**
+ Free collision hulls data
+ */
+ virtual void releaseCollisionHulls() = 0;
+
+ /**
+ Free all data and AuthoringResult
+ */
+ virtual void release() = 0;
+};
+
+
+} // namespace Blast
+} // namespace Nv
+
+
+#endif // ifndef NVBLASTAUTHORINGTYPES_H
|