BXLYT : Auto generate tex gens if none created.

This commit is contained in:
KillzXGaming 2020-09-20 14:43:11 -04:00
parent e39e6f7d03
commit b7a7f871dc
5 changed files with 35 additions and 0 deletions

View file

@ -261,6 +261,13 @@ namespace LayoutBXLYT.Cafe
writer.Write(flags);
}
if (TextureMaps?.Length > 0 && TexCoordGens?.Length == 0)
{
TexCoordGens = new BxlytTexCoordGen[TextureMaps.Length];
for (int i = 0; i < TextureMaps?.Length; i++)
TexCoordGens[i] = new TexCoordGen();
}
flags = 0;
for (int i = 0; i < TextureMaps.Length; i++)
{

View file

@ -6,6 +6,13 @@ namespace LayoutBXLYT.Cafe
{
byte[] unkData;
public TexCoordGen()
{
Matrix = TexGenMatrixType.Matrix2x4;
Source = TexGenType.TextureCoord0;
unkData = new byte[6];
}
public TexCoordGen(FileReader reader, BxlytHeader header)
{
Matrix = reader.ReadEnum<TexGenMatrixType>(false);

View file

@ -212,6 +212,13 @@ namespace LayoutBXLYT.CTR
long flagPos = writer.Position;
writer.Write(flags);
if (TextureMaps?.Length > 0 && TexCoordGens?.Length == 0)
{
TexCoordGens = new BxlytTexCoordGen[TextureMaps.Length];
for (int i = 0; i < TextureMaps?.Length; i++)
TexCoordGens[i] = new TexCoordGen();
}
flags = 0;
for (int i = 0; i < TextureMaps?.Length; i++)
{

View file

@ -6,6 +6,13 @@ namespace LayoutBXLYT.CTR
{
ushort Unknown { get; set; }
public TexCoordGen()
{
Matrix = TexGenMatrixType.Matrix2x4;
Source = TexGenType.TextureCoord0;
Unknown = 0;
}
public TexCoordGen(FileReader reader, BxlytHeader header)
{
Matrix = (TexGenMatrixType)reader.ReadByte();

View file

@ -247,6 +247,13 @@ namespace LayoutBXLYT.Revolution
if (!((AlphaCompare)AlphaCompare).HasDefaults())
HasAlphaCompare = true;
if (TextureMaps?.Length > 0 && TexCoordGens?.Count == 0)
{
TexCoordGens = new List<TexCoordGenEntry>(TextureMaps.Length);
for (int i = 0; i < TextureMaps?.Length; i++)
TexCoordGens[i] = new TexCoordGenEntry();
}
flags = 0;
if (HasMaterialColor)
flags |= (1 << 27);