| 78832 | return PlaneGeometry1; |
| 78833 | }((0, _geometryDefault.default)); |
| 78834 | function tesselatePlane(props) { |
| 78835 | var _props$type = props.type, type = _props$type === void 0 ? "x,y" : _props$type, _props$offset = props.offset, offset = _props$offset === void 0 ? 0 : _props$offset, _props$flipCull = props.flipCull, flipCull = _props$flipCull === void 0 ? false : _props$flipCull, _props$unpack = props.unpack, unpack = _props$unpack === void 0 ? false : _props$unpack; |
| 78836 | var coords = type.split(","); |
| 78837 | var c1len = props["".concat(coords[0], "len")] || 1; |
| 78838 | var c2len = props["".concat(coords[1], "len")] || 1; |
| 78839 | var subdivisions1 = props["n".concat(coords[0])] || 1; |
| 78840 | var subdivisions2 = props["n".concat(coords[1])] || 1; |
| 78841 | var numVertices = (subdivisions1 + 1) * (subdivisions2 + 1); |
| 78842 | var positions = new Float32Array(numVertices * 3); |
| 78843 | var normals = new Float32Array(numVertices * 3); |
| 78844 | var texCoords = new Float32Array(numVertices * 2); |
| 78845 | if (flipCull) c1len = -c1len; |
| 78846 | var i2 = 0; |
| 78847 | var i3 = 0; |
| 78848 | for(var z = 0; z <= subdivisions2; z++)for(var x = 0; x <= subdivisions1; x++){ |
| 78849 | var u = x / subdivisions1; |
| 78850 | var v = z / subdivisions2; |
| 78851 | texCoords[i2 + 0] = flipCull ? 1 - u : u; |
| 78852 | texCoords[i2 + 1] = v; |
| 78853 | switch(type){ |
| 78854 | case "x,y": |
| 78855 | positions[i3 + 0] = c1len * u - c1len * 0.5; |
| 78856 | positions[i3 + 1] = c2len * v - c2len * 0.5; |
| 78857 | positions[i3 + 2] = offset; |
| 78858 | normals[i3 + 0] = 0; |
| 78859 | normals[i3 + 1] = 0; |
| 78860 | normals[i3 + 2] = flipCull ? 1 : -1; |
| 78861 | break; |
| 78862 | case "x,z": |
| 78863 | positions[i3 + 0] = c1len * u - c1len * 0.5; |
| 78864 | positions[i3 + 1] = offset; |
| 78865 | positions[i3 + 2] = c2len * v - c2len * 0.5; |
| 78866 | normals[i3 + 0] = 0; |
| 78867 | normals[i3 + 1] = flipCull ? 1 : -1; |
| 78868 | normals[i3 + 2] = 0; |
| 78869 | break; |
| 78870 | case "y,z": |
| 78871 | positions[i3 + 0] = offset; |
| 78872 | positions[i3 + 1] = c1len * u - c1len * 0.5; |
| 78873 | positions[i3 + 2] = c2len * v - c2len * 0.5; |
| 78874 | normals[i3 + 0] = flipCull ? 1 : -1; |
| 78875 | normals[i3 + 1] = 0; |
| 78876 | normals[i3 + 2] = 0; |
| 78877 | break; |
| 78878 | default: |
| 78879 | throw new Error("PlaneGeometry: unknown type"); |
| 78880 | } |
| 78881 | i2 += 2; |
| 78882 | i3 += 3; |
| 78883 | } |
| 78884 | var numVertsAcross = subdivisions1 + 1; |
| 78885 | var indices = new Uint16Array(subdivisions1 * subdivisions2 * 6); |
| 78886 | for(var _z = 0; _z < subdivisions2; _z++)for(var _x = 0; _x < subdivisions1; _x++){ |
| 78887 | var index = (_z * subdivisions1 + _x) * 6; |
| 78888 | indices[index + 0] = (_z + 0) * numVertsAcross + _x; |
| 78889 | indices[index + 1] = (_z + 1) * numVertsAcross + _x; |
| 78890 | indices[index + 2] = (_z + 0) * numVertsAcross + _x + 1; |
| 78891 | indices[index + 3] = (_z + 1) * numVertsAcross + _x; |