From 30a400a14b2cda40bd87234b284d692dbe540736 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 7 May 2011 03:48:22 +0200 Subject: a bit of fixing to the obj importer --- NW4RTools/ObjImporter.cs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/NW4RTools/ObjImporter.cs b/NW4RTools/ObjImporter.cs index 93666b1..1e36983 100755 --- a/NW4RTools/ObjImporter.cs +++ b/NW4RTools/ObjImporter.cs @@ -438,7 +438,7 @@ namespace NW4RTools { else if (Lightmap == ObjImporter.LightmapType.MapObj) tevColorDL.LoadBPReg(0xE6800000); tevColorDL.LoadBPReg(0xE7800000); - tevColorDL.AddPadding(24); + tevColorDL.PadToSize(0x80); tevColorDL.End(); currentMaterial.TevColorDL = tevColorDL.GetBuffer(); @@ -446,7 +446,7 @@ namespace NW4RTools { var indMtxAndScaleDL = new DisplayListWriter(); indMtxAndScaleDL.LoadBPReg(0x25000000); indMtxAndScaleDL.LoadBPReg(0x26000000); - indMtxAndScaleDL.AddPadding(54); + indMtxAndScaleDL.PadToSize(0x40); indMtxAndScaleDL.End(); currentMaterial.IndMtxAndScaleDL = indMtxAndScaleDL.GetBuffer(); @@ -494,22 +494,24 @@ namespace NW4RTools { currentMaterial.TextureInfos.Add(texInfo); // Now add the lightmaps - var lm01 = new TextureInfo(); - lm01.TextureName = LightmapName1; - lm01.TexMapID = 1; - lm01.TlutID = 1; + if (Lightmap != ObjImporter.LightmapType.None) { + var lm01 = new TextureInfo(); + lm01.TextureName = LightmapName1; + lm01.TexMapID = 1; + lm01.TlutID = 1; - lm01.MinFilt = lm01.MagFilt = 1; + lm01.MinFilt = lm01.MagFilt = 1; - var lm02 = new TextureInfo(); - lm02.TextureName = LightmapName2; - lm02.TexMapID = 2; - lm02.TlutID = 2; + var lm02 = new TextureInfo(); + lm02.TextureName = LightmapName2; + lm02.TexMapID = 2; + lm02.TlutID = 2; - lm02.MinFilt = lm02.MagFilt = 1; + lm02.MinFilt = lm02.MagFilt = 1; - currentMaterial.TextureInfos.Add(lm01); - currentMaterial.TextureInfos.Add(lm02); + currentMaterial.TextureInfos.Add(lm01); + currentMaterial.TextureInfos.Add(lm02); + } break; @@ -846,6 +848,7 @@ namespace NW4RTools { // a Quick Hack if (tcDataArray.Length == 0) { tcDataArray = new float[][] { new float[] { 0, 0 } }; + texCoordIndexes[0] = 0; } tcData.ComponentCount = VertexSettings.CompCount.TexCoord2; -- cgit v1.2.3