+2
-4
src/app.rs
+2
-4
src/app.rs
···
1
-
mod gfx_state;
2
-
3
-
use gfx_state::{Gfx, GfxBuilder, MaybeGfx};
1
+
use crate::gfx::{Gfx, GfxBuilder, MaybeGfx};
4
2
use std::sync::Arc;
5
3
use winit::{
6
4
application::ApplicationHandler,
···
10
8
window::{Window, WindowAttributes, WindowId},
11
9
};
12
10
13
-
const WASM_WIN_SIZE: (u32, u32) = (640, 480);
11
+
pub(crate) const WASM_WIN_SIZE: (u32, u32) = (640, 480);
14
12
15
13
// TODO citation:
16
14
// https://github.com/Bentebent/rita/ for winit 29.0->30.0 migration
+10
-4
src/app/gfx_state.rs
src/gfx.rs
+10
-4
src/app/gfx_state.rs
src/gfx.rs
···
1
+
mod camera;
2
+
mod model;
3
+
mod resources;
4
+
mod texture;
5
+
1
6
use std::sync::Arc;
2
7
3
8
use glam::{vec3, Quat, Vec3};
···
5
10
use winit::{dpi::PhysicalSize, event::{ElementState, KeyEvent, WindowEvent}, event_loop::EventLoopProxy, keyboard::{KeyCode, PhysicalKey}, window::Window};
6
11
7
12
use crate::{
8
-
app::WASM_WIN_SIZE, camera, model::{self, Vertex}, resources, texture, Instance, InstanceRaw, NUM_INSTANCES_PER_ROW
13
+
app::WASM_WIN_SIZE,
14
+
gfx::model::Vertex, Instance, InstanceRaw, NUM_INSTANCES_PER_ROW
9
15
};
10
16
11
17
struct CameraState {
···
165
171
let depth_texture =
166
172
texture::Texture::create_depth_texture(&device, &surface_config, "depth_texture");
167
173
168
-
let diffuse_bytes = include_bytes!("../happy-tree.png");
174
+
let diffuse_bytes = include_bytes!("../res/happy-tree.png");
169
175
let diffuse_texture =
170
176
texture::Texture::from_bytes(&device, &queue, diffuse_bytes, "happy_tree.png").unwrap();
171
177
···
285
291
286
292
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
287
293
label: Some("Shader"),
288
-
source: wgpu::ShaderSource::Wgsl(include_str!("../shader.wgsl").into()),
294
+
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
289
295
});
290
296
291
297
let render_pipeline_layout =
···
433
439
&self.render_pipeline.0
434
440
});
435
441
436
-
use crate::model::DrawModel;
442
+
use crate::gfx::model::DrawModel;
437
443
render_pass.draw_model_instanced(
438
444
&self.object.model,
439
445
0..self.object.instances.len() as u32,
src/camera.rs
src/gfx/camera.rs
src/camera.rs
src/gfx/camera.rs
src/happy-tree.png
res/happy-tree.png
src/happy-tree.png
res/happy-tree.png
+1
-4
src/lib.rs
+1
-4
src/lib.rs
+2
-1
src/model.rs
src/gfx/model.rs
+2
-1
src/model.rs
src/gfx/model.rs
+2
-1
src/resources.rs
src/gfx/resources.rs
+2
-1
src/resources.rs
src/gfx/resources.rs
src/texture.rs
src/gfx/texture.rs
src/texture.rs
src/gfx/texture.rs