summaryrefslogtreecommitdiff
path: root/NW4RTools/Texture.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-02-20 05:30:01 +0100
committerTreeki <treeki@gmail.com>2012-02-20 05:30:01 +0100
commit31380b4bb93d1fb65faff8f71753de80fb0a8c9d (patch)
tree8880321028df33877fec9af6c424afe48e7ac4ef /NW4RTools/Texture.cs
parent364e99d849378546323d1d06307b6773e813b742 (diff)
downloadnw4rtools-31380b4bb93d1fb65faff8f71753de80fb0a8c9d.tar.gz
nw4rtools-31380b4bb93d1fb65faff8f71753de80fb0a8c9d.zip
AnmChr/Clr/TexSrt writing done for now. Not 100% perfect but it works!
Diffstat (limited to '')
-rw-r--r--NW4RTools/Texture.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/NW4RTools/Texture.cs b/NW4RTools/Texture.cs
index a328648..f2cf231 100644
--- a/NW4RTools/Texture.cs
+++ b/NW4RTools/Texture.cs
@@ -63,6 +63,9 @@ namespace NW4RTools {
}
+#if DEV_DONT_MODIFY_TEXTURE
+ public byte[][] ImageData;
+#endif
public Bitmap[] Images;
@@ -95,7 +98,11 @@ namespace NW4RTools {
}
public int GetDataSize(int imageID) {
+#if DEV_DONT_MODIFY_TEXTURE
+ return ImageData[imageID].Length;
+#else
return GetDataSize(Images[imageID].Width, Images[imageID].Height, Format);
+#endif
}
@@ -104,9 +111,9 @@ namespace NW4RTools {
int blkWidth = info.TexelWidth;
int blkHeight = info.TexelHeight;
- int width = Images[imageID].Width;
- int height = Images[imageID].Height;
- var bits = Images[imageID].LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
+ int width = Images [imageID].Width;
+ int height = Images [imageID].Height;
+ var bits = Images [imageID].LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
var data = new OutputStream(ByteEndian.BigEndian);
@@ -238,7 +245,7 @@ namespace NW4RTools {
for (int iBlockX = 0; iBlockX < 2; iBlockX++) {
var block = Util.NVDXT.compressDXT1a((Util.NVDXT.ARGBPixel*)bits.Scan0,
x + (iBlockX * 4), y + (iBlockY * 4),
- bits.Width, bits.Height);
+ (bits.Stride / 4), bits.Height);
data.WriteUInt16(block.Color0);
data.WriteUInt16(block.Color1);