forked from 0ad/0ad
prefect
6fc1f45fa6
Added float-to-byte color conversion, including an SSE assembler version. Model renderer: Push UV coordinates into a shared vertex array and use bytes instead of floats for the color array, thereby, significantly reducing the total size of vertex arrays. This was SVN commit r2827.
20 lines
472 B
C++
20 lines
472 B
C++
#include "precompiled.h"
|
|
|
|
#include "MathUtil.h"
|
|
#include "graphics/Color.h"
|
|
|
|
|
|
static u32 fallback_ConvertRGBColorTo4ub(const RGBColor& src)
|
|
{
|
|
SColor4ub result;
|
|
result.R=clamp(int(src.X*255),0,255);
|
|
result.G=clamp(int(src.Y*255),0,255);
|
|
result.B=clamp(int(src.Z*255),0,255);
|
|
result.A=0xff;
|
|
return *(u32*)&result;
|
|
}
|
|
|
|
// on IA32, this is replaced by an SSE assembly version in ia32.cpp
|
|
u32 (*ConvertRGBColorTo4ub)(const RGBColor& src) = fallback_ConvertRGBColorTo4ub;
|
|
|