going to switch the lights over to using position, or maybe flesh out directional light more
This commit is contained in:
12
src/light.rs
12
src/light.rs
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user