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