DrawableModel: replaced more names

This commit is contained in:
Carmine 2018-01-04 10:35:38 +01:00
parent 4f87bf5d98
commit b6cbcb6ea7
4 changed files with 20 additions and 11 deletions

View File

@ -135,8 +135,8 @@ namespace CodeWalker.GameFiles
private void LoadMapParentTxds(string xml)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(xml);
XmlNodeList items = xmldoc.SelectNodes("CMapParentTxds/txdRelationships/Item");
xmldoc.LoadXml(xml); //maybe better load xml.ToLower() and use "cmapparenttxds/txdrelationships/item" as xpath?
XmlNodeList items = xmldoc.SelectNodes("CMapParentTxds/txdRelationships/Item | CMapParentTxds/txdRelationships/item");
CMapParentTxds = new Dictionary<string, string>();
for (int i = 0; i < items.Count; i++)

View File

@ -1034,7 +1034,10 @@ namespace CodeWalker.GameFiles
public ulong BoundsPointer { get; set; }
public ulong ShaderMappingPointer { get; set; }
public uint Unknown_28h { get; set; }
public uint Unknown_2Ch { get; set; }
public byte Mask { get; set; }
public byte Unknown_2Dh { get; set; }
public byte Unknown_2Eh { get; set; } //ShaderMappingCount ??
public byte Unknown_2Fh { get; set; }
// reference data
public ResourcePointerArray64<DrawableGeometry> Geometries { get; set; }
@ -1097,7 +1100,10 @@ namespace CodeWalker.GameFiles
this.BoundsPointer = reader.ReadUInt64();
this.ShaderMappingPointer = reader.ReadUInt64();
this.Unknown_28h = reader.ReadUInt32();
this.Unknown_2Ch = reader.ReadUInt32();
this.Mask = reader.ReadByte();
this.Unknown_2Dh = reader.ReadByte();
this.Unknown_2Eh = reader.ReadByte();
this.Unknown_2Fh = reader.ReadByte();
// read reference data
this.Geometries = reader.ReadBlockAt<ResourcePointerArray64<DrawableGeometry>>(
@ -1139,7 +1145,10 @@ namespace CodeWalker.GameFiles
writer.Write(this.BoundsPointer);
writer.Write(this.ShaderMappingPointer);
writer.Write(this.Unknown_28h);
writer.Write(this.Unknown_2Ch);
writer.Write(this.Mask);
writer.Write(this.Unknown_2Dh);
writer.Write(this.Unknown_2Eh);
writer.Write(this.Unknown_2Fh);
}
/// <summary>

View File

@ -282,7 +282,7 @@ namespace CodeWalker.Rendering
Unk4h = dmodel.Unknown_4h;
Unk14h = dmodel.Unknown_14h;
Unk28h = dmodel.Unknown_28h;
Unk2Ch = dmodel.Unknown_2Ch;
Unk2Ch = dmodel.Mask;
DrawableModel = dmodel;
@ -300,9 +300,9 @@ namespace CodeWalker.Rendering
Geometries[i] = rgeom;
GeometrySize += rgeom.TotalDataSize;
if ((dmodel.Unknown_18h_Data != null) && (i < dmodel.Unknown_18h_Data.Length))
if ((dmodel.BoundsData != null) && (i < dmodel.BoundsData.Length))
{
GeometryBounds[i] = dmodel.Unknown_18h_Data[i];
GeometryBounds[i] = dmodel.BoundsData[i];
}
else
{

View File

@ -2130,7 +2130,7 @@ namespace CodeWalker
for (int i = 0; i < dmodels.data_items.Length; i++)
{
var m = dmodels.data_items[i];
if (m.Unknown_18h_Data == null)
if (m.BoundsData == null)
{ usegeomboxes = false; break; }
}
}
@ -2152,10 +2152,10 @@ namespace CodeWalker
for (int i = 0; i < dmodels.data_items.Length; i++)
{
var m = dmodels.data_items[i];
int gbbcount = m.Unknown_18h_Data.Length;
int gbbcount = m.BoundsData.Length;
for (int j = 0; j < gbbcount; j++) //first box seems to be whole model
{
var gbox = m.Unknown_18h_Data[j];
var gbox = m.BoundsData[j];
gbbox.Minimum = gbox.Min.XYZ();
gbbox.Maximum = gbox.Max.XYZ();
bbox.Minimum = gbbox.Minimum * scale;