mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 22:20:20 +00:00
shader_def: use to_upper instead of to_screaming_snake
This commit is contained in:
parent
4d17763c85
commit
e523dc92d8
4 changed files with 10 additions and 10 deletions
|
@ -151,10 +151,10 @@ pub fn derive_uniforms(input: TokenStream) -> TokenStream {
|
|||
|
||||
let struct_name = &ast.ident;
|
||||
let struct_name_string = struct_name.to_string();
|
||||
let struct_name_screaming_snake = struct_name.to_string().to_screaming_snake_case();
|
||||
let field_infos_ident = format_ident!("{}_FIELD_INFO", struct_name_screaming_snake);
|
||||
let struct_name_uppercase = struct_name.to_string().to_uppercase();
|
||||
let field_infos_ident = format_ident!("{}_FIELD_INFO", struct_name_uppercase);
|
||||
let vertex_buffer_descriptor_ident =
|
||||
format_ident!("{}_VERTEX_BUFFER_DESCRIPTOR", struct_name_screaming_snake);
|
||||
format_ident!("{}_VERTEX_BUFFER_DESCRIPTOR", struct_name_uppercase);
|
||||
|
||||
let active_uniform_field_names = active_uniform_fields
|
||||
.iter()
|
||||
|
@ -342,7 +342,7 @@ pub fn derive_uniforms(input: TokenStream) -> TokenStream {
|
|||
|
||||
Some(potential_shader_defs.drain(..)
|
||||
.filter(|(f, shader_def)| shader_def.is_some())
|
||||
.map(|(f, shader_def)| format!("{}_{}{}", #struct_name_screaming_snake, f, shader_def.unwrap()))
|
||||
.map(|(f, shader_def)| format!("{}_{}{}", #struct_name_uppercase, f, shader_def.unwrap()))
|
||||
.collect::<Vec<String>>())
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ fn main() {
|
|||
.add_defaults()
|
||||
.setup_render_graph(|render_graph_builder| {
|
||||
render_graph_builder
|
||||
.add_resource_provider(UniformResourceProvider::<MyMaterial>::new())
|
||||
.add_resource_provider(UniformResourceProvider::<MyMaterial>::new(true))
|
||||
.add_pipeline_to_pass(resource_name::pass::MAIN, "MyMaterial", |builder| {
|
||||
builder
|
||||
.with_vertex_shader(Shader::from_glsl(
|
||||
|
@ -45,13 +45,13 @@ fn main() {
|
|||
void main() {
|
||||
o_Target = color;
|
||||
|
||||
# ifdef MY_MATERIAL_ALWAYS_RED
|
||||
# ifdef MYMATERIAL_ALWAYS_RED
|
||||
o_Target = vec4(0.8, 0.0, 0.0, 1.0);
|
||||
# endif
|
||||
}
|
||||
"#,
|
||||
))
|
||||
.with_standard_config();
|
||||
.with_default_config();
|
||||
});
|
||||
})
|
||||
.setup_world(setup)
|
||||
|
|
|
@ -236,7 +236,7 @@ impl<'a> PipelineBuilder<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn with_standard_config(&mut self) -> &mut Self {
|
||||
pub fn with_default_config(&mut self) -> &mut Self {
|
||||
self.with_depth_stencil_state(DepthStencilStateDescriptor {
|
||||
format: TextureFormat::Depth32Float,
|
||||
depth_write_enabled: true,
|
||||
|
|
|
@ -27,14 +27,14 @@ layout(set = 2, binding = 1) uniform StandardMaterial_albedo {
|
|||
vec4 Albedo;
|
||||
};
|
||||
|
||||
# ifdef STANDARD_MATERIAL_ALBEDO_TEXTURE
|
||||
# ifdef STANDARDMATERIAL_ALBEDO_TEXTURE
|
||||
layout(set = 3, binding = 1) uniform texture2D StandardMaterial_albedo_texture;
|
||||
layout(set = 3, binding = 2) uniform sampler StandardMaterial_albedo_texture_sampler;
|
||||
# endif
|
||||
|
||||
void main() {
|
||||
vec4 albedo = Albedo;
|
||||
# ifdef STANDARD_MATERIAL_ALBEDO_TEXTURE
|
||||
# ifdef STANDARDMATERIAL_ALBEDO_TEXTURE
|
||||
albedo *= texture(
|
||||
sampler2D(StandardMaterial_albedo_texture, StandardMaterial_albedo_texture_sampler),
|
||||
v_Uv);
|
||||
|
|
Loading…
Reference in a new issue