Nv::Blast::FractureToolImpl Class Reference

#include <NvBlastExtAuthoringFractureToolImpl.h>

Inheritance diagram for Nv::Blast::FractureToolImpl:

Nv::Blast::FractureTool

List of all members.

Public Member Functions

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

Protected Attributes

std::vector< ChunkInfomChunkData
int32_t mChunkIdCounter
std::vector< Triangulator * > mChunkPostprocessors
int32_t mInteriorMaterialId
NvcVec3 mOffset
int64_t mPlaneIndexerOffset
bool mRemoveIslands
float mScaleFactor


Detailed Description

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

Constructor & Destructor Documentation

Nv::Blast::FractureToolImpl::FractureToolImpl (  )  [inline]

FractureTool can log asset creation info if logCallback is provided.

Nv::Blast::FractureToolImpl::~FractureToolImpl (  )  [inline]


Member Function Documentation

Mesh* Nv::Blast::FractureToolImpl::createChunkMesh ( int32_t  chunkId  )  [override, virtual]

Get chunk mesh in polygonal representation

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::cut ( uint32_t  chunkId,
const NvcVec3 normal,
const NvcVec3 position,
const NoiseConfiguration noise,
bool  replaceChunk,
RandomGeneratorBase rnd 
) [override, 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.

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::cutout ( uint32_t  chunkId,
CutoutConfiguration  conf,
bool  replaceChunk,
RandomGeneratorBase rnd 
) [override, 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.

Implements Nv::Blast::FractureTool.

bool Nv::Blast::FractureToolImpl::deleteChunkSubhierarchy ( int32_t  chunkId,
bool  deleteRoot = false 
) [override, 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

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::finalizeFracturing (  )  [override, virtual]

Creates resulting fractured mesh geometry from intermediate format

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::fitAllUvToRect ( float  side  )  [override, 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

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::fitUvToRect ( float  side,
uint32_t  chunkId 
) [override, 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.

Implements Nv::Blast::FractureTool.

uint32_t Nv::Blast::FractureToolImpl::getBaseMesh ( int32_t  chunkIndex,
Triangle *&  output 
) [override, virtual]

Get chunk base mesh

Note:
User should call NVBLAST_FREE for output when it not needed anymore
Parameters:
[in] chunkIndex Chunk index
[out] output Array of triangles to be filled
Returns:
number of triangles in base mesh

Implements Nv::Blast::FractureTool.

uint32_t Nv::Blast::FractureToolImpl::getBufferedBaseMeshes ( Vertex *&  vertexBuffer,
uint32_t *&  indexBuffer,
uint32_t *&  indexBufferOffsets 
) [override, virtual]

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

Note:
User should call NVBLAST_FREE for vertexBuffer, indexBuffer and indexBufferOffsets when it not needed anymore
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

Implements Nv::Blast::FractureTool.

uint32_t Nv::Blast::FractureToolImpl::getChunkCount (  )  const [override, virtual]

Returns overall number of chunks in fracture.

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::getChunkDepth ( int32_t  chunkId  )  [override, virtual]

Return depth level of the given chunk

Parameters:
[in] chunkId Chunk ID
Returns:
Chunk depth or -1 if there is no such chunk.

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::getChunkId ( int32_t  chunkIndex  )  [override, virtual]

Return id of chunk with specified index.

Parameters:
[in] chunkIndex Chunk index
Returns:
Chunk id or -1 if there is no such chunk.

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::getChunkIndex ( int32_t  chunkId  )  [override, 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.

Implements Nv::Blast::FractureTool.

const ChunkInfo& Nv::Blast::FractureToolImpl::getChunkInfo ( int32_t  chunkIndex  )  [override, virtual]

Get chunk information

Implements Nv::Blast::FractureTool.

uint32_t Nv::Blast::FractureToolImpl::getChunksIdAtDepth ( uint32_t  depth,
int32_t *&  chunkIds 
) [override, virtual]

Return array of chunks IDs with given depth.

Note:
User should call NVBLAST_FREE for chunkIds when it not needed anymore
Parameters:
[in] depth Chunk depth
[out] Pointer to array of chunk IDs
Returns:
Number of chunks in array

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::getInteriorMaterialId (  )  const [override, virtual]

Gets the material id to use for new interior faces

Implements Nv::Blast::FractureTool.

float Nv::Blast::FractureToolImpl::getMeshOverlap ( const Mesh meshA,
const Mesh meshB 
) [override, 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

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::getTransformation ( NvcVec3 offset,
float &  scale 
) [override, virtual]

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

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::islandDetectionAndRemoving ( int32_t  chunkId,
bool  createAtNewDepth = false 
) [override, 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

Implements Nv::Blast::FractureTool.

bool Nv::Blast::FractureToolImpl::isMeshContainOpenEdges ( const Mesh input  )  [override, virtual]

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

Returns:
true if mesh contains open edges

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::release (  )  [override, virtual]

Release FractureTool memory

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::replaceMaterialId ( int32_t  oldMaterialId,
int32_t  newMaterialId 
) [override, virtual]

Replaces an material id on faces with a new one

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::reset (  )  [override, virtual]

Reset FractureTool state.

Implements Nv::Blast::FractureTool.

bool Nv::Blast::FractureToolImpl::setApproximateBonding ( uint32_t  chunkIndex,
bool  useApproximateBonding 
) [override, 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

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::setChunkMesh ( const Mesh mesh,
int32_t  parentId 
) [override, virtual]

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

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::setInteriorMaterialId ( int32_t  materialId  )  [override, virtual]

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

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::setRemoveIslands ( bool  isRemoveIslands  )  [override, virtual]

Set automatic islands removing. May cause instabilities.

Parameters:
[in] isRemoveIslands Flag whether remove or not islands.

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::setSourceMesh ( const Mesh mesh  )  [override, virtual]

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

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::slicing ( uint32_t  chunkId,
const SlicingConfiguration conf,
bool  replaceChunk,
RandomGeneratorBase rnd 
) [override, 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.

Implements Nv::Blast::FractureTool.

void Nv::Blast::FractureToolImpl::uniteChunks ( uint32_t  threshold,
uint32_t  targetClusterSize,
const uint32_t *  chunksToMerge,
uint32_t  mergeChunkCount,
const NvcVec2i adjChunks,
uint32_t  adjChunksSize,
bool  removeOriginalChunks = false 
) [override, 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.

Implements Nv::Blast::FractureTool.

uint32_t Nv::Blast::FractureToolImpl::updateBaseMesh ( int32_t  chunkIndex,
Triangle output 
) [override, 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

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::voronoiFracturing ( uint32_t  chunkId,
uint32_t  cellCount,
const NvcVec3 cellPoints,
const NvcVec3 scale,
const NvcQuat rotation,
bool  replaceChunk 
) [override, 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.

Implements Nv::Blast::FractureTool.

int32_t Nv::Blast::FractureToolImpl::voronoiFracturing ( uint32_t  chunkId,
uint32_t  cellCount,
const NvcVec3 cellPoints,
bool  replaceChunk 
) [override, 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.

Implements Nv::Blast::FractureTool.


Member Data Documentation

Mesh scaled to unite-cube and translated to the origin


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