Skip to content

Commit

Permalink
Updating blast-sdk to 5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nvidia-bgaldrikian committed Jul 25, 2023
1 parent 8f6cf9c commit e8c8deb
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 57 deletions.
2 changes: 1 addition & 1 deletion blast/VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.1
5.0.2
6 changes: 6 additions & 0 deletions blast/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [5.0.2] - 25-July-2023

### Bugfixes
- Fixed slice fracturing bug which set the local chunk transform to the identity in some cases


## [5.0.1] - 22-June-2023

### Bugfixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,9 @@ class FractureTool
\param[in] chunkId Chunk to fracture
\param[in] conf Slicing parameters, see SlicingConfiguration.
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
generated chunks will be at next depth level, source chunk will be parent for them. Case replaceChunk == true &&
chunkId == 0 considered as wrong input parameters \param[in] rnd User supplied random number
generator
generated chunks will be at next depth level, source chunk will be parent for
them. Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
\param[in] rnd User supplied random number generator
\return If 0, fracturing is successful.
*/
Expand All @@ -414,9 +414,9 @@ class FractureTool
\param[in] position Point on plane
\param[in] noise Noise configuration for plane-chunk intersection, see NoiseConfiguration.
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
generated chunks will be at next depth level, source chunk will be parent for them. Case replaceChunk == true &&
chunkId == 0 considered as wrong input parameters \param[in] rnd User supplied random number
generator
generated chunks will be at next depth level, source chunk will be parent for
them. Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
\param[in] rnd User supplied random number generator
\return If 0, fracturing is successful.
*/
Expand All @@ -428,9 +428,10 @@ class FractureTool
\param[in] chunkId Chunk to fracture
\param[in] conf Cutout parameters, see CutoutConfiguration.
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
generated chunks will be at next depth level, source chunk will be parent for them. Case replaceChunk == true &&
chunkId == 0 considered as wrong input parameters \param[in] rnd User supplied random number
generator
\param[in] replaceChunk if 'true', newly generated chunks will replace source chunk, if 'false', newly
generated chunks will be at next depth level, source chunk will be parent for
them. Case replaceChunk == true && chunkId == 0 considered as wrong input parameters
\param[in] rnd User supplied random number generator
\return If 0, fracturing is successful.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,8 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
ch.isChanged = true;
ch.flags = ChunkInfo::NO_FLAGS;
ch.parentChunkId = replaceChunk ? mChunkData[chunkInfoIndex].parentChunkId : chunkId;
std::vector<ChunkInfo> xSlicedChunks;
std::vector<ChunkInfo> ySlicedChunks;
std::vector<Mesh*> xSlicedChunks;
std::vector<Mesh*> ySlicedChunks;
std::vector<uint32_t> newlyCreatedChunksIds;
/**
Slice along x direction
Expand All @@ -865,12 +865,12 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&

setCuttingBox(center, -lDir, slBox, 20, mPlaneIndexerOffset);
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_INTERSECTION());
setChunkInfoMesh(ch, bTool.createNewMesh());

if (ch.getMesh() != 0)
Mesh* xSlice = bTool.createNewMesh();
if (xSlice != nullptr)
{
xSlicedChunks.push_back(ch);
xSlicedChunks.push_back(xSlice);
}

inverseNormalAndIndices(slBox);
++mPlaneIndexerOffset;
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_DIFFERENCE());
Expand All @@ -883,34 +883,32 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
}
center.x += x_offset + (rnd->getRandomValue()) * conf.offset_variations * x_offset;
}
if (mesh != 0)
if (mesh != nullptr)
{
setChunkInfoMesh(ch, mesh);
xSlicedChunks.push_back(ch);
xSlicedChunks.push_back(mesh);
}


for (uint32_t chunk = 0; chunk < xSlicedChunks.size(); ++chunk)
{
center = NvVec3(0, sourceBBox.minimum.y, 0);
center.y += y_offset;
dir = NvVec3(0, 1, 0);
mesh = xSlicedChunks[chunk].getMesh();
mesh = xSlicedChunks[chunk];

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


setCuttingBox(center, -lDir, slBox, 20, mPlaneIndexerOffset);
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_INTERSECTION());
setChunkInfoMesh(ch, bTool.createNewMesh());
if (ch.getMesh() != 0)
Mesh* ySlice = bTool.createNewMesh();
if (ySlice != nullptr)
{
ySlicedChunks.push_back(ch);
ySlicedChunks.push_back(ySlice);
}

inverseNormalAndIndices(slBox);
++mPlaneIndexerOffset;
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_DIFFERENCE());
Expand All @@ -923,35 +921,36 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
}
center.y += y_offset + (rnd->getRandomValue()) * conf.offset_variations * y_offset;
}
if (mesh != 0)
if (mesh != nullptr)
{
setChunkInfoMesh(ch, mesh);
ySlicedChunks.push_back(ch);
ySlicedChunks.push_back(mesh);
}
}


for (uint32_t chunk = 0; chunk < ySlicedChunks.size(); ++chunk)
{
center = NvVec3(0, 0, sourceBBox.minimum.z);
center.z += z_offset;
dir = NvVec3(0, 0, 1);
mesh = ySlicedChunks[chunk].getMesh();
mesh = ySlicedChunks[chunk];

for (int32_t slice = 0; slice < z_slices; ++slice)
{
NvVec3 randVect =
NvVec3(2 * rnd->getRandomValue() - 1, 2 * rnd->getRandomValue() - 1, 2 * rnd->getRandomValue() - 1);
NvVec3 lDir = dir + randVect * conf.angle_variations;

setCuttingBox(center, -lDir, slBox, 20, mPlaneIndexerOffset);
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_INTERSECTION());
setChunkInfoMesh(ch, bTool.createNewMesh());
if (ch.getMesh() != 0)
Mesh* ySlice = bTool.createNewMesh();
if (ySlice != nullptr)
{
setChunkInfoMesh(ch, ySlice);
ch.chunkId = createId();
newlyCreatedChunksIds.push_back(ch.chunkId);
mChunkData.push_back(ch);
}

inverseNormalAndIndices(slBox);
++mPlaneIndexerOffset;
bTool.performFastCutting(mesh, slBox, BooleanConfigurations::BOOLEAN_DIFFERENCE());
Expand All @@ -964,16 +963,15 @@ int32_t FractureToolImpl::slicing(uint32_t chunkId, const SlicingConfiguration&
}
center.z += z_offset + (rnd->getRandomValue()) * conf.offset_variations * z_offset;
}
if (mesh != 0)
if (mesh != nullptr)
{
ch.chunkId = createId();
setChunkInfoMesh(ch, mesh);
mChunkData.push_back(ch);
ch.chunkId = createId();
newlyCreatedChunksIds.push_back(ch.chunkId);
mChunkData.push_back(ch);
}
}


delete slBox;

mChunkData[chunkInfoIndex].isLeaf = false;
Expand Down Expand Up @@ -1047,8 +1045,8 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
ch.isChanged = true;
ch.flags = ChunkInfo::NO_FLAGS;
ch.parentChunkId = replaceChunk ? mChunkData[chunkInfoIndex].parentChunkId : chunkId;
std::vector<ChunkInfo> xSlicedChunks;
std::vector<ChunkInfo> ySlicedChunks;
std::vector<Mesh*> xSlicedChunks;
std::vector<Mesh*> ySlicedChunks;
std::vector<uint32_t> newlyCreatedChunksIds;
float noisyPartSize = 1.2f;
// int32_t acceleratorRes = 8;
Expand All @@ -1068,11 +1066,12 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
SweepingAccelerator accel(mesh);
SweepingAccelerator dummy(slBox);
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_DIFFERENCE());
setChunkInfoMesh(ch, bTool.createNewMesh());
if (ch.getMesh() != 0)
Mesh* xSlice = bTool.createNewMesh();
if (xSlice != nullptr)
{
xSlicedChunks.push_back(ch);
xSlicedChunks.push_back(xSlice);
}

inverseNormalAndIndices(slBox);
++mPlaneIndexerOffset;
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_INTERSECTION());
Expand All @@ -1086,19 +1085,19 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
}
center.x += x_offset + (rnd->getRandomValue()) * conf.offset_variations * x_offset;
}
if (mesh != 0)
if (mesh != nullptr)
{
setChunkInfoMesh(ch, mesh);
xSlicedChunks.push_back(ch);
xSlicedChunks.push_back(mesh);
}

slBox = getCuttingBox(center, dir, 20, 0, mInteriorMaterialId);
uint32_t slicedChunkSize = xSlicedChunks.size();
for (uint32_t chunk = 0; chunk < slicedChunkSize; ++chunk)
{
center = NvVec3(0, sourceBBox.minimum.y, 0);
center.y += y_offset;
dir = NvVec3(0, 1, 0);
mesh = xSlicedChunks[chunk].getMesh();
mesh = xSlicedChunks[chunk];

for (int32_t slice = 0; slice < y_slices; ++slice)
{
Expand All @@ -1114,11 +1113,12 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
SweepingAccelerator accel(mesh);
SweepingAccelerator dummy(slBox);
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_DIFFERENCE());
setChunkInfoMesh(ch, bTool.createNewMesh());
if (ch.getMesh() != 0)
Mesh* ySlice = bTool.createNewMesh();
if (ySlice != nullptr)
{
ySlicedChunks.push_back(ch);
ySlicedChunks.push_back(ySlice);
}

inverseNormalAndIndices(slBox);
++mPlaneIndexerOffset;
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_INTERSECTION());
Expand All @@ -1132,10 +1132,9 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
}
center.y += y_offset + (rnd->getRandomValue()) * conf.offset_variations * y_offset;
}
if (mesh != 0)
if (mesh != nullptr)
{
setChunkInfoMesh(ch, mesh);
ySlicedChunks.push_back(ch);
ySlicedChunks.push_back(mesh);
}
}

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

for (int32_t slice = 0; slice < z_slices; ++slice)
{
Expand All @@ -1159,13 +1158,15 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
SweepingAccelerator accel(mesh);
SweepingAccelerator dummy(slBox);
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_DIFFERENCE());
setChunkInfoMesh(ch, bTool.createNewMesh());
if (ch.getMesh() != 0)
Mesh* ySlice = bTool.createNewMesh();
if (ySlice != nullptr)
{
setChunkInfoMesh(ch, ySlice);
ch.chunkId = createId();
mChunkData.push_back(ch);
newlyCreatedChunksIds.push_back(ch.chunkId);
}

inverseNormalAndIndices(slBox);
++mPlaneIndexerOffset;
bTool.performBoolean(mesh, slBox, &accel, &dummy, BooleanConfigurations::BOOLEAN_INTERSECTION());
Expand All @@ -1179,12 +1180,12 @@ int32_t FractureToolImpl::slicingNoisy(uint32_t chunkId, const SlicingConfigurat
}
center.z += z_offset + (rnd->getRandomValue()) * conf.offset_variations * z_offset;
}
if (mesh != 0)
if (mesh != nullptr)
{
ch.chunkId = createId();
setChunkInfoMesh(ch, mesh);
mChunkData.push_back(ch);
ch.chunkId = createId();
newlyCreatedChunksIds.push_back(ch.chunkId);
mChunkData.push_back(ch);
}
}

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

return 0;
}

int32_t FractureToolImpl::cut(uint32_t chunkId, const NvcVec3& normal, const NvcVec3& point,
const NoiseConfiguration& noise, bool replaceChunk, RandomGeneratorBase* rnd)
{
Expand Down

0 comments on commit e8c8deb

Please sign in to comment.