summaryrefslogtreecommitdiff
path: root/NW4RTools/Models/OpenGL/GLModel.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-02-25 22:08:57 +0100
committerTreeki <treeki@gmail.com>2011-02-25 22:08:57 +0100
commit00e977b3dbb8f447b034b7be387ee1a1cce0598c (patch)
tree1a3e0c837d23b90c332e5e1dc4707607c19e7ebd /NW4RTools/Models/OpenGL/GLModel.cs
parent1d5fa5585f08dd82a6722af3dd8ab360fd161151 (diff)
downloadnw4rtools-00e977b3dbb8f447b034b7be387ee1a1cce0598c.tar.gz
nw4rtools-00e977b3dbb8f447b034b7be387ee1a1cce0598c.zip
start of a brres writer
Diffstat (limited to 'NW4RTools/Models/OpenGL/GLModel.cs')
-rw-r--r--NW4RTools/Models/OpenGL/GLModel.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/NW4RTools/Models/OpenGL/GLModel.cs b/NW4RTools/Models/OpenGL/GLModel.cs
index 315415e..8ca3f31 100644
--- a/NW4RTools/Models/OpenGL/GLModel.cs
+++ b/NW4RTools/Models/OpenGL/GLModel.cs
@@ -17,7 +17,11 @@ namespace NW4RTools.Models.OpenGL {
SourceModel = rf.GetGroup<Model>("3DModels(NW4R)")[modelName];
// cache some stuff
- m_textureGroup = rf.GetGroup<Texture>("Textures(NW4R)");
+ try {
+ m_textureGroup = rf.GetGroup<Texture>("Textures(NW4R)");
+ } catch (KeyNotFoundException) {
+ // boo
+ }
}
@@ -162,9 +166,11 @@ namespace NW4RTools.Models.OpenGL {
//CalculateNodes();
- foreach (var insn in SourceModel.Bytecode["DrawOpa"].Instructions) {
- if (insn is ByteCode.DrawShapeInstruction) {
- DrawShape(insn as ByteCode.DrawShapeInstruction);
+ if (SourceModel.Bytecode.ContainsKey("DrawOpa")) {
+ foreach (var insn in SourceModel.Bytecode["DrawOpa"].Instructions) {
+ if (insn is ByteCode.DrawShapeInstruction) {
+ DrawShape(insn as ByteCode.DrawShapeInstruction);
+ }
}
}