@@ -29,10 +29,7 @@ use parking_lot::Mutex;
2929use smallvec:: smallvec;
3030
3131/// GPU retrieved & processed picking data result.
32- pub struct PickingResult < T : ' static + Send + Sync > {
33- /// User data supplied on picking request.
34- pub user_data : T ,
35-
32+ pub struct PickingResult {
3633 /// Picking rect supplied on picking request.
3734 /// Describes the area of the picking layer that was read back.
3835 pub rect : RectInt ,
@@ -55,7 +52,7 @@ pub struct PickingResult<T: 'static + Send + Sync> {
5552 world_from_cropped_projection : glam:: Mat4 ,
5653}
5754
58- impl < T : ' static + Send + Sync > PickingResult < T > {
55+ impl PickingResult {
5956 /// Returns the picked world position.
6057 ///
6158 /// Panics if the position is outside of the picking rect.
@@ -81,13 +78,10 @@ impl<T: 'static + Send + Sync> PickingResult<T> {
8178 }
8279}
8380
84- type ReadbackBeltUserData = Box < dyn std:: any:: Any + Send + Sync > ;
85-
8681/// Type used as user data on the gpu readback belt.
8782struct ReadbackBeltMetadata {
8883 picking_rect : RectInt ,
8984 world_from_cropped_projection : glam:: Mat4 ,
90- user_data : ReadbackBeltUserData ,
9185
9286 depth_readback_workaround_in_use : bool ,
9387}
@@ -184,7 +178,6 @@ impl PickingLayerProcessor {
184178 frame_uniform_buffer_content : & FrameUniformBuffer ,
185179 enable_picking_target_sampling : bool ,
186180 readback_identifier : GpuReadbackIdentifier ,
187- readback_user_data : ReadbackBeltUserData ,
188181 ) -> Self {
189182 let mut picking_target_usage =
190183 wgpu:: TextureUsages :: RENDER_ATTACHMENT | wgpu:: TextureUsages :: COPY_SRC ;
@@ -292,7 +285,6 @@ impl PickingLayerProcessor {
292285 readback_identifier,
293286 Box :: new ( ReadbackBeltMetadata {
294287 picking_rect,
295- user_data : readback_user_data,
296288 world_from_cropped_projection : cropped_projection_from_world. inverse ( ) ,
297289 depth_readback_workaround_in_use : depth_readback_workaround. is_some ( ) ,
298290 } ) ,
@@ -390,15 +382,15 @@ impl PickingLayerProcessor {
390382 Ok ( ( ) )
391383 }
392384
393- /// Returns the latest available picking result for a given identifier and user data type .
385+ /// Returns the latest available picking result for a given identifier.
394386 ///
395387 /// Ready data that hasn't been retrieved for more than a frame will be discarded.
396388 ///
397- /// See also [`crate::view_builder::ViewBuilder::schedule_picking_rect `]
398- pub fn readback_result < T : ' static + Send + Sync > (
389+ /// See also [`crate::view_builder::ViewPickingConfiguration `]
390+ pub fn readback_result (
399391 ctx : & RenderContext ,
400392 identifier : GpuReadbackIdentifier ,
401- ) -> Option < PickingResult < T > > {
393+ ) -> Option < PickingResult > {
402394 ctx. gpu_readback_belt
403395 . lock ( )
404396 . readback_newest_available ( identifier, |data, metadata : Box < ReadbackBeltMetadata > | {
@@ -447,7 +439,6 @@ impl PickingLayerProcessor {
447439 Some ( PickingResult {
448440 picking_id_data,
449441 picking_depth_data,
450- user_data : * metadata. user_data . downcast :: < T > ( ) . ok ( ) ?,
451442 rect : metadata. picking_rect ,
452443 world_from_cropped_projection : metadata. world_from_cropped_projection ,
453444 } )
0 commit comments