Skip to content

Commit f6217ec

Browse files
committed
Converted Rasterize over to new operators away from explicit methods
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
1 parent 791e2d0 commit f6217ec

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

openvdb/openvdb/points/impl/PointRasterizeSDFImpl.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ struct SphericalTransfer :
456456

457457
const SimdIT ids = simd::load<Size>(points.data());
458458
int64_t firstInvalidIdx =
459-
simd::horizontal_find_first(simd::eq(ids, SimdIT(-1)));
459+
simd::horizontal_find_first(ids == SimdIT(-1));
460460
if (firstInvalidIdx == -1) firstInvalidIdx = Size;
461461
// It's guaranteed that at least two indices are valid in the
462462
// "points" array (if it's one then rasterizePoint is called).
@@ -514,14 +514,14 @@ struct SphericalTransfer :
514514
// single -/+ by horizontallying into 2xVCL4 types.
515515
CoordBBox intersectBox(
516516
Coord::round(Vec3d(
517-
simd::horizontal_min(simd::sub(px, rmax)),
518-
simd::horizontal_min(simd::sub(py, rmax)),
519-
simd::horizontal_min(simd::sub(pz, rmax))
517+
simd::horizontal_min(px - rmax),
518+
simd::horizontal_min(py - rmax),
519+
simd::horizontal_min(pz - rmax)
520520
)),
521521
Coord::round(Vec3d(
522-
simd::horizontal_max(simd::add(px, rmax)),
523-
simd::horizontal_max(simd::add(py, rmax)),
524-
simd::horizontal_max(simd::add(pz, rmax))
522+
simd::horizontal_max(px + rmax),
523+
simd::horizontal_max(py + rmax),
524+
simd::horizontal_max(pz + rmax)
525525
))
526526
);
527527
intersectBox.intersect(bounds);
@@ -560,36 +560,36 @@ struct SphericalTransfer :
560560
// incorrectly setting these voxels to inactive -background values as
561561
// x2y2z2 will never be < 0.0. We still want the lteq logic in the
562562
// (x2y2z2 <= min2) check as this is valid when min2 > 0.0.
563-
const ScalarT min2 = simd::select(simd::eq(Rmin2, ScalarT(0.0)), ScalarT(-1.0), Rmin2);
563+
const ScalarT min2 = simd::select((Rmin2 == ScalarT(0.0)), ScalarT(-1.0), Rmin2);
564564
const ScalarT max2 = Rmax2;
565565
const ScalarT vdx(this->mDx);
566566

567567
const Coord& a(intersection.min());
568568
const Coord& b(intersection.max());
569569
for (Coord c = a; c.x() <= b.x(); ++c.x()) {
570-
const ScalarT x2 = simd::square(simd::sub(ScalarT(RealT(c.x())), Px));
570+
const ScalarT x2 = simd::square(ScalarT(RealT(c.x())) - Px);
571571
const Index i = ((c.x() & (DIM-1u)) << 2*LOG2DIM); // unsigned bit shift mult
572572
for (c.y() = a.y(); c.y() <= b.y(); ++c.y()) {
573-
const ScalarT x2y2 = simd::add(x2, simd::square(simd::sub(ScalarT(RealT(c.y())), Py)));
573+
const ScalarT x2y2 = x2 + simd::square(ScalarT(RealT(c.y())) - Py);
574574
const Index ij = i + ((c.y() & (DIM-1u)) << LOG2DIM);
575575
for (c.z() = a.z(); c.z() <= b.z(); ++c.z()) {
576576
const Index offset = ij + /*k*/(c.z() & (DIM-1u));
577577
if (!mask.isOn(offset)) continue; // inside existing level set or not in range
578578

579-
const ScalarT x2y2z2 = simd::add(x2y2, simd::square(simd::sub(ScalarT(RealT(c.z())), Pz)));
579+
const ScalarT x2y2z2 = x2y2 + simd::square(ScalarT(RealT(c.z())) - Pz);
580580
OPENVDB_ASSERT(simd::horizontal_and(simd::is_finite(x2y2z2)));
581581

582582
// If all outside the maximum band, continue
583-
if (simd::horizontal_and(simd::gte(x2y2z2, max2))) continue;
583+
if (simd::horizontal_and(x2y2z2 >= max2)) continue;
584584
// If any inside the minimum band, set the maximum negative background
585-
if (simd::horizontal_or(simd::lte(x2y2z2, min2))) {
585+
if (simd::horizontal_or(x2y2z2 <= min2)) {
586586
data[offset] = -(this->mBackground);
587587
mask.setOff(offset);
588588
continue;
589589
}
590590

591591
// Compute distance to surface (the mul() takes us back to world space)
592-
const ScalarT dist = simd::mul(vdx, (simd::sub(simd::sqrt(x2y2z2), r)));
592+
const ScalarT dist = (vdx * (simd::sqrt(x2y2z2) - r));
593593
// keep original precision for horizontal_find_first below
594594
const auto mindist = simd::horizontal_min(dist);
595595
// Convert to surface precision
@@ -599,7 +599,7 @@ struct SphericalTransfer :
599599
if (d < v) {
600600
v = d; // replace surface value
601601
if constexpr(CPG) {
602-
const int id = simd::horizontal_find_first(simd::eq(ScalarT(mindist), dist));
602+
const int id = simd::horizontal_find_first(ScalarT(mindist) == dist);
603603
OPENVDB_ASSERT(id != -1);
604604
// transfer attributes - we can't use this here as the exposed
605605
// function signatures take vector of attributes (i.e. an unbounded

0 commit comments

Comments
 (0)