Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
polylines.push(polyline);
}
this._maskOutlinePoints = new Float32Array(maskOutlinePoints);
if (!(config.outlineHeight > 0 && config.outlineThickness > 0)) {
this._rootNode.remove(this._outlineMesh);
this._advancedRenderer.render();
return;
}
this._rootNode.add(this._outlineMesh);
let {indices, position, normal, uv} = extrudePolyline(polylines, {
// TODO Configuration
lineWidth: config.outlineThickness, depth: config.outlineHeight,
smoothSide: true
});
if (this._outlineMesh.geometry) {
this._outlineMesh.geometry.dispose(this._renderer);
}
let geo = this._outlineMesh.geometry = new Geometry();
geo.attributes.position.value = position;
geo.attributes.normal.value = normal;
geo.attributes.texcoord0.value = uv;
geo.indices = indices;
geo.generateTangents();
geo.updateBoundingBox();
geo.dirty();
export function getExtrudeLineGeometry(lineString, lineWidth = 1, depth = 1, layer, center) {
const positions = getLinePosition(lineString, layer, center).positionsV;
const ps = [];
for (let i = 0, len = positions.length; i < len; i++) {
const p = positions[i];
ps.push([p.x, p.y]);
}
const {
indices,
position,
normal
} = extrudePolyline([ps], {
lineWidth,
depth
});
const geometry = new THREE.BufferGeometry();
addAttribute(geometry, 'position', new THREE.Float32BufferAttribute(position, 3));
addAttribute(geometry, 'normal', new THREE.Float32BufferAttribute(normal, 3));
geometry.setIndex(new THREE.Uint32BufferAttribute(indices, 1));
return geometry;
}
export function getExtrudeLineParams(lineString, lineWidth = 1, depth = 1, layer, center) {
const positions = getLinePosition(lineString, layer, center).positionsV;
const ps = [];
for (let i = 0, len = positions.length; i < len; i++) {
const p = positions[i];
ps.push([p.x, p.y]);
}
const {
indices,
position,
normal
} = extrudePolyline([ps], {
lineWidth: lineWidth,
depth: depth
});
return {
position: position,
normal: normal,
indices: indices
};
}