diff options
author | Treeki <treeki@gmail.com> | 2011-03-08 05:17:56 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-08 05:17:56 +0100 |
commit | 7d391e33a0b3d9793c95fce832abb2c6d9002186 (patch) | |
tree | 075f8ec6272ad3ea12be44a8c2083f89b0d55228 /NW4RTools/Models/OpenGL | |
parent | e962fd89af865d6e01522e9752f5fbd855ce128a (diff) | |
download | nw4rtools-7d391e33a0b3d9793c95fce832abb2c6d9002186.tar.gz nw4rtools-7d391e33a0b3d9793c95fce832abb2c6d9002186.zip |
late night commit! obj importer is basic but working. also, tidied up DL stuff
Diffstat (limited to '')
-rw-r--r-- | NW4RTools/Models/OpenGL/GLModel.cs | 10 |
1 files changed, 6 insertions, 4 deletions
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]); } |