#include <ModuleDestructible.h>
Public Member Functions | |
virtual DestructibleActorJoint * | createDestructibleActorJoint (const DestructibleActorJointDesc &desc, Scene &scene)=0 |
virtual bool | isDestructibleActorJointActive (const DestructibleActorJoint *candidateJoint, Scene &apexScene) const =0 |
virtual void | setMaxDynamicChunkIslandCount (uint32_t maxCount)=0 |
virtual void | setMaxChunkCount (uint32_t maxCount)=0 |
virtual void | setSortByBenefit (bool sortByBenefit)=0 |
virtual void | setValidBoundsPadding (float pad)=0 |
virtual void | setMaxChunkDepthOffset (uint32_t maxChunkDepthOffset)=0 |
virtual void | setMaxChunkSeparationLOD (float separationLOD)=0 |
virtual void | setChunkReport (UserChunkReport *chunkReport)=0 |
virtual void | setImpactDamageReportCallback (UserImpactDamageReport *impactDamageReport)=0 |
virtual void | setChunkReportBitMask (uint32_t chunkReportBitMask)=0 |
virtual void | setDestructiblePhysXActorReport (UserDestructiblePhysXActorReport *destructiblePhysXActorReport)=0 |
virtual void | setChunkReportMaxFractureEventDepth (uint32_t chunkReportMaxFractureEventDepth)=0 |
virtual void | scheduleChunkStateEventCallback (DestructibleCallbackSchedule::Enum chunkStateEventCallbackSchedule)=0 |
virtual void | setChunkCrumbleReport (UserChunkParticleReport *chunkCrumbleReport)=0 |
virtual void | setChunkDustReport (UserChunkParticleReport *chunkDustReport)=0 |
virtual void | setWorldSupportPhysXScene (Scene &apexScene, PxScene *physxScene)=0 |
virtual bool | owns (const PxRigidActor *actor) const =0 |
virtual bool | isRuntimeFractureShape (const PxShape &shape) const =0 |
virtual DestructibleActor * | getDestructibleAndChunk (const PxShape *shape, int32_t *chunkIndex=NULL) const =0 |
virtual void | applyRadiusDamage (Scene &scene, float damage, float momentum, const PxVec3 &position, float radius, bool falloff)=0 |
virtual void | setMaxActorCreatesPerFrame (uint32_t maxActorsPerFrame)=0 |
virtual void | setMaxFracturesProcessedPerFrame (uint32_t maxFracturesProcessedPerFrame)=0 |
virtual bool | setSyncParams (UserDestructibleSyncHandler< DamageEventHeader > *userDamageEventHandler, UserDestructibleSyncHandler< FractureEventHeader > *userFractureEventHandler, UserDestructibleSyncHandler< ChunkTransformHeader > *userChunkMotionHandler)=0 |
virtual void | setUseLegacyChunkBoundsTesting (bool useLegacyChunkBoundsTesting)=0 |
virtual void | setUseLegacyDamageRadiusSpread (bool useLegacyDamageRadiusSpread)=0 |
virtual bool | setMassScaling (float massScale, float scaledMassExponent, Scene &apexScene)=0 |
virtual void | invalidateBounds (const PxBounds3 *bounds, uint32_t boundsCount, Scene &apexScene)=0 |
virtual void | setDamageApplicationRaycastFlags (nvidia::DestructibleActorRaycastFlags::Enum flags, Scene &apexScene)=0 |
virtual bool | setChunkCollisionHullCookingScale (const PxVec3 &scale)=0 |
virtual PxVec3 | getChunkCollisionHullCookingScale () const =0 |
virtual class FractureToolsAPI * | getFractureTools () const =0 |
Get reference to FractureTools object. | |
Protected Member Functions | |
virtual | ~ModuleDestructible () |
Descriptor used to create the Destructible APEX module.
virtual nvidia::apex::ModuleDestructible::~ModuleDestructible | ( | ) | [inline, protected, virtual] |
virtual void nvidia::apex::ModuleDestructible::applyRadiusDamage | ( | Scene & | scene, |
float | damage, | ||
float | momentum, | ||
const PxVec3 & | position, | ||
float | radius, | ||
bool | falloff | ||
) | [pure virtual] |
Applies damage to all DestructibleActors within the given radius in the apex scene. damage = the amount of damage at the damage point momentum = the magnitude of the impulse to transfer to each chunk position = the damage location radius = distance from damage location at which chunks will be affected falloff = whether or not to decrease damage with distance from the damage location. If true, damage will decrease linearly from the full damage (at zero distance) to zero damage (at radius). If false, full damage is applied to all chunks within the radius.
virtual DestructibleActorJoint* nvidia::apex::ModuleDestructible::createDestructibleActorJoint | ( | const DestructibleActorJointDesc & | desc, |
Scene & | scene | ||
) | [pure virtual] |
Object creation Create an DestructibleActorJoint from the descriptor. (See DestructibleActorJoint and DestructibleActorJointDesc.) This module will own the DestructibleActorJoint, so that any DestructibleAsset created by it will be released when this module is released. You may also call the DestructibleActorJoint's release() method, as long as the DestructibleActorJoint is still valid in the scene. (See isDestructibleActorJointActive())
virtual PxVec3 nvidia::apex::ModuleDestructible::getChunkCollisionHullCookingScale | ( | ) | const [pure virtual] |
Retrieves the cooking scale used for PhysX3 collision hulls, which can be set by setChunkCollisionHullCookingScale.
virtual DestructibleActor* nvidia::apex::ModuleDestructible::getDestructibleAndChunk | ( | const PxShape * | shape, |
int32_t * | chunkIndex = NULL |
||
) | const [pure virtual] |
PhysX SDK 3.X. Given an PxShape, returns the DestructibleActor and chunkIndex which belong to it, if the shape's PxActor is owned by the Destructible module (see the 'owns' function, above). Otherwise returns NULL. Useful when a scene query such as a raycast returns a shape.
virtual class FractureToolsAPI* nvidia::apex::ModuleDestructible::getFractureTools | ( | ) | const [pure virtual] |
Get reference to FractureTools object.
virtual void nvidia::apex::ModuleDestructible::invalidateBounds | ( | const PxBounds3 * | bounds, |
uint32_t | boundsCount, | ||
Scene & | apexScene | ||
) | [pure virtual] |
If a static PhysX actor is about to be removed, or has just been added, to the scene, then world support may change. Use this function to notify the destruction module that it may need to reconsider world support in the given volumes. This may be called multiple times, and the bounds list will accumulate. This list will be processed upon the next APEX simulate call, and cleared.
virtual bool nvidia::apex::ModuleDestructible::isDestructibleActorJointActive | ( | const DestructibleActorJoint * | candidateJoint, |
Scene & | apexScene | ||
) | const [pure virtual] |
Query the module on the validity of a created DestructibleActorJoint. A DestructibleActorJoint will no longer be valid when it is destroyed in the scene, in which case the module calls the DestructibleActorJoint's release(). Therefore, this DestructibleActorJoint should no longer be referenced if it is not valid.
virtual bool nvidia::apex::ModuleDestructible::isRuntimeFractureShape | ( | const PxShape & | shape | ) | const [pure virtual] |
PhysX SDK 3.X. Returns true iff the PxShape was created by the runtime fracture system.
virtual bool nvidia::apex::ModuleDestructible::owns | ( | const PxRigidActor * | actor | ) | const [pure virtual] |
PhysX SDK 3.X. Returns true iff the PxRigidActor was created by the Destructible module. If true, the user must NOT destroy the actor.
virtual void nvidia::apex::ModuleDestructible::scheduleChunkStateEventCallback | ( | DestructibleCallbackSchedule::Enum | chunkStateEventCallbackSchedule | ) | [pure virtual] |
Set whether or not the UserChunkReport::onStateChangeNotify interface will be used to deliver visibility change data to the user.
Default = DestructibleCallbackSchedule::Disabled.
virtual bool nvidia::apex::ModuleDestructible::setChunkCollisionHullCookingScale | ( | const PxVec3 & | scale | ) | [pure virtual] |
In PhysX 3.x, scaling of collision shapes can be done in the shape, not the cooked hull data. As a consequence, each collision hull only needs to be cooked once. By default, this hull is not scaled from the original data. But if the user desires, the hull can be scaled before cooking. That scale will be removed from the DestructibleActor's scale before being applied to the shape using the hull. So ideally, this user-set cooking scale does nothing. Numerically, however, it may have an effect, so we leave it as an option.
The input scale must be positive in all components. If not, the cooking scale will not be set, and the function returns false. Otherwise, the scale is set and the function returns true.
virtual void nvidia::apex::ModuleDestructible::setChunkCrumbleReport | ( | UserChunkParticleReport * | chunkCrumbleReport | ) | [pure virtual] |
Sets the user chunk crumble particle buffer callback. See UserChunkParticleReport. Set to NULL (the default) to disable. APEX does not take ownership of the report object.
virtual void nvidia::apex::ModuleDestructible::setChunkDustReport | ( | UserChunkParticleReport * | chunkDustReport | ) | [pure virtual] |
Sets the user chunk dust particle buffer callback. See UserChunkParticleReport. Set to NULL (the default) to disable. APEX does not take ownership of the report object.
Note - this is a placeholder API. The dust feature is disabled in 1.2.0.
virtual void nvidia::apex::ModuleDestructible::setChunkReport | ( | UserChunkReport * | chunkReport | ) | [pure virtual] |
General Sets the user chunk fracture/destroy callback. See UserChunkReport. Set to NULL (the default) to disable. APEX does not take ownership of the report object.
virtual void nvidia::apex::ModuleDestructible::setChunkReportBitMask | ( | uint32_t | chunkReportBitMask | ) | [pure virtual] |
Set a bit mask of flags (see ApexChunkFlag) for the fracture/destroy callback (See setChunkReport.) Fracture events with flags that overlap this mask will contribute to the DamageEventReportData.
virtual void nvidia::apex::ModuleDestructible::setChunkReportMaxFractureEventDepth | ( | uint32_t | chunkReportMaxFractureEventDepth | ) | [pure virtual] |
Set the maximum depth at which individual chunk fracture events will be reported in an DamageEventReportData's fractureEventList through the UserChunkReport. Fracture events deeper than this will still contribute to the DamageEventReportData's worldBounds and totalNumberOfFractureEvents.
virtual void nvidia::apex::ModuleDestructible::setDamageApplicationRaycastFlags | ( | nvidia::DestructibleActorRaycastFlags::Enum | flags, |
Scene & | apexScene | ||
) | [pure virtual] |
When applyDamage, or damage from impact, is processed, a rayCast call is used internally to find a more accurate damage position. This allows the user to specify the rayCast behavior. If no flags are set, no raycasting is done. Raycasting will be peformed against static or dynamic chunks, or both, depending on the value of flags. The flags are defined by DestructibleActorRaycastFlags::Enum.
The default flag used is DestructibleActorRaycastFlags::StaticChunks, since static-only raycasts are faster than ones that include dynamic chunks.
Note: only the flags DestructibleActorRaycastFlags::NoChunks, StaticChunks, and DynamicChunks are considered.
virtual void nvidia::apex::ModuleDestructible::setDestructiblePhysXActorReport | ( | UserDestructiblePhysXActorReport * | destructiblePhysXActorReport | ) | [pure virtual] |
Sets the user callback to receive PhysX actor create/release notifications for destruction-associated PhysX actors. Set to NULL (the default) to disable.
virtual void nvidia::apex::ModuleDestructible::setImpactDamageReportCallback | ( | UserImpactDamageReport * | impactDamageReport | ) | [pure virtual] |
Sets the user impact damage report callback. See UserImpactDamageReport. Set to NULL (the default) to disable. APEX does not take ownership of the report object.
virtual bool nvidia::apex::ModuleDestructible::setMassScaling | ( | float | massScale, |
float | scaledMassExponent, | ||
Scene & | apexScene | ||
) | [pure virtual] |
Sets mass scaling properties in a given apex scene.
massScale and scaledMassExponent are used for scaling dynamic chunk masses. The 'real' mass m of a chunk is calculated by the destructible actor's density multiplied by the total volume of the chunk's (scaled) collision shapes. The mass used in the simulation is massScale*pow(m/massScale,scaledMassExponent). Values less than 1 have the effect of reducing the ratio of different masses. The closer scaledMassExponent is to zero, the more the ratio will be 'flattened.' This helps PhysX converge when there is a very large number of interacting rigid bodies (such as a pile of destructible chunks).
massScale valid range: (0,infinity). Default = 1.0. scaledMassExponent valid range: [0,1]. Default = 0.5.
Returns true iff the parameters are valid and the apexScene is valid.
virtual void nvidia::apex::ModuleDestructible::setMaxActorCreatesPerFrame | ( | uint32_t | maxActorsPerFrame | ) | [pure virtual] |
Lets the user throttle the number of SDK actor creates per frame (per scene) due to destruction, as this can be quite costly. The default is 0xffffffff (unlimited).
virtual void nvidia::apex::ModuleDestructible::setMaxChunkCount | ( | uint32_t | maxCount | ) | [pure virtual] |
The maximum number of allowed visible chunks in the scene. If a fracturing event would cause more chunks to be created, then PxActors are released to make room for the created chunks. The priority for released PxActors is the same as described in setMaxDynamicChunkIslandCount.
virtual void nvidia::apex::ModuleDestructible::setMaxChunkDepthOffset | ( | uint32_t | maxChunkDepthOffset | ) | [pure virtual] |
Effectively eliminates the deeper level (smaller) chunks from DestructibleAssets (see DestructibleAsset). If maxChunkDepthOffset = 0, all chunks can be fractured. If maxChunkDepthOffset = 1, the depest level (smallest) chunks are eliminated, etc. This prevents too many chunks from being formed. In other words, the higher maxChunkDepthOffset, the lower the "level of detail."
virtual void nvidia::apex::ModuleDestructible::setMaxChunkSeparationLOD | ( | float | separationLOD | ) | [pure virtual] |
Every destructible asset defines a min and max lifetime, and maximum separation distance for its chunks. Chunk islands are destroyed after this time or separation from their origins. This parameter sets the lifetimes and max separations within their min-max ranges. The valid range is [0,1]. Default is 0.5.
virtual void nvidia::apex::ModuleDestructible::setMaxDynamicChunkIslandCount | ( | uint32_t | maxCount | ) | [pure virtual] |
LOD The maximum number of allowed PxActors which represent dynamic groups of chunks. If a fracturing event would cause more PxActors to be created, then some PxActors are released and the chunks they represent destroyed. The PxActors released to make room for others depends on the priority mode. If sorting by benefit (see setSortByBenefit), then chunks with the lowest LOD benefit are released first. Otherwise, oldest chunks are released first.
virtual void nvidia::apex::ModuleDestructible::setMaxFracturesProcessedPerFrame | ( | uint32_t | maxFracturesProcessedPerFrame | ) | [pure virtual] |
Lets the user throttle the number of fractures processed per frame (per scene) due to destruction, as this can be quite costly. The default is 0xffffffff (unlimited).
virtual void nvidia::apex::ModuleDestructible::setSortByBenefit | ( | bool | sortByBenefit | ) | [pure virtual] |
Instead of keeping the youngest PxActors, keep the greatest benefit PxActors if sortByBenefit is true. By default, this module does not sort by benefit. That is, oldest PxActors are released first.
virtual bool nvidia::apex::ModuleDestructible::setSyncParams | ( | UserDestructibleSyncHandler< DamageEventHeader > * | userDamageEventHandler, |
UserDestructibleSyncHandler< FractureEventHeader > * | userFractureEventHandler, | ||
UserDestructibleSyncHandler< ChunkTransformHeader > * | userChunkMotionHandler | ||
) | [pure virtual] |
Set the callback pointers from which APEX will use to return sync-able data.
virtual void nvidia::apex::ModuleDestructible::setUseLegacyChunkBoundsTesting | ( | bool | useLegacyChunkBoundsTesting | ) | [pure virtual] |
The following functions control the use of legacy behavior. By default, destruction damage application (either point or radius damage) now use the exact collision bounds of the chunk to determine damage application. Before, bounding spheres were used on "leaf" chunks (deepest in the fracture hierarchy) and only the bounding sphere center (effectively radius 0) was used on all chunks higher in the hierarchy. This led to inconsistent behavior when damaging destructibles at various levels of detail.
If true is passed into this function, the legacy behavior is restored.
virtual void nvidia::apex::ModuleDestructible::setUseLegacyDamageRadiusSpread | ( | bool | useLegacyDamageRadiusSpread | ) | [pure virtual] |
By default, the BehaviorGroup fields damageSpread.minimumRadius, damageSpread.radiusMultiplier, and damageSpread.falloffExponent are used for point and radius damage. Impact damage still uses damageToRadius, but this radius does not scale with the size of the destructible.
The old, deprecated behavior was to base damage spread upon the damageToRadius field of the BehaviorGroup used by the chunk. Specifically, damage would spread throughout a damage radius calculated as radius = damageToRadius * (damage / damageThreshold) * (size of destructible).
If true is passed into this function, the legacy behavior is restored.
virtual void nvidia::apex::ModuleDestructible::setValidBoundsPadding | ( | float | pad | ) | [pure virtual] |
Deprecated
virtual void nvidia::apex::ModuleDestructible::setWorldSupportPhysXScene | ( | Scene & | apexScene, |
PxScene * | physxScene | ||
) | [pure virtual] |
PhysX SDK 3.X. Allows the user to specify an alternative PhysX scene to use for world support calculations. If NULL (the default), the PhysX scene associated with the Scene will be used.