Zicklag
89217171b4
Add Sprite Flipping ( #1407 )
...
OK, here's my attempt at sprite flipping. There are a couple of points that I need review/help on, but I think the UX is about ideal:
```rust
.spawn(SpriteBundle {
material: materials.add(texture_handle.into()),
sprite: Sprite {
// Flip the sprite along the x axis
flip: SpriteFlip { x: true, y: false },
..Default::default()
},
..Default::default()
});
```
Now for the issues. The big issue is that for some reason, when flipping the UVs on the sprite, there is a light "bleeding" or whatever you call it where the UV tries to sample past the texture boundry and ends up clipping. This is only noticed when resizing the window, though. You can see a screenshot below.
![image](https://user-images.githubusercontent.com/25393315/107098172-397aaa00-67d4-11eb-8e02-c90c820cd70e.png )
I am quite baffled why the texture sampling is overrunning like it is and could use some guidance if anybody knows what might be wrong.
The other issue, which I just worked around, is that I had to remove the `#[render_resources(from_self)]` annotation from the Spritesheet because the `SpriteFlip` render resource wasn't being picked up properly in the shader when using it. I'm not sure what the cause of that was, but by removing the annotation and re-organizing the shader inputs accordingly the problem was fixed.
I'm not sure if this is the most efficient way to do this or if there is a better way, but I wanted to try it out if only for the learning experience. Let me know what you think!
2021-03-03 19:26:45 +00:00
Alexander Sepity
c2a427f1a3
Non-string labels ( #1423 continued) ( #1473 )
...
Non-string labels
2021-02-18 13:20:37 -08:00
Zhixing Zhang
81809c71ce
Update to wgpu-rs 0.7 ( #542 )
...
Update to wgpu-rs 0.7
2021-01-31 20:06:42 -08:00
Alice Cecile
6f5a4d9deb
Rename add_resource to insert_resource ( #1356 )
...
* Renamed add_resource to insert_resource
* Changed usage of add_resource to insert_resource
* Renamed add_thread_local_resource
2021-01-30 12:55:13 -08:00
Jasen Borisov
57f9ac18d7
OrthographicProjection scaling mode + camera bundle refactoring ( #400 )
...
* add normalized orthographic projection
* custom scale for ScaledOrthographicProjection
* allow choosing base axis for ScaledOrthographicProjection
* cargo fmt
* add general (scaled) orthographic camera bundle
FIXME: does the same "far" trick from Camera2DBundle make any sense here?
* fixes
* camera bundles: rename and new ortho constructors
* unify orthographic projections
* give PerspectiveCameraBundle constructors like those of OrthographicCameraBundle
* update examples with new camera bundle syntax
* rename CameraUiBundle to UiCameraBundle
* update examples
* ScalingMode::None
* remove extra blank lines
* sane default bounds for orthographic projection
* fix alien_cake_addict example
* reorder ScalingMode enum variants
* ios example fix
2021-01-30 02:31:03 -08:00
tigregalis
40b5bbd028
Rich text ( #1245 )
...
Rich text support (different fonts / styles within the same text section)
2021-01-24 17:07:43 -08:00
Christopher Durham
4d5ba7918b
Update rand requirement from 0.7 to 0.8 ( #1114 )
...
* Update rand requirement from 0.7 to 0.8
* Update examples' usage of Rng::gen_range
2021-01-17 13:43:03 -08:00
Daniel McNab
9f2410a4ac
Add from_xyz
to Transform
( #1212 )
...
* Add the from_xyz helper method to Transform
* Use `from_xyz` where possible
2021-01-06 17:17:06 -08:00
Nathan Stocks
f574c2c547
Render text in 2D scenes ( #1122 )
...
Render text in 2D scenes
2020-12-27 13:19:03 -06:00
Carter Anderson
841755aaf2
Adopt a Fetch pattern for SystemParams ( #1074 )
2020-12-15 21:57:16 -08:00
Carter Anderson
b12e3bf3bb
Improve usability of StateStage and cut down on "magic" ( #1059 )
...
Improve usability of StateStage and cut down on "magic"
2020-12-14 17:13:22 -08:00
Nathan Jeffords
d2e4327b14
update Window
's width
& height
methods to return f32
( #1033 )
...
update `Window`'s `width` & `height` methods to return `f32`
2020-12-13 15:05:56 -08:00
Mariusz Kryński
9a4327b3e2
fix contributors example ( #1050 )
2020-12-13 11:31:50 -08:00
Carter Anderson
509b138e8f
Schedule v2 ( #1021 )
...
Schedule V2
2020-12-12 18:04:42 -08:00
Nathan Jeffords
3d386a77b4
attempt to deal with rounding issue when creating the swap chain ( #997 )
...
attempt to deal with rounding issue when creating the swap chain on high DPI displays
2020-12-07 13:32:57 -08:00
François
59d98de194
naming coherence for cameras ( #995 )
...
naming coherence for cameras
2020-12-03 13:46:15 -08:00
Joshua J. Bouw
b8f8d468db
ChangeTextureAtlasBuilder
into expected Builder conventions ( #969 )
...
* Change`TextureAtlasBuilder` into expected Builder conventions
2020-12-02 20:54:13 -08:00
Joshua J. Bouw
9f4c8b1b9a
Fix errors and panics to typical Rust conventions ( #968 )
...
Fix errors and panics to typical Rust conventions
2020-12-02 11:31:16 -08:00
Amber Kowalski
097a55948c
Refactor Time API and internals ( #934 )
...
Refactor Time API and internals
2020-11-28 13:08:31 -08:00
rmsthebest
01c4dd96cf
make the timer trigger ( #935 )
...
Co-authored-by: Tony <mostlyharmless@riseup.net>
2020-11-27 13:37:19 -08:00
Nathan Stocks
12f29bd38c
Timer Polishing ( #931 )
...
* Pause stops ticks. Consistent getter method names. Update tests.
* Add timing example
* Format with the nightly formatter
Co-authored-by: Amber Kowalski <amberkowalski03@gmail.com>
2020-11-27 11:39:33 -08:00
Amber Kowalski
f69cc6f94c
Allow timers to be paused and encapsulate fields ( #914 )
...
Allow timers to be paused and encapsulate fields
2020-11-26 11:25:36 -08:00
bjorn3
d6eb647451
Misc cleanups ( #879 )
...
* Remove cfg!(feature = "metal-auto-capture")
This cfg! has existed since the initial commit, but the corresponding
feature has never been part of Cargo.toml
* Remove unnecessary handle_create_window_events call
* Remove EventLoopProxyPtr wrapper
* Remove unnecessary statics
* Fix unrelated deprecation warning to fix CI
2020-11-17 13:40:18 -08:00
Carter Anderson
3a6f6de277
System Inputs, Outputs, Chaining, and Registration Ergo ( #876 )
...
System Inputs, Outputs, Chaining, and Registration Ergo
2020-11-16 18:18:00 -08:00
Carter Anderson
7628f4a64e
combine bevy_ecs and bevy_hecs crates. rename XComponents to XBundle ( #863 )
...
combine bevy_ecs and bevy_hecs crates. rename XComponents to XBundle
2020-11-15 20:32:23 -08:00
MinerSebas
43aac1a784
More query filter usage ( #851 )
...
* Examples now use With<>
* More Bevy systems now use With<>
* parent_update_system now uses Changed<>
2020-11-12 18:22:46 -08:00
Olivier Pinon
465c3d4f7b
Use glyph_brush_layout and add text alignment support ( #765 )
...
Use glyph_brush_layout and add text alignment support
Co-authored-by: Olivier Pinon <op@impero.com>
Co-authored-by: tigregalis <anak.harimau@gmail.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-11-12 16:21:48 -08:00
Carter Anderson
ebcdc9fb8c
Flexible ECS System Params ( #798 )
...
system params can be in any order, faster compiles, remove foreach
2020-11-08 12:34:05 -08:00
karroffel
1c38106f75
add example that represents contributors as bevy icons ( #801 )
2020-11-06 14:35:18 -08:00
Carter Anderson
66f2f76a18
rename add_plugin_group to add_plugins ( #773 )
2020-11-02 19:01:17 -08:00
Nathan Stocks
9871e7e24b
Remove add_default_plugins and add MinimalPlugins for simple "headless" scenarios ( #767 )
...
Remove add_default_plugins and add MinimalPlugins for simple "headless" scenarios
2020-11-02 18:38:37 -08:00
Carter Anderson
1d4a95db62
ecs: ergonomic query.iter(), remove locks, add QuerySets ( #741 )
2020-10-29 23:39:55 -07:00
Carter Anderson
c32e637384
Asset system rework and GLTF scene loading ( #693 )
2020-10-18 13:48:15 -07:00
Marek Legris
5acebed731
Transform and GlobalTransform are now Similarities ( #596 )
...
Transform and GlobalTransform are now Similarities.
This resolves precision errors and simplifies the api
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-10-18 13:03:16 -07:00
M
9c48e5cccb
Add a way to specify padding/ margins between sprites in a TextureAtlas. ( #460 )
...
Add a way to specify padding between sprites in a TextureAtlas
2020-10-14 20:49:07 -07:00
Carter Anderson
ad7613c674
Fix set_scale and set_rotation in new Transform api ( #500 )
2020-09-16 00:19:14 -07:00
Marek Legris
474bb5403e
Transform Rewrite ( #374 )
...
Remove individual Translation / Rotation / Scale components in favor of a combined Transform component
2020-09-14 14:00:32 -07:00
8bp
68d419d40f
Add repeating flag to Timer ( #165 )
...
Repeating timers will reset themselves upon finishing, carrying over any
excess time during the last tick. This fixes timer drift upon resetting.
2020-08-21 14:57:25 -07:00
Carter Anderson
bd8e979de8
ecs: only borrow/iterate archetypes currently used by a given query
2020-07-28 16:37:37 -07:00
Carter Anderson
7212b70478
rustfmt changes
2020-07-28 14:24:03 -07:00
Carter Anderson
6dadf34401
add more example comments
2020-07-28 13:45:36 -07:00
Carter Anderson
0c2e26ddde
Revert "ecs: remove &mut requirement on query iterators"
...
This reverts commit 6dc1d07cbc
.
2020-07-21 20:12:15 -07:00
Carter Anderson
6dc1d07cbc
ecs: remove &mut requirement on query iterators
2020-07-20 13:59:51 -07:00
Carter Anderson
726eb37198
use rh coordinate system in 2d
...
z = 0 is now "farthest back" and z=1000 "farthest forward"
2020-07-19 17:00:08 -07:00
Carter Anderson
19fe299f5a
ecs: use Mut<T> tracking pointer everywhere
2020-07-18 02:09:55 -07:00
Carter Anderson
1db77b2435
examples: cleanup imports
2020-07-16 17:20:42 -07:00
Carter Anderson
950e50bbb1
Bevy ECS migration
2020-07-10 01:06:21 -07:00
Carter Anderson
1f12964026
legion: remove foreach system functions
...
this is a bit sad, but upstream legion's new lifetimes appear to be incompatible with our foreach approach
2020-06-27 12:06:12 -07:00
Carter Anderson
e75496772e
legion: change query system ordering
2020-06-27 10:18:27 -07:00
Carter Anderson
92c44320ee
ecs: rename EntityArchetype to ComponentSet
2020-06-25 11:21:56 -07:00
Carter Anderson
e921ae0199
sprite: use bevy_transform types in sprite sheet entities
2020-06-22 12:35:33 -07:00
Carter Anderson
f1786ec20a
sprite: use bevy_transform types in sprite entities
2020-06-22 12:14:40 -07:00
Carter Anderson
faacd2778d
sprite: add color to TextureAtlasSprite and make Vec3 16 bytes again to account for glsl UBO layout
2020-06-21 17:43:36 -07:00
Carter Anderson
4246d47fec
render: move pipeline compilation and bind group creation into draw stage. impl ResourceSet for DrawContext. progress on text drawing. general cleanup
2020-06-18 17:27:20 -07:00
Carter Anderson
e855995145
cargo fmt
2020-06-15 12:47:35 -07:00
Carter Anderson
f2b3b909b4
sprite: use rectangle_pack crate for texture atlases. rename guillotiere implementation to DynamicTextureAtlasBuilder
2020-06-07 11:30:04 -07:00
Carter Anderson
6164ea6ecc
sprite: dynamically resize atlas during build
2020-06-06 16:16:58 -07:00
Carter Anderson
2705e5cbb4
add texture atlases
2020-06-06 00:12:38 -07:00
Carter Anderson
9d80b5965e
example: add rpg assets for use in examples (maybe pair this down in the future)
2020-06-05 17:26:41 -07:00
Carter Anderson
db6a365b13
saner orthographic projection
2020-06-04 17:09:24 -07:00
Carter Anderson
a4c15f96de
Timer Resource/Component
2020-06-03 19:53:41 -07:00
Carter Anderson
5927bad382
sprite sheets are fully operational
2020-06-03 19:00:19 -07:00
Carter Anderson
5bcd594cb4
bytes: AsBytes trait, remove zerocopy, remove glam fork
2020-06-01 19:38:05 -07:00
Carter Anderson
e68ae995f8
rename rect to quad
2020-05-31 23:39:20 -07:00
Carter Anderson
6e76296ce0
sprite: create sprite crate. center 2d camera (split from ui camera). add 2d camera movement
2020-05-30 12:31:04 -07:00
Carter Anderson
71b3755633
camera: split 2d and ui camera. remove resource_name mod
2020-05-29 22:30:07 -07:00
Carter Anderson
fec9034644
camera: break out projection components
2020-05-29 17:25:14 -07:00
Carter Anderson
bf7f222318
Support async texture loading
2020-05-15 19:30:02 -07:00
Carter Anderson
8a61ef48d3
use relative paths for assets
2020-05-14 15:25:43 -07:00
Carter Anderson
6381611e89
Resource -> Res, Ref->Com
2020-05-13 17:57:08 -07:00
Carter Anderson
06f3a4efb9
Use system fns for all setup code
2020-05-13 17:31:56 -07:00
Carter Anderson
70f122b92a
Rename AssetStorage to Assets
2020-05-13 16:45:18 -07:00
Carter Anderson
73cc20768c
remove pathfinder code
...
its not ready yet so it shouldnt be on master :)
2020-05-12 16:35:49 -07:00
Carter Anderson
35e1d8b498
pathfinder: more backend work. it now renders the clear color without crashing
2020-05-11 09:01:31 -07:00
Carter Anderson
c5ca59dc4d
cargo fmt
2020-05-05 18:44:32 -07:00
Carter Anderson
dcc34473e5
sprites
2020-05-04 01:23:40 -07:00