@d5techs/3dgs-lib 1.4.73 → 1.4.75
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/dist/3dgs-lib.cjs +35 -38
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +35 -38
- package/dist/3dgs-lib.js.map +1 -1
- package/dist/editor/SplatEditor.d.ts +2 -3
- package/package.json +1 -1
package/dist/3dgs-lib.cjs
CHANGED
|
@@ -811,6 +811,7 @@ const _OrbitControls = class _OrbitControls {
|
|
|
811
811
|
onKeyDown(e) {
|
|
812
812
|
var _a2;
|
|
813
813
|
if (!this.enabled) return;
|
|
814
|
+
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
814
815
|
const tag = (_a2 = e.target) == null ? void 0 : _a2.tagName;
|
|
815
816
|
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return;
|
|
816
817
|
const key = e.key.toLowerCase();
|
|
@@ -2114,8 +2115,7 @@ struct V { @builtin(position) pos: vec4<f32>, @location(0) dir: vec3<f32> };
|
|
|
2114
2115
|
return o;
|
|
2115
2116
|
}
|
|
2116
2117
|
@fragment fn fs(i: V) -> @location(0) vec4<f32> {
|
|
2117
|
-
|
|
2118
|
-
return vec4(textureSample(cubeTexture, cubeSampler, vec3(-d.x, d.y, -d.z)).rgb, 1.);
|
|
2118
|
+
return vec4(textureSample(cubeTexture, cubeSampler, normalize(i.dir)).rgb, 1.);
|
|
2119
2119
|
}`
|
|
2120
2120
|
);
|
|
2121
2121
|
class SkyboxRenderer {
|
|
@@ -18248,52 +18248,49 @@ class SplatEditor {
|
|
|
18248
18248
|
this.editHistory.add(editOp);
|
|
18249
18249
|
}
|
|
18250
18250
|
/**
|
|
18251
|
-
*
|
|
18251
|
+
* 球选择:在屏幕空间判断 splat 是否在圆形区域内
|
|
18252
18252
|
*/
|
|
18253
18253
|
selectBySphere(op, centerPx, radiusPx) {
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
const
|
|
18258
|
-
|
|
18259
|
-
const
|
|
18260
|
-
const
|
|
18261
|
-
const
|
|
18254
|
+
this.ensureProjection();
|
|
18255
|
+
const proj = this.projectedPositions;
|
|
18256
|
+
if (!proj) return;
|
|
18257
|
+
const w = this.container.clientWidth;
|
|
18258
|
+
const h = this.container.clientHeight;
|
|
18259
|
+
const cx = centerPx.x / w;
|
|
18260
|
+
const cy = centerPx.y / h;
|
|
18261
|
+
const rx = radiusPx / w;
|
|
18262
|
+
const ry = radiusPx / h;
|
|
18263
|
+
const rx2 = rx * rx;
|
|
18264
|
+
const ry2 = ry * ry;
|
|
18262
18265
|
const editOp = new SelectOp(this.splatState, op, (i) => {
|
|
18263
|
-
|
|
18264
|
-
const
|
|
18265
|
-
|
|
18266
|
-
const
|
|
18267
|
-
|
|
18268
|
-
const wz = modelMat[2] * lx + modelMat[6] * ly + modelMat[10] * lz + modelMat[14];
|
|
18269
|
-
const dx = wx - cx, dy = wy - cy, dz = wz - cz;
|
|
18270
|
-
return dx * dx + dy * dy + dz * dz < r2;
|
|
18266
|
+
const b = i * 3;
|
|
18267
|
+
const sx = proj[b], sy = proj[b + 1], sz = proj[b + 2];
|
|
18268
|
+
if (sz <= 0 || sz >= 1) return false;
|
|
18269
|
+
const dx = sx - cx, dy = sy - cy;
|
|
18270
|
+
return dx * dx / rx2 + dy * dy / ry2 <= 1;
|
|
18271
18271
|
});
|
|
18272
18272
|
this.editHistory.add(editOp);
|
|
18273
18273
|
}
|
|
18274
18274
|
/**
|
|
18275
|
-
*
|
|
18276
|
-
* X/Y 半宽由屏幕拖拽距离转换,Z 半深度取 max(halfW, halfH)
|
|
18275
|
+
* 盒选择:在屏幕空间判断 splat 是否在矩形区域内
|
|
18277
18276
|
*/
|
|
18278
18277
|
selectByBox(op, centerPx, halfWPx, halfHPx) {
|
|
18279
|
-
|
|
18280
|
-
|
|
18281
|
-
|
|
18282
|
-
const
|
|
18283
|
-
const
|
|
18284
|
-
const
|
|
18285
|
-
const
|
|
18286
|
-
|
|
18287
|
-
const
|
|
18288
|
-
const
|
|
18278
|
+
this.ensureProjection();
|
|
18279
|
+
const proj = this.projectedPositions;
|
|
18280
|
+
if (!proj) return;
|
|
18281
|
+
const w = this.container.clientWidth;
|
|
18282
|
+
const h = this.container.clientHeight;
|
|
18283
|
+
const cx = centerPx.x / w;
|
|
18284
|
+
const cy = centerPx.y / h;
|
|
18285
|
+
const hw = halfWPx / w;
|
|
18286
|
+
const hh = halfHPx / h;
|
|
18287
|
+
const left = cx - hw, right = cx + hw;
|
|
18288
|
+
const top = cy - hh, bottom = cy + hh;
|
|
18289
18289
|
const editOp = new SelectOp(this.splatState, op, (i) => {
|
|
18290
|
-
|
|
18291
|
-
const
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
const wy = modelMat[1] * lx + modelMat[5] * ly + modelMat[9] * lz + modelMat[13];
|
|
18295
|
-
const wz = modelMat[2] * lx + modelMat[6] * ly + modelMat[10] * lz + modelMat[14];
|
|
18296
|
-
return Math.abs(wx - cx) < hx && Math.abs(wy - cy) < hy && Math.abs(wz - cz) < hz;
|
|
18290
|
+
const b = i * 3;
|
|
18291
|
+
const sx = proj[b], sy = proj[b + 1], sz = proj[b + 2];
|
|
18292
|
+
if (sz <= 0 || sz >= 1) return false;
|
|
18293
|
+
return sx >= left && sx <= right && sy >= top && sy <= bottom;
|
|
18297
18294
|
});
|
|
18298
18295
|
this.editHistory.add(editOp);
|
|
18299
18296
|
}
|