* Computes the geometry's faces using its vertices. * * All 3D shapes are made by connecting sets of points called *vertices*. A * geometry's surface is formed by connecting vertices to form triangles that * are stitched together. Each triangular patch on the geometry's surface is * c
()
| 823 | * } |
| 824 | */ |
| 825 | computeFaces() { |
| 826 | this.faces.length = 0; |
| 827 | const sliceCount = this.detailX + 1; |
| 828 | let a, b, c, d; |
| 829 | for (let i = 0; i < this.detailY; i++) { |
| 830 | for (let j = 0; j < this.detailX; j++) { |
| 831 | a = i * sliceCount + j; // + offset; |
| 832 | b = i * sliceCount + j + 1; // + offset; |
| 833 | c = (i + 1) * sliceCount + j + 1; // + offset; |
| 834 | d = (i + 1) * sliceCount + j; // + offset; |
| 835 | this.faces.push([a, b, d]); |
| 836 | this.faces.push([d, b, c]); |
| 837 | } |
| 838 | } |
| 839 | return this; |
| 840 | } |
| 841 | |
| 842 | _getFaceNormal(faceId) { |
| 843 | //This assumes that vA->vB->vC is a counter-clockwise ordering |
no test coverage detected