Skip to content

Commit

Permalink
Merge pull request #1583 from Ashheer/improve-maskwrangle
Browse files Browse the repository at this point in the history
add float attr type for pmw
  • Loading branch information
zhouhang95 authored Dec 6, 2023
2 parents 3a8f9b6 + 8513045 commit 2089747
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions projects/ZenoFX/pmw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ struct Buffer {
size_t count = 0;
size_t stride = 0;
};

template <typename T>
static void vectors_wrangle
( zfx::x64::Executable *exec
, std::vector<Buffer> const &chs
, int *maskarr
, T *maskarr
) {
if (chs.size() == 0)
return;
Expand Down Expand Up @@ -215,8 +215,18 @@ struct ParticlesMaskedWrangle : zeno::INode {
});
chs[i] = iob;
}
auto &maskarr = prim->attr<int>(get_input2<std::string>("maskAttr"));
vectors_wrangle(exec, chs, maskarr.data());
std::string maskAttr = get_input2<std::string>("maskAttr");
if(prim->attr_is<float>(maskAttr)){
auto &maskarr = prim->attr<float>(maskAttr);
vectors_wrangle(exec, chs, maskarr.data());
}
else if(prim->attr_is<int>(maskAttr)){
auto &maskarr = prim->attr<int>(maskAttr);
vectors_wrangle(exec, chs, maskarr.data());
}
else{
throw std::runtime_error("mask type not supported");
}

set_output("prim", std::move(prim));
}
Expand Down

0 comments on commit 2089747

Please sign in to comment.