Skip to content

Commit

Permalink
Normal & Specular support
Browse files Browse the repository at this point in the history
  • Loading branch information
sheilan102 committed Jul 11, 2019
1 parent 5ac811a commit da76e4d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Husky/Husky/Games/ModernWarfare2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ public static void ExportBSPData(ProcessReader reader, long assetPoolsAddress, l
var material = ReadMaterial(reader, surface.MaterialPointer);
// Add to images
imageNames.Add(material.DiffuseMap);
imageNames.Add(material.NormalMap);
imageNames.Add(material.SpecularMap);
// Add it
obj.AddMaterial(material);
// Add points
Expand Down Expand Up @@ -448,7 +450,11 @@ public static WavefrontOBJ.Material ReadMaterial(ProcessReader reader, long addr
var materialImage = reader.ReadStruct<MaterialImage32B>(material.ImageTablePointer + i * Marshal.SizeOf<MaterialImage32B>());
// Check for color map for now
if (materialImage.SemanticHash == 0xA0AB1041)
objMaterial.DiffuseMap = "_images\\\\" + reader.ReadNullTerminatedString(reader.ReadInt32(materialImage.ImagePointer + 0x1C)) + ".png";
objMaterial.DiffuseMap = reader.ReadNullTerminatedString(reader.ReadInt32(materialImage.ImagePointer + 0x1C));
else if (materialImage.SemanticHash == 0x59D30D0F)
objMaterial.NormalMap = reader.ReadNullTerminatedString(reader.ReadInt32(materialImage.ImagePointer + 0x1C));
else if (materialImage.SemanticHash == 0x34ECCCB3)
objMaterial.SpecularMap = reader.ReadNullTerminatedString(reader.ReadInt32(materialImage.ImagePointer + 0x1C));
}
// Done
return objMaterial;
Expand Down

0 comments on commit da76e4d

Please sign in to comment.