going to switch the lights over to using position, or maybe flesh out directional light more

This commit is contained in:
2021-02-13 23:05:45 -08:00
parent 2c9ce75b8b
commit 9665a70bac
7 changed files with 220 additions and 105 deletions

View File

@@ -2,7 +2,9 @@ use bytemuck::__core::ops::Range;
use bytemuck::{Zeroable, Pod};
use cgmath::Point3;
use crate::render::OPENGL_TO_WGPU_MATRIX;
use crate::components::DirectionalLight;
use std::sync::Arc;
use wgpu::TextureView;
use crate::components::RangeCopy;
#[repr(C)]
@@ -17,6 +19,14 @@ unsafe impl Pod for LightRaw {}
unsafe impl Zeroable for LightRaw {}
#[derive(Clone, Debug)]
pub struct DirectionalLight {
pub color: wgpu::Color,
pub fov: f32,
pub depth: RangeCopy<f32>,
pub target_view: Arc<TextureView>,
}
impl DirectionalLight {
pub fn to_raw(&self, pos: Point3<f32>) -> LightRaw {
use cgmath::{Deg, EuclideanSpace, Matrix4, PerspectiveFov, Point3, Vector3};