Fixed accidental indentation change

pull/347/head
disdamoe 2 years ago
parent eca31a5ed5
commit 03e905cc4d

@ -234,17 +234,17 @@ You'll then need to run the WASM code in an ES6 Module:
</head>
<body>
<script type="module">
import init from "./pkg/pong.js";
init().then(() => {
console.log("WASM Loaded");
});
</script>
<style>
canvas {
background-color: black;
}
</style>
<script type="module">
import init from "./pkg/pong.js";
init().then(() => {
console.log("WASM Loaded");
});
</script>
<style>
canvas {
background-color: black;
}
</style>
</body>
</html>

@ -487,4 +487,4 @@ Modify the `input()` method to capture mouse events, and update the clear color
<WasmExample example="tutorial2_surface"></WasmExample>
<AutoGithubLink/>
<AutoGithubLink/>

@ -313,4 +313,4 @@ Create a second pipeline that uses the triangle's position data to create a colo
<WasmExample example="tutorial3_pipeline"></WasmExample>
<AutoGithubLink/>
<AutoGithubLink/>

@ -444,4 +444,4 @@ Create a more complex shape than the one we made (aka. more than three triangles
<WasmExample example="tutorial4_buffer"></WasmExample>
<AutoGithubLink/>
<AutoGithubLink/>

@ -607,4 +607,4 @@ Create another texture and swap it out when you press the space key.
<WasmExample example="tutorial5_textures"></WasmExample>
<AutoGithubLink/>
<AutoGithubLink/>

@ -421,4 +421,4 @@ Have our model rotate on its own independently of the camera. *Hint: you'll need
<WasmExample example="tutorial6_uniforms"></WasmExample>
<AutoGithubLink/>
<AutoGithubLink/>

@ -127,11 +127,11 @@ Now that we have our data, we can create the actual `instance_buffer`.
```rust
let instance_data = instances.iter().map(Instance::to_raw).collect::<Vec<_>>();
let instance_buffer = device.create_buffer_init(
&wgpu::util::BufferInitDescriptor {
label: Some("Instance Buffer"),
contents: bytemuck::cast_slice(&instance_data),
usage: wgpu::BufferUsages::VERTEX,
}
&wgpu::util::BufferInitDescriptor {
label: Some("Instance Buffer"),
contents: bytemuck::cast_slice(&instance_data),
usage: wgpu::BufferUsages::VERTEX,
}
);
```
@ -183,13 +183,13 @@ We need to add this descriptor to the render pipeline so that we can use it when
```rust
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
// ...
vertex: wgpu::VertexState {
// ...
// UPDATED!
buffers: &[Vertex::desc(), InstanceRaw::desc()],
},
// ...
// ...
vertex: wgpu::VertexState {
// ...
// UPDATED!
buffers: &[Vertex::desc(), InstanceRaw::desc()],
},
// ...
});
```
@ -197,10 +197,10 @@ Don't forget to return our new variables!
```rust
Self {
// ...
// NEW!
instances,
instance_buffer,
// ...
// NEW!
instances,
instance_buffer,
}
```

@ -141,15 +141,15 @@ The last change we need to make is in the `render()` function. We've created the
```rust
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
// ...
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: &self.depth_texture.view,
depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0),
store: true,
}),
stencil_ops: None,
}),
// ...
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: &self.depth_texture.view,
depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0),
store: true,
}),
stencil_ops: None,
}),
});
```
@ -163,4 +163,4 @@ Since the depth buffer is a texture, we can sample it in the shader. Because it'
<WasmExample example="tutorial8_depth"></WasmExample>
<AutoGithubLink/>
<AutoGithubLink/>

@ -549,8 +549,8 @@ pub trait DrawModel<'a> {
}
impl<'a, 'b> DrawModel<'b> for wgpu::RenderPass<'a>
where
'b: 'a, {
where
'b: 'a, {
// ...
fn draw_model(&mut self, model: &'b Model, camera_bind_group: &'b wgpu::BindGroup) {
self.draw_model_instanced(model, 0..1, camera_bind_group);

Loading…
Cancel
Save