mirror of
https://github.com/lisk77/comet.git
synced 2025-10-23 21:38:50 +00:00
feat: added the Color component to the base components in the ECS
This commit is contained in:
parent
4b6b5e64e9
commit
4d4c6aad90
14 changed files with 136 additions and 23 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsva, Hwba, Laba, Lcha, LinearRgba, Oklaba, Oklcha, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Hsla {
|
||||
hue: f32,
|
||||
saturation: f32,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsla, Hwba, Laba, Lcha, LinearRgba, Oklaba, Oklcha, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Hsva {
|
||||
hue: f32,
|
||||
saturation: f32,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsla, Hsva, Laba, Lcha, LinearRgba, Oklaba, Oklcha, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Hwba {
|
||||
hue: f32,
|
||||
whiteness: f32,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsla, Hsva, Hwba, Lcha, LinearRgba, Oklaba, Oklcha, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Laba {
|
||||
lightness: f32,
|
||||
a: f32,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsla, Hsva, Hwba, Laba, LinearRgba, Oklaba, Oklcha, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Lcha {
|
||||
lightness: f32,
|
||||
chroma: f32,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ mod lcha;
|
|||
mod oklaba;
|
||||
mod oklcha;
|
||||
|
||||
pub trait Color {
|
||||
pub trait Color: Copy {
|
||||
fn to_wgpu(&self) -> wgpu::Color;
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
use wgpu;
|
||||
use crate::{sRgba, Color, Hsla, Hsva, Hwba, Laba, Lcha, Oklaba, Oklcha, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct LinearRgba {
|
||||
red: f32,
|
||||
green: f32,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsla, Hsva, Hwba, Laba, Lcha, LinearRgba, Oklcha, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Oklaba {
|
||||
lightness: f32,
|
||||
a: f32,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsla, Hsva, Hwba, Laba, Lcha, LinearRgba, Oklaba, Xyza};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Oklcha {
|
||||
lightness: f32,
|
||||
chroma: f32,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use crate::{math::Vec4, Color, Hsla, Hsva, Hwba, Laba, Lcha, LinearRgba, Oklaba,
|
|||
/// There are two variants: `sRgba<u8>` and `sRgba<f32>`
|
||||
/// The first one is your standard 0..255 RGB and the second is the normalized version with range 0..1
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct sRgba<T> {
|
||||
red: T,
|
||||
green: T,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{sRgba, Color, Hsla, Hsva, Hwba, Laba, Lcha, LinearRgba, Oklaba, Oklcha};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Copy)]
|
||||
pub struct Xyza {
|
||||
x: f32,
|
||||
y: f32,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue