Major refactor of material

Now every sampler has its own texture scaling and panning. There is some
kind of fatal memory bug with Mesh and UniformArrayValue; I can't figure
it out.