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/extensions/authoring/source/NvBlastExtAuthoringBondGeneratorImpl.cpp | |
| parent | Fixing chunk hierarchy optimization/merge bugs (diff) | |
| download | blast-dev.tar.xz blast-dev.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/extensions/authoring/source/NvBlastExtAuthoringBondGeneratorImpl.cpp')
| -rwxr-xr-x | sdk/extensions/authoring/source/NvBlastExtAuthoringBondGeneratorImpl.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sdk/extensions/authoring/source/NvBlastExtAuthoringBondGeneratorImpl.cpp b/sdk/extensions/authoring/source/NvBlastExtAuthoringBondGeneratorImpl.cpp index bda11e9..1fc61c2 100755 --- a/sdk/extensions/authoring/source/NvBlastExtAuthoringBondGeneratorImpl.cpp +++ b/sdk/extensions/authoring/source/NvBlastExtAuthoringBondGeneratorImpl.cpp @@ -1091,15 +1091,15 @@ int32_t BlastBondGeneratorImpl::buildDescFromInternalFracture(FractureTool* tool }
- bool hasCreatedByIslands = false;
+ bool hasApproximateBonding = false;
for (uint32_t i = 1; i < chunkCount; ++i)
{
NvBlastChunkDesc& desc = resultChunkDescriptors[i];
- desc.userData = i;
+ desc.userData = tool->getChunkId(i);
desc.parentChunkIndex = tool->getChunkIndex(tool->getChunkInfo(i).parent);
desc.flags = NvBlastChunkDesc::NoFlags;
- hasCreatedByIslands |= (tool->getChunkInfo(i).flags & ChunkInfo::CREATED_BY_ISLAND_DETECTOR);
+ hasApproximateBonding |= !!(tool->getChunkInfo(i).flags & ChunkInfo::APPROXIMATE_BONDING);
if (chunkIsSupport[i])
{
desc.flags = NvBlastChunkDesc::SupportFlag;
@@ -1246,7 +1246,7 @@ int32_t BlastBondGeneratorImpl::buildDescFromInternalFracture(FractureTool* tool }
}
- if (hasCreatedByIslands)
+ if (hasApproximateBonding)
{
std::vector<Triangle> chunkTriangles;
std::vector<uint32_t> chunkTrianglesOffsets;
@@ -1262,6 +1262,7 @@ int32_t BlastBondGeneratorImpl::buildDescFromInternalFracture(FractureTool* tool pairsAlreadyCreated.insert(pr);
}
+ const float EXPANSION = 0.01f;
chunkTrianglesOffsets.push_back(0);
for (uint32_t i = 0; i < chunkCount; ++i)
@@ -1273,18 +1274,19 @@ int32_t BlastBondGeneratorImpl::buildDescFromInternalFracture(FractureTool* tool {
chunkTriangles.push_back(trianglesBuffer[i].get()[k]);
- chunkTriangles.back().a.p =
- (chunkTriangles.back().a.p - centroid) * SCALE_FACTOR + centroid; // inflate mesh a bit to find
- }
+ // inflate mesh a bit
+ chunkTriangles.back().a.p = chunkTriangles.back().a.p + (chunkTriangles.back().a.p - centroid) * EXPANSION;
+ chunkTriangles.back().b.p = chunkTriangles.back().b.p + (chunkTriangles.back().b.p - centroid) * EXPANSION;
+ chunkTriangles.back().c.p = chunkTriangles.back().c.p + (chunkTriangles.back().c.p - centroid) * EXPANSION;
+ }
chunkTrianglesOffsets.push_back(chunkTriangles.size());
}
NvBlastBondDesc* adsc;
-
BondGenerationConfig cfg;
cfg.bondMode = BondGenerationConfig::AVERAGE;
- cfg.maxSeparation = 0.01f;
+ cfg.maxSeparation = EXPANSION;
uint32_t nbListSize =
createFullBondListAveraged(chunkCount, chunkTrianglesOffsets.data(), chunkTriangles.data(), nullptr,
|