sdk/lowlevel/include/NvBlast.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
00027 
00028 
00029 #ifndef NVBLAST_H
00030 #define NVBLAST_H
00031 
00032 
00033 #include "NvBlastTypes.h"
00034 
00035 
00037 //  NvBlastAsset functions
00040 
00050 NVBLAST_API size_t NvBlastGetAssetMemorySize(const NvBlastAssetDesc* desc, NvBlastLog logFn);
00051 
00052 
00062 NVBLAST_API size_t NvBlastGetRequiredScratchForCreateAsset(const NvBlastAssetDesc* desc, NvBlastLog logFn);
00063 
00064 
00089 NVBLAST_API NvBlastAsset* NvBlastCreateAsset(void* mem, const NvBlastAssetDesc* desc, void* scratch, NvBlastLog logFn);
00090 
00091 
00101 NVBLAST_API size_t NvBlastAssetGetFamilyMemorySize(const NvBlastAsset* asset, NvBlastLog logFn);
00102 
00103 
00116 NVBLAST_API NvBlastFamily* NvBlastAssetCreateFamily(void* mem, const NvBlastAsset* asset, NvBlastLog logFn);
00117 
00118 
00127 NVBLAST_API NvBlastID NvBlastAssetGetID(const NvBlastAsset* asset, NvBlastLog logFn);
00128 
00129 
00139 NVBLAST_API bool NvBlastAssetSetID(NvBlastAsset* asset, const NvBlastID* id, NvBlastLog logFn);
00140 
00141 
00150 NVBLAST_API uint32_t NvBlastAssetGetFormatVersion(const NvBlastAsset* asset, NvBlastLog logFn);
00151 
00152 
00161 NVBLAST_API uint32_t NvBlastAssetGetSize(const NvBlastAsset* asset, NvBlastLog logFn);
00162 
00163 
00172 NVBLAST_API uint32_t NvBlastAssetGetChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
00173 
00174 
00187 NVBLAST_API uint32_t NvBlastAssetGetSupportChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
00188 
00189 
00198 NVBLAST_API uint32_t NvBlastAssetGetLeafChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
00199 
00200 
00211 NVBLAST_API uint32_t NvBlastAssetGetFirstSubsupportChunkIndex(const NvBlastAsset* asset, NvBlastLog logFn);
00212 
00213 
00222 NVBLAST_API uint32_t NvBlastAssetGetBondCount(const NvBlastAsset* asset, NvBlastLog logFn);
00223 
00224 
00233 NVBLAST_API const NvBlastSupportGraph NvBlastAssetGetSupportGraph(const NvBlastAsset* asset, NvBlastLog logFn);
00234 
00235 
00246 NVBLAST_API const uint32_t* NvBlastAssetGetChunkToGraphNodeMap(const NvBlastAsset* asset, NvBlastLog logFn);
00247 
00248 
00257 NVBLAST_API const NvBlastChunk* NvBlastAssetGetChunks(const NvBlastAsset* asset, NvBlastLog logFn);
00258 
00259 
00268 NVBLAST_API const NvBlastBond* NvBlastAssetGetBonds(const NvBlastAsset* asset, NvBlastLog logFn);
00269 
00270 
00281 NVBLAST_API uint32_t NvBlastAssetGetActorSerializationSizeUpperBound(const NvBlastAsset* asset, NvBlastLog logFn);
00282 
00284 
00285 
00287 //  NvBlastAsset helper functions
00290 
00307 NVBLAST_API bool NvBlastEnsureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
00308 
00309 
00333 NVBLAST_API bool NvBlastBuildAssetDescChunkReorderMap(uint32_t* chunkReorderMap, const NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
00334 
00335 
00353 NVBLAST_API void NvBlastApplyAssetDescChunkReorderMap
00354 (
00355     NvBlastChunkDesc* reorderedChunkDescs,
00356     const NvBlastChunkDesc* chunkDescs,
00357     uint32_t chunkCount,
00358     NvBlastBondDesc* bondDescs,
00359     uint32_t bondCount,
00360     const uint32_t* chunkReorderMap,
00361     bool keepBondNormalChunkOrder,
00362     NvBlastLog logFn
00363 );
00364 
00365 
00385 NVBLAST_API void NvBlastApplyAssetDescChunkReorderMapInPlace
00386 (
00387     NvBlastChunkDesc* chunkDescs,
00388     uint32_t chunkCount,
00389     NvBlastBondDesc* bondDescs,
00390     uint32_t bondCount,
00391     const uint32_t* chunkReorderMap,
00392     bool keepBondNormalChunkOrder,
00393     void* scratch,
00394     NvBlastLog logFn
00395 );
00396 
00397 
00414 NVBLAST_API bool NvBlastReorderAssetDescChunks
00415 (
00416     NvBlastChunkDesc* chunkDescs,
00417     uint32_t chunkCount,
00418     NvBlastBondDesc* bondDescs,
00419     uint32_t bondCount,
00420     uint32_t* chunkReorderMap,
00421     bool keepBondNormalChunkOrder,
00422     void* scratch,
00423     NvBlastLog logFn
00424 );
00425 
00427 
00428 
00430 //  NvBlastFamily functions
00433 
00442 NVBLAST_API uint32_t NvBlastFamilyGetFormatVersion(const NvBlastFamily* family, NvBlastLog logFn);
00443 
00444 
00453 NVBLAST_API const NvBlastAsset* NvBlastFamilyGetAsset(const NvBlastFamily* family, NvBlastLog logFn);
00454 
00455 
00463 NVBLAST_API void NvBlastFamilySetAsset(NvBlastFamily* family, const NvBlastAsset* asset, NvBlastLog logFn);
00464 
00465 
00474 NVBLAST_API uint32_t NvBlastFamilyGetSize(const NvBlastFamily* family, NvBlastLog logFn);
00475 
00476 
00485 NVBLAST_API NvBlastID NvBlastFamilyGetAssetID(const NvBlastFamily* family, NvBlastLog logFn);
00486 
00487 
00496 NVBLAST_API size_t NvBlastFamilyGetRequiredScratchForCreateFirstActor(const NvBlastFamily* family, NvBlastLog logFn);
00497 
00498 
00509 NVBLAST_API NvBlastActor* NvBlastFamilyCreateFirstActor(NvBlastFamily* family, const NvBlastActorDesc* desc, void* scratch, NvBlastLog logFn);
00510 
00511 
00520 NVBLAST_API uint32_t NvBlastFamilyGetActorCount(const NvBlastFamily* family, NvBlastLog logFn);
00521 
00522 
00534 NVBLAST_API NvBlastActor* NvBlastFamilyDeserializeActor(NvBlastFamily* family, const void* buffer, NvBlastLog logFn);
00535 
00536 
00547 NVBLAST_API uint32_t NvBlastFamilyGetActors(NvBlastActor** actors, uint32_t actorsSize, const NvBlastFamily* family, NvBlastLog logFn);
00548 
00549 
00559 NVBLAST_API NvBlastActor* NvBlastFamilyGetChunkActor(const NvBlastFamily* family, uint32_t chunkIndex, NvBlastLog logFn);
00560 
00561 
00570 NVBLAST_API uint32_t NvBlastFamilyGetMaxActorCount(const NvBlastFamily* family, NvBlastLog logFn);
00571 
00573 
00574 
00576 //  NvBlastActor accessor, serialization, and deactivation functions
00579 
00588 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkCount(const NvBlastActor* actor, NvBlastLog logFn);
00589 
00590 
00601 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkIndices(uint32_t* visibleChunkIndices, uint32_t visibleChunkIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
00602 
00603 
00612 NVBLAST_API uint32_t NvBlastActorGetGraphNodeCount(const NvBlastActor* actor, NvBlastLog logFn);
00613 
00614 
00625 NVBLAST_API uint32_t NvBlastActorGetGraphNodeIndices(uint32_t* graphNodeIndices, uint32_t graphNodeIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
00626 
00627 
00648 NVBLAST_API const float* NvBlastActorGetBondHealths(const NvBlastActor* actor, NvBlastLog logFn);
00649 
00650 
00660 NVBLAST_API uint32_t NvBlastActorGetSerializationSize(const NvBlastActor* actor, NvBlastLog logFn);
00661 
00662 
00673 NVBLAST_API uint32_t NvBlastActorSerialize(void* buffer, uint32_t bufferSize, const NvBlastActor* actor, NvBlastLog logFn);
00674 
00675 
00684 NVBLAST_API NvBlastFamily* NvBlastActorGetFamily(const NvBlastActor* actor, NvBlastLog logFn);
00685 
00686 
00695 NVBLAST_API uint32_t NvBlastActorGetIndex(const NvBlastActor* actor, NvBlastLog logFn);
00696 
00697 
00706 NVBLAST_API bool NvBlastActorDeactivate(NvBlastActor* actor, NvBlastLog logFn);
00707 
00709 
00710 
00712 //  NvBlastActor damage and fracturing functions
00715 
00738 NVBLAST_API void NvBlastActorGenerateFracture
00739 (
00740     NvBlastFractureBuffers* commandBuffers,
00741     const NvBlastActor* actor,
00742     const NvBlastDamageProgram program, 
00743     const void* programParams,
00744     NvBlastLog logFn, 
00745     NvBlastTimers* timers
00746 );
00747 
00748 
00779 NVBLAST_API void NvBlastActorApplyFracture
00780 (
00781     NvBlastFractureBuffers* eventBuffers,
00782     NvBlastActor* actor,
00783     const NvBlastFractureBuffers* commands,
00784     NvBlastLog logFn,
00785     NvBlastTimers* timers
00786 );
00787 
00788 
00802 NVBLAST_API uint32_t NvBlastActorSplit
00803 (
00804     NvBlastActorSplitEvent* result, 
00805     NvBlastActor* actor,
00806     uint32_t newActorsMaxCount,
00807     void* scratch,
00808     NvBlastLog logFn,
00809     NvBlastTimers* timers
00810 );
00811 
00812 
00822 NVBLAST_API size_t NvBlastActorGetRequiredScratchForSplit(const NvBlastActor* actor, NvBlastLog logFn);
00823 
00824 
00834 NVBLAST_API uint32_t NvBlastActorGetMaxActorCountForSplit(const NvBlastActor* actor, NvBlastLog logFn);
00835 
00836 
00845 NVBLAST_API bool NvBlastActorCanFracture(const NvBlastActor* actor, NvBlastLog logFn);
00846 
00847 
00857 NVBLAST_API bool NvBlastActorIsSplitRequired(const NvBlastActor* actor, NvBlastLog logFn);
00858 
00859 
00863 NVBLAST_API bool NvBlastActorIsBoundToWorld(const NvBlastActor* actor, NvBlastLog logFn);
00864 
00866 
00867 
00869 //  NvBlastTimers functions and helpers
00872 
00878 NVBLAST_API void NvBlastTimersReset(NvBlastTimers* timers);
00879 
00880 
00888 NVBLAST_API double NvBlastTicksToSeconds(int64_t ticks);
00889 
00891 
00892 
00893 #endif // ifndef NVBLAST_H