From 7d391e33a0b3d9793c95fce832abb2c6d9002186 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 8 Mar 2011 05:17:56 +0100 Subject: late night commit! obj importer is basic but working. also, tidied up DL stuff --- NW4RTools/Models/Material.cs | 2 +- NW4RTools/Models/OpenGL/GLModel.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'NW4RTools/Models') diff --git a/NW4RTools/Models/Material.cs b/NW4RTools/Models/Material.cs index 519790c..a28240c 100644 --- a/NW4RTools/Models/Material.cs +++ b/NW4RTools/Models/Material.cs @@ -24,7 +24,7 @@ namespace NW4RTools.Models { ScaleY = 1.0f; CameraID = 0xFF; - LightID = 0xFf; + LightID = 0xFF; Flags = 1; TexMatrix.Identity(); diff --git a/NW4RTools/Models/OpenGL/GLModel.cs b/NW4RTools/Models/OpenGL/GLModel.cs index 072ea00..18e5f6f 100644 --- a/NW4RTools/Models/OpenGL/GLModel.cs +++ b/NW4RTools/Models/OpenGL/GLModel.cs @@ -199,14 +199,14 @@ namespace NW4RTools.Models.OpenGL { displayList.Begin(); if (m.TextureInfos.Count > 0) { - GL.Enable(EnableCap.Texture2D); - TextureInfo[] texInfoArray = new TextureInfo[8]; foreach (var texInfo in m.TextureInfos) { texInfoArray[texInfo.TexMapID] = texInfo; } + GL.Enable(EnableCap.Texture2D); + for (int i = 0; i < 8; i++) { GL.ActiveTexture(TextureUnits[i]); GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (int)TextureEnvMode.Modulate); @@ -215,6 +215,7 @@ namespace NW4RTools.Models.OpenGL { GL.BindTexture(TextureTarget.Texture2D, 0); } else { BindTextureInfo(texInfoArray[i]); + GL.Enable(EnableCap.Texture2D); } } @@ -302,8 +303,9 @@ namespace NW4RTools.Models.OpenGL { GL.MultiTexCoord2(TextureUnits[j], shape.TexCoordData[j].Data[vtxs[i].TexCoords[j]]); } } - - // TODO: normals + + if (vs.NormalDesc != VertexSettings.DescType.None) + GL.Normal3(shape.NrmData.Data[vtxs[i].Normal]); GL.Vertex3(shape.PosData.Data[vtxs[i].Position]); } -- cgit v1.2.3