Expand description
Ray-cast object picking. Renderer-free CPU picking primitives.
These functions pick directly off caller-supplied data (a Scene, a slice of
items, or a mesh_lookup), so they need no ViewportRenderer and cost nothing
per frame. That makes them the right choice for tests, headless/CPU-only tools,
and picking heavy or dynamic data at click time. They cover a subset of item
types: surface meshes, light glyphs, point clouds, gaussian splats, ray-marched
volumes, and transparent volume-mesh cells.
For the full set of item types (curves, implicit surfaces, marching cubes,
overlays) and sub-element masks, use the unified
ViewportRenderer::pick /
pick_rect. Those read the renderer’s per-frame pick cache, which is off by
default and enabled with
set_cpu_pick_cache.
Uses parry3d 0.26’s glam-native API (no nalgebra required). All conversions are contained here at the picking boundary.
§Skinned meshes
The CPU picking entry points in this module test against whatever positions are
passed in via mesh_lookup. On the GPU skinning path the vertex buffer is never
rewritten, so the natural CPU view of a skinned mesh is the bind pose: clicks land
on the bind-pose silhouette. See the module-level documentation on
crate::PickAccelerator for the two supported strategies (bind-pose with padded
AABBs, or per-frame refresh against deformed positions). GPU picking
(crate::renderer::picking) reads the rasterised object-ID buffer and therefore
picks the deformed silhouette automatically.
Structs§
- GpuPick
Hit - Result of a GPU object-ID pick pass.
- PickHit
- Result of a successful ray-cast pick against a scene object.
- Probe
Binding - Per-object attribute binding for probe-aware picking.
- Rect
Pick Result - Result of a rectangular (rubber-band) pick.
Functions§
- nearest_
vertex_ on_ hit - Find the triangle corner nearest to the ray-hit world position.
- pick_
gaussian_ splat_ cpu - Screen-space nearest-splat pick for a Gaussian splat object.
- pick_
gaussian_ splat_ rect - Rect-select splats from a Gaussian splat object.
- pick_
point_ cloud_ cpu - Pick the closest point in a
crate::renderer::PointCloudItemto a screen-space click. - pick_
scene_ accelerated_ with_ probe_ cpu - Like
pick_scene_accelerated_cpubut also computes the scalar value at the hit point. - pick_
scene_ cpu - Cast a ray against all visible viewport objects. Returns a
PickHitfor the nearest hit, orNoneif nothing was hit. - pick_
scene_ nodes_ cpu - Cast a ray against all visible scene nodes. Returns a
PickHitfor the nearest hit. - pick_
scene_ nodes_ with_ probe_ cpu - Like
pick_scene_nodes_cpubut also computes the scalar value at the hit point. - pick_
scene_ with_ probe_ cpu - Like [
pick_scene] but also computes the scalar attribute value at the hit point via barycentric interpolation (vertex attributes) or direct lookup (cell attributes). - pick_
transparent_ volume_ mesh_ cpu - Ray-cast pick against a transparent volume mesh.
- pick_
transparent_ volume_ mesh_ rect - Rect-select cells from a transparent volume mesh.
- pick_
volume_ cpu - Ray-cast a single volume using Amanatides-Woo DDA traversal.
- pick_
volume_ rect - Rect-select above-threshold voxels from a volume object.
- screen_
to_ ray - Convert screen position (in viewport-local pixels) to a world-space ray.
- voxel_
world_ aabb - Compute the world-space axis-aligned bounding box of a single voxel.