mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 04:23:09 +00:00
More adjustments to fix potential errors
This commit is contained in:
parent
411f07d4fb
commit
31e39b3308
1 changed files with 24 additions and 8 deletions
|
@ -83,11 +83,11 @@ namespace CafeLibrary.M2
|
|||
for (int j = 0; j < parameters.Length; j++)
|
||||
{
|
||||
if (parameters[j].ToString().StartsWith("34397848")) //tAlbedoMap
|
||||
material.DiffuseMap = this.Textures[(int)parameters[j - 1] - 1];
|
||||
material.DiffuseMap = FindTextureParam(parameters, j);
|
||||
if (parameters[j].ToString().StartsWith("577110")) //tNormalMap
|
||||
material.NormalMap = this.Textures[(int)parameters[j - 1] - 1];
|
||||
// if (parameters[j].ToString().StartsWith("24862")) //tSpecularMap
|
||||
// material.SpecularMap = this.Textures[(int)parameters[j - 1] - 1];
|
||||
material.NormalMap = FindTextureParam(parameters, j);
|
||||
if (parameters[j].ToString().StartsWith("24862")) //tSpecularMap
|
||||
material.SpecularMap = FindTextureParam(parameters, j);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -96,17 +96,33 @@ namespace CafeLibrary.M2
|
|||
for (int j = 0; j < parameters.Length; j++)
|
||||
{
|
||||
if (parameters[j].ToString().StartsWith("34397848")) //tAlbedoMap
|
||||
material.DiffuseMap = this.Textures[(int)parameters[j - 1] - 1];
|
||||
material.DiffuseMap = FindTextureParam(parameters, j);
|
||||
if (parameters[j].ToString().StartsWith("5771109")) //tNormalMap
|
||||
material.NormalMap = this.Textures[(int)parameters[j - 1] - 1];
|
||||
// if (parameters[j].ToString().StartsWith("2486240")) //tSpecularMap
|
||||
// material.SpecularMap = this.Textures[(int)parameters[j - 1] - 1];
|
||||
material.NormalMap = FindTextureParam(parameters, j);
|
||||
if (parameters[j].ToString().StartsWith("2486240")) //tSpecularMap
|
||||
material.SpecularMap = FindTextureParam(parameters, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Texture FindTextureParam(ulong[] parameters, int id)
|
||||
{
|
||||
var index = (uint)parameters[id - 1] - 1;
|
||||
if (index < Textures.Count) //Index before texture hash. Sometimes not always the case?
|
||||
return Textures[(int)index];
|
||||
return null;
|
||||
}
|
||||
|
||||
private Texture FindTextureParam(uint[] parameters, int id)
|
||||
{
|
||||
var index = parameters[id - 1] - 1;
|
||||
if (index < Textures.Count)
|
||||
return Textures[(int)index];
|
||||
return null;
|
||||
}
|
||||
|
||||
private uint ReadUint(FileReader reader)
|
||||
{
|
||||
if (_hasUint64Offsets)
|
||||
|
|
Loading…
Reference in a new issue