- Was originally resizing the pixel buffer with `PhysicalSize` units, which is definitely incorrect. (The pixel buffer is created with `LogicalSize` units.)
- Updated the World struct to retain its own size information.
- This issue can be seen when creating a window and pixel buffer that have differing sizes; the image will be stretched to fill the window.
- If the window supports the resize callback to correct the image aspect ratio, resizing the window will correct the matrix immediately, adding the black border as expected. This is a jarring effect when the texture size ratio is not an integer.
- This bug also causes issues with the new `resize_buffer()` API.
- The dependencies are a mess!
- Had to fork `imgui-wgpu`, which sits between 0.12 and 0.13 (has support for `winit` 0.24, but not `wgpu` 0.7)
- This is a temporary fix for CI, until https://github.com/Yatekii/imgui-wgpu-rs/pull/44 is merged and a new release of `imgui-wgpu` is out
- The WIP `wgpu` 0.7 update in https://github.com/parasyte/pixels/pull/134 will be needed for `imgui-wgpu` 0.14
- Update MSRV for `imgui` 0.7
This method is needed to let the user of the API configure the texture
format of the target texture/render texture that the surface texture is
rendered on. This texture format is hardware/platform dependent.
For example, this method makes it possible to use the pixels crate on
Android because Android seems not to use the previously hard-coded
texture format wgpu::TextureFormat::Bgra8UnormSrgb.
* Add Dear ImGui example
- Closes#90
* Change argument order to match `render_with`
* Remove unnecessary borrow
* Refactor error messages
* Add a space
* Refactor Gui field privacy
* Add a menu bar and allow the about window to be closed
- The local bool is necessary because the menu bar closures are not allowed to borrow `self` for mutable access while `imgui::Ui<'ui>` is alive.
- The token-based menu bar lifetime is even more verbose than this.
- I don't want to publish this crate.
- Can't publish pixels 0.2.0 if it depends on an internal unpublished crate.
- This requires allowing unsafe code, and removing the safety dance badge.
* WIP: Render API v2
* Fix doctests
* Expose all of PixelsContext (#110)
* Fix ScalingRenderer::new() taking &mut Device
* Replace getters with direct access to &mut PixelsContext
* Fix wrong reference type
* Fix unneeded mut
* Remove unnecessary mutable borrow, resurrect the shorter getter methods
* Initial port to wgpu master (0.6)
Surface creation is broken (see examples)
Does not support compressed textures
* Fix SurfaceTexture and examples
* Add support for compressed texture formats
* resize doesn't need mutability
* Update documentation
* Update wgpu
* Prepare release
* Goodbye Travis! Thanks for all the fish
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
* Add a method to convert cursor coords to pixel coords
* Add method `window_pos_to_pixel` to Pixels struct
* Converts cursor / window physical coordinates to pixel coords
* Fix formatting
* Return result rather than clamping pixel coordinates
* Use transformation matrices to convert from cursor coord to pixel
* Adds a struct ScalingMatrix that manages the creation and usage
of the transformation matrix used in the renderer.
* Added an inverse function on ScalingMatrix - 4x4 matrix inverse
(This should probably use a library, but it doesn't seem worth
adding a dependancy for one function)
* Optimize matrix multiplication for cursor position calculation
* Use ultraviolet for matrix and vector math
* Add suggested changes
This keeps the split between usize and isize
This also changes the input cursor position to f32, because it was
immediately cast to an f32 for the transformations.
* Add builder methods for VSync and setting wgpu backends
* enable_vsync sets the VSync mode
* wgpu_backend sets the wgpu BackendBit struct
* Made RequestAdapterOptions use compatible_surface by default
* Internally store wgpu::PresentMode for enabling vsync
This doesn't expose the PresentMode for the external api, because
the variants of PresentMode aren't very obvious to people without
wgpu experience. Mailbox corresponds to VSync enabled, and
Immediate corresponds to VSync disabled.