GenerateRegularGridFaces method
void
GenerateRegularGridFaces(
- int w,
- int h,
- bool wrapped, [
- bool reverse = false,
])
Implementation
void GenerateRegularGridFaces(int w, int h, bool wrapped,
[bool reverse = false]) {
assert(vertices.length == w * h);
for (int i = 0; i < h - (wrapped ? 0 : 1); ++i) {
for (int j = 0; j < w - (wrapped ? 0 : 1); ++j) {
int ip = i + 1;
int jp = j + 1;
if (wrapped) {
ip = ip % h;
jp = jp % w;
}
AddFace4(i * w + jp, ip * w + jp, ip * w + j, i * w + j, reverse);
}
}
if (wrapped) {
assert(faces4.length == w * h, "face4 length mismatch");
} else {
assert(faces4.length == (w - 1) * (h - 1), "face4 length mismatch");
}
}