broken normal maps
This commit is contained in:
parent
89789d5f4a
commit
19c5434d0f
7 changed files with 193 additions and 60 deletions
|
@ -1,3 +1,5 @@
|
|||
use super::model::Vertex;
|
||||
|
||||
pub struct Instance {
|
||||
pub position: cgmath::Vector3<f32>,
|
||||
pub rotation: cgmath::Quaternion<f32>,
|
||||
|
@ -19,8 +21,8 @@ impl Instance {
|
|||
}
|
||||
}
|
||||
|
||||
impl InstanceRaw {
|
||||
pub fn desc<'a>() -> wgpu::VertexBufferLayout<'a> {
|
||||
impl Vertex for InstanceRaw {
|
||||
fn desc<'a>() -> wgpu::VertexBufferLayout<'a> {
|
||||
use std::mem;
|
||||
wgpu::VertexBufferLayout {
|
||||
array_stride: mem::size_of::<InstanceRaw>() as wgpu::BufferAddress,
|
||||
|
@ -31,14 +33,9 @@ impl InstanceRaw {
|
|||
attributes: &[
|
||||
wgpu::VertexAttribute {
|
||||
offset: 0,
|
||||
// While our vertex shader only uses locations 0, and 1 now, in later tutorials we'll
|
||||
// be using 2, 3, and 4, for Vertex. We'll start at slot 5 not conflict with them later
|
||||
shader_location: 5,
|
||||
format: wgpu::VertexFormat::Float32x4,
|
||||
},
|
||||
// A mat4 takes up 4 vertex slots as it is technically 4 vec4s. We need to define a slot
|
||||
// for each vec4. We'll have to reassemble the mat4 in
|
||||
// the shader.
|
||||
wgpu::VertexAttribute {
|
||||
offset: mem::size_of::<[f32; 4]>() as wgpu::BufferAddress,
|
||||
shader_location: 6,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue