Skip to content

Commit

Permalink
bringing back a vec3
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Feb 28, 2024
1 parent cf5ad37 commit 68f194f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/bevy_pbr/src/pbr_material.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bevy_asset::Asset;
use bevy_math::{Affine2, Mat3, Vec4};
use bevy_math::{Affine2, Mat3, Vec3, Vec4};
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::{mesh::MeshVertexBufferLayout, render_asset::RenderAssets, render_resource::*};

Expand Down Expand Up @@ -598,6 +598,7 @@ pub struct StandardMaterialUniform {
pub attenuation_color: Vec4,
// /// The transform applied to the UVs corresponding to ATTRIBUTE_UV_0 on the mesh before sampling. Default is identity.
// pub uv_transform: Mat3,
pub uv_transform_x: Vec3,
/// Linear perceptual roughness, clamped to [0.089, 1.0] in the shader
/// Defaults to minimum of 0.089
pub roughness: f32,
Expand Down Expand Up @@ -733,6 +734,7 @@ impl AsBindGroupShaderType<StandardMaterialUniform> for StandardMaterial {
max_relief_mapping_search_steps: self.parallax_mapping_method.max_steps(),
deferred_lighting_pass_id: self.deferred_lighting_pass_id as u32,
// uv_transform: self.uv_transform.into(),
uv_transform_x: self.uv_transform.x_axis.extend(0.0),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_pbr/src/render/pbr_types.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ struct StandardMaterial {
emissive: vec4<f32>,
attenuation_color: vec4<f32>,
// uv_transform: mat3x3<f32>,
uv_transform_x: vec3<f32>,
perceptual_roughness: f32,
metallic: f32,
reflectance: f32,
Expand Down Expand Up @@ -79,6 +80,7 @@ fn standard_material_new() -> StandardMaterial {
material.deferred_lighting_pass_id = 1u;
// scale 1, translation 0, rotation 0
// material.uv_transform = mat3x3<f32>(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
material.uv_transform_x = vec3<f32>(1.0, 0.0, 0.0);

return material;
}
Expand Down

0 comments on commit 68f194f

Please sign in to comment.