summaryrefslogtreecommitdiff
path: root/NW4RTools/BrresReader.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-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