pub struct PreprocessorInvertSelectionBuffer(/* private fields */);Expand description
The invert selection buffer for Preprocessor.
This is used for inverting the selection in the preprocessor, it is essentially just a boolean.
Implementations§
Source§impl PreprocessorInvertSelectionBuffer
impl PreprocessorInvertSelectionBuffer
Sourcepub fn new(device: &Device) -> Self
pub fn new(device: &Device) -> Self
Create a new invert selection buffer.
Note: the initial value is true.
Sourcepub fn update(&self, queue: &Queue, invert: bool)
pub fn update(&self, queue: &Queue, invert: bool)
Update the invert selection buffer.
Examples found in repository?
examples/selection.rs (line 285)
263 fn update(&mut self, input: &core::Input, delta_time: f32) {
264 // Toggle selection mode
265 if input.pressed_keys.contains(&KeyCode::KeyN) {
266 self.selector_type = None;
267 log::info!("Selector: None");
268 }
269 if input.pressed_keys.contains(&KeyCode::KeyR) {
270 self.selector_type = Some(gs::selection::ViewportSelectorType::Rectangle);
271 log::info!("Selector: Rectangle");
272 self.selector.selector_type = gs::selection::ViewportSelectorType::Rectangle;
273 }
274 if input.pressed_keys.contains(&KeyCode::KeyB) {
275 self.selector_type = Some(gs::selection::ViewportSelectorType::Brush);
276 log::info!("Selector: Brush");
277 self.selector.selector_type = gs::selection::ViewportSelectorType::Brush;
278 }
279 if input.pressed_keys.contains(&KeyCode::KeyI) {
280 self.inverted = !self.inverted;
281 log::info!("Inverted: {}", self.inverted);
282 if self.filter {
283 self.viewer
284 .invert_selection_buffer
285 .update(&self.queue, self.inverted);
286 }
287 }
288
289 if self.selector_type.is_some() {
290 self.update_selection(input, delta_time);
291 } else {
292 self.update_movement(input, delta_time);
293 }
294
295 // Update the viewer
296 self.viewer.update_camera(
297 &self.queue,
298 &self.camera,
299 uvec2(self.config.width, self.config.height),
300 );
301 }Trait Implementations§
Source§impl BufferWrapper for PreprocessorInvertSelectionBuffer
impl BufferWrapper for PreprocessorInvertSelectionBuffer
Source§const DEFAULT_USAGES: BufferUsages = _
const DEFAULT_USAGES: BufferUsages = _
The default usages.
Source§fn download<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
device: &'life1 Device,
queue: &'life2 Queue,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + Sync + 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
fn download<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
device: &'life1 Device,
queue: &'life2 Queue,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: Send + Sync + 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
Download the buffer data into a
Vec.Source§fn prepare_download(
&self,
device: &Device,
encoder: &mut CommandEncoder,
) -> Buffer
fn prepare_download( &self, device: &Device, encoder: &mut CommandEncoder, ) -> Buffer
Prepare for downloading the buffer data. Read more
Source§fn map_download<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
Self: Send + 'async_trait,
fn map_download<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
Self: Send + 'async_trait,
Map the download buffer to read the buffer data. Read more
Source§fn map_download_with_poll_type<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
poll_type: PollType<SubmissionIndex>,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
fn map_download_with_poll_type<'life0, 'life1, 'async_trait, T>(
download: &'life0 Buffer,
device: &'life1 Device,
poll_type: PollType<SubmissionIndex>,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, DownloadBufferError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait + NoUninit + AnyBitPattern,
Map the download buffer to read the buffer data with custom
wgpu::PollType. Read moreSource§impl Clone for PreprocessorInvertSelectionBuffer
impl Clone for PreprocessorInvertSelectionBuffer
Source§fn clone(&self) -> PreprocessorInvertSelectionBuffer
fn clone(&self) -> PreprocessorInvertSelectionBuffer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl FixedSizeBufferWrapper for PreprocessorInvertSelectionBuffer
impl FixedSizeBufferWrapper for PreprocessorInvertSelectionBuffer
Source§fn verify_buffer_size(
buffer: &Buffer,
) -> Result<(), FixedSizeBufferWrapperError>
fn verify_buffer_size( buffer: &Buffer, ) -> Result<(), FixedSizeBufferWrapperError>
Check if the given buffer matches the expected size. Read more
Source§fn download_single(
&self,
device: &Device,
queue: &Queue,
) -> impl Future<Output = Result<Self::Pod, DownloadBufferError>> + Send
fn download_single( &self, device: &Device, queue: &Queue, ) -> impl Future<Output = Result<Self::Pod, DownloadBufferError>> + Send
Download a single
FixedSizeBufferWrapper::Pod.Source§impl From<PreprocessorInvertSelectionBuffer> for Buffer
impl From<PreprocessorInvertSelectionBuffer> for Buffer
Source§fn from(wrapper: PreprocessorInvertSelectionBuffer) -> Self
fn from(wrapper: PreprocessorInvertSelectionBuffer) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PreprocessorInvertSelectionBuffer
impl !RefUnwindSafe for PreprocessorInvertSelectionBuffer
impl Send for PreprocessorInvertSelectionBuffer
impl Sync for PreprocessorInvertSelectionBuffer
impl Unpin for PreprocessorInvertSelectionBuffer
impl UnsafeUnpin for PreprocessorInvertSelectionBuffer
impl !UnwindSafe for PreprocessorInvertSelectionBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more