Color class extension
#1
Apost 
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.
Reply


Messages In This Thread
Color class extension - by Andy - 19 Oct 2016, 10:44
RE: Color class extension - by Ketschak - 19 Oct 2016, 11:35

Forum Jump:


Copyright © 2011-2018 Spraylight GmbH.