using System; using OpenTK.Graphics; using OpenTK; namespace RecrownedAthenaeum.Types { public static class Color4Ext { public static byte GetRedAsByte(this Color4 color) { return (byte) (color.R * Byte.MaxValue); } public static byte GetGreenAsByte(this Color4 color) { return (byte) (color.G * Byte.MaxValue); } public static byte GetBlueAsByte(this Color4 color) { return (byte) (color.B * Byte.MaxValue); } public static byte GetAlphaAsByte(this Color4 color) { return (byte) (color.A * Byte.MaxValue); } public static void MultiplyByFloat(this Color4 color, float val) { color.A *= val; color.R *= val; color.G *= val; color.B *= val; } public static Color4 ReturnMultipliedByFloat(this Color4 color, float val) { Color4 output = new Color4(color.R * val, color.G * val, color.B * val, color.A * val); return output; } public static void FromNonPremultiplied(ref Vector4 vector) { //Premultiplied. vector = new Vector4(vector.W * vector.X, vector.W * vector.Y, vector.W * vector.Z, vector.W); } } }