public override void Draw(GraphicsDevice device, Camera camera)
{
if (popped)
return;
material.Parameters["TextureEnabled"].SetValue(true);
material.Parameters["World"].SetValue(Matrix.Identity);
material.Parameters["View"].SetValue(camera.view);
material.Parameters["Projection"].SetValue(camera.projection);
material.Parameters["Texture"].SetValue(Resources.bubble_texture);
material.CurrentTechnique.Passes[0].Apply();
PrimitiveBatch primitivebatch = PrimitiveBatch.GetInstance(device);
primitivebatch.Begin(Primitive.Triangle);
primitivebatch.SetColor(new Color(1, 1, 1, alpha));
for (int i = 0; i < vertices.Count - 1; i++)
vertices[i] = body.pointmass_list[i].position;
vertices[vertices.Count - 1] = body.position;
int center = vertices.Count-1;
for (short i = 0; i < center; i++)
{
primitivebatch.AddVertex(vertices[center].X, vertices[center].Y, 0, texture_coords[center].X, texture_coords[center].Y);
primitivebatch.AddVertex(vertices[i].X, vertices[i].Y, 0, texture_coords[i].X, texture_coords[i].Y);
primitivebatch.AddVertex(vertices[i+1].X, vertices[i+1].Y, 0, texture_coords[i+1].X, texture_coords[i+1].Y);
}
primitivebatch.AddVertex(vertices[center].X, vertices[center].Y, 0, texture_coords[center].X, texture_coords[center].Y);
primitivebatch.AddVertex(vertices[center - 1].X, vertices[center - 1].Y, 0, texture_coords[center - 1].X, texture_coords[center - 1].Y);
primitivebatch.AddVertex(vertices[0].X, vertices[0].Y, 0, texture_coords[0].X, texture_coords[0].Y);
primitivebatch.End();
//PhysicsRenderer.GetInstance(device).Draw(body, camera);
}