Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FPackedNormal& operator=(const uint16& InData)
- {
- auto x = (byte)(InData & 0xFF);
- auto y = (byte)((InData >> 8) & 0xFF);
- //ugly af, copied the vertex shader glsl code, didnt bother with W component
- FVector2D v27; // = v30;
- float f29;
- v27.X = x;
- v27.Y = y;
- if (((int)(x + 0.5f)) > 127 && ((int)(y + 0.5f)) > 127)
- {
- v27.X = (v27.X + -128.0f) / 127.0f;
- v27.Y = (v27.Y + -128.0f) / 127.0f;
- f29 = -1.0f;
- }
- else
- {
- v27.X /= 127.0f;
- v27.Y /= 127.0f;
- f29 = 1.0f;
- }
- FVector2D v31;
- v31.X = (v27.X * 2) + -1.0f;
- v31.Y = (v27.Y * 2) + -1.0f;
- FVector v32;
- v32.Set(v31.X, v31.Y, 1.0f + -(1.0f * fabsf(v31.X) + 1.0f * fabsf(v31.Y)));
- FVector v28 = v32;
- if (v32.Z < 0.0f)
- {
- FVector2D v33;
- v33.X = fabsf(v32.Y);
- v33.Y = fabsf(v32.X);
- FVector2D v34;
- v34.X = v32.X >= 0.0f ? 1.0f : -1.0f;
- v34.Y = v32.Y >= 0.0f ? 1.0f : -1.0f;
- v28.X = (1.0f + -v33.X) * v34.X;
- v28.Y = (1.0f + -v33.Y) * v34.Y;
- }
- CVec3 v35 = (CVec3&)v28;
- v35.Normalize();
- v28 = (FVector&)v35;
- FVector4 v36;
- v36.X = v28.X;
- v36.Y = v28.Y;
- v36.Z = v28.Z;
- v36.W = f29;
- return *this = v36;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement