Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
geom.setAttribute("position", posAttr);
let uvAttr: THREE.BufferAttribute | undefined;
if (texCoordType !== undefined) {
uvAttr = new THREE.BufferAttribute(new Float32Array(uvArray), 2);
geom.setAttribute("uv", uvAttr);
}
const edgeAttr = new THREE.BufferAttribute(new Float32Array(edgeArray), 1);
geom.setAttribute("edge", edgeAttr);
const wallAttr = new THREE.BufferAttribute(new Float32Array(wallArray), 1);
geom.setAttribute("wall", edgeAttr);
const indexAttr = new THREE.BufferAttribute(new Uint32Array(triangles), 1);
geom.setIndex(indexAttr);
// FIXME(HARP-5700): Subdivision modifier ignores texture coordinates.
const modifier = new SphericalGeometrySubdivisionModifier(
THREE.Math.degToRad(10),
webMercatorProjection
);
modifier.modify(geom);
// Reassemble the vertex buffer, transforming the subdivided global
// webMercator points back to local space.
vertices.length = 0;
triangles.length = 0;
for (let i = 0; i < posAttr.array.length; i += 3) {
const tilePos = world2tile(
extents,
this.m_decodeInfo,
tmpV2.set(posAttr.array[i], posAttr.array[i + 1]),
true,
tmpV2r
...sourceProjection
.projectPoint(new GeoCoordinates(north, east), tmpV)
.toArray()
]),
3
);
g.setAttribute("position", posAttr);
const uvAttr = new THREE.BufferAttribute(
new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]),
2
);
g.setAttribute("uv", uvAttr);
g.setIndex(new THREE.BufferAttribute(new Uint16Array([0, 1, 2, 2, 1, 3]), 1));
if (shouldSubdivide) {
const modifier = new SphericalGeometrySubdivisionModifier(
THREE.Math.degToRad(10),
sourceProjection
);
modifier.modify(g);
}
for (let i = 0; i < posAttr.array.length; i += 3) {
tmpV.set(posAttr.array[i], posAttr.array[i + 1], posAttr.array[i + 2]);
this.projection.reprojectPoint(sourceProjection, tmpV, tmpV);
tmpV.sub(tile.center);
(posAttr.array as Float32Array)[i] = tmpV.x;
(posAttr.array as Float32Array)[i + 1] = tmpV.y;
(posAttr.array as Float32Array)[i + 2] = tmpV.z;
}
posAttr.needsUpdate = true;
.toArray(),
...sourceProjection
.projectPoint(new GeoCoordinates(south, east), tmpV)
.toArray(),
...sourceProjection
.projectPoint(new GeoCoordinates(north, west), tmpV)
.toArray(),
...sourceProjection
.projectPoint(new GeoCoordinates(north, east), tmpV)
.toArray()
]),
3
);
g.setAttribute("position", posAttr);
g.setIndex(new THREE.BufferAttribute(new Uint16Array([0, 1, 2, 2, 1, 3]), 1));
const modifier = new SphericalGeometrySubdivisionModifier(
THREE.Math.degToRad(10),
sourceProjection
);
modifier.modify(g);
for (let i = 0; i < posAttr.array.length; i += 3) {
tmpV.set(posAttr.array[i], posAttr.array[i + 1], posAttr.array[i + 2]);
projection.reprojectPoint(sourceProjection, tmpV, tmpV);
tmpV.sub(tile.center);
(posAttr.array as Float32Array)[i] = tmpV.x;
(posAttr.array as Float32Array)[i + 1] = tmpV.y;
(posAttr.array as Float32Array)[i + 2] = tmpV.z;
}
posAttr.needsUpdate = true;
const material = new MapMeshBasicMaterial({