Skip to content

Commit e8c8deb

Browse files
Updating blast-sdk to 5.0.2
1 parent 8f6cf9c commit e8c8deb

File tree

4 files changed

+66
-57
lines changed

4 files changed

+66
-57
lines changed

blast/VERSION.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.1
1+
5.0.2

blast/docs/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [5.0.2] - 25-July-2023
4+
5+
### Bugfixes
6+
- Fixed slice fracturing bug which set the local chunk transform to the identity in some cases
7+
8+
39
## [5.0.1] - 22-June-2023
410

511
### Bugfixes

blast/include/extensions/authoring/NvBlastExtAuthoringFractureTool.h

+10-9
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ class FractureTool
398398
\param[in] chunkId Chunk to fracture
399399
\param[in] conf Slicing parameters, see SlicingConfiguration.
400400
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
401-
generated chunks will be at next depth level, source chunk will be parent for them. Case replaceChunk == true &&
402-
chunkId == 0 considered as wrong input parameters \param[in] rnd User supplied random number
403-
generator
401+
generated chunks will be at next depth level, source chunk will be parent for
402+
them. Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
403+
\param[in] rnd User supplied random number generator
404404
405405
\return If 0, fracturing is successful.
406406
*/
@@ -414,9 +414,9 @@ class FractureTool
414414
\param[in] position Point on plane
415415
\param[in] noise Noise configuration for plane-chunk intersection, see NoiseConfiguration.
416416
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
417-
generated chunks will be at next depth level, source chunk will be parent for them. Case replaceChunk == true &&
418-
chunkId == 0 considered as wrong input parameters \param[in] rnd User supplied random number
419-
generator
417+
generated chunks will be at next depth level, source chunk will be parent for
418+
them. Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
419+
\param[in] rnd User supplied random number generator
420420
421421
\return If 0, fracturing is successful.
422422
*/
@@ -428,9 +428,10 @@ class FractureTool
428428
\param[in] chunkId Chunk to fracture
429429
\param[in] conf Cutout parameters, see CutoutConfiguration.
430430
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
431-
generated chunks will be at next depth level, source chunk will be parent for them. Case replaceChunk == true &&
432-
chunkId == 0 considered as wrong input parameters \param[in] rnd User supplied random number
433-
generator
431+
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
432+
generated chunks will be at next depth level, source chunk will be parent for
433+
them. Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
434+
\param[in] rnd User supplied random number generator
434435
435436
\return If 0, fracturing is successful.
436437
*/

blast/source/sdk/extensions/authoring/NvBlastExtAuthoringFractureToolImpl.cpp

+49-47
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,8 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
851851
ch.isChanged = true;
852852
ch.flags = ChunkInfo::NO_FLAGS;
853853
ch.parentChunkId = replaceChunk ? mChunkData[chunkInfoIndex].parentChunkId : chunkId;
854-
std::vector<ChunkInfo> xSlicedChunks;
855-
std::vector<ChunkInfo> ySlicedChunks;
854+
std::vector<Mesh*> xSlicedChunks;
855+
std::vector<Mesh*> ySlicedChunks;
856856
std::vector<uint32_t> newlyCreatedChunksIds;
857857
/**
858858
Slice along x direction
@@ -865,12 +865,12 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
865865

866866
setCuttingBox(center, -lDir, slBox, 20, mPlaneIndexerOffset);
867867
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_INTERSECTION());
868-
setChunkInfoMesh(ch, bTool.createNewMesh());
869-
870-
if (ch.getMesh() != 0)
868+
Mesh* xSlice = bTool.createNewMesh();
869+
if (xSlice != nullptr)
871870
{
872-
xSlicedChunks.push_back(ch);
871+
xSlicedChunks.push_back(xSlice);
873872
}
873+
874874
inverseNormalAndIndices(slBox);
875875
++mPlaneIndexerOffset;
876876
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_DIFFERENCE());
@@ -883,34 +883,32 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
883883
}
884884
center.x += x_offset + (rnd->getRandomValue()) * conf.offset_variations * x_offset;
885885
}
886-
if (mesh != 0)
886+
if (mesh != nullptr)
887887
{
888-
setChunkInfoMesh(ch, mesh);
889-
xSlicedChunks.push_back(ch);
888+
xSlicedChunks.push_back(mesh);
890889
}
891890

892-
893891
for (uint32_t chunk = 0; chunk < xSlicedChunks.size(); ++chunk)
894892
{
895893
center = NvVec3(0, sourceBBox.minimum.y, 0);
896894
center.y += y_offset;
897895
dir = NvVec3(0, 1, 0);
898-
mesh = xSlicedChunks[chunk].getMesh();
896+
mesh = xSlicedChunks[chunk];
899897

900898
for (int32_t slice = 0; slice < y_slices; ++slice)
901899
{
902900
NvVec3 randVect =
903901
NvVec3(2 * rnd->getRandomValue() - 1, 2 * rnd->getRandomValue() - 1, 2 * rnd->getRandomValue() - 1);
904902
NvVec3 lDir = dir + randVect * conf.angle_variations;
905903

906-
907904
setCuttingBox(center, -lDir, slBox, 20, mPlaneIndexerOffset);
908905
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_INTERSECTION());
909-
setChunkInfoMesh(ch, bTool.createNewMesh());
910-
if (ch.getMesh() != 0)
906+
Mesh* ySlice = bTool.createNewMesh();
907+
if (ySlice != nullptr)
911908
{
912-
ySlicedChunks.push_back(ch);
909+
ySlicedChunks.push_back(ySlice);
913910
}
911+
914912
inverseNormalAndIndices(slBox);
915913
++mPlaneIndexerOffset;
916914
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_DIFFERENCE());
@@ -923,35 +921,36 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
923921
}
924922
center.y += y_offset + (rnd->getRandomValue()) * conf.offset_variations * y_offset;
925923
}
926-
if (mesh != 0)
924+
if (mesh != nullptr)
927925
{
928-
setChunkInfoMesh(ch, mesh);
929-
ySlicedChunks.push_back(ch);
926+
ySlicedChunks.push_back(mesh);
930927
}
931928
}
932929

933-
934930
for (uint32_t chunk = 0; chunk < ySlicedChunks.size(); ++chunk)
935931
{
936932
center = NvVec3(0, 0, sourceBBox.minimum.z);
937933
center.z += z_offset;
938934
dir = NvVec3(0, 0, 1);
939-
mesh = ySlicedChunks[chunk].getMesh();
935+
mesh = ySlicedChunks[chunk];
940936

941937
for (int32_t slice = 0; slice < z_slices; ++slice)
942938
{
943939
NvVec3 randVect =
944940
NvVec3(2 * rnd->getRandomValue() - 1, 2 * rnd->getRandomValue() - 1, 2 * rnd->getRandomValue() - 1);
945941
NvVec3 lDir = dir + randVect * conf.angle_variations;
942+
946943
setCuttingBox(center, -lDir, slBox, 20, mPlaneIndexerOffset);
947944
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_INTERSECTION());
948-
setChunkInfoMesh(ch, bTool.createNewMesh());
949-
if (ch.getMesh() != 0)
945+
Mesh* ySlice = bTool.createNewMesh();
946+
if (ySlice != nullptr)
950947
{
948+
setChunkInfoMesh(ch, ySlice);
951949
ch.chunkId = createId();
952950
newlyCreatedChunksIds.push_back(ch.chunkId);
953951
mChunkData.push_back(ch);
954952
}
953+
955954
inverseNormalAndIndices(slBox);
956955
++mPlaneIndexerOffset;
957956
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_DIFFERENCE());
@@ -964,16 +963,15 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
964963
}
965964
center.z += z_offset + (rnd->getRandomValue()) * conf.offset_variations * z_offset;
966965
}
967-
if (mesh != 0)
966+
if (mesh != nullptr)
968967
{
969-
ch.chunkId = createId();
970968
setChunkInfoMesh(ch, mesh);
971-
mChunkData.push_back(ch);
969+
ch.chunkId = createId();
972970
newlyCreatedChunksIds.push_back(ch.chunkId);
971+
mChunkData.push_back(ch);
973972
}
974973
}
975974

976-
977975
delete slBox;
978976

979977
mChunkData[chunkInfoIndex].isLeaf = false;
@@ -1047,8 +1045,8 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
10471045
ch.isChanged = true;
10481046
ch.flags = ChunkInfo::NO_FLAGS;
10491047
ch.parentChunkId = replaceChunk ? mChunkData[chunkInfoIndex].parentChunkId : chunkId;
1050-
std::vector<ChunkInfo> xSlicedChunks;
1051-
std::vector<ChunkInfo> ySlicedChunks;
1048+
std::vector<Mesh*> xSlicedChunks;
1049+
std::vector<Mesh*> ySlicedChunks;
10521050
std::vector<uint32_t> newlyCreatedChunksIds;
10531051
float noisyPartSize = 1.2f;
10541052
// int32_t acceleratorRes = 8;
@@ -1068,11 +1066,12 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
10681066
SweepingAccelerator accel(mesh);
10691067
SweepingAccelerator dummy(slBox);
10701068
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_DIFFERENCE());
1071-
setChunkInfoMesh(ch, bTool.createNewMesh());
1072-
if (ch.getMesh() != 0)
1069+
Mesh* xSlice = bTool.createNewMesh();
1070+
if (xSlice != nullptr)
10731071
{
1074-
xSlicedChunks.push_back(ch);
1072+
xSlicedChunks.push_back(xSlice);
10751073
}
1074+
10761075
inverseNormalAndIndices(slBox);
10771076
++mPlaneIndexerOffset;
10781077
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_INTERSECTION());
@@ -1086,19 +1085,19 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
10861085
}
10871086
center.x += x_offset + (rnd->getRandomValue()) * conf.offset_variations * x_offset;
10881087
}
1089-
if (mesh != 0)
1088+
if (mesh != nullptr)
10901089
{
1091-
setChunkInfoMesh(ch, mesh);
1092-
xSlicedChunks.push_back(ch);
1090+
xSlicedChunks.push_back(mesh);
10931091
}
1092+
10941093
slBox = getCuttingBox(center, dir, 20, 0, mInteriorMaterialId);
10951094
uint32_t slicedChunkSize = xSlicedChunks.size();
10961095
for (uint32_t chunk = 0; chunk < slicedChunkSize; ++chunk)
10971096
{
10981097
center = NvVec3(0, sourceBBox.minimum.y, 0);
10991098
center.y += y_offset;
11001099
dir = NvVec3(0, 1, 0);
1101-
mesh = xSlicedChunks[chunk].getMesh();
1100+
mesh = xSlicedChunks[chunk];
11021101

11031102
for (int32_t slice = 0; slice < y_slices; ++slice)
11041103
{
@@ -1114,11 +1113,12 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
11141113
SweepingAccelerator accel(mesh);
11151114
SweepingAccelerator dummy(slBox);
11161115
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_DIFFERENCE());
1117-
setChunkInfoMesh(ch, bTool.createNewMesh());
1118-
if (ch.getMesh() != 0)
1116+
Mesh* ySlice = bTool.createNewMesh();
1117+
if (ySlice != nullptr)
11191118
{
1120-
ySlicedChunks.push_back(ch);
1119+
ySlicedChunks.push_back(ySlice);
11211120
}
1121+
11221122
inverseNormalAndIndices(slBox);
11231123
++mPlaneIndexerOffset;
11241124
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_INTERSECTION());
@@ -1132,10 +1132,9 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
11321132
}
11331133
center.y += y_offset + (rnd->getRandomValue()) * conf.offset_variations * y_offset;
11341134
}
1135-
if (mesh != 0)
1135+
if (mesh != nullptr)
11361136
{
1137-
setChunkInfoMesh(ch, mesh);
1138-
ySlicedChunks.push_back(ch);
1137+
ySlicedChunks.push_back(mesh);
11391138
}
11401139
}
11411140

@@ -1144,7 +1143,7 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
11441143
center = NvVec3(0, 0, sourceBBox.minimum.z);
11451144
center.z += z_offset;
11461145
dir = NvVec3(0, 0, 1);
1147-
mesh = ySlicedChunks[chunk].getMesh();
1146+
mesh = ySlicedChunks[chunk];
11481147

11491148
for (int32_t slice = 0; slice < z_slices; ++slice)
11501149
{
@@ -1159,13 +1158,15 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
11591158
SweepingAccelerator accel(mesh);
11601159
SweepingAccelerator dummy(slBox);
11611160
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_DIFFERENCE());
1162-
setChunkInfoMesh(ch, bTool.createNewMesh());
1163-
if (ch.getMesh() != 0)
1161+
Mesh* ySlice = bTool.createNewMesh();
1162+
if (ySlice != nullptr)
11641163
{
1164+
setChunkInfoMesh(ch, ySlice);
11651165
ch.chunkId = createId();
11661166
mChunkData.push_back(ch);
11671167
newlyCreatedChunksIds.push_back(ch.chunkId);
11681168
}
1169+
11691170
inverseNormalAndIndices(slBox);
11701171
++mPlaneIndexerOffset;
11711172
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_INTERSECTION());
@@ -1179,12 +1180,12 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
11791180
}
11801181
center.z += z_offset + (rnd->getRandomValue()) * conf.offset_variations * z_offset;
11811182
}
1182-
if (mesh != 0)
1183+
if (mesh != nullptr)
11831184
{
1184-
ch.chunkId = createId();
11851185
setChunkInfoMesh(ch, mesh);
1186-
mChunkData.push_back(ch);
1186+
ch.chunkId = createId();
11871187
newlyCreatedChunksIds.push_back(ch.chunkId);
1188+
mChunkData.push_back(ch);
11881189
}
11891190
}
11901191

@@ -1206,6 +1207,7 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
12061207

12071208
return 0;
12081209
}
1210+
12091211
int32_t FractureToolImpl::cut(uint32_t chunkId, const NvcVec3& normal, const NvcVec3& point,
12101212
const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd)
12111213
{

0 commit comments

Comments
 (0)