public static void CreateIndexBuffers(ref Device device, ref BSPModel bsp)
{
bsp.Display.indexBuffer = new IndexBuffer[bsp.BSPRawDataMetaChunks.Length];
for (int x = 0; x < bsp.BSPRawDataMetaChunks.Length; x++)
{
if (bsp.BSPRawDataMetaChunks[x].RawDataChunkInfo.Length == 0)
{
continue;
}
bsp.Display.indexBuffer[x] = new IndexBuffer(
typeof(short), bsp.BSPRawDataMetaChunks[x].IndiceCount, device, Usage.WriteOnly, Pool.Managed);
IndexBuffer ib = bsp.Display.indexBuffer[x];
ib.SetData(bsp.BSPRawDataMetaChunks[x].Indices, 0, LockFlags.None);
ib.Unlock();
}
bsp.Display.permindexBuffer = new IndexBuffer[bsp.BSPPermutationRawDataMetaChunks.Length];
for (int x = 0; x < bsp.BSPPermutationRawDataMetaChunks.Length; x++)
{
if (bsp.BSPPermutationRawDataMetaChunks[x].RawDataChunkInfo.Length == 0)
{
continue;
}
bsp.Display.permindexBuffer[x] = new IndexBuffer(
typeof(short),
bsp.BSPPermutationRawDataMetaChunks[x].IndiceCount,
device,
Usage.WriteOnly,
Pool.Managed);
IndexBuffer ib = bsp.Display.permindexBuffer[x];
ib.SetData(bsp.BSPPermutationRawDataMetaChunks[x].Indices, 0, LockFlags.None);
ib.Unlock();
}
}