The Color class should provide the following method:
UInt32 ToUInt32Clamped() const
{
UInt32 red = Math::Clamp<SInt32>(Math::Round(mColor[RED] * Float(255.0)), 0, 255);
UInt32 green = Math::Clamp<SInt32>(Math::Round(mColor[GREEN] * Float(255.0)), 0, 255);
UInt32 blue = Math::Clamp<SInt32>(Math::Round(mColor[BLUE] * Float(255.0)), 0, 255);
UInt32 alpha = Math::Clamp<SInt32>(Math::Round(mColor[ALPHA] * Float(255.0)), 0, 255);
return red + (green << 8) + (blue << 16) + (alpha << 24);
}
This will help converting overdriven floating point color values.
UInt32 ToUInt32Clamped() const
{
UInt32 red = Math::Clamp<SInt32>(Math::Round(mColor[RED] * Float(255.0)), 0, 255);
UInt32 green = Math::Clamp<SInt32>(Math::Round(mColor[GREEN] * Float(255.0)), 0, 255);
UInt32 blue = Math::Clamp<SInt32>(Math::Round(mColor[BLUE] * Float(255.0)), 0, 255);
UInt32 alpha = Math::Clamp<SInt32>(Math::Round(mColor[ALPHA] * Float(255.0)), 0, 255);
return red + (green << 8) + (blue << 16) + (alpha << 24);
}
This will help converting overdriven floating point color values.