public static int CompressNormal(Vector3 normal)
{
bool negx = false;
if (normal.X < 0)
{
negx = true;
normal.X = -normal.X;
}
float bbb = normal.X * Convert.ToSingle(0x3ff);
int b = Convert.ToInt32(bbb);
if (negx)
{
b = -b + 1 | 0x400;
}
bool negy = false;
if (normal.Y < 0)
{
negy = true;
normal.Y = -normal.Y;
}
float bbb2 = normal.Y * Convert.ToSingle(0x3ff);
int b2 = Convert.ToInt32(bbb2);
if (negy)
{
b2 = -b2 + 1 | 0x400;
}
b2 <<= 11;
bool negz = false;
if (normal.Z < 0)
{
negz = true;
normal.Z = -normal.Z;
}
float bbb3 = normal.Z * Convert.ToSingle(0x1ff);
int b3 = Convert.ToInt32(bbb3);
if (negz)
{
b3 = -b3 + 1 | 0x200;
}
b3 <<= 22;
int result = b3 | b2 | b;
return result;
}