How to use the @here/harp-materials.HighPrecisionPointMaterial 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
export function createPoints(
        pointPositions: ArrayLike,
        materialParameters?: PointsMaterialParameters | HighPrecisionPointMaterial
    ): HPP.HighPrecisionPoints {
        const indices: number[] = [];

        // tslint:disable-next-line:prefer-for-of - pointPositions doesn't have iterable interface
        for (let i = 0; i < pointPositions.length; i++) {
            indices.push(indices.length / 3);
        }

        const hpPointsGeometry = new BufferGeometry();

        const hpPointsMaterial = isHighPrecisionPointMaterial(materialParameters)
            ? materialParameters
            : new HighPrecisionPointMaterial(materialParameters);

        const pointsObject = new HPP.HighPrecisionPoints(hpPointsGeometry, hpPointsMaterial);

        setPositions(pointsObject, pointPositions);

        pointsObject.setupForRendering();

        return pointsObject;
    }
}
github heremaps / harp.gl / @here / harp-lines / lib / HighPrecisionPoints.ts View on Github external
constructor(
        geometry?: THREE.BufferGeometry,
        material?: HighPrecisionPointMaterial,
        positions?: number[] | THREE.Vector3[],
        color?: THREE.Color,
        opacity?: number
    ) {
        if (material === undefined) {
            material = new HighPrecisionPointMaterial({
                color: color ? color : HighPrecisionPointMaterial.DEFAULT_COLOR,
                opacity: opacity !== undefined ? opacity : 1
            });
        }

        super(geometry === undefined ? new THREE.BufferGeometry() : geometry, material);

        this.matrixWorldInverse = new THREE.Matrix4();

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