public void Initialize(World world, PhysicsControl physics)
{
_physics = physics;
var particles = new List<Vector2>();
var velocities = new List<Vector2>();
Particles = new Vector2[ParticleCount];
Velocities = new Vector2[ParticleCount];
_velocityBuffer = new Vector2[ParticleCount];
const float initGridSize = 0.4f;
for (var x = 0.0f; x < _width; x += initGridSize)
for (var y = 0.0f; y < _height; y += initGridSize)
{
if (!world.StaticGeometry.IsWaterSpawn(x, y))
continue;
particles.Add(new Vector2(x, y));
velocities.Add(new Vector2(0,0));
_grid[(int)(particles.Last().X * GridMultiplier), (int)(particles.Last().Y * GridMultiplier)].Add(particles.Count-1);
}
Particles = particles.ToArray();
Velocities = velocities.ToArray();
_velocityBuffer = Velocities.ToArray();
ParticleCount = particles.Count;
_w = new float[ParticleCount, ParticleCount];
}