1
0
mirror of synced 2024-11-28 09:20:57 +01:00

Texture mapping fixes for LM3.

This commit is contained in:
KillzXGaming 2019-11-02 19:43:22 -04:00
parent d54c835bc4
commit b8be2d31f8
2 changed files with 15 additions and 12 deletions

View File

@ -360,7 +360,7 @@ namespace FirstPlugin.LuigisMansion3
chunkEntry.DataFile = File053Data;
break;
case SubDataType.BoneData:
if (chunk.ChunkSize > 0x40 && currentModel.Skeleton == null)
/* if (chunk.ChunkSize > 0x40 && currentModel.Skeleton == null)
{
chunkEntry.DataFile = File052Data;
using (var boneReader = new FileReader(chunkEntry.FileData))
@ -392,7 +392,7 @@ namespace FirstPlugin.LuigisMansion3
currentModel.Skeleton.reset();
currentModel.Skeleton.update();
}
}
}*/
break;
case (SubDataType)0x5012:
case (SubDataType)0x5013:
@ -422,8 +422,8 @@ namespace FirstPlugin.LuigisMansion3
foreach (var model in modelFolder.Nodes)
{
((LM3_Model)currentModel).ModelInfo.Read(new FileReader(
currentModel.ModelInfo.Data), currentModel, currentModel.Meshes, TextureHashes);
((LM3_Model)model).ModelInfo.Read(new FileReader(
((LM3_Model)model).ModelInfo.Data), ((LM3_Model)model), TextureHashes);
}
if (havokFolder.Nodes.Count > 0)

View File

@ -226,6 +226,8 @@ namespace FirstPlugin.LuigisMansion3
Tag = tex
});
}
else
Nodes.Add(TextureHashes[t].ToString("x"));
}
if (texturesList.Nodes.Count > 0)
@ -428,10 +430,8 @@ namespace FirstPlugin.LuigisMansion3
{
public byte[] Data;
public void Read(FileReader reader, LM3_Model model, List<LM3_Mesh> Meshes, List<uint> Hashes)
public void Read(FileReader reader, LM3_Model model, List<uint> Hashes)
{
uint meshSize = (uint)(reader.BaseStream.Length / Meshes.Count);
while (!reader.EndOfStream && reader.Position < reader.BaseStream.Length - 4)
{
uint HashIDCheck = reader.ReadUInt32();
@ -441,9 +441,12 @@ namespace FirstPlugin.LuigisMansion3
model.TextureHashes.Add(HashIDCheck);
}
}
/* for (int i = 0; i < Meshes.Count; i++)
reader.Position = 0;
var meshSize = reader.BaseStream.Length / model.Meshes.Count;
for (int i = 0; i < model.Meshes.Count; i++)
{
reader.SeekBegin(i * meshSize);
while (!reader.EndOfStream && reader.Position < reader.BaseStream.Length - 4)
@ -452,9 +455,9 @@ namespace FirstPlugin.LuigisMansion3
if (Hashes.Contains(HashIDCheck))
{
Console.WriteLine("HashCheck " + HashIDCheck);
Meshes[i].Material = new LM3_Material();
model.Meshes[i].Material = new LM3_Material();
var texUnit = 1;
Meshes[i].Material.TextureMaps.Add(new STGenericMatTexture()
model.Meshes[i].Material.TextureMaps.Add(new STGenericMatTexture()
{
textureUnit = texUnit++,
Type = STGenericMatTexture.TextureType.Diffuse,
@ -464,7 +467,7 @@ namespace FirstPlugin.LuigisMansion3
break;
}
}
}*/
}
}
}