@@ -812,10 +812,6 @@ RGL_API rgl_status_t rgl_node_raytrace(rgl_node_t* node, rgl_scene_t scene)
812
812
813
813
createOrUpdateNode<RaytraceNode>(node);
814
814
auto raytraceNode = Node::validatePtr<RaytraceNode>(*node);
815
- // Clear velocity that could be set by rgl_node_raytrace_in_motion
816
- raytraceNode->setVelocity (Vec3f{0 , 0 , 0 }, Vec3f{0 , 0 , 0 });
817
- // Disable ray distortion that could be set by rgl_node_raytrace_in_motion
818
- raytraceNode->enableRayDistortion (false );
819
815
});
820
816
TAPE_HOOK (node, scene);
821
817
return status;
@@ -829,46 +825,67 @@ void TapeCore::tape_node_raytrace(const YAML::Node& yamlNode, PlaybackState& sta
829
825
state.nodes .insert ({nodeId, node});
830
826
}
831
827
832
- RGL_API rgl_status_t rgl_node_raytrace_with_distortion (rgl_node_t * node, rgl_scene_t scene , const rgl_vec3f* linear_velocity,
833
- const rgl_vec3f* angular_velocity)
828
+ RGL_API rgl_status_t rgl_node_raytrace_configure_velocity (rgl_node_t node, const rgl_vec3f* linear_velocity,
829
+ const rgl_vec3f* angular_velocity)
834
830
{
835
- return rgl_node_raytrace_in_motion (node, scene, linear_velocity, angular_velocity, true );
831
+ auto status = rglSafeCall ([&]() {
832
+ RGL_API_LOG (" rgl_node_raytrace_configure_velocity(node={}, linear_velocity={}, angular_velocity={})" , repr (node),
833
+ repr (linear_velocity), repr (angular_velocity));
834
+ CHECK_ARG (node != nullptr );
835
+ CHECK_ARG (linear_velocity != nullptr );
836
+ CHECK_ARG (angular_velocity != nullptr );
837
+ RaytraceNode::Ptr raytraceNode = Node::validatePtr<RaytraceNode>(node);
838
+ raytraceNode->setVelocity (*reinterpret_cast <const Vec3f*>(linear_velocity),
839
+ *reinterpret_cast <const Vec3f*>(angular_velocity));
840
+ });
841
+ TAPE_HOOK (node, linear_velocity, angular_velocity);
842
+ return status;
836
843
}
837
844
838
- void TapeCore::tape_node_raytrace_with_distortion (const YAML::Node& yamlNode, PlaybackState& state)
845
+ void TapeCore::tape_node_raytrace_configure_velocity (const YAML::Node& yamlNode, PlaybackState& state)
839
846
{
840
- return tape_node_raytrace_in_motion (yamlNode, state);
847
+ auto nodeId = yamlNode[0 ].as <TapeAPIObjectID>();
848
+ rgl_node_t node = state.nodes .at (nodeId);
849
+ rgl_node_raytrace_configure_velocity (state.nodes .at (nodeId), state.getPtr <const rgl_vec3f>(yamlNode[1 ]),
850
+ state.getPtr <const rgl_vec3f>(yamlNode[2 ]));
841
851
}
842
852
843
- RGL_API rgl_status_t rgl_node_raytrace_in_motion (rgl_node_t * node, rgl_scene_t scene, const rgl_vec3f* linear_velocity,
844
- const rgl_vec3f* angular_velocity, bool apply_ray_distortion)
853
+ RGL_API rgl_status_t rgl_node_raytrace_configure_distortion (rgl_node_t node, bool enable)
845
854
{
846
855
auto status = rglSafeCall ([&]() {
847
- RGL_API_LOG (
848
- " rgl_node_raytrace_in_motion(node={}, scene={}, linear_velocity={}, angular_velocity={}, apply_ray_distortion={})" ,
849
- repr (node), (void *) scene, repr (linear_velocity), repr (angular_velocity), apply_ray_distortion);
856
+ RGL_API_LOG (" rgl_node_raytrace_configure_distortion(node={}, enable={})" , repr (node), enable);
850
857
CHECK_ARG (node != nullptr );
851
- CHECK_ARG (linear_velocity != nullptr );
852
- CHECK_ARG (angular_velocity != nullptr );
853
- CHECK_ARG (scene == nullptr );
858
+ RaytraceNode::Ptr raytraceNode = Node::validatePtr<RaytraceNode>(node);
859
+ raytraceNode->enableRayDistortion (enable);
860
+ });
861
+ TAPE_HOOK (node, enable);
862
+ return status;
863
+ }
854
864
855
- createOrUpdateNode<RaytraceNode>(node);
856
- auto raytraceNode = Node::validatePtr<RaytraceNode>(*node);
857
- raytraceNode->setVelocity (*reinterpret_cast <const Vec3f*>(linear_velocity),
858
- *reinterpret_cast <const Vec3f*>(angular_velocity));
859
- raytraceNode->enableRayDistortion (apply_ray_distortion);
865
+ void TapeCore::tape_node_raytrace_configure_distortion (const YAML::Node& yamlNode, PlaybackState& state)
866
+ {
867
+ auto nodeId = yamlNode[0 ].as <TapeAPIObjectID>();
868
+ rgl_node_t node = state.nodes .at (nodeId);
869
+ rgl_node_raytrace_configure_distortion (node, yamlNode[1 ].as <bool >());
870
+ }
871
+
872
+ RGL_API rgl_status_t rgl_node_raytrace_configure_non_hits (rgl_node_t node, float near, float far)
873
+ {
874
+ auto status = rglSafeCall ([&]() {
875
+ RGL_API_LOG (" rgl_node_raytrace_configure_non_hits(node={}, near={}, far={})" , repr (node), near, far);
876
+ CHECK_ARG (node != nullptr );
877
+ RaytraceNode::Ptr raytraceNode = Node::validatePtr<RaytraceNode>(node);
878
+ raytraceNode->setNonHitDistanceValues (near, far);
860
879
});
861
- TAPE_HOOK (node, scene, linear_velocity, angular_velocity );
880
+ TAPE_HOOK (node, near, far );
862
881
return status;
863
882
}
864
883
865
- void TapeCore::tape_node_raytrace_in_motion (const YAML::Node& yamlNode, PlaybackState& state)
884
+ void TapeCore::tape_node_raytrace_configure_non_hits (const YAML::Node& yamlNode, PlaybackState& state)
866
885
{
867
886
auto nodeId = yamlNode[0 ].as <TapeAPIObjectID>();
868
- rgl_node_t node = state.nodes .contains (nodeId) ? state.nodes .at (nodeId) : nullptr ;
869
- rgl_node_raytrace_with_distortion (&node, nullptr , state.getPtr <const rgl_vec3f>(yamlNode[2 ]),
870
- state.getPtr <const rgl_vec3f>(yamlNode[3 ]));
871
- state.nodes .insert ({nodeId, node});
887
+ rgl_node_t node = state.nodes .at (nodeId);
888
+ rgl_node_raytrace_configure_non_hits (node, yamlNode[1 ].as <float >(), yamlNode[2 ].as <float >());
872
889
}
873
890
874
891
RGL_API rgl_status_t rgl_node_points_format (rgl_node_t * node, const rgl_field_t * fields, int32_t field_count)
0 commit comments