and the problem was a query that I mis-typed. damn

master
mitchellhansen 4 years ago
parent 3d87d11485
commit 9dffd6797c

@ -1,6 +1,7 @@
use bytemuck::__core::ops::Range; use bytemuck::__core::ops::Range;
use bytemuck::{Zeroable, Pod}; use bytemuck::{Zeroable, Pod};
use crate::{OPENGL_TO_WGPU_MATRIX, DirectionalLight, Position}; use crate::{OPENGL_TO_WGPU_MATRIX, DirectionalLight, Position};
use cgmath::Point3;
#[repr(C)] #[repr(C)]
@ -16,10 +17,10 @@ unsafe impl Pod for LightRaw {}
unsafe impl Zeroable for LightRaw {} unsafe impl Zeroable for LightRaw {}
impl DirectionalLight { impl DirectionalLight {
pub fn to_raw(&self, pos: Position) -> LightRaw { pub fn to_raw(&self, pos: Point3<f32>) -> LightRaw {
use cgmath::{Deg, EuclideanSpace, Matrix4, PerspectiveFov, Point3, Vector3}; use cgmath::{Deg, EuclideanSpace, Matrix4, PerspectiveFov, Point3, Vector3};
let pos = cgmath::Point3::new(pos.x, pos.y, pos.z); //let pos = cgmath::Point3::new(pos.x, pos.y, pos.z);
let mx_view = Matrix4::look_at(pos, Point3::origin(), Vector3::unit_z()); let mx_view = Matrix4::look_at(pos, Point3::origin(), Vector3::unit_z());
let projection = PerspectiveFov { let projection = PerspectiveFov {
fovy: Deg(self.fov).into(), fovy: Deg(self.fov).into(),

@ -118,8 +118,8 @@ pub fn render_test(world: &mut SubWorld, #[resource] renderer: &mut Renderer) {
// Update the entity uniforms // Update the entity uniforms
for (pos, mesh, color) in query.iter_mut(world) { for (pos, mesh, color) in query.iter_mut(world) {
// let rotation = cgmath::Matrix4::from_angle_x(cgmath::Deg(1.0)); let rotation = cgmath::Matrix4::from_angle_x(cgmath::Deg(2.0));
// pos.mx = pos.mx * rotation; pos.mx = pos.mx * rotation;
let data = EntityUniforms { let data = EntityUniforms {
model: pos.mx.into(), model: pos.mx.into(),
@ -139,7 +139,7 @@ pub fn render_test(world: &mut SubWorld, #[resource] renderer: &mut Renderer) {
if renderer.lights_are_dirty { if renderer.lights_are_dirty {
//renderer.lights_are_dirty = false; //renderer.lights_are_dirty = false;
let mut query = <(&mut DirectionalLight, &mut Position)>::query(); let mut query = <(&mut DirectionalLight, &mut Point3<f32>)>::query();
for (i, (light, pos)) in query.iter_mut(world).enumerate() { for (i, (light, pos)) in query.iter_mut(world).enumerate() {
renderer.queue.write_buffer( renderer.queue.write_buffer(
&renderer.light_uniform_buf, &renderer.light_uniform_buf,

Loading…
Cancel
Save