public static zzTextureClass.Tom smethod_2(zzTextureClass.Tom struct87_0, zzTextureClass.Tom struct87_1) { zzTextureClass.Tom result; result.float_0 = struct87_0.float_0 + struct87_1.float_0; result.float_1 = struct87_0.float_1 + struct87_1.float_1; result.float_2 = struct87_0.float_2 + struct87_1.float_2; result.float_3 = struct87_0.float_3 + struct87_1.float_3; return(result); }
public static zzTextureClass.Tom smethod_1(zzTextureClass.Tom struct87_0, float float_4) { zzTextureClass.Tom result; result.float_0 = float_4 * struct87_0.float_0; result.float_1 = float_4 * struct87_0.float_1; result.float_2 = float_4 * struct87_0.float_2; result.float_3 = float_4 * struct87_0.float_3; return(result); }
public static void smethod_17(BinaryReader binaryReader_0, Class219 class219_0, IMGPixelFormat imgpixelFormat_0) { zzTextureClass.Tom[] array = new zzTextureClass.Tom[16]; int num = class219_0.method_1(); int num2 = class219_0.method_0(); for (int i = 0; i < num; i += 4) { for (int j = 0; j < num2; j += 4) { if (imgpixelFormat_0 == IMGPixelFormat.Dxt3) { ushort[] array2 = new ushort[4]; for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { if (l == 0) { array2[k] = binaryReader_0.ReadUInt16(); } array[k * 4 + l].float_0 = (float)(array2[k] & 15) / 15f; ushort[] expr_74_cp_0 = array2; int expr_74_cp_1 = k; expr_74_cp_0[expr_74_cp_1] = (ushort)(expr_74_cp_0[expr_74_cp_1] >> 4); } } } else if (imgpixelFormat_0 == IMGPixelFormat.Dxt5) { byte[] array3 = binaryReader_0.ReadBytes(2); byte[] array4 = binaryReader_0.ReadBytes(6); float[] array5 = new float[8]; array5[0] = (float)array3[0] / 255f; array5[1] = (float)array3[1] / 255f; int num3 = 4; if (array3[0] > array3[1]) { num3 = 6; } else { array5[6] = 0f; array5[7] = 1f; } float num4 = 1f / (float)(num3 + 1); for (int m = 0; m < num3; m++) { float num5 = (float)(num3 - m) * num4; float num6 = (float)(m + 1) * num4; array5[m + 2] = num5 * (float)array3[0] + num6 * (float)array3[1]; } for (int n = 0; n < 16; n++) { //Console.WriteLine("Broken"); int div = (n * 3) / 8; int rem = (n * 3) % 8; byte b = (byte)((array4[div] >> rem) & 7); if (rem > 5) { byte b2 = (byte)((array4[div + 1] << (8 - rem)) & 0xFF); b |= (byte)(b2 & 7); } array[n].float_0 = array5[b]; } } zzTextureClass.Jerry @struct = zzTextureClass.Jerry.smethod_0(binaryReader_0); zzTextureClass.Tom[] array6 = new zzTextureClass.Tom[4]; array6[0].float_1 = (float)((@struct.ushort_0 & 63488) >> 11) / 31f; array6[0].float_2 = (float)((@struct.ushort_0 & 2016) >> 5) / 63f; array6[0].float_3 = (float)(@struct.ushort_0 & 31) / 31f; array6[1].float_1 = (float)((@struct.ushort_1 & 63488) >> 11) / 31f; array6[1].float_2 = (float)((@struct.ushort_1 & 2016) >> 5) / 63f; array6[1].float_3 = (float)(@struct.ushort_1 & 31) / 31f; if (imgpixelFormat_0 == IMGPixelFormat.Dxt1 && @struct.ushort_0 <= @struct.ushort_1) { array6[2] = zzTextureClass.Tom.smethod_1(zzTextureClass.Tom.smethod_2(array6[0], array6[1]), 0.5f); array6[3] = default(zzTextureClass.Tom); } else { array6[2] = zzTextureClass.Tom.smethod_1(zzTextureClass.Tom.smethod_2(zzTextureClass.Tom.smethod_0(2f, array6[0]), array6[1]), 0.333333343f); array6[3] = zzTextureClass.Tom.smethod_1(zzTextureClass.Tom.smethod_2(array6[0], zzTextureClass.Tom.smethod_0(2f, array6[1])), 0.333333343f); } for (int num9 = 0; num9 < 4; num9++) { for (int num10 = 0; num10 < 4; num10++) { if (j + num10 < num2 && i + num9 < num) { Point point_ = new Point(j + num10, i + num9); uint num11 = @struct.uint_0 & 3u; if (imgpixelFormat_0 == IMGPixelFormat.Dxt1) { class219_0.method_6(point_, Color.FromArgb((int)((byte)(array6[(int)((UIntPtr)num11)].float_0 * 255f)), (int)((byte)(array6[(int)((UIntPtr)num11)].float_1 * 255f)), (int)((byte)(array6[(int)((UIntPtr)num11)].float_2 * 255f)), (int)((byte)(array6[(int)((UIntPtr)num11)].float_3 * 255f)))); } else { class219_0.method_6(point_, Color.FromArgb((int)((byte)(array[num9 * 4 + num10].float_0 * 255f)), (int)((byte)(array6[(int)((UIntPtr)num11)].float_1 * 255f)), (int)((byte)(array6[(int)((UIntPtr)num11)].float_2 * 255f)), (int)((byte)(array6[(int)((UIntPtr)num11)].float_3 * 255f)))); } } @struct.uint_0 >>= 2; } } } } }
public static zzTextureClass.Tom smethod_0(float float_4, zzTextureClass.Tom struct87_0) { return(zzTextureClass.Tom.smethod_1(struct87_0, float_4)); }