@@ -102,16 +102,21 @@ internal static void DecompressATI2Block(byte[] source, int sourceStart, byte[]
102102 // BC6
103103 internal static void DecompressBC6Block ( byte [ ] source , int sourceStart , byte [ ] destination , int decompressedStart , int decompressedLineLength , bool unused )
104104 {
105- throw new NotImplementedException ( "Not currently implemented." ) ;
105+ var colours = BC6 . DecompressBC6 ( source , sourceStart , false ) ;
106+ SetColoursFromDX10 ( colours , destination , decompressedStart , decompressedLineLength ) ;
106107 }
107108
108109
109110 // BC7
110111 internal static void DecompressBC7Block ( byte [ ] source , int sourceStart , byte [ ] destination , int decompressedStart , int decompressedLineLength , bool unused )
111112 {
112- BC7 . LDRColour [ ] colours = BC7 . DecompressBC7 ( source , sourceStart ) ;
113+ var colours = BC7 . DecompressBC7 ( source , sourceStart ) ;
114+ SetColoursFromDX10 ( colours , destination , decompressedStart , decompressedLineLength ) ;
115+ }
113116
114- for ( int i = 0 ; i < 4 ; i ++ )
117+ static void SetColoursFromDX10 ( DX10_Helpers . LDRColour [ ] block , byte [ ] destination , int decompressedStart , int decompressedLineLength )
118+ {
119+ for ( int i = 0 ; i < 4 ; i ++ )
115120 {
116121 for ( int j = 0 ; j < 4 ; j ++ )
117122 {
@@ -120,21 +125,14 @@ internal static void DecompressBC7Block(byte[] source, int sourceStart, byte[] d
120125 int GPos = decompressedStart + ( i * decompressedLineLength ) + ( j * 4 ) + 1 ;
121126 int RPos = decompressedStart + ( i * decompressedLineLength ) + ( j * 4 ) + 2 ;
122127 int APos = decompressedStart + ( i * decompressedLineLength ) + ( j * 4 ) + 3 ;
123- var colour = colours [ ( i * 4 ) + j ] ;
124-
125- /*Debug.WriteLine($"{nameof(BPos)}: {BPos}");
126- Debug.WriteLine($"{nameof(GPos)}: {GPos}");
127- Debug.WriteLine($"{nameof(RPos)}: {RPos}");
128- Debug.WriteLine($"{nameof(APos)}: {APos}");
129- Debug.WriteLine("");*/
128+ var colour = block [ ( i * 4 ) + j ] ;
130129
131130 destination [ RPos ] = ( byte ) colour . R ;
132131 destination [ GPos ] = ( byte ) colour . G ;
133132 destination [ BPos ] = ( byte ) colour . B ;
134133 destination [ APos ] = ( byte ) colour . A ;
135134 }
136135 }
137-
138136 }
139137
140138
0 commit comments