package renderer import "core:math/rand" Color :: union { RGB_Color, RGBA_Color, } RGB_Color :: [3]u8 RGBA_Color :: [4]u8 color_to_f32 :: proc { rgb_color_to_f32_array, rgba_color_to_f32_array, } rgb_color_to_f32_array :: proc(color: RGB_Color) -> [3]f32 { return { f32(color.r) / f32(max(u8)), f32(color.g) / f32(max(u8)), f32(color.b) / f32(max(u8)), } } rgba_color_to_f32_array :: proc(color: RGBA_Color) -> [4]f32 { return { f32(color.r) / f32(max(u8)), f32(color.g) / f32(max(u8)), f32(color.b) / f32(max(u8)), f32(color.a) / f32(max(u8)), } } get_random_color_rgb :: proc() -> RGB_Color { r := u8(rand.uint32() / u32(max(u8))) g := u8(rand.uint32() / u32(max(u8))) b := u8(rand.uint32() / u32(max(u8))) return { r, g, b } } get_random_color_rgba :: proc() -> RGBA_Color { c := get_random_color_rgb() a := u8(rand.uint32() / u32(max(u8))) return { c.r, c.g, c.b, a } }