sdk/extensions/authoring/include/NvBlastExtAuthoring.h File Reference

#include "NvBlastExtAuthoringTypes.h"

Go to the source code of this file.

Namespaces

namespace  Nv
namespace  Nv::Blast

Functions

void NvBlastExtAuthoringBuildCollisionMeshes (Nv::Blast::AuthoringResult &ares, Nv::Blast::ConvexMeshBuilder &collisionBuilder, const Nv::Blast::ConvexDecompositionParams &collisionParam, uint32_t chunksToProcessCount, uint32_t *chunksToProcess)
void NvBlastExtAuthoringBuildCutoutSet (Nv::Blast::CutoutSet &cutoutSet, const uint8_t *pixelBuffer, uint32_t bufferWidth, uint32_t bufferHeight, float segmentationErrorThreshold, float snapThreshold, bool periodic, bool expandGaps)
int32_t NvBlastExtAuthoringBuildMeshConvexDecomposition (Nv::Blast::ConvexMeshBuilder *cmb, const Nv::Blast::Triangle *mesh, uint32_t triangleCount, const Nv::Blast::ConvexDecompositionParams &params, Nv::Blast::CollisionHull **&convexes)
Nv::Blast::BlastBondGeneratorNvBlastExtAuthoringCreateBondGenerator (Nv::Blast::ConvexMeshBuilder *builder)
Nv::Blast::CutoutSetNvBlastExtAuthoringCreateCutoutSet ()
Nv::Blast::FractureToolNvBlastExtAuthoringCreateFractureTool ()
Nv::Blast::GridNvBlastExtAuthoringCreateGridAccelerator (uint32_t resolution, const Nv::Blast::Mesh *m)
Nv::Blast::GridWalkerNvBlastExtAuthoringCreateGridWalker (Nv::Blast::Grid *parent)
Nv::Blast::MeshNvBlastExtAuthoringCreateMesh (const NvcVec3 *positions, const NvcVec3 *normals, const NvcVec2 *uv, uint32_t verticesCount, const uint32_t *indices, uint32_t indicesCount)
Nv::Blast::MeshCleanerNvBlastExtAuthoringCreateMeshCleaner ()
Nv::Blast::MeshNvBlastExtAuthoringCreateMeshFromFacets (const void *vertices, const void *edges, const void *facets, uint32_t verticesCount, uint32_t edgesCount, uint32_t facetsCount)
Nv::Blast::MeshNvBlastExtAuthoringCreateMeshOnlyTriangles (const void *vertices, uint32_t verticesCount, uint32_t *indices, uint32_t indexCount, void *materials=nullptr, uint32_t materialStride=4)
Nv::Blast::PatternGeneratorNvBlastExtAuthoringCreatePatternGenerator ()
Nv::Blast::VoronoiSitesGeneratorNvBlastExtAuthoringCreateVoronoiSitesGenerator (Nv::Blast::Mesh *mesh, Nv::Blast::RandomGeneratorBase *rng)
uint32_t NvBlastExtAuthoringFindAssetConnectingBonds (const NvBlastAsset **components, const NvcVec3 *scales, const NvcQuat *rotations, const NvcVec3 *translations, const uint32_t **convexHullOffsets, const Nv::Blast::CollisionHull ***chunkHulls, uint32_t componentCount, NvBlastExtAssetUtilsBondDesc *&newBondDescs, float maxSeparation=0.0f)
Nv::Blast::AuthoringResultNvBlastExtAuthoringProcessFracture (Nv::Blast::FractureTool &fTool, Nv::Blast::BlastBondGenerator &bondGenerator, Nv::Blast::ConvexMeshBuilder &collisionBuilder, const Nv::Blast::ConvexDecompositionParams &collisionParam, int32_t defaultSupportDepth=-1)
void NvBlastExtAuthoringReleaseAuthoringResult (Nv::Blast::ConvexMeshBuilder &collisionBuilder, Nv::Blast::AuthoringResult *ar)
void NvBlastExtAuthoringReleaseAuthoringResultCollision (Nv::Blast::ConvexMeshBuilder &collisionBuilder, Nv::Blast::AuthoringResult *ar)
Nv::Blast::CollisionHullNvBlastExtAuthoringTransformCollisionHull (const Nv::Blast::CollisionHull *hull, const NvcVec3 *scaling, const NvcQuat *rotation, const NvcVec3 *translation)
void NvBlastExtAuthoringTransformCollisionHullInPlace (Nv::Blast::CollisionHull *hull, const NvcVec3 *scaling, const NvcQuat *rotation, const NvcVec3 *translation)
void NvBlastExtAuthoringTrimCollisionGeometry (Nv::Blast::ConvexMeshBuilder *cmb, uint32_t chunksCount, Nv::Blast::CollisionHull **in, const uint32_t *chunkDepth)
void NvBlastExtAuthoringUpdateGraphicsMesh (Nv::Blast::FractureTool &fTool, Nv::Blast::AuthoringResult &ares)


Function Documentation

void NvBlastExtAuthoringBuildCollisionMeshes ( Nv::Blast::AuthoringResult ares,
Nv::Blast::ConvexMeshBuilder collisionBuilder,
const Nv::Blast::ConvexDecompositionParams collisionParam,
uint32_t  chunksToProcessCount,
uint32_t *  chunksToProcess 
)

Build collision meshes

Parameters:
[in,out] ares AuthoringResult object which contains chunks, for which collision meshes will be built.
[in] collisionBuilder Reference to ConvexMeshBuilder instance.
[in] collisionParam Parameters of collision hulls generation.
[in] chunksToProcessCount Number of chunk indices in chunksToProcess memory buffer.
[in] chunksToProcess Chunk indices for which collision mesh should be built.

void NvBlastExtAuthoringBuildCutoutSet ( Nv::Blast::CutoutSet cutoutSet,
const uint8_t *  pixelBuffer,
uint32_t  bufferWidth,
uint32_t  bufferHeight,
float  segmentationErrorThreshold,
float  snapThreshold,
bool  periodic,
bool  expandGaps 
)

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.

Parameters:
cutoutSet the CutoutSet to build
pixelBuffer pointer to be beginning of the pixel buffer
bufferWidth the width of the buffer in pixels
bufferHeight the height of the buffer in pixels
segmentationErrorThreshold Reduce the number of vertices on curve untill segmentation error is smaller then specified. By default set it to 0.001.
snapThreshold the pixel distance at which neighboring cutout vertices and segments may be fudged into alignment. By default set it to 1.
periodic whether or not to use periodic boundary conditions when creating cutouts from the map
expandGaps expand cutout regions to gaps or keep it as is

int32_t NvBlastExtAuthoringBuildMeshConvexDecomposition ( Nv::Blast::ConvexMeshBuilder cmb,
const Nv::Blast::Triangle mesh,
uint32_t  triangleCount,
const Nv::Blast::ConvexDecompositionParams params,
Nv::Blast::CollisionHull **&  convexes 
)

Build convex mesh decomposition.

Parameters:
[in] mesh Triangle mesh to decompose.
[in] triangleCount Number of triangles in mesh.
[in] params Parameters for convex mesh decomposition builder.
[out] convexes The resulting convex hulls.
Returns:
Number of created convex hulls.

Nv::Blast::BlastBondGenerator* NvBlastExtAuthoringCreateBondGenerator ( Nv::Blast::ConvexMeshBuilder builder  ) 

Create BlastBondGenerator

Returns:
Pointer to created BlastBondGenerator. User's code should release it after usage.

Nv::Blast::CutoutSet* NvBlastExtAuthoringCreateCutoutSet (  ) 

Instantiates a blank CutoutSet

Nv::Blast::FractureTool* NvBlastExtAuthoringCreateFractureTool (  ) 

Create FractureTool object.

Returns:
Pointer to create FractureTool. User's code should release it after usage.

Nv::Blast::Grid* NvBlastExtAuthoringCreateGridAccelerator ( uint32_t  resolution,
const Nv::Blast::Mesh m 
)

Create spatial grid for mesh.

Nv::Blast::GridWalker* NvBlastExtAuthoringCreateGridWalker ( Nv::Blast::Grid parent  ) 

Create GridWalker - SpatialAccelerator which use Grid for faster mesh sampling.

Nv::Blast::Mesh* NvBlastExtAuthoringCreateMesh ( const NvcVec3 positions,
const NvcVec3 normals,
const NvcVec2 uv,
uint32_t  verticesCount,
const uint32_t *  indices,
uint32_t  indicesCount 
)

Constructs mesh object from array of triangles. User should call release() after usage.

Parameters:
[in] positions Array for vertex positions, 3 * verticesCount floats will be read
[in] normals Array for vertex normals, 3 * verticesCount floats will be read
[in] uv Array for vertex uv coordinates, 2 * verticesCount floats will be read
[in] verticesCount Number of vertices in mesh
[in] indices Array of vertex indices. Indices contain vertex index triplets which form a mesh triangle.
[in] indicesCount Indices count (should be equal to numberOfTriangles * 3)
Returns:
pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr

Nv::Blast::MeshCleaner* NvBlastExtAuthoringCreateMeshCleaner (  ) 

Creates MeshCleaner object

Returns:
pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr

Nv::Blast::Mesh* NvBlastExtAuthoringCreateMeshFromFacets ( const void *  vertices,
const void *  edges,
const void *  facets,
uint32_t  verticesCount,
uint32_t  edgesCount,
uint32_t  facetsCount 
)

Constructs mesh object from array of vertices, edges and facets. User should call release() after usage.

Parameters:
[in] vertices Array for Nv::Blast::Vertex
[in] edges Array for Nv::Blast::Edge
[in] facets Array for Nv::Blast::Facet
[in] verticesCount Number of vertices in mesh
[in] edgesCount Number of edges in mesh
[in] facetsCount Number of facets in mesh
Returns:
pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr

Nv::Blast::Mesh* NvBlastExtAuthoringCreateMeshOnlyTriangles ( const void *  vertices,
uint32_t  verticesCount,
uint32_t *  indices,
uint32_t  indexCount,
void *  materials = nullptr,
uint32_t  materialStride = 4 
)

Constructs mesh object from triangles represented as arrays of vertices, indices and per facet material. User should call Mesh::release() after usage.

Parameters:
[in] vertices Array for vertex positions, 3 * verticesCount floats will be read
[in] verticesCount Number of vertices in mesh
[in] indices Array of vertex indices. Indices contain vertex index triplets which form a mesh triangle.
[in] indicesCount Indices count (should be equal to numberOfTriangles * 3)
[in] materials Array of material indices per triangle. If not set default material (0) will be assigned.
[in] materialStride Stride for material indices
Returns:
pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr

Nv::Blast::PatternGenerator* NvBlastExtAuthoringCreatePatternGenerator (  ) 

Returns pattern generator used for generating fracture patterns.

Nv::Blast::VoronoiSitesGenerator* NvBlastExtAuthoringCreateVoronoiSitesGenerator ( Nv::Blast::Mesh mesh,
Nv::Blast::RandomGeneratorBase rng 
)

Voronoi sites should not be generated outside of the fractured mesh, so VoronoiSitesGenerator should be supplied with fracture mesh.

Parameters:
[in] mesh Fracture mesh
[in] rnd User supplied random value generator.
Returns:
Pointer to VoronoiSitesGenerator. User's code should release it after usage.

uint32_t NvBlastExtAuthoringFindAssetConnectingBonds ( const NvBlastAsset **  components,
const NvcVec3 scales,
const NvcQuat rotations,
const NvcVec3 translations,
const uint32_t **  convexHullOffsets,
const Nv::Blast::CollisionHull ***  chunkHulls,
uint32_t  componentCount,
NvBlastExtAssetUtilsBondDesc *&  newBondDescs,
float  maxSeparation = 0.0f 
)

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

Parameters:
[in] components An array of assets to merge, of size componentCount.
[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.
[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.
[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.
[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.
[in] chunkHulls For each component, an array of CollisionHull* specifying the collision geometry for the chunks in that component.
[in] componentCount The size of the components and relativeTransforms arrays.
[out] newBondDescs Descriptors of type NvBlastExtAssetUtilsBondDesc for new bonds between components.
[in] maxSeparation Maximal distance between chunks which can be connected by bond.
Returns:
the number of bonds in newBondDescs

Nv::Blast::AuthoringResult* NvBlastExtAuthoringProcessFracture ( Nv::Blast::FractureTool fTool,
Nv::Blast::BlastBondGenerator bondGenerator,
Nv::Blast::ConvexMeshBuilder collisionBuilder,
const Nv::Blast::ConvexDecompositionParams collisionParam,
int32_t  defaultSupportDepth = -1 
)

Performs pending fractures and generates fractured asset, render and collision geometry

Parameters:
[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool
[in] bondGenerator Bond generator created by NvBlastExtAuthoringCreateBondGenerator
[in] collisionBuilder Collision builder created by NvBlastExtAuthoringCreateConvexMeshBuilder
[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.
[in] collisionParam Parameters of collision hulls generation.
Returns:
Authoring result

void NvBlastExtAuthoringReleaseAuthoringResult ( Nv::Blast::ConvexMeshBuilder collisionBuilder,
Nv::Blast::AuthoringResult ar 
)

Releases AuthoringResult data. AuthoringResult should be created by NvBlast.

void NvBlastExtAuthoringReleaseAuthoringResultCollision ( Nv::Blast::ConvexMeshBuilder collisionBuilder,
Nv::Blast::AuthoringResult ar 
)

Releases collision data for AuthoringResult. AuthoringResult should be created by NvBlast.

Nv::Blast::CollisionHull* NvBlastExtAuthoringTransformCollisionHull ( const Nv::Blast::CollisionHull hull,
const NvcVec3 scaling,
const NvcQuat rotation,
const NvcVec3 translation 
)

Transforms collision hull in place using scale, rotation, transform.

Parameters:
[in] hull Pointer to the hull to be transformed (modified).
[in] scale Pointer to scale to be applied. Can be nullptr.
[in] rotation Pointer to rotation to be applied. Can be nullptr.
[in] translation Pointer to translation to be applied. Can be nullptr.

void NvBlastExtAuthoringTransformCollisionHullInPlace ( Nv::Blast::CollisionHull hull,
const NvcVec3 scaling,
const NvcQuat rotation,
const NvcVec3 translation 
)

Transforms collision hull in place using scale, rotation, transform.

Parameters:
[in,out] hull Pointer to the hull to be transformed (modified).
[in] scale Pointer to scale to be applied. Can be nullptr.
[in] rotation Pointer to rotation to be applied. Can be nullptr.
[in] translation Pointer to translation to be applied. Can be nullptr.

void NvBlastExtAuthoringTrimCollisionGeometry ( Nv::Blast::ConvexMeshBuilder cmb,
uint32_t  chunksCount,
Nv::Blast::CollisionHull **  in,
const uint32_t *  chunkDepth 
)

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.

Parameters:
[in] chunksCount Number of chunks
[in,out] in ConvexHull geometry which should be clipped.
[in] chunkDepth Array of depth levels of convex hulls corresponding chunks.

void NvBlastExtAuthoringUpdateGraphicsMesh ( Nv::Blast::FractureTool fTool,
Nv::Blast::AuthoringResult ares 
)

Updates graphics mesh only

Parameters:
[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool
[out] ares AuthoringResult object which contains chunks, for which rendermeshes will be updated (e.g. to tweak UVs). Initially should be created by NvBlastExtAuthoringProcessFracture.