mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-09 04:18:28 +00:00
Add transformation matrix for normal vectors
This commit is contained in:
parent
95a2cb4c7d
commit
cc156b43ab
@ -241,12 +241,17 @@ impl Renderer {
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Uniforms {
|
pub struct Uniforms {
|
||||||
pub transform: Mat4,
|
pub transform: Mat4,
|
||||||
|
pub transform_for_normals: Mat4,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Uniforms {
|
impl Default for Uniforms {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let transform = default_transform();
|
let transform = default_transform();
|
||||||
Self { transform }
|
let transform_for_normals = transform.inverse().transpose();
|
||||||
|
Self {
|
||||||
|
transform,
|
||||||
|
transform_for_normals,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
struct Uniforms {
|
struct Uniforms {
|
||||||
transform: mat4x4<f32>,
|
transform: mat4x4<f32>,
|
||||||
|
transform_for_normals: mat4x4<f32>,
|
||||||
};
|
};
|
||||||
|
|
||||||
@group(0) @binding(0)
|
@group(0) @binding(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user