diff options
Diffstat (limited to 'sdk/lowlevel')
| -rw-r--r-- | sdk/lowlevel/include/NvBlast.h | 2 | ||||
| -rw-r--r-- | sdk/lowlevel/include/NvBlastTypes.h | 33 | ||||
| -rw-r--r-- | sdk/lowlevel/source/NvBlastActor.cpp | 10 | ||||
| -rw-r--r-- | sdk/lowlevel/source/NvBlastActor.h | 2 |
4 files changed, 17 insertions, 30 deletions
diff --git a/sdk/lowlevel/include/NvBlast.h b/sdk/lowlevel/include/NvBlast.h index 0a4872f..bc01253 100644 --- a/sdk/lowlevel/include/NvBlast.h +++ b/sdk/lowlevel/include/NvBlast.h @@ -740,7 +740,7 @@ NVBLAST_API void NvBlastActorGenerateFracture NvBlastFractureBuffers* commandBuffers, const NvBlastActor* actor, const NvBlastDamageProgram program, - const NvBlastProgramParams* programParams, + const void* programParams, NvBlastLog logFn, NvBlastTimers* timers ); diff --git a/sdk/lowlevel/include/NvBlastTypes.h b/sdk/lowlevel/include/NvBlastTypes.h index 9fbeef9..91a3544 100644 --- a/sdk/lowlevel/include/NvBlastTypes.h +++ b/sdk/lowlevel/include/NvBlastTypes.h @@ -490,6 +490,9 @@ A single actor's representation used by NvBlastGraphShaderFunction. */ struct NvBlastGraphShaderActor { + uint32_t actorIndex; //!< Actor's index. + uint32_t graphNodeCount; //!< Actor's graph node count. + uint32_t assetNodeCount; //!< Asset node count. uint32_t firstGraphNodeIndex; //!< Entry index for graphNodeIndexLinks const uint32_t* graphNodeIndexLinks; //!< Linked index list of connected nodes. Traversable with nextIndex = graphNodeIndexLinks[currentIndex], terminates with 0xFFFFFFFF. const uint32_t* chunkIndices; //!< Graph's map from node index to support chunk index. @@ -500,27 +503,7 @@ struct NvBlastGraphShaderActor const NvBlastChunk* assetChunks; //!< NvBlastChunks geometry in the NvBlastAsset. const float* familyBondHealths; //!< Actual bond health values for broken bond detection. const float* supportChunkHealths; //!< Actual chunk health values for dead chunk detection. -}; - - -/** -Damage program params. - -Custom user params to be passed in shader functions. This structure hints recommended parameters layout, but it -doesn't required to be this way. - -The idea of this 'hint' is that damage parameters are basically 2 entities: material + damage description. -1. Material is something that describes an actor properties (e.g. mass, stiffness, fragility) which are not expected to be changed often. -2. Damage description is something that describes particular damage event (e.g. position, radius and force of explosion). - -Also this damage program hints that there could be more than one damage event happening and processed per one shader call (for efficiency reasons). -So different damage descriptions can be stacked and passed in one shader call (while material is kept the same obviously). -*/ -struct NvBlastProgramParams -{ - const void* damageDescBuffer; //!< array of damage descriptions - uint32_t damageDescCount; //!< number of damage descriptions in array - const void* material; //!< pointer to material + const uint32_t* nodeActorIndices; //!< Family's map from node index to actor index. }; @@ -544,7 +527,7 @@ creates a list of NvBlastFractureCommand to be applied to the respective NvBlast Typically requires an array of size (number of support chunks) + (number of bonds) of the processed asset but may depend on the actual implementation. \param[in] actor The actor representation used for creating commands. -\param[in] params A set of parameters defined by the damage shader implementer. +\param[in] programParams A set of parameters defined by the damage shader implementer. Interpretation of NvBlastFractureBuffers: As input: @@ -559,7 +542,7 @@ Health values denote how much damage is to be applied. @see NvBlastFractureBuffers NvBlastGraphShaderActor */ -typedef void(*NvBlastGraphShaderFunction)(NvBlastFractureBuffers* commandBuffers, const NvBlastGraphShaderActor* actor, const NvBlastProgramParams* params); +typedef void(*NvBlastGraphShaderFunction)(NvBlastFractureBuffers* commandBuffers, const NvBlastGraphShaderActor* actor, const void* programParams); /** @@ -572,7 +555,7 @@ creates a list of NvBlastFractureCommand to be applied to the respective NvBlast Typically requires an array of size (number of support chunks) + (number of bonds) of the processed asset but may depend on the actual implementation. \param[in] actor The actor representation used for creating commands. -\param[in] params A set of parameters defined by the damage shader implementer. +\param[in] programParams A set of parameters defined by the damage shader implementer. Interpretation of NvBlastFractureBuffers: As input: @@ -587,7 +570,7 @@ Health values denote how much damage is to be applied. @see NvBlastFractureBuffers NvBlastSubgraphShaderActor */ -typedef void(*NvBlastSubgraphShaderFunction)(NvBlastFractureBuffers* commandBuffers, const NvBlastSubgraphShaderActor* actor, const NvBlastProgramParams* params); +typedef void(*NvBlastSubgraphShaderFunction)(NvBlastFractureBuffers* commandBuffers, const NvBlastSubgraphShaderActor* actor, const void* programParams); /** diff --git a/sdk/lowlevel/source/NvBlastActor.cpp b/sdk/lowlevel/source/NvBlastActor.cpp index afed7bb..8c90d0f 100644 --- a/sdk/lowlevel/source/NvBlastActor.cpp +++ b/sdk/lowlevel/source/NvBlastActor.cpp @@ -187,7 +187,7 @@ uint32_t Actor::damageBond(const NvBlastBondFractureData& cmd) } -void Actor::generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBlastDamageProgram& program, const NvBlastProgramParams* programParams, +void Actor::generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBlastDamageProgram& program, const void* programParams, NvBlastLog logFn, NvBlastTimers* timers) const { NVBLASTLL_CHECK(commandBuffers != nullptr, logFn, "Actor::generateFracture: NULL commandBuffers pointer input.", return); @@ -214,6 +214,9 @@ void Actor::generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBla if (graphNodeCount > 1 && program.graphShaderFunction != nullptr) { const NvBlastGraphShaderActor shaderActor = { + getIndex(), + getGraphNodeCount(), + graph->m_nodeCount, getFirstGraphNodeIndex(), getGraphNodeIndexLinks(), graph->getChunkIndices(), @@ -223,7 +226,8 @@ void Actor::generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBla getBonds(), getChunks(), getBondHealths(), - getLowerSupportChunkHealths() + getLowerSupportChunkHealths(), + getFamilyHeader()->getFamilyGraph()->getIslandIds() }; program.graphShaderFunction(commandBuffers, &shaderActor, programParams); @@ -817,7 +821,7 @@ void NvBlastActorGenerateFracture NvBlastFractureBuffers* commandBuffers, const NvBlastActor* actor, const NvBlastDamageProgram program, - const NvBlastProgramParams* programParams, + const void* programParams, NvBlastLog logFn, NvBlastTimers* timers ) diff --git a/sdk/lowlevel/source/NvBlastActor.h b/sdk/lowlevel/source/NvBlastActor.h index 7e30660..8474e83 100644 --- a/sdk/lowlevel/source/NvBlastActor.h +++ b/sdk/lowlevel/source/NvBlastActor.h @@ -331,7 +331,7 @@ public: /** See NvBlastActorGenerateFracture */ - void generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBlastDamageProgram& program, const NvBlastProgramParams* programParams, NvBlastLog logFn, NvBlastTimers* timers) const; + void generateFracture(NvBlastFractureBuffers* commandBuffers, const NvBlastDamageProgram& program, const void* programParams, NvBlastLog logFn, NvBlastTimers* timers) const; /** Damage bond between two chunks by health amount (instance graph also will be notified in case bond is broken after). |