6 #include "VectorMath.h"
13 inline v3 MakeColorRGB(u8 r, u8 g, u8 b)
15 v3 color(static_cast<float>(r)/255.f, static_cast<float>(g)/255.f, static_cast<float>(b)/255.f);
19 inline v4 MakeColorRGBA(u8 r, u8 g, u8 b, u8 a)
21 v4 color(static_cast<float>(r)/255.f, static_cast<float>(g)/255.f, static_cast<float>(b)/255.f, static_cast<float>(a)/255.f);
26 inline v4 RGBA32ToColor(u32 rgba)
29 u8 b = (rgba >> 8) & 0xff;
30 u8 g = (rgba >> 16) & 0xff;
31 u8 r = (rgba >> 24) & 0xff;
32 return MakeColorRGBA(r, g, b, a);
35 inline v4 ARGB32ToColor(u32 argb)
38 u8 g = (argb >> 8) & 0xff;
39 u8 r = (argb >> 16) & 0xff;
40 u8 a = (argb >> 24) & 0xff;
41 return MakeColorRGBA(r, g, b, a);
44 inline u32 MakeColorRGBA32(u8 r, u8 g, u8 b, u8 a)
46 u32 rgba32 = (r << 24) | (g << 16) | (b << 8) | a;
50 inline u32 MakeColorUnityColor32(u8 r, u8 g, u8 b, u8 a)
52 u32 rgba32 = (a << 24) | (b << 16) | (g << 8) | r;
56 inline v4 ToFloatColorRange(
double r,
double g,
double b,
double a)
58 return v4((
float)(r / 255.0), (
float)(g / 255.0), (
float)(b / 255.0), (
float)(a / 255.0));