File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -139,19 +139,17 @@ impl GpuPickingCamera {
139
139
}
140
140
141
141
// TODO This is currently a constant, but could be user configurable
142
- let entity = match MESH_ID_TEXTURE_FORMAT {
142
+ let texture_bytes = & self . data . mesh_id_buffer [ start..end] ;
143
+ let index = match MESH_ID_TEXTURE_FORMAT {
143
144
TextureFormat :: R16Uint => {
144
- let index =
145
- u16:: from_ne_bytes ( self . data . mesh_id_buffer [ start..end] . try_into ( ) . ok ( ) ?) ;
146
- self . data . visible_mesh_entities [ index as usize ]
145
+ u16:: from_ne_bytes ( texture_bytes. try_into ( ) . ok ( ) ?) as usize
147
146
}
148
147
TextureFormat :: R32Uint => {
149
- let index =
150
- u32:: from_ne_bytes ( self . data . mesh_id_buffer [ start..end] . try_into ( ) . ok ( ) ?) ;
151
- self . data . visible_mesh_entities [ index as usize ]
148
+ u32:: from_ne_bytes ( texture_bytes. try_into ( ) . ok ( ) ?) as usize
152
149
}
153
150
_ => panic ! ( "Unsupported mesh id texture format" ) ,
154
151
} ;
152
+ let entity = self . data . visible_mesh_entities [ index] ;
155
153
156
154
if entity != Entity :: PLACEHOLDER {
157
155
Some ( entity)
You can’t perform that action at this time.
0 commit comments