rm-webgpu-compute-tasks 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +6 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -3190,7 +3190,12 @@ async function sopc_(opt) {
|
|
|
3190
3190
|
console.log("开始计算");
|
|
3191
3191
|
let t = performance.now();
|
|
3192
3192
|
await initWebgpu();
|
|
3193
|
-
|
|
3193
|
+
let canvasWidth = 256, canvasHeight = 256;
|
|
3194
|
+
if (typeof window !== "undefined") {
|
|
3195
|
+
canvasWidth = window.innerWidth ?? canvasWidth;
|
|
3196
|
+
canvasHeight = window.innerHeight ?? canvasHeight;
|
|
3197
|
+
}
|
|
3198
|
+
const renderer = new Renderer(canvasWidth, canvasHeight, "rgba8unorm"), camera = new PerspectiveCamera(75, canvasWidth / canvasHeight, 1e-3, 100), { points: pointsArray, itemsFiles, width, height } = await load(base, urls), pointCount = pointsArray.length / 3, pcIndexMaterial = new PointCloudsIndexMaterial(width, height), polyAreaIndexMaterial = new PolyAreaIndexMaterial(width, height), erodeMaskComputeMaterial = new ErodeMaskComputeMaterial(width, height, polyAreaIndexMaterial.resultTexture, erodeMaskSize), sopcComputeMaterial = new SOPCComputeMaterial(width, height, pointCount, pcIndexMaterial.resultTexture, kernelSize), points = new Object3D(
|
|
3194
3199
|
new BufferGeometry().setAttribute("position", new THREE.BufferAttribute(pointsArray, 3)),
|
|
3195
3200
|
pcIndexMaterial
|
|
3196
3201
|
), mesh = new Object3D(
|