Commit graph

97 commits

Author SHA1 Message Date
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
Rob Parrett
110ff77db9
Fix regression causing "flipped" sprites to be invisible (#1399)
Regressed in 81809c71ce
2021-02-04 20:17:11 -08:00
François
6b8f8a7ed0
Texture atlas format and conversion (#1365)
* can specify texture format for a texture atlas
* add automatic conversion
2021-02-01 11:30:11 -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
Nathan Jeffords
b8fb462eff
Text2d render quality (#1171)
improve quality of text2d rendering

* remove coordinate tweaking in sprite-sheet shader
* fixes glyph shimmering of animated text
* reposition glyph before passing it to ab_glyph to normalize its rendering

The result of layout of sequence of glyphs causes individuals to have fractional positions, but since glyph renderings are reused for future instances of that glyph, this produces errors. This change accepts the errors but repositions the glyph to "0, 0" in an effort to get the cleanest possible rendering.
2021-01-01 15:36:00 -06:00
Matthias Seiffert
030ccf1984
Derive Clone for SpriteSheetBundle and SpriteBundle (#1177)
* Derive Clone for TextureAtlasSprite and SpriteSheetBundle

* Derive Clone for Sprite and SpriteBundle
2021-01-01 14:52:09 -06:00
Carter Anderson
3b2c6ce49b
release 0.4.0 (#1093) 2020-12-19 13:28:00 -06:00
Carter Anderson
841755aaf2
Adopt a Fetch pattern for SystemParams (#1074) 2020-12-15 21:57:16 -08:00
Carter Anderson
7ab0eeece0
Break out Visible component from Draw (#1034)
Break out Visible component from Draw
2020-12-09 13:38:48 -08:00
Carter Anderson
704a116778
fix scene loading (#988) 2020-12-03 13:57:36 -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
Carter Anderson
b5ffab7135
Renderer Optimization Round 1 (#958)
* only update global transforms when they (or their ancestors) have changed

* only update render resource nodes when they have changed (quality check plz)

* only update entity mesh specialization when mesh (or mesh component) has changed

* only update sprite size when changed

* remove stale bind groups

* fix setting size of loading sprites

* store unmatched render resource binding results

* reduce state changes

* cargo fmt + clippy

* remove cached "NoMatch" results when new bindings are added to RenderResourceBindings

* inline current_entity in world_builder

* try creating bind groups even when they havent changed

* render_resources_node: update all entities when resized

* fmt
2020-12-01 13:17:48 -08:00
Andre Kuehne
0b818d7b32
Fix collision detection by calculating positive penetration depth. (#966) 2020-12-01 00:33:52 -08:00
Carter Anderson
72b2fc9843
Bevy Reflection (#926)
Bevy Reflection
2020-11-27 16:39:59 -08:00
Duncan
46fac78774
Extend the Texture asset type to support 3D data (#903)
Extend the Texture asset type to support 3D data

Textures are still loaded from images as 2D, but they can be reshaped
according to how the render pipeline would like to use them.

Also add an example of how this can be used with the texture2DArray uniform type.
2020-11-22 12:04:47 -08:00
rod-salazar
85ecab8bb9
Tweaks to TextureAtlasBuilder.finish() (#887)
Tweaks to TextureAtlasBuilder.finish()
2020-11-21 12:55:25 -08:00
Joshua J. Bouw
b4a864ba5a
Replace Bytes with Byteable for TextureAtlasSprite (#874)
Replace Bytes with Byteable for TextureAtlasSprite
2020-11-21 11:48:10 -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
Mariusz Kryński
60fa2d5f93
delegate layout reflection to RenderResourceContext (#691)
* delegate layout reflection to RenderResourceContext
Also:
 * auto-reflect DynamicBindings
 * use RenderPipeline::new, update dynamic_bindings

linting.

* add dynamic binding generation

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-11-10 13:20:05 -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
Carter Anderson
9afe196f16
release: 0.3.0 (#783) 2020-11-03 13:34:00 -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
David Ackerman
7ba45849f3
Add default for texture format (#675) 2020-10-16 11:44:31 -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
df64e1fc92
upgrade rectangle pack (#673) 2020-10-12 18:12:17 -07:00
Grayson Burton
354d71cc1f
The Great Debuggening (#632)
The Great Debuggening
2020-10-08 11:43:01 -07:00
Carter Anderson
74dba5f36b
release: 0.2.1 (#533) 2020-09-20 15:58:32 -07:00
Carter Anderson
ba5af4dd56
release: 0.2.0 (#520) 2020-09-19 15:29:08 -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
Smite Rust
a9ce7f4e82
update dependencies (#470) 2020-09-10 12:54:24 -07:00
Sergey Minakov
52ae217b16
Resize mode for Sprite component (#430)
Adds a 'resize_mode' field for 'Sprite'.
This allows different resize handling based on 'SpriteResizeMode' enum value.
2020-09-08 12:04:22 -07:00
Carter Anderson
413caae7bb resolve errors from latest clippy version 2020-09-07 15:00:03 -07:00
Robbie Davenport
4aabe983ec
Switch usage of std HashMap/HashSet default hasher, to aHash algo (#258)
switch to ahash for HashMaps and HashSets via a new bevy_utils crate
2020-08-28 17:08:51 -07:00
Grant Moyer
e6a57bad25
Fix sprite clipping at same depth (#385) 2020-08-28 16:45:54 -07:00
Xavientois
0ae74a4a4d
Some examples of documentation (#338) 2020-08-24 17:57:10 -07:00
Carter Anderson
b925e22949 0.1.3 upgrade 2020-08-22 10:16:52 -07:00
kaflu
2dadc86fb0
Change CullMode to none for sprites (#241)
With `CullMode::Back`, a sprite image that is rotated in x,y plane won't display properly

Co-authored-by: kaflu <kaflu@users.noreply.github.com>
2020-08-21 19:52:31 -07:00
Carter Anderson
7c3b49cb6f upgrade to latest wgpu 2020-08-21 18:36:32 -07:00
Victor "multun" Collod
c38420f1e9 enforce clippy for all target and features 2020-08-16 07:20:06 -07:00
Carter Anderson
34752a27bd add "0.1" version to all bevy crate references 2020-08-09 17:39:28 -07:00
Carter Anderson
9aee5323e1 add crate metadata 2020-08-09 17:24:27 -07:00
Carter Anderson
3d09459813 add more doc comments and clean up some public exports 2020-08-09 16:13:04 -07:00
Carter Anderson
f963cd41dc app: rename AppPlugin to Plugin 2020-08-07 20:22:17 -07:00
Carter Anderson
ccf81edd8f render: add atlas padding support to work around MSAA artifacts, disable MSAA by default 2020-07-30 14:38:13 -07:00
Carter Anderson
2929197d9b render: add RenderPass queries. move ui to its own pass 2020-07-28 20:11:27 -07:00