diff options
author | Treeki <treeki@gmail.com> | 2012-09-23 17:43:33 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-09-23 17:43:33 +0200 |
commit | c9bfbf84244c8aa4e26ece994ef6b93386c708e3 (patch) | |
tree | d267d5732bed21c666750263d2ca62dcdfa9e44f /NW4RTools/ObjImporter.cs | |
parent | 31380b4bb93d1fb65faff8f71753de80fb0a8c9d (diff) | |
download | nw4rtools-c9bfbf84244c8aa4e26ece994ef6b93386c708e3.tar.gz nw4rtools-c9bfbf84244c8aa4e26ece994ef6b93386c708e3.zip |
tons of junk I'll clean up eventually
Diffstat (limited to '')
-rwxr-xr-x | NW4RTools/ObjImporter.cs | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/NW4RTools/ObjImporter.cs b/NW4RTools/ObjImporter.cs index 384fb66..cdc9fcd 100755 --- a/NW4RTools/ObjImporter.cs +++ b/NW4RTools/ObjImporter.cs @@ -2,6 +2,7 @@ using System; using System.IO; using System.Collections; using System.Collections.Generic; +using System.Globalization; using NW4RTools.Models; namespace NW4RTools { @@ -271,7 +272,7 @@ namespace NW4RTools { var output = new float[count]; for (int i = 0; i < count; i++) { - output[i] = float.Parse(src[i + index]); + output[i] = float.Parse(src[i + index], CultureInfo.InvariantCulture); } return output; @@ -293,13 +294,13 @@ namespace NW4RTools { if (line.Length == 0 || line[0] == '#') continue; - var parsed = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
-
- switch (parsed[0]) {
- case "newmtl":
- // Create a new material and initialise everything
- // Default settings taken from Test_Lift material
- currentMaterial = new Material();
+ var parsed = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + + switch (parsed[0]) { + case "newmtl": + // Create a new material and initialise everything + // Default settings taken from Test_Lift material + currentMaterial = new Material(); currentMaterial.ChanCtrls[0] = new ChanCtrl(); currentMaterial.ChanCtrls[0].Flags = 0x3F; @@ -315,20 +316,20 @@ namespace NW4RTools { currentMaterial.ChanCtrls[1].FlagC = 0; currentMaterial.ChanCtrls[1].FlagA = 0; - if (Lightmap == ObjImporter.LightmapType.None) {
- currentMaterial.TexCoordGenCount = 1;
- currentMaterial.ChanCount = 1;
- currentMaterial.TevStageCount = 2;
- currentMaterial.IndStageCount = 0;
-
- // This might need changing
- currentMaterial.CullMode = 2;
+ if (Lightmap == ObjImporter.LightmapType.None) { + currentMaterial.TexCoordGenCount = 1; + currentMaterial.ChanCount = 1; + currentMaterial.TevStageCount = 2; + currentMaterial.IndStageCount = 0; + + // This might need changing + currentMaterial.CullMode = 2; currentMaterial.LightSetID = 1; - currentMaterial.SRTSettings[0] = new SRTSettingInfo();
-
- // Default display lists, taken from test_lift
+ currentMaterial.SRTSettings[0] = new SRTSettingInfo(); + + // Default display lists, taken from test_lift var pixDL = new DisplayListWriter(); pixDL.LoadBPReg(0xF31EFF80); pixDL.LoadBPReg(0x40000017); @@ -469,10 +470,10 @@ namespace NW4RTools { Shader thisShader = CreateShader(); CurrentModel.Shaders.Add(parsed[1], thisShader); - currentMaterial.ShaderRef = thisShader;
-
- break;
-
+ currentMaterial.ShaderRef = thisShader; + + break; + case "map_Kd": var rawTexName = string.Join(" ", parsed, 1, parsed.Length - 1); // TODO: fix this to use the mtllib path @@ -512,9 +513,9 @@ namespace NW4RTools { currentMaterial.TextureInfos.Add(lm01); currentMaterial.TextureInfos.Add(lm02); } -
- break;
-
+ + break; + } } |