summaryrefslogtreecommitdiff
path: root/NW4RTools/Models
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-03-08 05:17:56 +0100
committerTreeki <treeki@gmail.com>2011-03-08 05:17:56 +0100
commit7d391e33a0b3d9793c95fce832abb2c6d9002186 (patch)
tree075f8ec6272ad3ea12be44a8c2083f89b0d55228 /NW4RTools/Models
parente962fd89af865d6e01522e9752f5fbd855ce128a (diff)
downloadnw4rtools-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/Material.cs2
-rw-r--r--NW4RTools/Models/OpenGL/GLModel.cs10
2 files changed, 7 insertions, 5 deletions
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]);
}