Main Page Class List Class Members

# Nv::Blast::Actor Class Reference

`#include <NvBlastActor.h>`

Inheritance diagram for Nv::Blast::Actor:

List of all members.

## Classes
class | GraphNodeIt
class | VisibleChunkIt
## Public Member Functions
| Actor ()
void | applyFracture (NvBlastFractureBuffers *eventBuffers, const NvBlastFractureBuffers *commands, NvBlastLog logFn, NvBlastTimers *timers)
uint32_t | damageBond (const NvBlastBondFractureData &cmd)
void | damageBond (uint32_t nodeIndex0, uint32_t nodeIndex1, uint32_t bondIndex, float healthDamage)
uint32_t | damageBond (uint32_t nodeIndex0, uint32_t nodeIndex1, float healthDamage)
uint32_t | findIslands (void *scratch)
void | generateFracture (NvBlastFractureBuffers *commandBuffers, const NvBlastDamageProgram &program, const void *programParams, NvBlastLog logFn, NvBlastTimers *timers) const
const Asset * | getAsset () const
float * | getBondHealths () const
NvBlastBond * | getBonds () const
NvBlastChunk * | getChunks () const
FamilyGraph * | getFamilyGraph () const
FamilyHeader * | getFamilyHeader () const
uint32_t | getFirstGraphNodeIndex () const
uint32_t | getFirstSubsupportChunkIndex () const
uint32_t | getFirstVisibleChunkIndex () const
const SupportGraph * | getGraph () const
uint32_t | getGraphNodeCount () const
const uint32_t * | getGraphNodeIndexLinks () const
uint32_t | getIndex () const
uint32_t | getLeafChunkCount () const
float * | getLowerSupportChunkHealths () const
float * | getSubsupportChunkHealths () const
uint32_t | getVisibleChunkCount () const
bool | isActive () const
bool | isBoundToWorld () const
bool | isSingleSupportChunk () const
bool | isSplitRequired () const
bool | isSubSupportChunk () const
uint32_t | partition (Actor **newActors, uint32_t newActorsSize, NvBlastLog logFn)
uint32_t | partitionMultipleGraphNodes (Actor **newActors, uint32_t newActorsSize, NvBlastLog logFn)
uint32_t | partitionSingleLowerSupportChunk (Actor **newActors, uint32_t newActorsSize, NvBlastLog logFn)
bool | release ()
uint32_t | serializationRequiredStorage (NvBlastLog logFn) const
uint32_t | serialize (void *buffer, uint32_t bufferSize, NvBlastLog logFn) const
uint32_t | split (NvBlastActorSplitEvent *result, uint32_t newActorsMaxCount, void *scratch, NvBlastLog logFn, NvBlastTimers *timers)
size_t | splitRequiredScratch () const
void | updateVisibleChunksFromGraphNodes ()
## Static Public Member Functions
static Actor * | create (NvBlastFamily *family, const NvBlastActorDesc *desc, void *scratch, NvBlastLog logFn)
static size_t | createRequiredScratch (const NvBlastFamily *family)
static Actor * | deserialize (NvBlastFamily *family, const void *buffer, NvBlastLog logFn)
## Friends
struct | FamilyHeader
void | updateVisibleChunksFromSupportChunk (Actor *, IndexDLink< uint32_t > *, uint32_t *, uint32_t, uint32_t, const NvBlastChunk *, uint32_t)

## Detailed Description

Internal implementation of solver actor.

These objects are stored within the family in a single array. A pointer to a Actor class will be given to the user through the NvBlastActor opaque type.

## Constructor & Destructor Documentation

Nv::Blast::Actor::Actor | ( |  | ) | `[inline]`

## Member Function Documentation

void Nv::Blast::Actor::applyFracture | ( | NvBlastFractureBuffers * | eventBuffers,
|  | const NvBlastFractureBuffers * | commands,
|  | NvBlastLog | logFn,
|  | NvBlastTimers * | timers |
| ) |  |  |

See NvBlastActorApplyFracture

static Actor* Nv::Blast::Actor::create | ( | NvBlastFamily * | family,
|  | const NvBlastActorDesc * | desc,
|  | void * | scratch,
|  | NvBlastLog | logFn |
| ) |  |  | `[static]`

Create an actor from a descriptor (creates a family). This actor will represent an unfractured instance of the asset. The asset must be in a valid state, for example each chunk hierarchy in it must contain at least one support chunk (a single support chunk in a hierarchy corresponds to the root chunk). This will always be the case for assets created by NvBlastCreateAsset.

Parameters:

  `[in]` | family | Family in which to create a new actor. The family must be valid and have no other actors in it. (See createFamily.)
  `[in]` | desc | Actor initialization data, must be a valid pointer.
  `[in]` | scratch | User-supplied scratch memory of size createRequiredScratch(desc) bytes.
  `[in]` | logFn | User-supplied message function (see NvBlastLog definition). May be NULL.

Returns:
  the new actor if the input is valid (by the conditions described above), NULL otherwise.

static size_t Nv::Blast::Actor::createRequiredScratch | ( | const NvBlastFamily * | family | ) | `[static]`

Returns the size of the scratch space (in bytes) required to be passed into the create function, based upon the family that will be passed to the create function.

Parameters:

  `[in]` | family | The family being instanced.

Returns:
  the number of bytes required.

uint32_t Nv::Blast::Actor::damageBond | ( | const NvBlastBondFractureData & | cmd | ) |

TODO: document

void Nv::Blast::Actor::damageBond | ( | uint32_t | nodeIndex0,
|  | uint32_t | nodeIndex1,
|  | uint32_t | bondIndex,
|  | float | healthDamage |
| ) |  |  |

TODO: document

uint32_t Nv::Blast::Actor::damageBond | ( | uint32_t | nodeIndex0,
|  | uint32_t | nodeIndex1,
|  | float | healthDamage |
| ) |  |  |

Damage bond between two chunks by health amount (instance graph also will be notified in case bond is broken after).

static Actor* Nv::Blast::Actor::deserialize | ( | NvBlastFamily * | family,
|  | const void * | buffer,
|  | NvBlastLog | logFn |
| ) |  |  | `[static]`

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

Parameters:

  `[in]` | family | Family in which to deserialize the actor.
  `[in]` | buffer | Buffer containing the serialized actor data.
  `[in]` | logFn | User-supplied message function (see NvBlastLog definition). May be NULL.

Returns:
  the deserialized actor if successful, NULL otherwise.

uint32_t Nv::Blast::Actor::findIslands | ( | void * | scratch | ) |

Perform islands search. Bonds which are broken when their health values drop to zero (or below) may lead to new islands of chunks which need to be split into new actors. This function labels all nodes in the instance graph (see FamilyGraph) with a unique index per island that may be used as actor indices for new islands.

Parameters:

  `[in]` | scratch | User-supplied scratch memory of size splitRequiredScratch().

Returns:
  the number of new islands found.

void Nv::Blast::Actor::generateFracture | ( | NvBlastFractureBuffers * | commandBuffers,
|  | const NvBlastDamageProgram & | program,
|  | const void * | programParams,
|  | NvBlastLog | logFn,
|  | NvBlastTimers * | timers |
| ) |  |  | const

See NvBlastActorGenerateFracture

NV_INLINE const Asset * Nv::Blast::Actor::getAsset | ( |  | ) | const

Utility to get the asset this actor is associated with, through its family.

Returns:
  the asset associated with this actor.

NV_INLINE float * Nv::Blast::Actor::getBondHealths | ( |  | ) | const

Bond health for the interfaces between two chunks, of type float. Since the bond is shared by two chunks, the same bond health is used for chunk[i] -> chunk[j] as for chunk[j] -> chunk[i].

Returns:
  the array of healths associated with all bonds in the support graph.

NV_INLINE NvBlastBond * Nv::Blast::Actor::getBonds | ( |  | ) | const

Access to the bonds, of type NvBlastBond.

Returns:
  an array of size m_bondCount.

NV_INLINE NvBlastChunk * Nv::Blast::Actor::getChunks | ( |  | ) | const

Access to the chunks, of type NvBlastChunk.

Returns:
  an array of size m_chunkCount.

NV_INLINE FamilyGraph * Nv::Blast::Actor::getFamilyGraph | ( |  | ) | const

Access the instance graph for islands searching.

Return the dynamic data generated for the support graph. (See FamilyGraph.) This is used to store current connectivity information based upon bond and chunk healths, as well as cached intermediate data for faster incremental updates.

NV_INLINE FamilyHeader * Nv::Blast::Actor::getFamilyHeader | ( |  | ) | const

Find the family (see FamilyHeader) that this actor belongs to.

Returns:
  a pointer to the FamilyHeader for this actor.

NV_INLINE uint32_t Nv::Blast::Actor::getFirstGraphNodeIndex | ( |  | ) | const

Access to graph node linked list for this actor. The index returned is that of a link in the FamilyHeader's getGraphNodeIndexLinks().

Returns:
  the index of the head of the graph node linked list.

NV_INLINE uint32_t Nv::Blast::Actor::getFirstSubsupportChunkIndex | ( |  | ) | const

Access to the index of the first subsupport chunk.

Returns:
  the index of the first subsupport chunk.

NV_INLINE uint32_t Nv::Blast::Actor::getFirstVisibleChunkIndex | ( |  | ) | const

Access to visible chunk linked list for this actor. The index returned is that of a link in the FamilyHeader's getVisibleChunkIndexLinks().

Returns:
  the index of the head of the visible chunk linked list.

NV_INLINE const SupportGraph * Nv::Blast::Actor::getGraph | ( |  | ) | const

Access to the support graph.

Returns:
  the support graph associated with this actor.

NV_INLINE uint32_t Nv::Blast::Actor::getGraphNodeCount | ( |  | ) | const

The number of graph nodes, corresponding to support chunks, for this actor. See also getFirstGraphNodeIndex.

Returns:
  the number of graph nodes in the actor's graph node index list.

NV_INLINE const uint32_t * Nv::Blast::Actor::getGraphNodeIndexLinks | ( |  | ) | const

Graph node index links, of type uint32_t. The successor to index[i] is m_graphNodeIndexLinksOffset[i]. A value of invalidIndex<uint32_t>() indicates no successor.

getGraphNodeIndexLinks returns an array of size m_asset->m_graphNodeCount.

NV_INLINE uint32_t Nv::Blast::Actor::getIndex | ( |  | ) | const

Utility to calculate actor index.

Returns:
  the index of this actor in the FamilyHeader's getActors() array.

NV_INLINE uint32_t Nv::Blast::Actor::getLeafChunkCount | ( |  | ) | const

The number of leaf chunks for this actor.

Returns:
  number of leaf chunks for this actor.

NV_INLINE float * Nv::Blast::Actor::getLowerSupportChunkHealths | ( |  | ) | const

Access to the health for each support chunk and subsupport chunk, of type float.

Use getAsset()->getContiguousLowerSupportIndex() to map lower-support chunk indices into the range of indices valid for this array.

Returns:
  a float array of chunk healths.

NV_INLINE float * Nv::Blast::Actor::getSubsupportChunkHealths | ( |  | ) | const

Access to the start of the subsupport chunk health array.

Returns:
  the array of health values associated with all descendants of support chunks.

NV_INLINE uint32_t Nv::Blast::Actor::getVisibleChunkCount | ( |  | ) | const

The number of visible chunks. This is calculated from updateVisibleChunksFromGraphNodes(). See also getFirstVisibleChunkIndex.

Returns:
  the number of chunks in the actor's visible chunk index list.

NV_INLINE bool Nv::Blast::Actor::isActive | ( |  | ) | const

Since this object is not deleted (unless the family is deleted), we use m_familyOffset to determine if the actor is valid, or "active." When no actors in an instance return isActive(), it should be safe to delete the family.

Returns:
  true iff this actor is valid for use (active).

NV_INLINE bool Nv::Blast::Actor::isBoundToWorld | ( |  | ) | const

Returns:
  true iff this actor contains the "world" support graph node, created when a bond contains the invalidIndex<uint32_t>() value for one of their chunkIndices.

NV_INLINE bool Nv::Blast::Actor::isSingleSupportChunk | ( |  | ) | const

Whether or not this actor represents a single support chunk. If the actor contains a single support chunk, it can have no other chunks associated with it.

Returns:
  true iff this actor contains exactly one support chunk.

NV_INLINE bool Nv::Blast::Actor::isSplitRequired | ( |  | ) | const

Returns:
  true iff this actor was damaged and split() call is required.

NV_INLINE bool Nv::Blast::Actor::isSubSupportChunk | ( |  | ) | const

Whether or not this actor represents a subsupport chunk. If the actor contains a subsupport chunk, then it can have only that chunk.

Returns:
  true iff this actor contains a chunk which is a descendant of a support chunk.

NV_INLINE uint32_t Nv::Blast::Actor::partition | ( | Actor ** | newActors,
|  | uint32_t | newActorsSize,
|  | NvBlastLog | logFn |
| ) |  |  |

Partition this actor into smaller pieces.

If this actor represents a single support or subsupport chunk, then after this operation this actor will released if child chunks are created (see Return value), and its pointer no longer valid for use (unless it appears in the newActors list).

This function will not split a leaf chunk actor. In that case, the actor is not destroyed and this function returns 0.

Parameters:

  `[in]` | newActors | user-supplied array of actor pointers to hold the actors generated from this partitioning. This array must be of size equal to the number of leaf chunks in the asset, to guarantee that all actors are reported. (See AssetDataHeader::m_leafChunkCount.)
  `[in]` | newActorsSize | The size of the user-supplied newActors array.
  `[in]` | logFn | User-supplied message function (see NvBlastLog definition). May be NULL.

Returns:
  the number of new actors created. If greater than newActorsSize, some actors are not reported in the newActors array.

uint32_t Nv::Blast::Actor::partitionMultipleGraphNodes | ( | Actor ** | newActors,
|  | uint32_t | newActorsSize,
|  | NvBlastLog | logFn |
| ) |  |  |

Partition this actor into smaller pieces. Use this function if this actor contains more than one support chunk.

After this operation, if successful, this actor will released, and its pointer no longer valid for use (unless it appears in the newActors list).

Parameters:

  `[in]` | newActors | User-supplied array of actor pointers to hold the actors generated from this partitioning. Note: this actor will not be released, but will hold a subset of the graph nodes that it had before the function was called. This array must be of size equal to the number of graph nodes in the asset, to guarantee that all actors are reported.
  `[in]` | newActorsSize | The size of the user-supplied newActors array.
  `[in]` | logFn | User-supplied message function (see NvBlastLog definition). May be NULL.

Returns:
  the number of new actors created.

uint32_t Nv::Blast::Actor::partitionSingleLowerSupportChunk | ( | Actor ** | newActors,
|  | uint32_t | newActorsSize,
|  | NvBlastLog | logFn |
| ) |  |  |

Partition this actor into smaller pieces if it is a single lower-support chunk actor. Use this function on single support or sub-support chunks.

After this operation, if successful (child chunks created, see Return value), this actor will released, and its pointer no longer valid for use.

This function will not split a leaf chunk actor. In that case, the actor is not destroyed and this function returns 0.

Parameters:

  `[in]` | newActors | User-supplied array of actor pointers to hold the actors generated from this partitioning. Note: this actor will be released. This array must be of size equal to the lower-support chunk's child count, to guarantee that all actors are reported.
  `[in]` | newActorsSize | The size of the user-supplied newActors array.
  `[in]` | logFn | User-supplied message function (see NvBlastLog definition). May be NULL.

Returns:
  the number of new actors created.

NV_INLINE bool Nv::Blast::Actor::release | ( | void |  | ) |

Release this actor's association with a family, if any. This actor should be considered deleted after this function is called.

Returns:
  true if release was successful (actor was active).

uint32_t Nv::Blast::Actor::serializationRequiredStorage | ( | NvBlastLog | logFn | ) | const

Calculate the space required to serialize this actor.

Parameters:

  `[in]` | logFn | User-supplied message function (see NvBlastLog definition). May be NULL.

Returns:
  the required buffer size in bytes.

uint32_t Nv::Blast::Actor::serialize | ( | void * | buffer,
|  | uint32_t | bufferSize,
|  | NvBlastLog | logFn |
| ) |  |  | const

Serialize actor into single-actor 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. The buffer size must be less than 4GB. If NvBlastActorGetSerializationSize(actor) >= 4GB, this actor cannot be serialized with this method.
  `[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 Nv::Blast::Actor::split | ( | NvBlastActorSplitEvent * | result,
|  | uint32_t | newActorsMaxCount,
|  | void * | scratch,
|  | NvBlastLog | logFn,
|  | NvBlastTimers * | timers |
| ) |  |  |

See NvBlastActorSplit

size_t Nv::Blast::Actor::splitRequiredScratch | ( |  | ) | const

The scratch space required to call the findIslands function, or the split function, in bytes.

Returns:
  the number of bytes required.

void Nv::Blast::Actor::updateVisibleChunksFromGraphNodes | ( |  | ) |

Recalculate the visible chunk list for this actor based upon it graph node list (does not modify subsupport chunk actors)

## Friends And Related Function Documentation

friend struct FamilyHeader`[friend]`

void updateVisibleChunksFromSupportChunk | ( | Actor * | ,
|  | IndexDLink< uint32_t > * | ,
|  | uint32_t * | ,
|  | uint32_t | ,
|  | uint32_t | ,
|  | const NvBlastChunk * | ,
|  | uint32_t |  |
| ) |  |  | `[friend]`

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

- sdk/lowlevel/source/NvBlastActor.h