mirror of
https://github.com/bevyengine/bevy
synced 2024-12-23 19:43:07 +00:00
79d36e7c28
# Objective - Our crevice is still called "crevice", which we can't use for a release - Users would need to use our "crevice" directly to be able to use the derive macro ## Solution - Rename crevice to bevy_crevice, and crevice-derive to bevy-crevice-derive - Re-export it from bevy_render, and use it from bevy_render everywhere - Fix derive macro to work either from bevy_render, from bevy_crevice, or from bevy ## Remaining - It is currently re-exported as `bevy::render::bevy_crevice`, is it the path we want? - After a brief suggestion to Cart, I changed the version to follow Bevy version instead of crevice, do we want that? - Crevice README.md need to be updated - in the `Cargo.toml`, there are a few things to change. How do we want to change them? How do we keep attributions to original Crevice? ``` authors = ["Lucien Greathouse <me@lpghatguy.com>"] documentation = "https://docs.rs/crevice" homepage = "https://github.com/LPGhatguy/crevice" repository = "https://github.com/LPGhatguy/crevice" ``` Co-authored-by: François <8672791+mockersf@users.noreply.github.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
97 lines
3 KiB
Rust
97 lines
3 KiB
Rust
#![allow(unused_macros)]
|
|
|
|
macro_rules! easy_impl {
|
|
( $( $std_name:ident $imp_ty:ty { $($field:ident),* }, )* ) => {
|
|
$(
|
|
impl crate::std140::AsStd140 for $imp_ty {
|
|
type Output = crate::std140::$std_name;
|
|
|
|
#[inline]
|
|
fn as_std140(&self) -> Self::Output {
|
|
crate::std140::$std_name {
|
|
$(
|
|
$field: self.$field.as_std140(),
|
|
)*
|
|
..bytemuck::Zeroable::zeroed()
|
|
}
|
|
}
|
|
|
|
#[inline]
|
|
fn from_std140(value: Self::Output) -> Self {
|
|
Self {
|
|
$(
|
|
$field: <_ as crate::std140::AsStd140>::from_std140(value.$field),
|
|
)*
|
|
}
|
|
}
|
|
}
|
|
|
|
impl crate::std430::AsStd430 for $imp_ty {
|
|
type Output = crate::std430::$std_name;
|
|
|
|
#[inline]
|
|
fn as_std430(&self) -> Self::Output {
|
|
crate::std430::$std_name {
|
|
$(
|
|
$field: self.$field.as_std430(),
|
|
)*
|
|
..bytemuck::Zeroable::zeroed()
|
|
}
|
|
}
|
|
|
|
#[inline]
|
|
fn from_std430(value: Self::Output) -> Self {
|
|
Self {
|
|
$(
|
|
$field: <_ as crate::std430::AsStd430>::from_std430(value.$field),
|
|
)*
|
|
}
|
|
}
|
|
}
|
|
|
|
unsafe impl crate::glsl::Glsl for $imp_ty {
|
|
const NAME: &'static str = crate::std140::$std_name::NAME;
|
|
}
|
|
)*
|
|
};
|
|
}
|
|
|
|
macro_rules! minty_impl {
|
|
( $( $mint_ty:ty => $imp_ty:ty, )* ) => {
|
|
$(
|
|
impl crate::std140::AsStd140 for $imp_ty {
|
|
type Output = <$mint_ty as crate::std140::AsStd140>::Output;
|
|
|
|
#[inline]
|
|
fn as_std140(&self) -> Self::Output {
|
|
let mint: $mint_ty = (*self).into();
|
|
mint.as_std140()
|
|
}
|
|
|
|
#[inline]
|
|
fn from_std140(value: Self::Output) -> Self {
|
|
<$mint_ty>::from_std140(value).into()
|
|
}
|
|
}
|
|
|
|
impl crate::std430::AsStd430 for $imp_ty {
|
|
type Output = <$mint_ty as crate::std430::AsStd430>::Output;
|
|
|
|
#[inline]
|
|
fn as_std430(&self) -> Self::Output {
|
|
let mint: $mint_ty = (*self).into();
|
|
mint.as_std430()
|
|
}
|
|
|
|
#[inline]
|
|
fn from_std430(value: Self::Output) -> Self {
|
|
<$mint_ty>::from_std430(value).into()
|
|
}
|
|
}
|
|
|
|
unsafe impl crate::glsl::Glsl for $imp_ty {
|
|
const NAME: &'static str = <$mint_ty>::NAME;
|
|
}
|
|
)*
|
|
};
|
|
}
|