macros are now fully screaming snake
This commit is contained in:
parent
8a10c06ad5
commit
2f1a0cb4a4
@ -99,7 +99,7 @@ pub fn derive_uniforms(input: TokenStream) -> TokenStream {
|
||||
.collect::<Vec<&Field>>();
|
||||
|
||||
let shader_def_field_names = shader_def_fields.iter().map(|field| &field.ident);
|
||||
let shader_def_field_name_strs = shader_def_fields.iter().map(|field| field.ident.as_ref().unwrap().to_string());
|
||||
let shader_def_field_names_screaming_snake = shader_def_fields.iter().map(|field| field.ident.as_ref().unwrap().to_string().to_screaming_snake_case());
|
||||
|
||||
let struct_name = &ast.ident;
|
||||
let struct_name_screaming_snake = struct_name.to_string().to_screaming_snake_case();
|
||||
@ -161,7 +161,7 @@ pub fn derive_uniforms(input: TokenStream) -> TokenStream {
|
||||
fn get_shader_defs(&self) -> Option<Vec<String>> {
|
||||
use bevy::render::render_graph::ShaderDefSuffixProvider;
|
||||
let mut potential_shader_defs: Vec<(&'static str, Option<&'static str>)> = vec![
|
||||
#((#shader_def_field_name_strs, self.#shader_def_field_names.get_shader_def()),)*
|
||||
#((#shader_def_field_names_screaming_snake, self.#shader_def_field_names.get_shader_def()),)*
|
||||
];
|
||||
|
||||
Some(potential_shader_defs.drain(..)
|
||||
|
@ -60,7 +60,7 @@ fn main() {
|
||||
void main() {
|
||||
o_Target = color;
|
||||
|
||||
# ifdef MY_MATERIAL_always_red
|
||||
# ifdef MY_MATERIAL_ALWAYS_RED
|
||||
o_Target = vec4(0.8, 0.0, 0.0, 1.0);
|
||||
# endif
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ impl From<Handle<Texture>> for ColorSource {
|
||||
impl ShaderDefSuffixProvider for ColorSource {
|
||||
fn get_shader_def(&self) -> Option<&'static str> {
|
||||
match *self {
|
||||
ColorSource::Color(_) => Some("_color"),
|
||||
ColorSource::Texture(_) => Some("_texture"),
|
||||
ColorSource::Color(_) => Some("_COLOR"),
|
||||
ColorSource::Texture(_) => Some("_TEXTURE"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ layout(set = 0, binding = 1) uniform Lights {
|
||||
Light SceneLights[MAX_LIGHTS];
|
||||
};
|
||||
|
||||
# ifdef STANDARD_MATERIAL_albedo_texture
|
||||
# ifdef STANDARD_MATERIAL_ALBEDO_TEXTURE
|
||||
layout(set = 1, binding = 1) uniform texture2D StandardMaterial_albedo_texture;
|
||||
layout(set = 1, binding = 2) uniform sampler StandardMaterial_albedo_sampler;
|
||||
# else
|
||||
@ -33,7 +33,7 @@ layout(set = 1, binding = 1) uniform StandardMaterial_albedo {
|
||||
# endif
|
||||
|
||||
void main() {
|
||||
# ifdef STANDARD_MATERIAL_albedo_texture
|
||||
# ifdef STANDARD_MATERIAL_ALBEDO_TEXTURE
|
||||
vec4 Albedo = texture(
|
||||
sampler2D(StandardMaterial_albedo_texture, StandardMaterial_albedo_sampler),
|
||||
v_Uv);
|
||||
|
@ -28,11 +28,6 @@ impl ShaderDefSuffixProvider for bool {
|
||||
}
|
||||
}
|
||||
|
||||
// pub struct UniformInfo<'a> {
|
||||
// pub name: &'a str,
|
||||
// pub
|
||||
// }
|
||||
|
||||
pub struct UniformInfo<'a> {
|
||||
pub name: &'a str,
|
||||
pub bind_type: BindType,
|
||||
|
Loading…
Reference in New Issue
Block a user