public void LoadParticles()
{
particleArray = new BillboardParticleElement[partCount * 4];
for (int p = 0; p < partCount; p += 4)
{
for (int thisP = 0; thisP < 4; thisP++)
{
int currentParticle = p + thisP;
particleArray[currentParticle] = new BillboardParticleElement();
particleArray[currentParticle].Position = myPosition;
particleArray[currentParticle].Color = particleColor;
particleArray[currentParticle].Data = new Vector4(1f, 1f, 0f, 0f);
switch (thisP)
{
case 0:
particleArray[currentParticle].TextureCoordinate = Vector2.Zero;
break;
case 1:
particleArray[currentParticle].TextureCoordinate = new Vector2(1, 0);
break;
case 2:
particleArray[currentParticle].TextureCoordinate = new Vector2(0, 1);
break;
case 3:
particleArray[currentParticle].TextureCoordinate = Vector2.One;
break;
}
}
}
short[] indices = new short[6 * partCount];
for (int part = 0; part < partCount; part++)
{
int off = part * 6;
int offVal = part * 4;
indices[off + 0] = (short)(0 + offVal);
indices[off + 1] = (short)(1 + offVal);
indices[off + 2] = (short)(2 + offVal);
indices[off + 3] = (short)(1 + offVal);
indices[off + 4] = (short)(3 + offVal);
indices[off + 5] = (short)(2 + offVal);
}
ib = new DynamicIndexBuffer(REngine.Instance._game.GraphicsDevice, typeof(short), 6 * partCount, BufferUsage.WriteOnly);
ib.SetData(indices);
}