final int sx = 32;
final int sy = 32;
final int sz = 16;
Type.Builder tb = new Type.Builder(mRS, Element.U8_4(mRS));
tb.setX(sx);
tb.setY(sy);
tb.setZ(sz);
Type t = tb.create();
mCube = Allocation.createTyped(mRS, t);
int dat[] = new int[sx * sy * sz];
for (int z = 0; z < sz; z++) {
for (int y = 0; y < sy; y++) {
for (int x = 0; x < sx; x++ ) {
int v = 0xff000000;
v |= (0xff * x / (sx - 1));
v |= (0xff * y / (sy - 1)) << 8;
v |= (0xff * z / (sz - 1)) << 16;
dat[z*sy*sx + y*sx + x] = v;
}
}
}
mCube.copyFromUnchecked(dat);