GpuRayQuery¶
Import: import system.gpu;
This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside shader entry points and helpers reached from them; using them elsewhere is a compile error.
GpuRayQuery¶
An inline ray trace inside an ordinary shader, without a ray tracing pipeline. Useful for shadows and ambient occlusion in compute and fragment shaders. Create one with GpuRayQuery.of, start it with trace, then call proceed in a loop until it returns false. Inside the loop, decide about non-opaque candidates with commit_triangle; afterwards read the committed hit. Needs GpuFeature.RayQuery.
constructor¶
Creates a query with flags applied to every trace.
trace¶
Starts tracing ray against scene, seeing only instances whose mask shares a bit with mask.
proceed¶
Advances to the next candidate that needs a decision; false once the trace finished.
commit_triangle¶
Accepts the current non-opaque triangle candidate as a hit.
candidate_distance¶
The distance to the current candidate.
candidate_barycentrics¶
The current triangle candidate's barycentric weights, as in GpuTriangleHit.
has_hit¶
True when the finished trace committed a hit.
hit_distance¶
The distance to the committed hit.
hit_barycentrics¶
The committed hit's barycentric weights, as in GpuTriangleHit.
hit_instance_id¶
The GpuInstance.with_id value of the committed hit's instance.
hit_primitive_index¶
The index of the committed hit's triangle or box within its geometry.