How to use the @here/harp-materials.HighPrecisionLineMaterial function in @here/harp-materials

To help you get started, we’ve selected a few @here/harp-materials 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-lines / lib / HighPrecisionUtils.ts View on Github external
const indices: number[] = [];

        triangulateLine(linePositions, lineWidth, positions, indices, addCircles);

        const hpLineGeometry = new BufferGeometry();
        const hpPositions = addInterleavedAttributes3(positions, 3);
        const buffer = new InterleavedBuffer(new Float32Array(hpPositions), 6);

        const positionAttribute = new InterleavedBufferAttribute(buffer, 3, 0, false);
        const positionLowAttribute = new InterleavedBufferAttribute(buffer, 3, 3, false);

        hpLineGeometry.setAttribute("position", positionAttribute);
        hpLineGeometry.setAttribute("positionLow", positionLowAttribute);
        hpLineGeometry.setIndex(new BufferAttribute(new Uint32Array(indices), 1));

        const hpSolidMaterial = new HighPrecisionLineMaterial(params);

        const lineObject = wireFrame
            ? new HPL.HighPrecisionWireFrameLine(hpLineGeometry, hpSolidMaterial)
            : new HPL.HighPrecisionLine(hpLineGeometry, hpSolidMaterial);

        lineObject.setupForRendering();

        return lineObject;
    }
github heremaps / harp.gl / @here / harp-lines / lib / HighPrecisionLines.ts View on Github external
constructor(
        geometry?: THREE.BufferGeometry,
        material?: HighPrecisionLineMaterial,
        positions?: number[] | THREE.Vector3[],
        color?: THREE.Color,
        opacity?: number
    ) {
        super(geometry === undefined ? new THREE.BufferGeometry() : geometry, material);

        if (material === undefined) {
            material = new HighPrecisionLineMaterial({
                color: color ? color : HighPrecisionLineMaterial.DEFAULT_COLOR,
                opacity: opacity !== undefined ? opacity : HighPrecisionLineMaterial.DEFAULT_OPACITY
            });
        }

        this.matrixWorldInverse = new THREE.Matrix4();

        if (positions) {
            this.setPositions(positions);
        }
    }