use crate::lib::*; type Args = (i32, [f32; 4]); pub trait ClearArgs { fn get(self) -> Args; } impl ClearArgs for (u32, (R, G, B, A)) where Vec4: Cast<(R, G, B, A)>, { fn get(self) -> Args { let (r, g, b, a) = Vec4(self.1); (i32(self.0), [r, g, b, a]) } } impl ClearArgs for (R, G, B, A) where Vec4: Cast<(R, G, B, A)>, { fn get(self) -> Args { (0, self).get() } } impl ClearArgs for (u32, C) where f32: Cast, { fn get(self) -> Args { let v = self.1; (self.0, (v, v, v, v)).get() } } impl ClearArgs for C where f32: Cast, { fn get(self) -> Args { (0, self).get() } } type CArgs = ((f32, f32, f32, f32), f32); pub trait ColorDepthArg { fn getc(self) -> CArgs; } impl ColorDepthArg for ((R, G, B, A), D) where f32: Cast, Vec4: Cast<(R, G, B, A)>, { fn getc(self) -> CArgs { (Vec4(self.0), f32(self.1)) } } impl ColorDepthArg for (R, G, B, A) where Vec4: Cast<(R, G, B, A)>, { fn getc(self) -> CArgs { (self, 1.).getc() } } impl ColorDepthArg for (C, D) where f32: Cast + Cast, { fn getc(self) -> CArgs { let v = self.0; ((v, v, v, v), self.1).getc() } } impl ColorDepthArg for C where f32: Cast, { fn getc(self) -> CArgs { (self, 1.).getc() } }