Beispiel #1
0
int R_VaoPackColors(byte *out, vec4_t color)
{
	if (glRefConfig.packedTexcoordDataType == GL_HALF_FLOAT)
	{
		uint16_t *num = (uint16_t *)out;

		*num++ = FloatToHalf(color[0]);
		*num++ = FloatToHalf(color[1]);
		*num++ = FloatToHalf(color[2]);
		*num++ = FloatToHalf(color[3]);

		return sizeof(*num) * 4;
	}
	else
	{
		float *num = (float *)out;

		*num++ = color[0];
		*num++ = color[1];
		*num++ = color[2];
		*num++ = color[3];

		return sizeof(*num) * 4;
	}
}
Beispiel #2
0
int R_VaoPackTexCoord(byte *out, vec2_t st)
{
	if (glRefConfig.packedTexcoordDataType == GL_HALF_FLOAT)
	{
		uint16_t *num = (uint16_t *)out;

		*num++ = FloatToHalf(st[0]);
		*num++ = FloatToHalf(st[1]);

		return sizeof(*num) * 2;
	}
	else
	{
		float *num = (float *)out;

		*num++ = st[0];
		*num++ = st[1];

		return sizeof(*num) * 2;
	}
}
Beispiel #3
0
void ImfFloatToHalf (float f, ImfHalf *h)
{
	short half = FloatToHalf( *(int*)&f );
	h[0] = *(ImfHalf*)½
}