How to use the @here/harp-geometry/lib/SphericalGeometrySubdivisionModifier.SphericalGeometrySubdivisionModifier function in @here/harp-geometry

To help you get started, we’ve selected a few @here/harp-geometry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
);
                        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
github heremaps / harp.gl / @here / harp-webtile-datasource / lib / WebTileDataSource.ts View on Github external
...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;
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometryCreator.ts View on Github external
.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({

@here/harp-geometry

Algorithms and data structures for processing geometries

Apache-2.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages