switch models world from "2d array of objects" to "object of typed arrays

This is kind of a huge commit, and there's a lot more to be done.

I'm switching worlds from being a 2d array of objects to being objects of 1d typed arrays.

So before we had
```js
water.world[x][y] == {
  volume: 1,
  elevation: 2,
  siltFloating: 3
}
```
Now, for the same (x,y) we have:
```js
idx = water.width * y + x;
water.world.volume[idx] == 1
water.world.elevation[idx] == 2
water.world.siltFloating[idx] == 3
```
These arrays are typed contiguous arrays like `Uint32Array`, `Float32Array`, etc.

There's more to be done. Sampling is especially inefficient, as I kept the previous interface. So when you `water.sample(x,y)`, that samples *all* the arrays and builds an object to return. Sampling should probably then specify a field to sample.
Ah, damn. Well it looks like Object.keys
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys>
is
built into modern browsers now, but since we're using underscore anyway, I
guess we can stick with it?


On Tue, Jun 24, 2014 at 12:24 PM, Marius Nita <notifications@github.com>
wrote:

> In ModelingCore/BaseModel.js:
>
> >          for (var i = x; i < x + width; ++i) {
> >              for (var j = y; j < y + height; ++j) {
> > -                for (var key in obj) {
> > -                    this.world[i][j][key] = obj[key];
> > -                }
> > +                var idx = this.toIndex(i,j);
> > +                _.each(_.keys(obj), (key) => {
>
> I don't think you can do for/of on objects. Only arrays. You can do for/in
> on objects. Btw `for of _.keys(obj)` is different than `for/in obj`. The
> former iterates only over immediate properties, the latter iterates over
> all properties, including inherited ones. Btw I click "view it on github"
> for this comment and can't see it! Kinks to work out for github.
> … <#146cf56086bee1df_>
> On Jun 24, 2014, at 1:18 PM, Benny Lichtner <notifications@github.com>
> wrote: In ModelingCore/BaseModel.js: > for (var i = x; i < x + width; ++i)
> { > for (var j = y; j < y + height; ++j) { > - for (var key in obj) { > -
> this.world[i][j][key] = obj[key]; > - } > + var idx = this.toIndex(i,j); >
> + _.each(_.keys(obj), (key) => { Mmm. If you iterate over an object, do
> iterators delve into prototype properties? — Reply to this email directly
> or view it on GitHub.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/simtable/st-api/pull/10/files#r14149508>.
>