Main Page Class List Class Members

# Nv::Blast::FractureTool Class Reference

`#include <NvBlastExtAuthoringFractureTool.h>`

Inheritance diagram for Nv::Blast::FractureTool:

List of all members.

## Public Member Functions
virtual Mesh * | createChunkMesh (int32_t chunkId)=0
virtual int32_t | cut (uint32_t chunkId, const NvcVec3 &normal, const NvcVec3 &position, const NoiseConfiguration &noise, bool replaceChunk, RandomGeneratorBase *rnd)=0
virtual int32_t | cutout (uint32_t chunkId, CutoutConfiguration conf, bool replaceChunk, RandomGeneratorBase *rnd)=0
virtual bool | deleteChunkSubhierarchy (int32_t chunkId, bool deleteRoot=false)=0
virtual void | finalizeFracturing ()=0
virtual void | fitAllUvToRect (float side)=0
virtual void | fitUvToRect (float side, uint32_t chunkId)=0
virtual uint32_t | getBaseMesh (int32_t chunkIndex, Triangle *&output)=0
virtual uint32_t | getBufferedBaseMeshes (Vertex *&vertexBuffer, uint32_t *&indexBuffer, uint32_t *&indexBufferOffsets)=0
virtual uint32_t | getChunkCount () const =0
virtual int32_t | getChunkDepth (int32_t chunkId)=0
virtual int32_t | getChunkId (int32_t chunkIndex)=0
virtual int32_t | getChunkIndex (int32_t chunkId)=0
virtual const ChunkInfo & | getChunkInfo (int32_t chunkIndex)=0
virtual uint32_t | getChunksIdAtDepth (uint32_t depth, int32_t *&chunkIds)=0
virtual int32_t | getInteriorMaterialId () const =0
virtual float | getMeshOverlap (const Mesh &meshA, const Mesh &meshB)=0
virtual void | getTransformation (NvcVec3 &offset, float &scale)=0
virtual int32_t | islandDetectionAndRemoving (int32_t chunkId, bool createAtNewDepth=false)=0
virtual bool | isMeshContainOpenEdges (const Mesh *input)=0
virtual void | release ()=0
virtual void | replaceMaterialId (int32_t oldMaterialId, int32_t newMaterialId)=0
virtual void | reset ()=0
virtual bool | setApproximateBonding (uint32_t chunkIndex, bool useApproximateBonding)=0
virtual int32_t | setChunkMesh (const Mesh *mesh, int32_t parentId)=0
virtual void | setInteriorMaterialId (int32_t materialId)=0
virtual void | setRemoveIslands (bool isRemoveIslands)=0
virtual void | setSourceMesh (const Mesh *mesh)=0
virtual int32_t | slicing (uint32_t chunkId, const SlicingConfiguration &conf, bool replaceChunk, RandomGeneratorBase *rnd)=0
virtual void | uniteChunks (uint32_t threshold, uint32_t targetClusterSize, const uint32_t *chunksToMerge, uint32_t mergeChunkCount, const NvcVec2i *adjChunks, uint32_t adjChunksSize, bool removeOriginalChunks=false)=0
virtual uint32_t | updateBaseMesh (int32_t chunkIndex, Triangle *output)=0
virtual int32_t | voronoiFracturing (uint32_t chunkId, uint32_t cellCount, const NvcVec3 *cellPoints, const NvcVec3 &scale, const NvcQuat &rotation, bool replaceChunk)=0
virtual int32_t | voronoiFracturing (uint32_t chunkId, uint32_t cellCount, const NvcVec3 *cellPoints, bool replaceChunk)=0
virtual | ~FractureTool ()

## Detailed Description

FractureTool class provides methods to fracture provided mesh and generate Blast asset data

## Constructor & Destructor Documentation

virtual Nv::Blast::FractureTool::~FractureTool | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

virtual Mesh* Nv::Blast::FractureTool::createChunkMesh | ( | int32_t | chunkId | ) | `[pure virtual]`

Get chunk mesh in polygonal representation. User's code should release it after usage.

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::cut | ( | uint32_t | chunkId,
|  | const NvcVec3 & | normal,
|  | const NvcVec3 & | position,
|  | const NoiseConfiguration & | noise,
|  | bool | replaceChunk,
|  | RandomGeneratorBase * | rnd |
| ) |  |  | `[pure virtual]`

Cut chunk with plane.

Parameters:

  `[in]` | chunkId | Chunk to fracture
  `[in]` | normal | Plane normal
  `[in]` | position | Point on plane
  `[in]` | noise | Noise configuration for plane-chunk intersection, see NoiseConfiguration.
  `[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
  `[in]` | rnd | User supplied random number generator

Returns:
  If 0, fracturing is successful.

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::cutout | ( | uint32_t | chunkId,
|  | CutoutConfiguration | conf,
|  | bool | replaceChunk,
|  | RandomGeneratorBase * | rnd |
| ) |  |  | `[pure virtual]`

Cutout fracture for specified chunk.

Parameters:

  `[in]` | chunkId | Chunk to fracture
  `[in]` | conf | Cutout parameters, see CutoutConfiguration.
  `[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
  `[in]` | rnd | User supplied random number generator

Returns:
  If 0, fracturing is successful.

Implemented in Nv::Blast::FractureToolImpl.

virtual bool Nv::Blast::FractureTool::deleteChunkSubhierarchy | ( | int32_t | chunkId,
|  | bool | deleteRoot = `false` |
| ) |  |  | `[pure virtual]`

Delete all children for specified chunk (also recursively delete chidren of children).

Parameters:

  `[in]` | chunkId | Chunk ID which children should be deleted
  `[in]` | deleteRoot | (optional) If true, deletes the given chunk too

Returns:
  true if one or more chunks were removed

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::finalizeFracturing | ( |  | ) | `[pure virtual]`

Creates resulting fractured mesh geometry from intermediate format

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::fitAllUvToRect | ( | float | side | ) | `[pure virtual]`

Rescale interior uv coordinates of all existing chunks to fit square of given size, relative sizes will be preserved.

Parameters:

  `[in]` | side | Size of square side

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::fitUvToRect | ( | float | side,
|  | uint32_t | chunkId |
| ) |  |  | `[pure virtual]`

Rescale interior uv coordinates of given chunk to fit square of given size.

Parameters:

  `[in]` | side | Size of square side
  `[in]` | chunkId | Chunk ID for which UVs should be scaled.

Implemented in Nv::Blast::FractureToolImpl.

virtual uint32_t Nv::Blast::FractureTool::getBaseMesh | ( | int32_t | chunkIndex,
|  | Triangle *& | output |
| ) |  |  | `[pure virtual]`

Get chunk base mesh

Parameters:

  `[in]` | chunkIndex | Chunk index
  `[out]` | output | Array of triangles to be filled

Returns:
  number of triangles in base mesh

Implemented in Nv::Blast::FractureToolImpl.

virtual uint32_t Nv::Blast::FractureTool::getBufferedBaseMeshes | ( | Vertex *& | vertexBuffer,
|  | uint32_t *& | indexBuffer,
|  | uint32_t *& | indexBufferOffsets |
| ) |  |  | `[pure virtual]`

Get result geometry without noise as vertex and index buffers, where index buffers contain series of triplets which represent triangles.

Parameters:

  `[out]` | vertexBuffer | Array of vertices to be filled
  `[out]` | indexBuffer | Array of indices to be filled
  `[out]` | indexBufferOffsets | Array of offsets in indexBuffer for each base mesh. Contains getChunkCount() + 1 elements. Last one is indexBuffer size

Returns:
  Number of vertices in vertexBuffer

Implemented in Nv::Blast::FractureToolImpl.

virtual uint32_t Nv::Blast::FractureTool::getChunkCount | ( |  | ) | const`[pure virtual]`

Returns overall number of chunks in fracture.

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::getChunkDepth | ( | int32_t | chunkId | ) | `[pure virtual]`

Return depth level of the given chunk

Parameters:

  `[in]` | chunkId | Chunk ID

Returns:
  Chunk depth or -1 if there is no such chunk.

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::getChunkId | ( | int32_t | chunkIndex | ) | `[pure virtual]`

Return id of chunk with specified index.

Parameters:

  `[in]` | chunkIndex | Chunk index

Returns:
  Chunk id or -1 if there is no such chunk.

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::getChunkIndex | ( | int32_t | chunkId | ) | `[pure virtual]`

Return index of chunk with specified chunkId

Parameters:

  `[in]` | chunkId | Chunk ID

Returns:
  Chunk index in internal buffer, if not exist -1 is returned.

Implemented in Nv::Blast::FractureToolImpl.

virtual const ChunkInfo& Nv::Blast::FractureTool::getChunkInfo | ( | int32_t | chunkIndex | ) | `[pure virtual]`

Get chunk information

Implemented in Nv::Blast::FractureToolImpl.

virtual uint32_t Nv::Blast::FractureTool::getChunksIdAtDepth | ( | uint32_t | depth,
|  | int32_t *& | chunkIds |
| ) |  |  | `[pure virtual]`

Return array of chunks IDs with given depth.

Parameters:

  `[in]` | depth | Chunk depth
  `[out]` | Pointer | to array of chunk IDs

Returns:
  Number of chunks in array

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::getInteriorMaterialId | ( |  | ) | const`[pure virtual]`

Gets the material id to use for new interior faces

Implemented in Nv::Blast::FractureToolImpl.

virtual float Nv::Blast::FractureTool::getMeshOverlap | ( | const Mesh & | meshA,
|  | const Mesh & | meshB |
| ) |  |  | `[pure virtual]`

Get percentage of mesh overlap. percentage computed as volume(intersection(meshA , meshB)) / volume (meshA)

Parameters:

  `[in]` | meshA | Mesh A
  `[in]` | meshB | Mesh B

Returns:
  mesh overlap percentage

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::getTransformation | ( | NvcVec3 & | offset,
|  | float & | scale |
| ) |  |  | `[pure virtual]`

Input mesh is scaled and transformed internally to fit unit cube centered in origin. Method provides offset vector and scale parameter;

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::islandDetectionAndRemoving | ( | int32_t | chunkId,
|  | bool | createAtNewDepth = `false` |
| ) |  |  | `[pure virtual]`

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.

Parameters:

  `[in]` | chunkId | Chunk ID which should be checked for islands

Returns:
  Number of found islands is returned

Implemented in Nv::Blast::FractureToolImpl.

virtual bool Nv::Blast::FractureTool::isMeshContainOpenEdges | ( | const Mesh * | input | ) | `[pure virtual]`

Check if input mesh contains open edges. Open edges can lead to wrong fracturing results.

Returns:
  true if mesh contains open edges

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::release | ( |  | ) | `[pure virtual]`

Release FractureTool memory

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::replaceMaterialId | ( | int32_t | oldMaterialId,
|  | int32_t | newMaterialId |
| ) |  |  | `[pure virtual]`

Replaces an material id on faces with a new one

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::reset | ( |  | ) | `[pure virtual]`

Reset FractureTool state.

Implemented in Nv::Blast::FractureToolImpl.

virtual bool Nv::Blast::FractureTool::setApproximateBonding | ( | uint32_t | chunkIndex,
|  | bool | useApproximateBonding |
| ) |  |  | `[pure virtual]`

Set the APPROXIMATE_BONDING flag in the chunk's ChunkInfo

Parameters:

  `[in]` | chunkIndex | chunk index - use getChunkIndex(ID)
  `[in]` | useApproximateBonding | value of flag to set

Returns:
  true if the chunk ID is found, false otherwise

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::setChunkMesh | ( | const Mesh * | mesh,
|  | int32_t | parentId |
| ) |  |  | `[pure virtual]`

Set chunk mesh, parentId should be valid, return id of new chunk.

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::setInteriorMaterialId | ( | int32_t | materialId | ) | `[pure virtual]`

Set the material id to use for new interior faces. Defaults to kMaterialInteriorId

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::setRemoveIslands | ( | bool | isRemoveIslands | ) | `[pure virtual]`

Set automatic islands removing. May cause instabilities.

Parameters:

  `[in]` | isRemoveIslands | Flag whether remove or not islands.

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::setSourceMesh | ( | const Mesh * | mesh | ) | `[pure virtual]`

Set input mesh which will be fractured, FractureTool will be reseted.

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::slicing | ( | uint32_t | chunkId,
|  | const SlicingConfiguration & | conf,
|  | bool | replaceChunk,
|  | RandomGeneratorBase * | rnd |
| ) |  |  | `[pure virtual]`

Fractures specified chunk with slicing method.

Parameters:

  `[in]` | chunkId | Chunk to fracture
  `[in]` | conf | Slicing parameters, see SlicingConfiguration.
  `[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
  `[in]` | rnd | User supplied random number generator

Returns:
  If 0, fracturing is successful.

Implemented in Nv::Blast::FractureToolImpl.

virtual void Nv::Blast::FractureTool::uniteChunks | ( | uint32_t | threshold,
|  | uint32_t | targetClusterSize,
|  | const uint32_t * | chunksToMerge,
|  | uint32_t | mergeChunkCount,
|  | const NvcVec2i * | adjChunks,
|  | uint32_t | adjChunksSize,
|  | bool | removeOriginalChunks = `false` |
| ) |  |  | `[pure virtual]`

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.

Parameters:

  `[in]` | threshold | If number of children of some chunk less then maxAtLevel then it would be considered as already optimized and skipped.
  `[in]` | targetClusterSize | Target number of children for processed chunks.
  `[in]` | chunksToMerge | Which chunks are merge candidate. If NULL, all chunks will be a merge candidate.
  `[in]` | mergeChunkCount | size of chunksToMerge array, if chunksToMerge != NULL.
  `[in]` | adjChunks | Optional index pairs to describe chunk adjacency. May be NULL.
  `[in]` | adjChunksSize | If 'adjChunks' is not NULL, the number of index pairs in the adjChunks array.
  `[in]` | removeOriginalChunks | If true, original chunks that are merged are removed.

Implemented in Nv::Blast::FractureToolImpl.

virtual uint32_t Nv::Blast::FractureTool::updateBaseMesh | ( | int32_t | chunkIndex,
|  | Triangle * | output |
| ) |  |  | `[pure virtual]`

Update chunk base mesh

Note:
  Doesn't allocates output array, Triangle* output should be preallocated by user

Parameters:

  `[in]` | chunkIndex | Chunk index
  `[out]` | output | Array of triangles to be filled

Returns:
  number of triangles in base mesh

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::voronoiFracturing | ( | uint32_t | chunkId,
|  | uint32_t | cellCount,
|  | const NvcVec3 * | cellPoints,
|  | const NvcVec3 & | scale,
|  | const NvcQuat & | rotation,
|  | bool | replaceChunk |
| ) |  |  | `[pure virtual]`

Fractures specified chunk with voronoi method. Cells can be scaled along x,y,z axes.

Parameters:

  `[in]` | chunkId | Chunk to fracture
  `[in]` | cellPoints | Array of voronoi sites
  `[in]` | cellPoints | Array of voronoi sites
  `[in]` | scale | Voronoi cells scaling factor
  `[in]` | rotation | Voronoi cells rotation. Has no effect without cells scale factor
  `[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

Returns:
  If 0, fracturing is successful.

Implemented in Nv::Blast::FractureToolImpl.

virtual int32_t Nv::Blast::FractureTool::voronoiFracturing | ( | uint32_t | chunkId,
|  | uint32_t | cellCount,
|  | const NvcVec3 * | cellPoints,
|  | bool | replaceChunk |
| ) |  |  | `[pure virtual]`

Fractures specified chunk with voronoi method.

Parameters:

  `[in]` | chunkId | Chunk to fracture
  `[in]` | cellPoints | Array of voronoi sites
  `[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

Returns:
  If 0, fracturing is successful.

Implemented in Nv::Blast::FractureToolImpl.

The documentation for this class was generated from the following file:

- sdk/extensions/authoring/include/NvBlastExtAuthoringFractureTool.h