Skip to content

Commit 1e702c1

Browse files
committed
fixed more compiler warnings
Signed-off-by: Ken Museth <ken.museth@gmail.com>
1 parent d7bb6d8 commit 1e702c1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

openvdb/openvdb/tools/PolySoupToLevelSet.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ PolySoupToLevelSet<GridType>::PolySoupToLevelSet(PolySoup &&poly, int dim, float
251251
}
252252
if (!mPoly.bbox) mPoly.bbox = PolySoupToLevelSet::getBBox(mPoly.vtx);
253253
const float maxLength = mPoly.bbox.extents()[mPoly.bbox.maxExtent()];
254-
mMinVoxelSize = maxLength/(dim - 2.0f*(mHalfWidth + 1.0f));// +1 since final surface is dilated by dx
254+
mMinVoxelSize = maxLength/(float(dim) - 2.0f*(mHalfWidth + 1.0f));// +1 since final surface is dilated by dx
255255
mMaxVoxelSize = maxLength / 2.0f;
256256
OPENVDB_ASSERT(2*mMinVoxelSize <= mMaxVoxelSize);
257257
}// tools::PolySoupToLevelSet::PolySoupToLevelSet()
@@ -288,13 +288,13 @@ void PolySoupToLevelSet<GridType>::process(const ShrinkWrapT &D, ProgressT *prog
288288
}
289289

290290
// Coarse to fine shrink wrap algorithm
291-
float vol[2];
291+
double vol[2];// levelSetVolume returns Real (double); keep full precision
292292
auto grid = mGrids.back();// initiate grid with the coarsest offset
293293
mGrids.pop_back();
294294
mIsGridSDF = true;
295295
for (auto iter = mGrids.rbegin(), end = mGrids.rend(); iter != end; ++iter) {// coarse -> fine
296296
grid = this->upsample(*grid);// grid(dx) -> grid(dx/2)
297-
for (float d = 0.0f, dx = grid->voxelSize()[0], Ddx = D(dx); d < Ddx; vol[0] = vol[1]) {
297+
for (float d = 0.0f, dx = float(grid->voxelSize()[0]), Ddx = D(dx); d < Ddx; vol[0] = vol[1]) {
298298
myProgress("Shrink wrap d=" + std::to_string(d) + ", D("+std::to_string(dx) + ")=" + std::to_string(Ddx));
299299
grid = this->shrinkWrap(*grid, **iter, d);
300300
vol[1] = levelSetVolume(*grid);
@@ -390,7 +390,7 @@ auto PolySoupToLevelSet<GridType>::shrinkWrap(GridType &grid, const GridType &gr
390390
filter.normalize();
391391
filter.prune();// is this needed?
392392
}
393-
filter.offset(maxDist * grid.voxelSize()[0]);// erode by maxDist * dx
393+
filter.offset(static_cast<typename GridType::ValueType>(maxDist * grid.voxelSize()[0]));// erode by maxDist * dx
394394
mIsGridSDF = false;// the CSG operation messed up the SDF
395395
d += maxDist;
396396
return csgUnionCopy(grid, gridB);

0 commit comments

Comments
 (0)