Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DecodeRgbBlock()

void Microsoft.Xna.Framework.Graphics.DxtDecoder.DecodeRgbBlock ( byte[] source,
int sourceOffset,
Color[] result,
int resultOffset,
bool isDxt1 )
inlineprivate

Definition at line 75 of file DxtDecoder.cs.

76 {
77 ushort num = Read16(source, sourceOffset);
78 ushort num2 = Read16(source, sourceOffset + 2);
79 ref Color reference = ref colorPalette[0];
80 Bgr565 bgr = new Bgr565
81 {
82 PackedValue = num
83 };
84 reference = new Color(bgr.ToVector3());
85 ref Color reference2 = ref colorPalette[1];
86 Bgr565 bgr2 = new Bgr565
87 {
88 PackedValue = num2
89 };
90 reference2 = new Color(bgr2.ToVector3());
91 if (num > num2 || !isDxt1)
92 {
93 ref Color reference3 = ref colorPalette[2];
94 reference3 = Color.Lerp(colorPalette[0], colorPalette[1], 1f / 3f);
95 ref Color reference4 = ref colorPalette[3];
96 reference4 = Color.Lerp(colorPalette[0], colorPalette[1], 2f / 3f);
97 }
98 else
99 {
100 ref Color reference5 = ref colorPalette[2];
101 reference5 = Color.Lerp(colorPalette[0], colorPalette[1], 0.5f);
102 ref Color reference6 = ref colorPalette[3];
103 reference6 = Color.Transparent;
104 }
105 uint num3 = Read32(source, sourceOffset + 4);
106 for (int i = 0; i < 4; i++)
107 {
108 for (int j = 0; j < 4; j++)
109 {
110 uint num4 = num3 & 3u;
111 num3 >>= 2;
112 ref Color reference7 = ref result[resultOffset + i * width + j];
113 reference7 = colorPalette[num4];
114 }
115 }
116 }
static uint Read32(byte[] source, int offset)
static ushort Read16(byte[] source, int offset)
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References Microsoft.Xna.Framework.Graphics.Bgr565, Microsoft.Xna.Framework.Graphics.Color, Microsoft.Xna.Framework.Graphics.DxtDecoder.colorPalette, Microsoft.Xna.Framework.Color.Lerp(), Microsoft.Xna.Framework.Graphics.DxtDecoder.Read16(), Microsoft.Xna.Framework.Graphics.DxtDecoder.Read32(), System.source, Microsoft.Xna.Framework.Color.Transparent, and Microsoft.Xna.Framework.Graphics.DxtDecoder.width.

Referenced by Microsoft.Xna.Framework.Graphics.DxtDecoder.Decode().