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
02f8d46620
commit
e0dcd6ac10
@ -747,45 +747,53 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#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
|
||||||
{
|
{
|
||||||
var streamList = new List<StreamInfo>(streamCount);
|
m_Streams = new StreamInfo[streamCount];
|
||||||
uint offset = 0;
|
for (int s = 0; s < streamCount; s++)
|
||||||
for (int str = 0; str < streamCount; str++)
|
|
||||||
{
|
{
|
||||||
|
m_Streams[s] = new StreamInfo();
|
||||||
|
m_Streams[s].offset = 0;
|
||||||
|
m_Streams[s].stride = 0;
|
||||||
|
|
||||||
uint chnMask = 0;
|
uint chnMask = 0;
|
||||||
byte stride = 0;
|
for (var chn = 0; chn < m_Channels.Length; chn++)
|
||||||
for (int chn = 0; chn < m_Channels.Length; chn++)
|
|
||||||
{
|
{
|
||||||
var m_Channel = m_Channels[chn];
|
var m_Channel = m_Channels[chn];
|
||||||
if (m_Channel.stream == str)
|
if (m_Channel.stream == s)
|
||||||
{
|
{
|
||||||
stride += (byte)(m_Channel.dimension * (m_Channel.format == 0 ? 4 : 1));
|
|
||||||
if (m_Channel.dimension > 0)
|
if (m_Channel.dimension > 0)
|
||||||
{
|
{
|
||||||
chnMask |= 1u << chn;
|
chnMask |= 1u << chn;
|
||||||
}
|
}
|
||||||
|
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 }),
|
m_Streams[s].offset = m_Streams[s - 1].offset + m_Streams[s - 1].stride * m_VertexCount;
|
||||||
offset = (int)offset,
|
//sometimes there are 8 bytes between streams
|
||||||
stride = stride,
|
//this is NOT an alignment, even if sometimes it may seem so
|
||||||
dividerOp = 0,
|
|
||||||
frequency = 0
|
if (streamCount >= 2)
|
||||||
};
|
{
|
||||||
streamList.Add(streamInfo);
|
m_Streams[s].offset = m_DataSize.Length - m_Streams[s].stride * m_VertexCount;
|
||||||
offset += (uint)m_VertexCount * stride + (((uint)m_VertexCount & 1) != 0 ? (uint)8 : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Streams = streamList.ToArray();
|
/*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 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//actual Vertex Buffer
|
|
||||||
byte[] m_DataSize = new byte[reader.ReadInt32()];
|
|
||||||
reader.Read(m_DataSize, 0, m_DataSize.Length);
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region compute FvF
|
#region compute FvF
|
||||||
|
Loading…
Reference in New Issue
Block a user