sdk/lowlevel/include/NvBlast.h

Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2016-2017, NVIDIA CORPORATION.  All rights reserved.
00003 *
00004 * NVIDIA CORPORATION and its licensors retain all intellectual property
00005 * and proprietary rights in and to this software, related documentation
00006 * and any modifications thereto.  Any use, reproduction, disclosure or
00007 * distribution of this software and related documentation without an express
00008 * license agreement from NVIDIA CORPORATION is strictly prohibited.
00009 */
00010 
00011 #ifndef NVBLAST_H
00012 #define NVBLAST_H
00013 
00014 
00015 #include "NvBlastTypes.h"
00016 
00017 
00019 //  NvBlastAsset functions
00022 
00032 NVBLAST_API size_t NvBlastGetAssetMemorySize(const NvBlastAssetDesc* desc, NvBlastLog logFn);
00033 
00034 
00044 NVBLAST_API size_t NvBlastGetRequiredScratchForCreateAsset(const NvBlastAssetDesc* desc, NvBlastLog logFn);
00045 
00046 
00071 NVBLAST_API NvBlastAsset* NvBlastCreateAsset(void* mem, const NvBlastAssetDesc* desc, void* scratch, NvBlastLog logFn);
00072 
00073 
00083 NVBLAST_API size_t NvBlastAssetGetFamilyMemorySize(const NvBlastAsset* asset, NvBlastLog logFn);
00084 
00085 
00098 NVBLAST_API NvBlastFamily* NvBlastAssetCreateFamily(void* mem, const NvBlastAsset* asset, NvBlastLog logFn);
00099 
00100 
00109 NVBLAST_API NvBlastID NvBlastAssetGetID(const NvBlastAsset* asset, NvBlastLog logFn);
00110 
00111 
00121 NVBLAST_API bool NvBlastAssetSetID(NvBlastAsset* asset, const NvBlastID* id, NvBlastLog logFn);
00122 
00123 
00132 NVBLAST_API uint32_t NvBlastAssetGetFormatVersion(const NvBlastAsset* asset, NvBlastLog logFn);
00133 
00134 
00143 NVBLAST_API uint32_t NvBlastAssetGetSize(const NvBlastAsset* asset, NvBlastLog logFn);
00144 
00145 
00154 NVBLAST_API uint32_t NvBlastAssetGetChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
00155 
00156 
00165 NVBLAST_API uint32_t NvBlastAssetGetLeafChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
00166 
00167 
00178 NVBLAST_API uint32_t NvBlastAssetGetFirstSubsupportChunkIndex(const NvBlastAsset* asset, NvBlastLog logFn);
00179 
00180 
00189 NVBLAST_API uint32_t NvBlastAssetGetBondCount(const NvBlastAsset* asset, NvBlastLog logFn);
00190 
00191 
00200 NVBLAST_API const NvBlastSupportGraph NvBlastAssetGetSupportGraph(const NvBlastAsset* asset, NvBlastLog logFn);
00201 
00202 
00213 NVBLAST_API const uint32_t* NvBlastAssetGetChunkToGraphNodeMap(const NvBlastAsset* asset, NvBlastLog logFn);
00214 
00215 
00224 NVBLAST_API const NvBlastChunk* NvBlastAssetGetChunks(const NvBlastAsset* asset, NvBlastLog logFn);
00225 
00226 
00235 NVBLAST_API const NvBlastBond* NvBlastAssetGetBonds(const NvBlastAsset* asset, NvBlastLog logFn);
00236 
00237 
00248 NVBLAST_API uint32_t NvBlastAssetGetActorSerializationSizeUpperBound(const NvBlastAsset* asset, NvBlastLog logFn);
00249 
00251 
00252 
00254 //  NvBlastAsset helper functions
00257 
00274 NVBLAST_API bool NvBlastEnsureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
00275 
00276 
00300 NVBLAST_API bool NvBlastBuildAssetDescChunkReorderMap(uint32_t* chunkReorderMap, const NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
00301 
00302 
00319 NVBLAST_API void NvBlastApplyAssetDescChunkReorderMap
00320 (
00321     NvBlastChunkDesc* reorderedChunkDescs,
00322     const NvBlastChunkDesc* chunkDescs,
00323     uint32_t chunkCount,
00324     NvBlastBondDesc* bondDescs,
00325     uint32_t bondCount,
00326     const uint32_t* chunkReorderMap,
00327     NvBlastLog logFn
00328 );
00329 
00330 
00349 NVBLAST_API void NvBlastApplyAssetDescChunkReorderMapInplace(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, NvBlastBondDesc* bondDescs, uint32_t bondCount, const uint32_t* chunkReorderMap, void* scratch, NvBlastLog logFn);
00350 
00351 
00367 NVBLAST_API bool NvBlastReorderAssetDescChunks(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, NvBlastBondDesc* bondDescs, uint32_t bondCount, uint32_t* chunkReorderMap, void* scratch, NvBlastLog logFn);
00368 
00370 
00371 
00373 //  NvBlastFamily functions
00376 
00385 NVBLAST_API uint32_t NvBlastFamilyGetFormatVersion(const NvBlastFamily* family, NvBlastLog logFn);
00386 
00387 
00395 NVBLAST_API void NvBlastFamilySetAsset(NvBlastFamily* family, const NvBlastAsset* asset, NvBlastLog logFn);
00396 
00397 
00406 NVBLAST_API uint32_t NvBlastFamilyGetSize(const NvBlastFamily* family, NvBlastLog logFn);
00407 
00408 
00417 NVBLAST_API NvBlastID NvBlastFamilyGetAssetID(const NvBlastFamily* family, NvBlastLog logFn);
00418 
00419 
00428 NVBLAST_API size_t NvBlastFamilyGetRequiredScratchForCreateFirstActor(const NvBlastFamily* family, NvBlastLog logFn);
00429 
00430 
00441 NVBLAST_API NvBlastActor* NvBlastFamilyCreateFirstActor(NvBlastFamily* family, const NvBlastActorDesc* desc, void* scratch, NvBlastLog logFn);
00442 
00443 
00452 NVBLAST_API uint32_t NvBlastFamilyGetActorCount(const NvBlastFamily* family, NvBlastLog logFn);
00453 
00454 
00466 NVBLAST_API NvBlastActor* NvBlastFamilyDeserializeActor(NvBlastFamily* family, const void* buffer, NvBlastLog logFn);
00467 
00468 
00479 NVBLAST_API uint32_t NvBlastFamilyGetActors(NvBlastActor** actors, uint32_t actorsSize, const NvBlastFamily* family, NvBlastLog logFn);
00480 
00481 
00491 NVBLAST_API NvBlastActor* NvBlastFamilyGetChunkActor(const NvBlastFamily* family, uint32_t chunkIndex, NvBlastLog logFn);
00492 
00493 
00502 NVBLAST_API uint32_t NvBlastFamilyGetMaxActorCount(const NvBlastFamily* family, NvBlastLog logFn);
00503 
00505 
00506 
00508 //  NvBlastActor accessor, serialization, and deactivation functions
00511 
00520 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkCount(const NvBlastActor* actor, NvBlastLog logFn);
00521 
00522 
00533 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkIndices(uint32_t* visibleChunkIndices, uint32_t visibleChunkIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
00534 
00535 
00544 NVBLAST_API uint32_t NvBlastActorGetGraphNodeCount(const NvBlastActor* actor, NvBlastLog logFn);
00545 
00546 
00557 NVBLAST_API uint32_t NvBlastActorGetGraphNodeIndices(uint32_t* graphNodeIndices, uint32_t graphNodeIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
00558 
00559 
00580 NVBLAST_API const float* NvBlastActorGetBondHealths(const NvBlastActor* actor, NvBlastLog logFn);
00581 
00582 
00592 NVBLAST_API uint32_t NvBlastActorGetSerializationSize(const NvBlastActor* actor, NvBlastLog logFn);
00593 
00594 
00605 NVBLAST_API uint32_t NvBlastActorSerialize(void* buffer, uint32_t bufferSize, const NvBlastActor* actor, NvBlastLog logFn);
00606 
00607 
00616 NVBLAST_API NvBlastFamily* NvBlastActorGetFamily(const NvBlastActor* actor, NvBlastLog logFn);
00617 
00618 
00627 NVBLAST_API uint32_t NvBlastActorGetIndex(const NvBlastActor* actor, NvBlastLog logFn);
00628 
00629 
00638 NVBLAST_API bool NvBlastActorDeactivate(NvBlastActor* actor, NvBlastLog logFn);
00639 
00641 
00642 
00644 //  NvBlastActor damage and fracturing functions
00647 
00670 NVBLAST_API void NvBlastActorGenerateFracture
00671 (
00672     NvBlastFractureBuffers* commandBuffers,
00673     const NvBlastActor* actor,
00674     const NvBlastDamageProgram program, 
00675     const NvBlastProgramParams* programParams,
00676     NvBlastLog logFn, 
00677     NvBlastTimers* timers
00678 );
00679 
00680 
00711 NVBLAST_API void NvBlastActorApplyFracture
00712 (
00713     NvBlastFractureBuffers* eventBuffers,
00714     NvBlastActor* actor,
00715     const NvBlastFractureBuffers* commands,
00716     NvBlastLog logFn,
00717     NvBlastTimers* timers
00718 );
00719 
00720 
00734 NVBLAST_API uint32_t NvBlastActorSplit
00735 (
00736     NvBlastActorSplitEvent* result, 
00737     NvBlastActor* actor,
00738     uint32_t newActorsMaxCount,
00739     void* scratch,
00740     NvBlastLog logFn,
00741     NvBlastTimers* timers
00742 );
00743 
00744 
00754 NVBLAST_API size_t NvBlastActorGetRequiredScratchForSplit(const NvBlastActor* actor, NvBlastLog logFn);
00755 
00756 
00766 NVBLAST_API uint32_t NvBlastActorGetMaxActorCountForSplit(const NvBlastActor* actor, NvBlastLog logFn);
00767 
00768 
00777 NVBLAST_API bool NvBlastActorCanFracture(const NvBlastActor* actor, NvBlastLog logFn);
00778 
00780 
00781 
00783 //  NvBlastTimers functions and helpers
00786 
00792 NVBLAST_API void NvBlastTimersReset(NvBlastTimers* timers);
00793 
00794 
00802 NVBLAST_API double NvBlastTicksToSeconds(int64_t ticks);
00803 
00805 
00806 
00807 #endif // ifndef NVBLAST_H