Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
}
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);
}
}