summaryrefslogtreecommitdiff
path: root/NW4RTools/Texture.cs
diff options
context:
space:
mode:
Diffstat (limited to 'NW4RTools/Texture.cs')
-rw-r--r--NW4RTools/Texture.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/NW4RTools/Texture.cs b/NW4RTools/Texture.cs
index 078fa6b..3dadce8 100644
--- a/NW4RTools/Texture.cs
+++ b/NW4RTools/Texture.cs
@@ -228,7 +228,26 @@ namespace NW4RTools {
}
}
-
+ break;
+
+ case TextureFormat.CMPR:
+ // the texture format from hell
+ for (int y = 0; y < height; y += 8) {
+ for (int x = 0; x < width; x += 8) {
+ for (int iBlockY = 0; iBlockY < 2; iBlockY++) {
+ for (int iBlockX = 0; iBlockX < 2; iBlockX++) {
+ var block = Util.NVDXT.compressDXT1a(bits.Scan0,
+ x + (iBlockX * 4), y + (iBlockY * 4),
+ bits.Stride, bits.Height);
+
+ data.WriteUInt16(block.Color0);
+ data.WriteUInt16(block.Color1);
+ data.WriteUInt32(block.Lookup);
+ }
+ }
+ }
+ }
+
break;
}