mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 22:18:33 +00:00
Replace Bytes with Byteable for TextureAtlasSprite (#874)
Replace Bytes with Byteable for TextureAtlasSprite
This commit is contained in:
parent
4fecb899aa
commit
b4a864ba5a
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
use crate::Rect;
|
use crate::Rect;
|
||||||
use bevy_asset::Handle;
|
use bevy_asset::Handle;
|
||||||
use bevy_core::Bytes;
|
use bevy_core::Byteable;
|
||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
color::Color,
|
color::Color,
|
||||||
|
@ -25,9 +25,7 @@ pub struct TextureAtlas {
|
||||||
pub texture_handles: Option<HashMap<Handle<Texture>, usize>>,
|
pub texture_handles: Option<HashMap<Handle<Texture>, usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: cannot do `unsafe impl Byteable` here because Vec3 takes up the space of a Vec4. If/when glam changes this we can swap out
|
#[derive(Debug, RenderResources, RenderResource)]
|
||||||
// Bytes for Byteable as a micro-optimization. https://github.com/bitshifter/glam-rs/issues/36
|
|
||||||
#[derive(Bytes, Debug, RenderResources, RenderResource)]
|
|
||||||
#[render_resources(from_self)]
|
#[render_resources(from_self)]
|
||||||
pub struct TextureAtlasSprite {
|
pub struct TextureAtlasSprite {
|
||||||
pub color: Color,
|
pub color: Color,
|
||||||
|
@ -43,6 +41,8 @@ impl Default for TextureAtlasSprite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe impl Byteable for TextureAtlasSprite {}
|
||||||
|
|
||||||
impl TextureAtlasSprite {
|
impl TextureAtlasSprite {
|
||||||
pub fn new(index: u32) -> TextureAtlasSprite {
|
pub fn new(index: u32) -> TextureAtlasSprite {
|
||||||
Self {
|
Self {
|
||||||
|
|
Loading…
Add table
Reference in a new issue