byte-engine 0.1.0

A composable Rust game engine focused on graphics, input, audio, physics, and retained UI.
use math::Vector3;

use super::super::cct;
use crate::{
	core::{Entity, EntityHandle},
	inspector::Inspectable,
	rendering::lights::{Light, LightClasses},
};

/// The `DirectionalLight` struct provides parallel scene lighting from a distant
/// source, such as the sun.
#[derive(Debug, Clone, PartialEq)]
pub struct DirectionalLight {
	pub direction: Vector3,
	pub color: Vector3,
}

impl DirectionalLight {
	pub fn new(direction: Vector3, cct: f32) -> Self {
		Self {
			direction,
			color: cct::rgb_from_temperature(cct),
		}
	}
}

impl Light for DirectionalLight {
	fn class(&self) -> LightClasses {
		LightClasses::Directional
	}
}

impl Inspectable for DirectionalLight {
	fn as_string(&self) -> String {
		format!("{:?}", self)
	}
}