|
Rapier C — 3D / f64 0.36.0+c.0
|
Status-returning calls report OK or an error code.
Fallible value-returning calls report failure through LastStatus and LastError on the calling thread. Check LastStatus immediately after such a call: later fallible calls replace it. Value constructors that only initialize POD data do not change the status.
A failed value-returning call returns a default value (often zero, NULL, or an invalid handle). That value alone does not distinguish success from failure. LastError is a borrowed UTF-8 string valid until the next fallible call on that thread; copy it before making another call. Reading LastStatus/LastError does not clear them.
SetErrorHandler installs a thread-local synchronous notification callback and returns the previous handler. A callback that returns does not suppress the error. Nested failures do not recursively invoke it. NOT_FOUND also invokes this handler; use TryCastRay or CastRayToi if an ordinary ray miss should return OK with found = 0.
Pointer checks cannot prove that memory is live, large enough, or owned by the caller. Supply correctly aligned buffers and valid pointers for their documented lifetimes. A caught PANIC is not transactional: discard objects mutated by that call. Validation errors are not a general rollback guarantee either.