File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ struct CompactByFieldPointsNode : IPointsNodeSingleInput
84
84
void enqueueExecImpl () override ;
85
85
86
86
// Node requirements
87
- std::vector<rgl_field_t > getRequiredFieldList () const override { return {IS_HIT_I32, IS_GROUND_I32 }; }
87
+ std::vector<rgl_field_t > getRequiredFieldList () const override { return {fieldToCompactBy }; }
88
88
89
89
// Point cloud description
90
90
bool isDense () const override { return true ; }
@@ -399,8 +399,15 @@ struct YieldPointsNode : IPointsNodeSingleInput
399
399
// Node requirements
400
400
std::vector<rgl_field_t > getRequiredFieldList () const override { return fields; }
401
401
402
+ // Point cloud description
403
+ bool hasField (rgl_field_t field) const override
404
+ {
405
+ // The `results` map cannot be relied on because the hasField() may be called before the node has finished executing.
406
+ return std::find (fields.begin (), fields.end (), field) != fields.end ();
407
+ }
408
+
402
409
// Data getters
403
- IAnyArray::ConstPtr getFieldData (rgl_field_t field) override { return results. at (field); }
410
+ IAnyArray::ConstPtr getFieldData (rgl_field_t field) override ;
404
411
405
412
HostPinnedArray<Field<XYZ_VEC3_F32>::type>::Ptr getXYZCache () { return xyzHostCache; }
406
413
Original file line number Diff line number Diff line change 16
16
17
17
void YieldPointsNode::setParameters (const std::vector<rgl_field_t >& fields)
18
18
{
19
+ results.clear ();
19
20
if (std::find (fields.begin (), fields.end (), RGL_FIELD_DYNAMIC_FORMAT) != fields.end ()) {
20
21
throw InvalidAPIArgument (" cannot yield field 'RGL_FIELD_DYNAMIC_FORMAT'" ); // TODO: Yeah, but dummies are OK?
21
22
}
@@ -33,3 +34,11 @@ void YieldPointsNode::enqueueExecImpl()
33
34
xyzHostCache->getCount () * xyzHostCache->getSizeOf (), cudaMemcpyDefault, getStreamHandle ()));
34
35
}
35
36
}
37
+
38
+ IAnyArray::ConstPtr YieldPointsNode::getFieldData (rgl_field_t field)
39
+ {
40
+ if (!results.contains (field)) {
41
+ throw std::runtime_error (" Field data is not ready yet. It was requested without waiting for results." );
42
+ }
43
+ return results.at (field);
44
+ }
You can’t perform that action at this time.
0 commit comments