sdk/lowlevel/include/NvBlast.h File Reference

#include "NvBlastTypes.h"

Go to the source code of this file.

Functions

void NvBlastActorApplyFracture (NvBlastFractureBuffers *eventBuffers, NvBlastActor *actor, const NvBlastFractureBuffers *commands, NvBlastLog logFn, NvBlastTimers *timers)
bool NvBlastActorCanFracture (const NvBlastActor *actor, NvBlastLog logFn)
void NvBlastActorGenerateFracture (NvBlastFractureBuffers *commandBuffers, const NvBlastActor *actor, const NvBlastDamageProgram program, const void *programParams, NvBlastLog logFn, NvBlastTimers *timers)
uint32_t NvBlastActorGetMaxActorCountForSplit (const NvBlastActor *actor, NvBlastLog logFn)
size_t NvBlastActorGetRequiredScratchForSplit (const NvBlastActor *actor, NvBlastLog logFn)
bool NvBlastActorIsBoundToWorld (const NvBlastActor *actor, NvBlastLog logFn)
bool NvBlastActorIsSplitRequired (const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorSplit (NvBlastActorSplitEvent *result, NvBlastActor *actor, uint32_t newActorsMaxCount, void *scratch, NvBlastLog logFn, NvBlastTimers *timers)
bool NvBlastActorDeactivate (NvBlastActor *actor, NvBlastLog logFn)
const float * NvBlastActorGetBondHealths (const NvBlastActor *actor, NvBlastLog logFn)
NvBlastFamilyNvBlastActorGetFamily (const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorGetGraphNodeCount (const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorGetGraphNodeIndices (uint32_t *graphNodeIndices, uint32_t graphNodeIndicesSize, const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorGetIndex (const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorGetSerializationSize (const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorGetVisibleChunkCount (const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorGetVisibleChunkIndices (uint32_t *visibleChunkIndices, uint32_t visibleChunkIndicesSize, const NvBlastActor *actor, NvBlastLog logFn)
uint32_t NvBlastActorSerialize (void *buffer, uint32_t bufferSize, const NvBlastActor *actor, NvBlastLog logFn)
void NvBlastApplyAssetDescChunkReorderMap (NvBlastChunkDesc *reorderedChunkDescs, const NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, NvBlastBondDesc *bondDescs, uint32_t bondCount, const uint32_t *chunkReorderMap, bool keepBondNormalChunkOrder, NvBlastLog logFn)
void NvBlastApplyAssetDescChunkReorderMapInPlace (NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, NvBlastBondDesc *bondDescs, uint32_t bondCount, const uint32_t *chunkReorderMap, bool keepBondNormalChunkOrder, void *scratch, NvBlastLog logFn)
bool NvBlastBuildAssetDescChunkReorderMap (uint32_t *chunkReorderMap, const NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, void *scratch, NvBlastLog logFn)
bool NvBlastEnsureAssetExactSupportCoverage (NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, void *scratch, NvBlastLog logFn)
bool NvBlastReorderAssetDescChunks (NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, NvBlastBondDesc *bondDescs, uint32_t bondCount, uint32_t *chunkReorderMap, bool keepBondNormalChunkOrder, void *scratch, NvBlastLog logFn)
NvBlastFamilyNvBlastAssetCreateFamily (void *mem, const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetActorSerializationSizeUpperBound (const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetBondCount (const NvBlastAsset *asset, NvBlastLog logFn)
const NvBlastBondNvBlastAssetGetBonds (const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetChunkCount (const NvBlastAsset *asset, NvBlastLog logFn)
const NvBlastChunkNvBlastAssetGetChunks (const NvBlastAsset *asset, NvBlastLog logFn)
const uint32_t * NvBlastAssetGetChunkToGraphNodeMap (const NvBlastAsset *asset, NvBlastLog logFn)
size_t NvBlastAssetGetFamilyMemorySize (const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetFirstSubsupportChunkIndex (const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetFormatVersion (const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastID NvBlastAssetGetID (const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetLeafChunkCount (const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetSize (const NvBlastAsset *asset, NvBlastLog logFn)
uint32_t NvBlastAssetGetSupportChunkCount (const NvBlastAsset *asset, NvBlastLog logFn)
const NvBlastSupportGraph NvBlastAssetGetSupportGraph (const NvBlastAsset *asset, NvBlastLog logFn)
bool NvBlastAssetSetID (NvBlastAsset *asset, const NvBlastID *id, NvBlastLog logFn)
NvBlastAssetNvBlastCreateAsset (void *mem, const NvBlastAssetDesc *desc, void *scratch, NvBlastLog logFn)
size_t NvBlastGetAssetMemorySize (const NvBlastAssetDesc *desc, NvBlastLog logFn)
size_t NvBlastGetRequiredScratchForCreateAsset (const NvBlastAssetDesc *desc, NvBlastLog logFn)
NvBlastActorNvBlastFamilyCreateFirstActor (NvBlastFamily *family, const NvBlastActorDesc *desc, void *scratch, NvBlastLog logFn)
NvBlastActorNvBlastFamilyDeserializeActor (NvBlastFamily *family, const void *buffer, NvBlastLog logFn)
uint32_t NvBlastFamilyGetActorCount (const NvBlastFamily *family, NvBlastLog logFn)
uint32_t NvBlastFamilyGetActors (NvBlastActor **actors, uint32_t actorsSize, const NvBlastFamily *family, NvBlastLog logFn)
const NvBlastAssetNvBlastFamilyGetAsset (const NvBlastFamily *family, NvBlastLog logFn)
NvBlastID NvBlastFamilyGetAssetID (const NvBlastFamily *family, NvBlastLog logFn)
NvBlastActorNvBlastFamilyGetChunkActor (const NvBlastFamily *family, uint32_t chunkIndex, NvBlastLog logFn)
uint32_t NvBlastFamilyGetFormatVersion (const NvBlastFamily *family, NvBlastLog logFn)
uint32_t NvBlastFamilyGetMaxActorCount (const NvBlastFamily *family, NvBlastLog logFn)
size_t NvBlastFamilyGetRequiredScratchForCreateFirstActor (const NvBlastFamily *family, NvBlastLog logFn)
uint32_t NvBlastFamilyGetSize (const NvBlastFamily *family, NvBlastLog logFn)
void NvBlastFamilySetAsset (NvBlastFamily *family, const NvBlastAsset *asset, NvBlastLog logFn)
double NvBlastTicksToSeconds (int64_t ticks)
void NvBlastTimersReset (NvBlastTimers *timers)


Function Documentation

void NvBlastActorApplyFracture ( NvBlastFractureBuffers eventBuffers,
NvBlastActor actor,
const NvBlastFractureBuffers commands,
NvBlastLog  logFn,
NvBlastTimers timers 
)

Applies the direct fracture and breaks graph bonds/edges as necessary. Chunks damaged beyond their respective health fracture their children recursively, creating a NvBlastChunkFractureData for each.

Parameters:
[in,out] eventBuffers Target buffers to hold applied fracture events. May be NULL, in which case events are not reported. To avoid data loss, provide an entry for every lower-support chunk and every bond in the original actor.
[in,out] actor The NvBlastActor to apply fracture to.
[in] commands The fracture commands to process.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
[in,out] timers If non-NULL this struct will be filled out with profiling information for the step, in profile build configurations.
Interpretation of NvBlastFractureBuffers: commands: Counters denote the number of command entries to process. Chunk and Bond userdata are not used. Health values denote the amount of damage to apply, as a positive value.

eventBuffers as input: Counters denote available entries for FractureData. Chunk and Bond userdata are not used. Health values are not used.

eventBuffers as output: Counters denote valid entires in FractureData arrays. Chunks and Bond userdata reflect the respective userdata set during asset initialization. Health values denote how much health is remaining for the damaged element. Broken elements report a negative value corresponding to the superfluous health damage.

commands and eventBuffers may point to the same memory.

bool NvBlastActorCanFracture ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Determines if the actor can fracture further.

Parameters:
[in] actor The actor potentially being fractured.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
true if any result can be expected from fracturing the actor. false if no further change to the actor is possible.

bool NvBlastActorDeactivate ( NvBlastActor actor,
NvBlastLog  logFn 
)

Deactivate an actor within its family. Conceptually this is "destroying" the actor, however memory will not be released until the family is released.

Parameters:
[in] actor Points to a user-supplied actor struct. May be NULL, in which case this function no-ops.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
true iff successful (actor was active).

void NvBlastActorGenerateFracture ( NvBlastFractureBuffers commandBuffers,
const NvBlastActor actor,
const NvBlastDamageProgram  program,
const void *  programParams,
NvBlastLog  logFn,
NvBlastTimers timers 
)

Creates fracture commands for the actor using a damage program and program parameters (material and damage descriptions).

Parameters:
[in,out] commandBuffers Target buffers to hold generated commands. To avoid data loss, provide an entry for every support chunk and every bond in the original actor.
[in] actor The NvBlastActor to create fracture commands for.
[in] program A NvBlastDamageProgram containing damage shaders.
[in] programParams Parameters for the NvBlastDamageProgram.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
[in,out] timers If non-NULL this struct will be filled out with profiling information for the step, in profile build configurations.
Interpretation of NvBlastFractureBuffers: As input: Counters denote available entries for FractureData. Chunk and Bond userdata are not used. Health values are not used.

As output: Counters denote valid entires in FractureData arrays. Chunks and Bond userdata reflect the respective userdata set during asset initialization, where implemented by the material function. Health values denote how much damage is to be applied.

const float* NvBlastActorGetBondHealths ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Access the bond health data for an actor.

This function returns a pointer to the head of an array of bond healths (floats). This array is the same for any actor that has been created from repeated fracturing of the same original instance of an asset (in the same instance family).

The indices obtained from NvBlastSupportGraph::adjacentBondIndices in the asset may be used to access this array.

The size of the array returned is NvBlastAssetGetBondCount(asset, logFn), where 'asset' is the NvBlastAsset that was used to create the actor.

This array is valid as long as any actor in the instance family for the input actor exists.

If the input actor is invalid, NULL will be returned.

Parameters:
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the array of bond healths for the actor's instance family, or NULL if the actor is invalid.

NvBlastFamily* NvBlastActorGetFamily ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Access to an actor's family.

Parameters:
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the family with which the actor is associated.

uint32_t NvBlastActorGetGraphNodeCount ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Get the number of graph nodes for this actor. May be used in conjunction with NvBlastActorGetGraphNodeIndices.

Parameters:
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of graph node indices for the actor.

uint32_t NvBlastActorGetGraphNodeIndices ( uint32_t *  graphNodeIndices,
uint32_t  graphNodeIndicesSize,
const NvBlastActor actor,
NvBlastLog  logFn 
)

Retrieve a list of graph node indices for the actor into the given array.

Parameters:
[in] graphNodeIndices User-supplied array to be filled in with indices of graph nodes for this actor.
[in] graphNodeIndicesSize The size of the graphNodeIndices array. To receive all graph node indices, the size must be at least that given by NvBlastActorGetGraphNodeCount(actor).
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of indices written to graphNodeIndices. This will not exceed graphNodeIndicesSize.

uint32_t NvBlastActorGetIndex ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Access to an actor's internal index.

Parameters:
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
actor's internal index in family.

uint32_t NvBlastActorGetMaxActorCountForSplit ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Returns the upper-bound number of actors which can be created by calling NvBlastActorSplit with that actor, this value can't exceed chunk count.

Parameters:
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the upper-bound number of actors which can be created by calling NvBlastActorSplit with that actor.

size_t NvBlastActorGetRequiredScratchForSplit ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Returns the number of bytes of scratch memory that the user must supply to NvBlastActorSplit, based upon the actor that will be passed into that function.

Parameters:
[in] actor The actor that will be passed into NvBlastActorSplit.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of bytes of scratch memory required for a call to NvBlastActorSplit with that actor.

uint32_t NvBlastActorGetSerializationSize ( const NvBlastActor actor,
NvBlastLog  logFn 
)

The buffer size needed to serialize a single actor. This will give the exact size needed. For an upper bound on the buffer size needed for any actor instanced from an NvBlastAsset, use NvBlastAssetGetActorSerializationSizeUpperBound.

Parameters:
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the required buffer size in bytes.

uint32_t NvBlastActorGetVisibleChunkCount ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Get the number of visible chunks for this actor. May be used in conjunction with NvBlastActorGetVisibleChunkIndices.

Parameters:
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of visible chunk indices for the actor.

uint32_t NvBlastActorGetVisibleChunkIndices ( uint32_t *  visibleChunkIndices,
uint32_t  visibleChunkIndicesSize,
const NvBlastActor actor,
NvBlastLog  logFn 
)

Retrieve a list of visible chunk indices for the actor into the given array.

Parameters:
[in] visibleChunkIndices User-supplied array to be filled in with indices of visible chunks for this actor.
[in] visibleChunkIndicesSize The size of the visibleChunkIndices array. To receive all visible chunk indices, the size must be at least that given by NvBlastActorGetVisibleChunkCount(actor).
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of indices written to visibleChunkIndices. This will not exceed visibleChunkIndicesSize.

bool NvBlastActorIsBoundToWorld ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Returns:
true iff this actor contains the "world" support graph node, created when a bond contains the UINT32_MAX value for one of their chunkIndices.

bool NvBlastActorIsSplitRequired ( const NvBlastActor actor,
NvBlastLog  logFn 
)

Determines if the actor is damaged (was fractured) and split call is required.

The actor could be damaged by calling NvBlastActorApplyFracture or NvBlastFamilyApplyFracture and NvBlastActorSplit is expected after. This function gives a hint that NvBlastActorSplit will have some work to be done and actor could potentially be split. If actor is not damaged calling NvBlastActorSplit will make no effect.

Returns:
true iff split call is required for this actor.

uint32_t NvBlastActorSerialize ( void *  buffer,
uint32_t  bufferSize,
const NvBlastActor actor,
NvBlastLog  logFn 
)

Serialize a single actor to a buffer.

Parameters:
[out] buffer User-supplied buffer, must be at least of size given by NvBlastActorGetSerializationSize(actor).
[in] bufferSize The size of the user-supplied buffer.
[in] actor The actor.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of bytes written to the buffer, or 0 if there is an error (such as an under-sized buffer).

uint32_t NvBlastActorSplit ( NvBlastActorSplitEvent result,
NvBlastActor actor,
uint32_t  newActorsMaxCount,
void *  scratch,
NvBlastLog  logFn,
NvBlastTimers timers 
)

Releases the oldActor and creates its children newActors if necessary.

Parameters:
[out] result The list of deleted and created NvBlastActor objects.
[in] actor The actor to split.
[in] newActorsMaxCount Number of available NvBlastActor slots. In the worst case, one NvBlastActor may be created for every chunk in the asset.
[in] scratch Scratch Memory used during processing. NvBlastActorGetRequiredScratchForSplit provides the necessary size.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
[in,out] timers If non-NULL this struct will be filled out with profiling information for the step, in profile build configurations
Returns:
1..n: new actors were created

0: oldActor is unchanged

void NvBlastApplyAssetDescChunkReorderMap ( NvBlastChunkDesc reorderedChunkDescs,
const NvBlastChunkDesc chunkDescs,
uint32_t  chunkCount,
NvBlastBondDesc bondDescs,
uint32_t  bondCount,
const uint32_t *  chunkReorderMap,
bool  keepBondNormalChunkOrder,
NvBlastLog  logFn 
)

Apply chunk reorder map.

Function applies reorder map on NvBlastChunkDesc and NvBlastBondDesc arrays. It reorders chunks, replaces their 'parentChunkIndex' field with new indices. Bonds are kept in the same order, but their 'chunkIndices' field is updated with proper indices.

See also:
NvBlastBuildAssetDescChunkReorderMap
Parameters:
[out] reorderedChunkDescs User-supplied array of size chunkCount to fill with new reordered NvBlastChunkDesc's.
[in] chunkDescs Array of chunk descriptors of size chunkCount.
[in] chunkCount The number of chunk descriptors.
[in] bondDescs Array of bond descriptors of size chunkCount. It will be updated accordingly.
[in] bondCount The number of bond descriptors.
[in] chunkReorderMap Chunk reorder map to use, must be of size chunkCount.
[in] keepBondNormalChunkOrder If true, bond normals will be flipped if their chunk index order was reveresed by the reorder map.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.

void NvBlastApplyAssetDescChunkReorderMapInPlace ( NvBlastChunkDesc chunkDescs,
uint32_t  chunkCount,
NvBlastBondDesc bondDescs,
uint32_t  bondCount,
const uint32_t *  chunkReorderMap,
bool  keepBondNormalChunkOrder,
void *  scratch,
NvBlastLog  logFn 
)

Apply chunk reorder map.

Function applies reorder map on NvBlastChunkDesc and NvBlastBondDesc arrays. It reorders chunks, replaces their 'parentChunkIndex' field with new indices. Bonds are kept in the same order, but their 'chunkIndices' field is updated with proper indices.

This overload of function reorders chunks in place.

See also:
NvBlastBuildAssetDescChunkReorderMap
Parameters:
[in] chunkDescs Array of chunk descriptors of size chunkCount. It will be updated accordingly.
[in] chunkCount The number of chunk descriptors.
[in] bondDescs Array of bond descriptors of size chunkCount. It will be updated accordingly.
[in] bondCount The number of bond descriptors.
[in] chunkReorderMap Chunk reorder map to use, must be of size chunkCount.
[in] keepBondNormalChunkOrder If true, bond normals will be flipped if their chunk index order was reveresed by the reorder map.
[in] scratch User-supplied scratch storage, must point to chunkCount * sizeof(NvBlastChunkDesc) valid bytes of memory.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.

NvBlastFamily* NvBlastAssetCreateFamily ( void *  mem,
const NvBlastAsset asset,
NvBlastLog  logFn 
)

Family-building function.

Constructs an NvBlastFamily in-place at the address given by the user. The address must point to a block of memory of at least the size given by NvBlastAssetGetFamilyMemorySize(asset, logFn), and must be 16-byte aligned.

Parameters:
[in] mem Pointer to block of memory of at least the size given by NvBlastAssetGetFamilyMemorySize(asset, logFn). Must be 16-byte aligned.
[in] asset Asset to instance.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the family.

uint32_t NvBlastAssetGetActorSerializationSizeUpperBound ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

A buffer size sufficient to serialize an actor instanced from a given asset. This function is faster than NvBlastActorGetSerializationSize, and can be used to create a reusable buffer for actor serialization.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the required buffer size in bytes.

uint32_t NvBlastAssetGetBondCount ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Get the number of bonds in the given asset.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of bonds in the asset.

const NvBlastBond* NvBlastAssetGetBonds ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Access an array of bonds of the given asset.

Parameters:
[in] asset The asset.
[in] logFn User - supplied message function(see NvBlastLog definition).May be NULL.
Returns:
a pointer to an array of bonds of the asset.

uint32_t NvBlastAssetGetChunkCount ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Get the number of chunks in the given asset.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of chunks in the asset.

const NvBlastChunk* NvBlastAssetGetChunks ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Access an array of chunks of the given asset.

Parameters:
[in] asset The asset.
[in] logFn User - supplied message function(see NvBlastLog definition).May be NULL.
Returns:
a pointer to an array of chunks of the asset.

const uint32_t* NvBlastAssetGetChunkToGraphNodeMap ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Access a map from chunk index to graph node index. Returned map is valid in the domain [0, NvBlastAssetGetChunkCount(asset, logFn)). Non-support chunks are mapped to the invalid index 0xFFFFFFFF.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
an array of uint32_t values defining the map, of size NvBlastAssetGetChunkCount(asset, logFn).

size_t NvBlastAssetGetFamilyMemorySize ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Calculates the memory requirements for a family based upon an asset. Use this function when building a family with NvBlastAssetCreateFamily.

Parameters:
[in] asset Asset used to build the family (see NvBlastAsset).
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the memory size (in bytes) required for the family, or zero if asset is invalid.

uint32_t NvBlastAssetGetFirstSubsupportChunkIndex ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Get the first subsupport chunk index in the given asset. Chunks are sorted such that subsupport chunks come last. This is the first subsupport chunk index. Equals to total chunk count if there are no subsupport chunks.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the first subsupport chunk index in the asset.

uint32_t NvBlastAssetGetFormatVersion ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Retrieve the data format version for the given asset

Parameters:
[in] asset The asset. Cannot be NULL.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the data format version (NvBlastAssetDataFormat).

NvBlastID NvBlastAssetGetID ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Retrieve the asset ID.

Parameters:
[in] asset The given asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the ID of the asset.

uint32_t NvBlastAssetGetLeafChunkCount ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Get the number of leaf chunks in the given asset.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of leaf chunks in the asset.

uint32_t NvBlastAssetGetSize ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Retrieve the memory size (in bytes) of the given data asset

Parameters:
[in] asset The asset. Cannot be NULL.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the memory size of the asset (in bytes).

uint32_t NvBlastAssetGetSupportChunkCount ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Get the number of support chunks in the given asset. This will equal the number of graph nodes in NvBlastSupportGraph::nodeCount returned by NvBlastAssetGetSupportGraph only if no extra "world" node was created due to bonds defined between support chunks and the world. If such bonds were created, then there is an extra graph node representing the world, and this function will return NvBlastSupportGraph::nodeCount - 1.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of chunks in the asset.

const NvBlastSupportGraph NvBlastAssetGetSupportGraph ( const NvBlastAsset asset,
NvBlastLog  logFn 
)

Access the support graph for the given asset.

Parameters:
[in] asset The asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
a struct of support graph for the given asset.

bool NvBlastAssetSetID ( NvBlastAsset asset,
const NvBlastID id,
NvBlastLog  logFn 
)

Set an asset's ID

Parameters:
[in] asset The given asset.
[in] id A pointer to the id to copy into the asset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
true iff the id is successfully set.

bool NvBlastBuildAssetDescChunkReorderMap ( uint32_t *  chunkReorderMap,
const NvBlastChunkDesc chunkDescs,
uint32_t  chunkCount,
void *  scratch,
NvBlastLog  logFn 
)

Build chunk reorder map.

NvBlastCreateAsset function requires NvBlastChunkDesc array to be in correct oder:

1. Root chunks (chunks with invalid parent index) must be first in the asset's chunk list. 2. Chunks in the asset must be arranged such that sibling chunks (chunks with the same parent) are contiguous. 3. Chunks must be arranged such that upper-support chunks (support chunks and their parent chunks) go first in chunk list.

This function builds chunk reorder map which can be used to order chunk descs. Reordering chunk's descriptors according to generated map places them in correct order for NvBlastCreateAsset to succeed.

Iff chunks are already ordered correctly, function returns 'true' and identity chunk reorder map. Otherwise 'false' is returned.

Parameters:
[out] chunkReorderMap User-supplied map of size chunkCount to fill. For every chunk index this array will contain new chunk position (index).
[in] chunkDescs Array of chunk descriptors of size chunkCount.
[in] chunkCount The number of chunk descriptors.
[in] scratch User-supplied scratch storage, must point to 2 * chunkCount * sizeof(uint32_t) valid bytes of memory.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
true iff the chunks did not require reordering (chunkReorderMap is the identity map).

NvBlastAsset* NvBlastCreateAsset ( void *  mem,
const NvBlastAssetDesc desc,
void *  scratch,
NvBlastLog  logFn 
)

Asset-building function.

Constructs an NvBlastAsset in-place at the address given by the user. The address must point to a block of memory of at least the size given by NvBlastGetAssetMemorySize(desc, logFn), and must be 16-byte aligned.

Support chunks (marked in the NvBlastChunkDesc struct) must provide full coverage over the asset. This means that from any leaf chunk to the root node, exactly one chunk must be support. If this condition is not met the function fails to create an asset.

Any bonds described by NvBlastBondDesc descriptors that reference non-support chunks will be removed. Duplicate bonds will be removed as well (bonds that are between the same chunk pairs).

Chunks in the asset should be arranged such that sibling chunks (chunks with the same parent) are contiguous. Chunks are also should be arranged such that leaf chunks (chunks with no children) are at the end of the chunk list. If chunks aren't arranged properly the function fails to create an asset.

Parameters:
[in] mem Pointer to block of memory of at least the size given by NvBlastGetAssetMemorySize(desc, logFn). Must be 16-byte aligned.
[in] desc Asset descriptor (see NvBlastAssetDesc).
[in] scratch User-supplied scratch memory of size NvBlastGetRequiredScratchForCreateAsset(desc) bytes.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
pointer to new NvBlastAsset (will be the same address as mem), or NULL if unsuccessful.

bool NvBlastEnsureAssetExactSupportCoverage ( NvBlastChunkDesc chunkDescs,
uint32_t  chunkCount,
void *  scratch,
NvBlastLog  logFn 
)

Function to ensure (check and update) support coverage of chunks.

Support chunks (marked in the NvBlastChunkDesc struct) must provide full coverage over the asset. This means that from any leaf chunk to the root node, exactly one chunk must be support. If this condition is not met, the actual support chunks will be adjusted accordingly.

Chunk order depends on support coverage, so this function should be called before chunk reordering.

Parameters:
[in] chunkDescs Array of chunk descriptors of size chunkCount. It will be updated accordingly.
[in] chunkCount The number of chunk descriptors.
[in] scratch User-supplied scratch storage, must point to chunkCount valid bytes of memory.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
true iff coverage was already exact.

NvBlastActor* NvBlastFamilyCreateFirstActor ( NvBlastFamily family,
const NvBlastActorDesc desc,
void *  scratch,
NvBlastLog  logFn 
)

Instance the family's asset into a new, unfractured actor.

Parameters:
[in] family Family in which to create a new actor. The family must have no other actors in it. (See NvBlastAssetCreateFamily.)
[in] desc Actor descriptor (see NvBlastActorDesc).
[in] scratch User-supplied scratch memory of size NvBlastFamilyGetRequiredScratchForCreateFirstActor(asset) bytes, where 'asset' is the NvBlastAsset from which the family was created.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
pointer to new NvBlastActor if successful (the actor was successfully inserted into the family), or NULL if unsuccessful.

NvBlastActor* NvBlastFamilyDeserializeActor ( NvBlastFamily family,
const void *  buffer,
NvBlastLog  logFn 
)

Deserialize a single Actor from a buffer into the given family. The actor will be inserted if it is compatible with the current family state. That is, it must not share any chunks or internal IDs with the actors already present in the family.

Parameters:
[in] family Family in which to deserialize the actor.
[in] buffer User-supplied buffer containing the actor to deserialize.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the deserialized actor if successful, NULL otherwise.

uint32_t NvBlastFamilyGetActorCount ( const NvBlastFamily family,
NvBlastLog  logFn 
)

Retrieve the number of active actors associated with the given family.

Parameters:
[in] family The family.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of active actors in the family.

uint32_t NvBlastFamilyGetActors ( NvBlastActor **  actors,
uint32_t  actorsSize,
const NvBlastFamily family,
NvBlastLog  logFn 
)

Retrieve the active actors associated with the given family.

Parameters:
[out] actors User-supplied array to be filled with the returned actor pointers.
[out] actorsSize The size of the actors array. To receive all actor pointers, the size must be at least that given by NvBlastFamilyGetActorCount(family).
[in] family The family.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of actor pointers written to actors. This will not exceed actorsSize.

const NvBlastAsset* NvBlastFamilyGetAsset ( const NvBlastFamily family,
NvBlastLog  logFn 
)

Retrieve the asset of the given family.

Parameters:
[in] family The family.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
pointer to the asset associated with the family.

NvBlastID NvBlastFamilyGetAssetID ( const NvBlastFamily family,
NvBlastLog  logFn 
)

Retrieve the asset ID of the given family.

Parameters:
[in] family The family.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the ID of the asset associated with the family.

NvBlastActor* NvBlastFamilyGetChunkActor ( const NvBlastFamily family,
uint32_t  chunkIndex,
NvBlastLog  logFn 
)

Retrieve the actor associated with the given chunk.

Parameters:
[in] family The family.
[in] chunkIndex The index of chunk.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
pointer to actor associated with given chunk. NULL if there is no such actor.

uint32_t NvBlastFamilyGetFormatVersion ( const NvBlastFamily family,
NvBlastLog  logFn 
)

Retrieve the data format version for the given family.

Parameters:
[in] family The family.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the family format version.

uint32_t NvBlastFamilyGetMaxActorCount ( const NvBlastFamily family,
NvBlastLog  logFn 
)

Retrieve the max active actor count family could have.

Parameters:
[in] family The family.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the max number of active actors family could have.

size_t NvBlastFamilyGetRequiredScratchForCreateFirstActor ( const NvBlastFamily family,
NvBlastLog  logFn 
)

Returns the number of bytes of scratch memory that the user must supply to NvBlastFamilyCreateFirstActor.

Parameters:
[in] family The family from which the first actor will be instanced.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of bytes of scratch memory required for a call to NvBlastFamilyCreateFirstActor.

uint32_t NvBlastFamilyGetSize ( const NvBlastFamily family,
NvBlastLog  logFn 
)

Retrieve the size (in bytes) of the given family.

Parameters:
[in] family The family.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the size of the family (in bytes).

void NvBlastFamilySetAsset ( NvBlastFamily family,
const NvBlastAsset asset,
NvBlastLog  logFn 
)

Set asset to the family. It should be the same asset as the one family was created from (same ID).

Parameters:
[in] family The family.
[in] asset Asset to instance.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.

size_t NvBlastGetAssetMemorySize ( const NvBlastAssetDesc desc,
NvBlastLog  logFn 
)

Calculates the memory requirements for an asset based upon its descriptor. Use this function when building an asset with NvBlastCreateAsset.

Parameters:
[in] desc Asset descriptor (see NvBlastAssetDesc).
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the memory size (in bytes) required for the asset, or zero if desc is invalid.

size_t NvBlastGetRequiredScratchForCreateAsset ( const NvBlastAssetDesc desc,
NvBlastLog  logFn 
)

Returns the number of bytes of scratch memory that the user must supply to NvBlastCreateAsset, based upon the descriptor that will be passed into that function.

Parameters:
[in] desc The asset descriptor that will be passed into NvBlastCreateAsset.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the number of bytes of scratch memory required for a call to NvBlastCreateAsset with that descriptor.

bool NvBlastReorderAssetDescChunks ( NvBlastChunkDesc chunkDescs,
uint32_t  chunkCount,
NvBlastBondDesc bondDescs,
uint32_t  bondCount,
uint32_t *  chunkReorderMap,
bool  keepBondNormalChunkOrder,
void *  scratch,
NvBlastLog  logFn 
)

Build and apply chunk reorder map.

Function basically calls NvBlastBuildAssetDescChunkReorderMap and NvBlastApplyAssetDescChunkReorderMap. Used for Convenience.

Parameters:
[in] chunkDescs Array of chunk descriptors of size chunkCount. It will be updated accordingly.
[in] chunkCount The number of chunk descriptors.
[in] bondDescs Array of bond descriptors of size chunkCount. It will be updated accordingly.
[in] bondCount The number of bond descriptors.
[in] chunkReorderMap Chunk reorder map to fill, must be of size chunkCount.
[in] keepBondNormalChunkOrder If true, bond normals will be flipped if their chunk index order was reveresed by the reorder map.
[in] scratch User-supplied scratch storage, must point to chunkCount * sizeof(NvBlastChunkDesc) valid bytes of memory.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
true iff the chunks did not require reordering (chunkReorderMap is the identity map).

double NvBlastTicksToSeconds ( int64_t  ticks  ) 

Convert a tick value from NvBlastTimers to seconds.

Parameters:
[in] ticks The tick value.
Returns:
the seconds correposnding to the input tick value.

void NvBlastTimersReset ( NvBlastTimers timers  ) 

Resets all values in the given NvBlastTimers struct to zero.

Parameters:
[in] timers The NvBlastTimers to set to zero.