diff options
author | Treeki <treeki@gmail.com> | 2011-03-26 05:14:59 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-26 05:14:59 +0100 |
commit | cff0bbcdf339ec99b9a1311605fb16f6378b3fb4 (patch) | |
tree | e921928236eef23869ddf4d27faa01f14e457594 /NW4RTools/ObjImporter.cs | |
parent | e00b60edda34f50baaa0a21cf2bae4fcad1609a4 (diff) | |
download | nw4rtools-cff0bbcdf339ec99b9a1311605fb16f6378b3fb4.tar.gz nw4rtools-cff0bbcdf339ec99b9a1311605fb16f6378b3fb4.zip |
the Wii killing bug is hopefully gone for good! also, a few other improvements
Diffstat (limited to '')
-rwxr-xr-x | NW4RTools/ObjImporter.cs | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/NW4RTools/ObjImporter.cs b/NW4RTools/ObjImporter.cs index f00d0f6..93666b1 100755 --- a/NW4RTools/ObjImporter.cs +++ b/NW4RTools/ObjImporter.cs @@ -103,28 +103,32 @@ namespace NW4RTools { // At the end of the .obj parsing, all the shapes will be converted and written. - if (Lightmap != LightmapType.None && !texGroup.ContainsKey(LightmapName1)) { - var lm01 = new Texture(); - var lm02 = new Texture(); + if (Lightmap != LightmapType.None) { + if (!texGroup.ContainsKey(LightmapName1)) { + var lm01 = new Texture(); - lm01.Images = new System.Drawing.Bitmap[1]; - lm01.Images[0] = new System.Drawing.Bitmap(Path.Combine(BasePath, string.Format("images/{0}.png", LightmapName1))); + lm01.Images = new System.Drawing.Bitmap[1]; + lm01.Images[0] = new System.Drawing.Bitmap(Path.Combine(BasePath, string.Format("images/{0}.png", LightmapName1))); - lm01.Format = TextureFormat.I8; + lm01.Format = TextureFormat.I8; + texGroup.Add(LightmapName1, lm01); + } - lm02.Images = new System.Drawing.Bitmap[1]; - lm02.Images[0] = new System.Drawing.Bitmap(Path.Combine(BasePath, string.Format("images/{0}.png", LightmapName2))); + if (!texGroup.ContainsKey(LightmapName2)) { + var lm02 = new Texture(); - lm02.Format = TextureFormat.I8; + lm02.Images = new System.Drawing.Bitmap[1]; + lm02.Images[0] = new System.Drawing.Bitmap(Path.Combine(BasePath, string.Format("images/{0}.png", LightmapName2))); - texGroup.Add(LightmapName1, lm01); - texGroup.Add(LightmapName2, lm02); + lm02.Format = TextureFormat.I8; + texGroup.Add(LightmapName2, lm02); + } } CurrentModel = new Model(); - modelGroup.Add(modelName, CurrentModel); + modelGroup[modelName] = CurrentModel; // Before we start reading the OBJ file, prepare the model CurrentModel.ScaleMode = Model.ScaleModeType.Standard; @@ -780,10 +784,17 @@ namespace NW4RTools { // I might need to create XFMEM_VTXSPECS... // test_lift uses 0x14. According to Dolphin's src, this means: // numcolors = 0, numnormals = 1 (just normal), numtextures = 1. Makes sense. - // If lightmaps, then use: numcolors = 1, numnormals = 1, numtextures = 3 + // If lightmaps, then use: numcolors = 1, numnormals = 1, numtextures = 1 + + // NOTE: Dolphin's source names that as "numtextures" -- but in reality it defines + // the number of texture coords that are sent in the vertex data, NOT textures! + // This little bug was the source of tons of trouble on real consoles, since + // previously I was using 3 (one regular texture; two lightmaps). + // Lightmap texcoords are auto generated, so we now use 1 here. + byte vtxSpecs; if (usingLightmaps) - vtxSpecs = 1 | (1 << 2) | (3 << 4); + vtxSpecs = 1 | (1 << 2) | (1 << 4); else vtxSpecs = 0 | (1 << 2) | (1 << 4); |