summaryrefslogtreecommitdiff
path: root/NW4RTools/BrresReader.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-02-12 15:00:44 +0100
committerTreeki <treeki@gmail.com>2011-02-12 15:00:44 +0100
commit8b48608d45c8266b765e8ee29e612fb18376aa65 (patch)
treedabb0546d053586e7c022de8b481c79d892857f8 /NW4RTools/BrresReader.cs
parentcd9ce0418bf8e36e39e71757c8ef74fa4a163ab3 (diff)
downloadnw4rtools-8b48608d45c8266b765e8ee29e612fb18376aa65.tar.gz
nw4rtools-8b48608d45c8266b765e8ee29e612fb18376aa65.zip
fixed W7 (missing vtxclr/nrm/texcoord dicts now supported) and the matrix code
Diffstat (limited to 'NW4RTools/BrresReader.cs')
-rw-r--r--NW4RTools/BrresReader.cs44
1 files changed, 36 insertions, 8 deletions
diff --git a/NW4RTools/BrresReader.cs b/NW4RTools/BrresReader.cs
index fa3bf26..20d7739 100644
--- a/NW4RTools/BrresReader.cs
+++ b/NW4RTools/BrresReader.cs
@@ -152,14 +152,42 @@ namespace NW4RTools {
VtxClrIndexLookup = new Dictionary<int, VertexClrData>();
VtxTexCoordIndexLookup = new Dictionary<int, VertexTexCoordData>();
- using (var c2 = Debug.Push("Vertex Position Data"))
- mdl.VtxPosData = ReadAndConvertDict<VertexPosData>(ins.At(startPos + vtxPosOffset), ConvertVtxPosData);
- using (var c2 = Debug.Push("Vertex Normal Data"))
- mdl.VtxNrmData = ReadAndConvertDict<VertexNrmData>(ins.At(startPos + vtxNrmOffset), ConvertVtxNrmData);
- using (var c2 = Debug.Push("Vertex Colour Data"))
- mdl.VtxClrData = ReadAndConvertDict<VertexClrData>(ins.At(startPos + vtxClrOffset), ConvertVtxClrData);
- using (var c2 = Debug.Push("Vertex TexCoord Data"))
- mdl.VtxTexCoordData = ReadAndConvertDict<VertexTexCoordData>(ins.At(startPos + texCoordOffset), ConvertVtxTexCoordData);
+ using (var c2 = Debug.Push("Vertex Position Data")) {
+ if (vtxPosOffset == 0) {
+ Debug.Send("None (what?)");
+ mdl.VtxPosData = new ResDict<VertexPosData>();
+ } else {
+ mdl.VtxPosData = ReadAndConvertDict<VertexPosData>(ins.At(startPos + vtxPosOffset), ConvertVtxPosData);
+ }
+ }
+
+ using (var c2 = Debug.Push("Vertex Normal Data")) {
+ if (vtxNrmOffset == 0) {
+ Debug.Send("None");
+ mdl.VtxNrmData = new ResDict<VertexNrmData>();
+ } else {
+ mdl.VtxNrmData = ReadAndConvertDict<VertexNrmData>(ins.At(startPos + vtxNrmOffset), ConvertVtxNrmData);
+ }
+ }
+
+ using (var c2 = Debug.Push("Vertex Colour Data")) {
+ if (vtxClrOffset == 0) {
+ Debug.Send("None");
+ mdl.VtxClrData = new ResDict<VertexClrData>();
+ } else {
+ mdl.VtxClrData = ReadAndConvertDict<VertexClrData>(ins.At(startPos + vtxClrOffset), ConvertVtxClrData);
+ }
+ }
+
+ using (var c2 = Debug.Push("Vertex TexCoord Data")) {
+ if (texCoordOffset == 0) {
+ Debug.Send("None");
+ mdl.VtxTexCoordData = new ResDict<VertexTexCoordData>();
+ } else {
+ mdl.VtxTexCoordData = ReadAndConvertDict<VertexTexCoordData>(ins.At(startPos + texCoordOffset), ConvertVtxTexCoordData);
+ }
+ }
+
//*/
// Load materials and associated structs