From 6b14bc71cb699b72ca6cf164b7b800add414dec6 Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 28 Feb 2011 03:23:02 +0100 Subject: progress on writing: offset calculation for models and textures complete! --- NW4RTools/Models/Animation/TextureSRT.cs | 8 ++++++++ NW4RTools/Models/OpenGL/GLTexture.cs | 10 ++++++---- NW4RTools/Models/Shape.cs | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 NW4RTools/Models/Animation/TextureSRT.cs (limited to 'NW4RTools/Models') diff --git a/NW4RTools/Models/Animation/TextureSRT.cs b/NW4RTools/Models/Animation/TextureSRT.cs new file mode 100644 index 0000000..5c35905 --- /dev/null +++ b/NW4RTools/Models/Animation/TextureSRT.cs @@ -0,0 +1,8 @@ +using System; +namespace NW4RTools.Models.Animation { + public class TextureSRT { + public TextureSRT() { + } + } +} + diff --git a/NW4RTools/Models/OpenGL/GLTexture.cs b/NW4RTools/Models/OpenGL/GLTexture.cs index c4cdee6..d56d6ca 100644 --- a/NW4RTools/Models/OpenGL/GLTexture.cs +++ b/NW4RTools/Models/OpenGL/GLTexture.cs @@ -26,16 +26,18 @@ namespace NW4RTools.Models.OpenGL { //byte[] pixelData = new byte[tex.BaseImage.Width * tex.BaseImage.Height * 4]; - var lb = tex.BaseImage.LockBits( - new System.Drawing.Rectangle(0, 0, tex.BaseImage.Width, tex.BaseImage.Height), + // TODO: mipmaps + + var lb = tex.Images[0].LockBits( + new System.Drawing.Rectangle(0, 0, tex.Images[0].Width, tex.Images[0].Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Four, - tex.BaseImage.Width, tex.BaseImage.Height, 0, + tex.Images[0].Width, tex.Images[0].Height, 0, PixelFormat.Bgra, PixelType.UnsignedByte, lb.Scan0); - tex.BaseImage.UnlockBits(lb); + tex.Images[0].UnlockBits(lb); } public void Bind(TextureTarget target) { diff --git a/NW4RTools/Models/Shape.cs b/NW4RTools/Models/Shape.cs index 88d6670..6bc7e44 100644 --- a/NW4RTools/Models/Shape.cs +++ b/NW4RTools/Models/Shape.cs @@ -5,6 +5,7 @@ namespace NW4RTools.Models { public Int32 MatrixID; public byte[] Unk; public byte[] DisplayList1, DisplayList2; + public UInt32 DLBufferSize1, DLBufferSize2; public UInt32 DataFlags; public UInt32 Flags; public UInt32 Index; -- cgit v1.2.3