diff options
| author | Bryan Galdrikian <[email protected]> | 2019-09-17 09:16:55 -0700 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2019-09-17 09:16:55 -0700 |
| commit | 9f4fc41dc5d857e3c7c3500fc71953e54d780a39 (patch) | |
| tree | 20a548f0eda0ff2f0510ef57f6d038e480dd8611 /sdk/lowlevel/source/NvBlastAsset.cpp | |
| parent | Fixing chunk hierarchy optimization/merge bugs (diff) | |
| download | blast-1.1.5_pre5.tar.xz blast-1.1.5_pre5.zip | |
* NvBlastAsset::testForValidChunkOrder (used when creating an NvBlastAsset) is now more strict, requiring parent chunk descriptors to come before their children. It is still less strict than the order created by NvBlastBuildAssetDescChunkReorderMap.v1.1.5_releasev1.1.5_rc1v1.1.5_pre5dev
* Added FractureTool::setApproximateBonding function. Signals the tool to create bonds by proximity instead of just using cut plane data.
* Chunks which have been merged using the uniteChunks function may be merged again
* Restored chunk volume calculation
* NvBlastBuildAssetDescChunkReorderMap failure cases fixed.
Diffstat (limited to 'sdk/lowlevel/source/NvBlastAsset.cpp')
| -rwxr-xr-x | sdk/lowlevel/source/NvBlastAsset.cpp | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/sdk/lowlevel/source/NvBlastAsset.cpp b/sdk/lowlevel/source/NvBlastAsset.cpp index c82fa29..553599d 100755 --- a/sdk/lowlevel/source/NvBlastAsset.cpp +++ b/sdk/lowlevel/source/NvBlastAsset.cpp @@ -777,42 +777,48 @@ bool Asset::ensureExactSupportCoverage(uint32_t& supportChunkCount, uint32_t& le bool Asset::testForValidChunkOrder(uint32_t chunkCount, const NvBlastChunkDesc* chunkDescs, const char* chunkAnnotation, void* scratch)
{
- char* chunkMarks = static_cast<char*>(memset(scratch, 0, chunkCount));
-
- uint32_t currentParentChunkIndex = invalidIndex<uint32_t>();
- for (uint32_t i = 0; i < chunkCount; ++i)
- {
- const uint32_t parentChunkIndex = chunkDescs[i].parentChunkIndex;
- if (parentChunkIndex != currentParentChunkIndex)
- {
- if (!isInvalidIndex(currentParentChunkIndex))
- {
- chunkMarks[currentParentChunkIndex] = 1;
- }
- currentParentChunkIndex = parentChunkIndex;
- if (isInvalidIndex(currentParentChunkIndex))
- {
- return false;
- }
- else if (chunkMarks[currentParentChunkIndex] != 0)
- {
- return false;
- }
- }
-
- if (i < chunkCount - 1)
- {
- const bool upperSupport0 = (chunkAnnotation[i] & ChunkAnnotation::UpperSupport) != 0;
- const bool upperSupport1 = (chunkAnnotation[i + 1] & ChunkAnnotation::UpperSupport) != 0;
-
- if (!upperSupport0 && upperSupport1)
- {
- return false;
- }
- }
- }
-
- return true;
+ char* chunkMarks = static_cast<char*>(memset(scratch, 0, chunkCount));
+
+ uint32_t currentParentChunkIndex = invalidIndex<uint32_t>();
+ for (uint32_t i = 0; i < chunkCount; ++i)
+ {
+ const uint32_t parentChunkIndex = chunkDescs[i].parentChunkIndex;
+
+ if (!isInvalidIndex(parentChunkIndex) && parentChunkIndex >= i) // 'chunks should come after their parents'
+ {
+ return false;
+ }
+
+ if (parentChunkIndex != currentParentChunkIndex)
+ {
+ if (!isInvalidIndex(currentParentChunkIndex))
+ {
+ chunkMarks[currentParentChunkIndex] = 1;
+ }
+ currentParentChunkIndex = parentChunkIndex;
+ if (isInvalidIndex(currentParentChunkIndex)) // 'root chunks should go first'
+ {
+ return false;
+ }
+ else if (chunkMarks[currentParentChunkIndex] != 0) // 'all chunks with same parent index should go in a row'
+ {
+ return false;
+ }
+ }
+
+ if (i < chunkCount - 1)
+ {
+ const bool upperSupport0 = (chunkAnnotation[i] & ChunkAnnotation::UpperSupport) != 0;
+ const bool upperSupport1 = (chunkAnnotation[i + 1] & ChunkAnnotation::UpperSupport) != 0;
+
+ if (!upperSupport0 && upperSupport1) // 'upper-support chunks should come before subsupport chunks'
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
}
} // namespace Blast
|