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::{Zeroable, Pod};
use crate::{OPENGL_TO_WGPU_MATRIX, DirectionalLight, Position};
use cgmath::Point3;
#[repr(C)]
@ -16,10 +17,10 @@ unsafe impl Pod for LightRaw {}
unsafe impl Zeroable for LightRaw {}
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};
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 projection = PerspectiveFov {
fovy: Deg(self.fov).into(),

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

Loading…
Cancel
Save