mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-27 22:00:23 -04:00
fixed bug
This commit is contained in:
parent
8218662548
commit
9c8601a665
@ -734,50 +734,55 @@ namespace AssetStudio
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (version[0] >= 5) //ComputeCompressedStreams
|
||||
//actual Vertex Buffer
|
||||
byte[] m_DataSize = new byte[reader.ReadInt32()];
|
||||
reader.Read(m_DataSize, 0, m_DataSize.Length);
|
||||
|
||||
if (version[0] >= 5) //create streams
|
||||
{
|
||||
int maxStream = 0;
|
||||
foreach (var m_Channel in m_Channels)
|
||||
{
|
||||
if (m_Channel.stream > maxStream)
|
||||
{
|
||||
maxStream = m_Channel.stream;
|
||||
}
|
||||
}
|
||||
var streamList = new List<StreamInfo>(maxStream + 1);
|
||||
uint offset = 0;
|
||||
for (int str = 0; str <= maxStream; str++)
|
||||
m_Streams = new StreamInfo[streamCount];
|
||||
for (int s = 0; s < streamCount; s++)
|
||||
{
|
||||
m_Streams[s] = new StreamInfo();
|
||||
m_Streams[s].offset = 0;
|
||||
m_Streams[s].stride = 0;
|
||||
|
||||
uint chnMask = 0;
|
||||
byte stride = 0;
|
||||
for (int chn = 0; chn < m_Channels.Length; chn++)
|
||||
for (var chn = 0; chn < m_Channels.Length; chn++)
|
||||
{
|
||||
if (m_Channels[chn].dimension > 0 && m_Channels[chn].stream == str)
|
||||
var m_Channel = m_Channels[chn];
|
||||
if (m_Channel.stream == s)
|
||||
{
|
||||
chnMask |= 1u << chn;
|
||||
stride += (byte)(m_Channels[chn].dimension * (m_Channels[chn].format == 0 ? 4 : 1));
|
||||
m_Streams[s].stride += m_Channel.dimension * (4 / (int)Math.Pow(2, m_Channel.format));
|
||||
}
|
||||
}
|
||||
|
||||
var streamInfo = new StreamInfo
|
||||
if (s > 0)
|
||||
{
|
||||
channelMask = new BitArray(new[] { (int)chnMask }),
|
||||
offset = (int)offset,
|
||||
stride = stride,
|
||||
dividerOp = 0,
|
||||
frequency = 0
|
||||
};
|
||||
streamList.Add(streamInfo);
|
||||
offset += (uint)m_VertexCount * stride + (((uint)m_VertexCount & 1) != 0 ? (uint)8 : 0);
|
||||
m_Streams[s].offset = m_Streams[s - 1].offset + m_Streams[s - 1].stride * m_VertexCount;
|
||||
//sometimes there are 8 bytes between streams
|
||||
//this is NOT an alignment, even if sometimes it may seem so
|
||||
|
||||
if (streamCount == 2)
|
||||
{
|
||||
m_Streams[s].offset = m_DataSize.Length - m_Streams[s].stride * m_VertexCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_VertexCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/*var absoluteOffset = a_Stream.Position + 4 + m_Streams[s].offset;
|
||||
if ((absoluteOffset % m_Streams[s].stride) != 0)
|
||||
{
|
||||
m_Streams[s].offset += m_Streams[s].stride - (int)(absoluteOffset % m_Streams[s].stride);
|
||||
}*/
|
||||
}
|
||||
m_Streams[s].channelMask = new BitArray(new[] { (int)chnMask });
|
||||
}
|
||||
|
||||
m_Streams = streamList.ToArray();
|
||||
}
|
||||
|
||||
|
||||
//actual Vertex Buffer
|
||||
var m_DataSize = new byte[reader.ReadInt32()];
|
||||
reader.Read(m_DataSize, 0, m_DataSize.Length);
|
||||
#endregion
|
||||
|
||||
#region compute FvF
|
||||
@ -852,7 +857,7 @@ namespace AssetStudio
|
||||
}
|
||||
|
||||
m_Stream.channelMask.Set(b, false);
|
||||
break;
|
||||
break; //go to next channel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user