Retrieve errors from pointcloud_search()


Larry Gritz
 

As you probably know, some functionality (including pointcloud_search) is implemented by callbacks to the RendererServices object supplied by the renderer itself. Each renderer makes a derived class from RendererServices, and makes choices about which of the virtual functions directly inherit the default implementations in our RendererServices base class, and which override with renderer-specific functionality.

The default RendererServices::pointcloud_search (see src/liboslexec/pointcloud.cpp) issues an error message if there is no pointcloud file at all, but then returns control back to the shader.

You could have YourRendererServices::pointcloud_search supply a different implementation. Say, copy ours, but modify it so that in the cases of a missing or broken ptc file, instead of merely issuing an error and returning 0, it could do something more drastic, signalling the renderer to terminate early.

There may be a simpler way -- many renderers have an option to terminate at the first error (or after some fixed number of errors), and given that the default RendererServices::pointcloud_search does issue an error that gets bubbled back to the renderer, maybe enabling this option is enough? But if your renderer doesn't  have an "early terminate on any error" option, or if you really need to terminate for this particular error but not for other errors, then suppling a replacement RS::pointcloud_search that handles the error in a custom way is probably the best approach.

-- lg


On May 20, 2022, at 7:42 AM, elizabeth.bonnefoy@... wrote:

Hi everyone!


We are using the pointcloud_search function in our renderer to read some pdc files.
Generally everything works well, but sometimes a pdc file is missing, and in that case we would like to kill the rendering.

The problem is we can't find a proper way to catch this case after the call of the pointcloud_search function.
This function has no "errormessage" argument (like the texture() function) allowing to retrieve errors generated by PartIO during its execution.
We can't use the return value because the function return 0 in this case, which is also the returned value if the file is existing but no particle was found in the given neighborhood.

Does anyone have an idea on how we can handle this?
Thanks a lot.


Kind regards,
Elisabeth


--
Larry Gritz






elizabeth.bonnefoy@...
 

Hi everyone!


We are using the pointcloud_search function in our renderer to read some pdc files.
Generally everything works well, but sometimes a pdc file is missing, and in that case we would like to kill the rendering.

The problem is we can't find a proper way to catch this case after the call of the pointcloud_search function.
This function has no "errormessage" argument (like the texture() function) allowing to retrieve errors generated by PartIO during its execution.
We can't use the return value because the function return 0 in this case, which is also the returned value if the file is existing but no particle was found in the given neighborhood.

Does anyone have an idea on how we can handle this?
Thanks a lot.


Kind regards,
Elisabeth