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
Thomas Herzog
4cf0f53eae
use TextureFormat for Textures
...
This commit also inserts debug asserts that texture data roughly respects
the format.
2020-07-26 22:08:15 +02: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
b5d3f7e794
use right handed coordinate system in 3d
2020-07-20 01:33:30 -07:00
Carter Anderson
19fe299f5a
ecs: use Mut<T> tracking pointer everywhere
2020-07-18 02:09:55 -07:00
Carter Anderson
81df34adcf
finish up import simplification
2020-07-16 19:38:21 -07:00
Carter Anderson
f742ce3ef2
app: simplify app imports
2020-07-16 18:47:51 -07:00
Carter Anderson
b12c4d0a48
render: simplify imports and cleanup prelude
2020-07-16 18:26:21 -07:00
Carter Anderson
196bde64e3
cargo fmt
2020-07-16 17:23:50 -07:00
Carter Anderson
1110f9b877
create bevy_math crate and move math types there
2020-07-16 17:11:52 -07:00
Carter Anderson
c81ab99dac
cargo fmt
2020-07-10 01:37:06 -07:00
Carter Anderson
950e50bbb1
Bevy ECS migration
2020-07-10 01:06:21 -07:00
Carter Anderson
5787bcb2c5
legion: upgrade
2020-06-27 14:32:50 -07:00
Carter Anderson
7441ac1a01
add breakout example game
2020-06-26 22:04:56 -07:00
Carter Anderson
5e1f81037d
sprite: add sprite sheet floating point error correction
2020-06-26 13:07:33 -07:00
Carter Anderson
69925f0817
render: multi-window cameras ready to go!
...
passes now bind camera buffers and cameras can now be assigned non-primary windows
2020-06-25 23:04:08 -07:00
Carter Anderson
92c44320ee
ecs: rename EntityArchetype to ComponentSet
2020-06-25 11:21:56 -07:00
Carter Anderson
1ef4fbf005
ui: rework so Nodes now use transforms and z-sort happens
2020-06-25 10:13:00 -07:00
Carter Anderson
75429f4639
render: use left-handed coordinate system and y-up
2020-06-24 15:29:10 -07:00
Carter Anderson
4ba2f72572
render: is_transparent flag. draw transparent object back-to-front and opaque objects front-to-back
2020-06-24 11:35:01 -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
99a3ee6570
fix texture atlas bytes test
2020-06-21 18:26:11 -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
ecea30cadb
text: new atlased rendering finally works!
...
removed old render-to-texture rendering
2020-06-20 12:40:37 -07:00
Carter Anderson
74d0055a3d
render: move dynamic_bindings to PipelineSpecialization
...
This is a temporary step back in ergonomics as we are no longer automatically inferring dynamic bindings from RenderResourceBindings
2020-06-17 18:10:29 -07:00
Carter Anderson
e855995145
cargo fmt
2020-06-15 12:47:35 -07:00
Carter Anderson
f799d3ac93
render: add RenderPipeline and begin moving logic there
2020-06-15 00:08:50 -07:00
Carter Anderson
516cf9ddf0
text: font atlas generation. initial Drawable boilerplate. temporary font atlas debug example
2020-06-13 18:53:31 -07:00
Carter Anderson
fc4160ea41
AssetRenderResourceNodes now consume asset change events. Remove EntitiesWaitingForAssets in favor of DrawState.
2020-06-10 18:54:17 -07:00
Carter Anderson
3d07fbdc81
render: "Immediate Mode" draw api
...
This replaces Renderable with Draw/RenderPipelines components and makes various aspects of the renderer much simpler and legible
2020-06-09 23:16:48 -07:00
Carter Anderson
1426208e2f
remove DrawTargets in favor of PassNodes and in preparation for "immediate mode" drawing api
2020-06-08 14:35:13 -07:00
Carter Anderson
be23f119d5
remove old uniform system
2020-06-07 22:32:55 -07:00
Carter Anderson
62c434274f
shader_defs: new leaner shader defs. they are now separate from uniforms
2020-06-07 22:24:53 -07:00
Carter Anderson
fd8f87400d
add RenderResources/RenderResource traits to replace Uniforms/Uniform
2020-06-07 19:12:41 -07:00
Carter Anderson
5add29f8cf
rename LocalToWorld -> Transform and LocalToParent -> LocalTransform
2020-06-07 13:39:50 -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
db6a365b13
saner orthographic projection
2020-06-04 17:09:24 -07:00
Carter Anderson
6eea96366d
cargo fmt
2020-06-03 20:08:20 -07:00
Carter Anderson
5927bad382
sprite sheets are fully operational
2020-06-03 19:00:19 -07:00
Carter Anderson
13d56907ed
sprite: more sprite sheet work (not quite operable yet)
2020-06-03 11:39:10 -07:00
Carter Anderson
5bcd594cb4
bytes: AsBytes trait, remove zerocopy, remove glam fork
2020-06-01 19:38:05 -07:00
Carter Anderson
d5d0107ada
bytes: remove AsBytes in favor of Bytes
2020-06-01 14:33:00 -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