|
|
|
@ -23,7 +23,7 @@ use winit::window::Window;
|
|
|
|
|
use crate::camera::{Camera, CameraController};
|
|
|
|
|
use crate::components::{Color, Mesh, Position, RangeCopy};
|
|
|
|
|
use crate::geometry::{create_plane, import_mesh, vertex, Vertex};
|
|
|
|
|
use crate::light::{LightRaw, DirectionalLight};
|
|
|
|
|
use crate::light::{DirectionalLight, LightRaw};
|
|
|
|
|
|
|
|
|
|
#[cfg_attr(rustfmt, rustfmt_skip)]
|
|
|
|
|
#[allow(unused)]
|
|
|
|
@ -109,7 +109,7 @@ pub fn render_test(world: &mut SubWorld, #[resource] renderer: &mut Renderer) {
|
|
|
|
|
let d = Decomposed {
|
|
|
|
|
scale: 1.0,
|
|
|
|
|
rot: Quaternion::from(pos.rot),
|
|
|
|
|
disp: Vector3::new(pos.x, pos.y, pos.z)
|
|
|
|
|
disp: Vector3::new(pos.x, pos.y, pos.z),
|
|
|
|
|
};
|
|
|
|
|
let m = Matrix4::from(d);
|
|
|
|
|
let data = EntityUniforms {
|
|
|
|
@ -135,7 +135,7 @@ pub fn render_test(world: &mut SubWorld, #[resource] renderer: &mut Renderer) {
|
|
|
|
|
renderer.queue.write_buffer(
|
|
|
|
|
&renderer.light_uniform_buf,
|
|
|
|
|
(i * mem::size_of::<LightRaw>()) as wgpu::BufferAddress,
|
|
|
|
|
bytemuck::bytes_of(&light.to_raw(*pos)),
|
|
|
|
|
bytemuck::bytes_of(&light.to_raw()),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -337,6 +337,16 @@ impl Renderer {
|
|
|
|
|
end: 20.0,
|
|
|
|
|
},
|
|
|
|
|
target_view: target.clone(),
|
|
|
|
|
pos: Position {
|
|
|
|
|
x: 0.0,
|
|
|
|
|
y: 0.0,
|
|
|
|
|
z: 0.0,
|
|
|
|
|
rot: Euler {
|
|
|
|
|
x: Deg(0.0),
|
|
|
|
|
y: Deg(-25.0),
|
|
|
|
|
z: Deg(0.0),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -371,7 +381,6 @@ impl Renderer {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn init(window: &Window) -> Renderer {
|
|
|
|
|
|
|
|
|
|
// Grab the GPU instance, and query its features
|
|
|
|
|
let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY);
|
|
|
|
|
let (size, surface) = unsafe {
|
|
|
|
|