@xeokit/xeokit-sdk 2.6.96 → 2.6.98
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/xeokit-sdk.cjs.js +139 -57
- package/dist/xeokit-sdk.es.js +139 -57
- package/dist/xeokit-sdk.es5.js +192 -183
- package/dist/xeokit-sdk.min.cjs.js +7 -7
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +6 -6
- package/package.json +1 -1
- package/src/viewer/scene/Component.js +1 -0
- package/src/viewer/scene/math/math.js +3 -3
- package/src/viewer/scene/model/SceneModel.js +26 -23
- package/src/viewer/scene/model/layer/Layer.js +10 -7
- package/src/viewer/scene/model/layer/programs/SnapProgram.js +1 -1
- package/src/viewer/scene/webgl/Renderer.js +79 -4
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2025-12-
|
|
2
|
+
* xeokit-sdk v2.6.98
|
|
3
|
+
* Commit: 30ac0fa9a4eaf6759fe306bb2e332cce49884787
|
|
4
|
+
* Built: 2025-12-08T14:33:34.719Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
if (typeof window !== 'undefined') {
|
|
8
|
-
window.__XEOKIT__ = { version: '2.6.
|
|
8
|
+
window.__XEOKIT__ = { version: '2.6.98', commit: '30ac0fa9a4eaf6759fe306bb2e332cce49884787', built: '2025-12-08T14:33:34.719Z' };
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/** @private */
|
|
@@ -1969,7 +1969,7 @@ const tempVec3a$j = new FloatArrayType(3);
|
|
|
1969
1969
|
|
|
1970
1970
|
const tempMat1 = new FloatArrayType(16);
|
|
1971
1971
|
const tempMat2 = new FloatArrayType(16);
|
|
1972
|
-
const tempVec4$
|
|
1972
|
+
const tempVec4$4 = new FloatArrayType(4);
|
|
1973
1973
|
|
|
1974
1974
|
|
|
1975
1975
|
/**
|
|
@@ -4075,9 +4075,9 @@ const math = {
|
|
|
4075
4075
|
|
|
4076
4076
|
const sy = math.lenVec3(vec);
|
|
4077
4077
|
|
|
4078
|
-
vec[
|
|
4079
|
-
vec[
|
|
4080
|
-
vec[
|
|
4078
|
+
vec[0] = mat[8];
|
|
4079
|
+
vec[1] = mat[9];
|
|
4080
|
+
vec[2] = mat[10];
|
|
4081
4081
|
|
|
4082
4082
|
const sz = math.lenVec3(vec);
|
|
4083
4083
|
|
|
@@ -5184,7 +5184,7 @@ const math = {
|
|
|
5184
5184
|
},
|
|
5185
5185
|
|
|
5186
5186
|
quaternionToAngleAxis(q, angleAxis = math.vec4()) {
|
|
5187
|
-
q = math.normalizeQuaternion(q, tempVec4$
|
|
5187
|
+
q = math.normalizeQuaternion(q, tempVec4$4);
|
|
5188
5188
|
const q3 = q[3];
|
|
5189
5189
|
const angle = 2 * Math.acos(q3);
|
|
5190
5190
|
const s = Math.sqrt(1 - q3 * q3);
|
|
@@ -9614,6 +9614,7 @@ class Component {
|
|
|
9614
9614
|
this._eventCallDepth = 0;
|
|
9615
9615
|
this._ownedComponents = null;
|
|
9616
9616
|
this._updateScheduled = false;
|
|
9617
|
+
this._renderer = null;
|
|
9617
9618
|
}
|
|
9618
9619
|
}
|
|
9619
9620
|
|
|
@@ -20658,7 +20659,7 @@ const CompressedMediaType = 10003;
|
|
|
20658
20659
|
|
|
20659
20660
|
const ids$1 = new Map$1({});
|
|
20660
20661
|
const tempVec3a$f = math.vec3();
|
|
20661
|
-
const tempVec4$
|
|
20662
|
+
const tempVec4$3 = math.vec4();
|
|
20662
20663
|
const TEXTURE_DECODE_FUNCS = { [sRGBEncoding]: "sRGBToLinear" };
|
|
20663
20664
|
|
|
20664
20665
|
const iota$3 = function(n) {
|
|
@@ -21078,11 +21079,11 @@ const createLightSetup = function(programVariables, lightsState) {
|
|
|
21078
21079
|
const lightUniforms = {
|
|
21079
21080
|
color: programVariables.createUniform("vec4", `lightColor${i}`, (set) => {
|
|
21080
21081
|
const light = lights[i]; // in case it changed
|
|
21081
|
-
tempVec4$
|
|
21082
|
-
tempVec4$
|
|
21083
|
-
tempVec4$
|
|
21084
|
-
tempVec4$
|
|
21085
|
-
set(tempVec4$
|
|
21082
|
+
tempVec4$3[0] = light.color[0];
|
|
21083
|
+
tempVec4$3[1] = light.color[1];
|
|
21084
|
+
tempVec4$3[2] = light.color[2];
|
|
21085
|
+
tempVec4$3[3] = light.intensity;
|
|
21086
|
+
set(tempVec4$3);
|
|
21086
21087
|
}),
|
|
21087
21088
|
position: programVariables.createUniform("vec3", `lightPos${i}`, (set) => set(lights[i].pos)),
|
|
21088
21089
|
direction: programVariables.createUniform("vec3", `lightDir${i}`, (set) => set(lights[i].dir)),
|
|
@@ -21264,7 +21265,7 @@ const makeInputSetters = function(gl, handle) {
|
|
|
21264
21265
|
};
|
|
21265
21266
|
};
|
|
21266
21267
|
|
|
21267
|
-
const tempVec4$
|
|
21268
|
+
const tempVec4$2 = math.vec4();
|
|
21268
21269
|
|
|
21269
21270
|
const DrawShaderSource = function(meshDrawHash, programVariables, geometry, material, scene) {
|
|
21270
21271
|
const materialState = material._state;
|
|
@@ -21355,10 +21356,10 @@ const DrawShaderSource = function(meshDrawHash, programVariables, geometry, mate
|
|
|
21355
21356
|
const materialAlphaModeCutoff = setupUniform("materialAlphaModeCutoff", "vec4", mtl => {
|
|
21356
21357
|
const alpha = mtl.alpha;
|
|
21357
21358
|
if ((alpha !== undefined) && (alpha !== null)) {
|
|
21358
|
-
tempVec4$
|
|
21359
|
-
tempVec4$
|
|
21360
|
-
tempVec4$
|
|
21361
|
-
return tempVec4$
|
|
21359
|
+
tempVec4$2[0] = alpha;
|
|
21360
|
+
tempVec4$2[1] = (mtl.alphaMode === 1 ? 1 : 0);
|
|
21361
|
+
tempVec4$2[2] = mtl.alphaCutoff;
|
|
21362
|
+
return tempVec4$2;
|
|
21362
21363
|
} else {
|
|
21363
21364
|
return null;
|
|
21364
21365
|
}
|
|
@@ -31844,7 +31845,7 @@ const SnapProgram = function(programVariables, geometry, isSnapInit, isPoints) {
|
|
|
31844
31845
|
const coordinateScaler = programVariables.createUniform("vec3", "coordinateScaler", (set, state) => set(state.legacyFrameCtx.snapPickCoordinateScale));
|
|
31845
31846
|
|
|
31846
31847
|
const vWorldPosition = programVariables.createVarying("vec3", "vWorldPosition", () => `${geometry.attributes.position.world}.xyz`);
|
|
31847
|
-
const vPickColor = programVariables.createVarying("vec4", "vPickColor", () => geometry.attributes.pickColor
|
|
31848
|
+
const vPickColor = programVariables.createVarying("vec4", "vPickColor", () => geometry.attributes.pickColor); // Using `flat` causes an instability - see XEOK-385 and XEOK-401
|
|
31848
31849
|
|
|
31849
31850
|
const outCoords = programVariables.createOutput("highp ivec4", "outCoords", 0);
|
|
31850
31851
|
const outNormal = programVariables.createOutput("highp ivec4", "outNormal", 1);
|
|
@@ -31869,7 +31870,7 @@ const SnapProgram = function(programVariables, geometry, isSnapInit, isPoints) {
|
|
|
31869
31870
|
|
|
31870
31871
|
const tempVec2 = math.vec2();
|
|
31871
31872
|
const tempVec3$6 = math.vec3();
|
|
31872
|
-
const tempVec4 = math.vec4();
|
|
31873
|
+
const tempVec4$1 = math.vec4();
|
|
31873
31874
|
const tempMat4$2 = math.mat4();
|
|
31874
31875
|
const vec3zero = math.vec3([0,0,0]);
|
|
31875
31876
|
|
|
@@ -32352,6 +32353,15 @@ class Layer {
|
|
|
32352
32353
|
|
|
32353
32354
|
aabbChanged() { this._aabbDirty = true; }
|
|
32354
32355
|
|
|
32356
|
+
getAABB() {
|
|
32357
|
+
if (this._aabbDirty) { // Per-layer AABB for best RTC accuracy
|
|
32358
|
+
math.collapseAABB3(this._aabb);
|
|
32359
|
+
this._meshes.forEach(m => math.expandAABB3(this._aabb, m.aabb));
|
|
32360
|
+
this._aabbDirty = false;
|
|
32361
|
+
}
|
|
32362
|
+
return this._aabb;
|
|
32363
|
+
}
|
|
32364
|
+
|
|
32355
32365
|
__drawLayer(renderFlags, frameCtx, renderer, pass) {
|
|
32356
32366
|
if ((this._countsByFlag[ENTITY_FLAGS.CULLED].count < this._portions.length) && (this._countsByFlag[ENTITY_FLAGS.VISIBLE].count > 0)) {
|
|
32357
32367
|
const backfacePasses = (this.primitive !== "points") && (this.primitive !== "lines") && [
|
|
@@ -32424,7 +32434,7 @@ class Layer {
|
|
|
32424
32434
|
// ---------------------- SILHOUETTE RENDERING -----------------------------------
|
|
32425
32435
|
|
|
32426
32436
|
__drawSilhouette(renderFlags, frameCtx, material, renderPass) {
|
|
32427
|
-
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.fillColor, material.fillAlpha, tempVec4);
|
|
32437
|
+
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.fillColor, material.fillAlpha, tempVec4$1);
|
|
32428
32438
|
this.__drawLayer(renderFlags, frameCtx, this._renderers.silhouetteRenderer, renderPass);
|
|
32429
32439
|
}
|
|
32430
32440
|
|
|
@@ -32470,7 +32480,7 @@ class Layer {
|
|
|
32470
32480
|
__drawUniformEdges(renderFlags, frameCtx, material, renderPass) {
|
|
32471
32481
|
const renderer = this._renderers.edgesRenderers && this._renderers.edgesRenderers.uniform;
|
|
32472
32482
|
if (renderer) {
|
|
32473
|
-
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.edgeColor, material.edgeAlpha, tempVec4);
|
|
32483
|
+
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.edgeColor, material.edgeAlpha, tempVec4$1);
|
|
32474
32484
|
this.__drawLayer(renderFlags, frameCtx, renderer, renderPass);
|
|
32475
32485
|
}
|
|
32476
32486
|
}
|
|
@@ -32517,13 +32527,7 @@ class Layer {
|
|
|
32517
32527
|
drawSnap(renderFlags, frameCtx, isSnapInit) {
|
|
32518
32528
|
frameCtx.snapPickOrigin = [0, 0, 0];
|
|
32519
32529
|
|
|
32520
|
-
|
|
32521
|
-
math.collapseAABB3(this._aabb);
|
|
32522
|
-
this._meshes.forEach(m => math.expandAABB3(this._aabb, m.aabb));
|
|
32523
|
-
this._aabbDirty = false;
|
|
32524
|
-
}
|
|
32525
|
-
|
|
32526
|
-
const aabb = this._aabb;
|
|
32530
|
+
const aabb = this.getAABB();
|
|
32527
32531
|
frameCtx.snapPickCoordinateScale = math.mulVec3Scalar(
|
|
32528
32532
|
safeInvVec3([ aabb[3] - aabb[0], aabb[4] - aabb[1], aabb[5] - aabb[2] ]),
|
|
32529
32533
|
math.MAX_INT);
|
|
@@ -40968,34 +40972,37 @@ class SceneModel extends Component {
|
|
|
40968
40972
|
/**
|
|
40969
40973
|
* @private
|
|
40970
40974
|
*/
|
|
40971
|
-
_withEachVisibleLayer(testNumVisibleLayerPortions, cb) {
|
|
40975
|
+
_withEachVisibleLayer(frameCtx, testNumVisibleLayerPortions, cb) {
|
|
40972
40976
|
if (testNumVisibleLayerPortions && (this.numVisibleLayerPortions === 0)) {
|
|
40973
40977
|
return;
|
|
40974
40978
|
}
|
|
40979
|
+
const testLayerCull = frameCtx.testAABB;
|
|
40975
40980
|
const renderFlags = this.renderFlags;
|
|
40976
40981
|
for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {
|
|
40977
|
-
const
|
|
40978
|
-
|
|
40979
|
-
|
|
40980
|
-
|
|
40981
|
-
|
|
40982
|
-
|
|
40983
|
-
|
|
40984
|
-
|
|
40985
|
-
|
|
40986
|
-
|
|
40987
|
-
|
|
40988
|
-
|
|
40989
|
-
|
|
40990
|
-
|
|
40991
|
-
|
|
40992
|
-
|
|
40993
|
-
|
|
40994
|
-
|
|
40995
|
-
|
|
40996
|
-
|
|
40997
|
-
|
|
40998
|
-
|
|
40982
|
+
const layer = this.layerList[renderFlags.visibleLayers[i]];
|
|
40983
|
+
if ((! testLayerCull) || testLayerCull(layer.getAABB())) {
|
|
40984
|
+
cb(layer);
|
|
40985
|
+
}
|
|
40986
|
+
}
|
|
40987
|
+
}
|
|
40988
|
+
|
|
40989
|
+
drawColorOpaque (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawColorOpaque (this.renderFlags, frameCtx)); }
|
|
40990
|
+
drawColorTransparent (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawColorTransparent (this.renderFlags, frameCtx)); }
|
|
40991
|
+
drawDepth (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawDepth (this.renderFlags, frameCtx)); } // Dedicated to SAO because it skips transparent objects
|
|
40992
|
+
drawSilhouetteXRayed (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawSilhouetteXRayed (this.renderFlags, frameCtx)); }
|
|
40993
|
+
drawSilhouetteHighlighted(frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawSilhouetteHighlighted(this.renderFlags, frameCtx)); }
|
|
40994
|
+
drawSilhouetteSelected (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawSilhouetteSelected (this.renderFlags, frameCtx)); }
|
|
40995
|
+
drawEdgesColorOpaque (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesColorOpaque (this.renderFlags, frameCtx)); }
|
|
40996
|
+
drawEdgesColorTransparent(frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesColorTransparent(this.renderFlags, frameCtx)); }
|
|
40997
|
+
drawEdgesXRayed (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesXRayed (this.renderFlags, frameCtx)); }
|
|
40998
|
+
drawEdgesHighlighted (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesHighlighted (this.renderFlags, frameCtx)); }
|
|
40999
|
+
drawEdgesSelected (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesSelected (this.renderFlags, frameCtx)); }
|
|
41000
|
+
drawOcclusion (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawOcclusion (this.renderFlags, frameCtx)); }
|
|
41001
|
+
drawShadow (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawShadow (this.renderFlags, frameCtx)); }
|
|
41002
|
+
drawPickMesh (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawPickMesh (this.renderFlags, frameCtx)); }
|
|
41003
|
+
drawPickDepths (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawPickDepths (this.renderFlags, frameCtx)); }
|
|
41004
|
+
drawPickNormals (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawPickNormals (this.renderFlags, frameCtx)); }
|
|
41005
|
+
_drawSnap (frameCtx, isSnapInit) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawSnap (this.renderFlags, frameCtx, isSnapInit)); }
|
|
40999
41006
|
|
|
41000
41007
|
drawSnapInit(frameCtx) { this._drawSnap(frameCtx, true ); }
|
|
41001
41008
|
drawSnap (frameCtx) { this._drawSnap(frameCtx, false); }
|
|
@@ -47037,6 +47044,9 @@ const vec3_0 = math.vec3([0,0,0]);
|
|
|
47037
47044
|
|
|
47038
47045
|
const iota = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
|
|
47039
47046
|
|
|
47047
|
+
const tempPlanes = iota(6).map(() => math.vec4());
|
|
47048
|
+
const tempVec4 = math.vec4();
|
|
47049
|
+
|
|
47040
47050
|
const bitShiftScreenZ = math.vec4([1.0 / (256.0 * 256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0]);
|
|
47041
47051
|
|
|
47042
47052
|
const pixelToInt = pix => pix[0] + (pix[1] << 8) + (pix[2] << 16) + (pix[3] << 24);
|
|
@@ -47046,6 +47056,66 @@ const toWorldPos = (p, origin, scale) => math.vec3([ p[0] * scale[0] + origin
|
|
|
47046
47056
|
p[1] * scale[1] + origin[1],
|
|
47047
47057
|
p[2] * scale[2] + origin[2] ]);
|
|
47048
47058
|
|
|
47059
|
+
const makeFrustumAABBIntersectionTest = function(camera) {
|
|
47060
|
+
const m = math.mat4();
|
|
47061
|
+
math.mulMat4(camera.projMatrix, camera.viewMatrix, m);
|
|
47062
|
+
|
|
47063
|
+
for (let i = 0; i < 3; ++i) {
|
|
47064
|
+
tempPlanes[i * 2 + 0][0] = m[ 3] + m[i];
|
|
47065
|
+
tempPlanes[i * 2 + 0][1] = m[ 7] + m[i + 4];
|
|
47066
|
+
tempPlanes[i * 2 + 0][2] = m[11] + m[i + 8];
|
|
47067
|
+
tempPlanes[i * 2 + 0][3] = m[15] + m[i + 12];
|
|
47068
|
+
|
|
47069
|
+
tempPlanes[i * 2 + 1][0] = m[ 3] - m[i];
|
|
47070
|
+
tempPlanes[i * 2 + 1][1] = m[ 7] - m[i + 4];
|
|
47071
|
+
tempPlanes[i * 2 + 1][2] = m[11] - m[i + 8];
|
|
47072
|
+
tempPlanes[i * 2 + 1][3] = m[15] - m[i + 12];
|
|
47073
|
+
}
|
|
47074
|
+
|
|
47075
|
+
// Normalize each plane
|
|
47076
|
+
tempPlanes.forEach(p => math.divVec4Scalar(p, math.lenVec3(p), p));
|
|
47077
|
+
|
|
47078
|
+
return aabb => tempPlanes.every(p => {
|
|
47079
|
+
// Compute the positive vertex (farthest in direction of normal)
|
|
47080
|
+
tempVec4[0] = aabb[(p[0] >= 0) ? 3 : 0];
|
|
47081
|
+
tempVec4[1] = aabb[(p[1] >= 0) ? 4 : 1];
|
|
47082
|
+
tempVec4[2] = aabb[(p[2] >= 0) ? 5 : 2];
|
|
47083
|
+
tempVec4[3] = 1;
|
|
47084
|
+
return math.dotVec4(p, tempVec4) >= 0;
|
|
47085
|
+
});
|
|
47086
|
+
};
|
|
47087
|
+
|
|
47088
|
+
const makeRayAABBIntersectionTest = (O, D) => aabb => {
|
|
47089
|
+
let tmin = -Infinity;
|
|
47090
|
+
let tmax = Infinity;
|
|
47091
|
+
|
|
47092
|
+
for (let i = 0; i < 3; i++) {
|
|
47093
|
+
const origin = O[i];
|
|
47094
|
+
const direction = D[i];
|
|
47095
|
+
const minBound = aabb[i];
|
|
47096
|
+
const maxBound = aabb[i + 3];
|
|
47097
|
+
|
|
47098
|
+
if (Math.abs(direction) < 1e-8) {
|
|
47099
|
+
// Ray is parallel to plane
|
|
47100
|
+
if ((origin < minBound) || (origin > maxBound)) {
|
|
47101
|
+
return false; // No intersection
|
|
47102
|
+
}
|
|
47103
|
+
} else {
|
|
47104
|
+
const t1 = (minBound - origin) / direction;
|
|
47105
|
+
const t2 = (maxBound - origin) / direction;
|
|
47106
|
+
|
|
47107
|
+
tmin = Math.max(tmin, Math.min(t1, t2)); // near
|
|
47108
|
+
tmax = Math.min(tmax, Math.max(t1, t2)); // far
|
|
47109
|
+
|
|
47110
|
+
if (tmin > tmax) {
|
|
47111
|
+
return false; // No intersection
|
|
47112
|
+
}
|
|
47113
|
+
}
|
|
47114
|
+
}
|
|
47115
|
+
|
|
47116
|
+
return tmax >= 0; // Check if intersection is in front of ray
|
|
47117
|
+
};
|
|
47118
|
+
|
|
47049
47119
|
/**
|
|
47050
47120
|
* @private
|
|
47051
47121
|
*/
|
|
@@ -47798,6 +47868,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
47798
47868
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
47799
47869
|
}
|
|
47800
47870
|
|
|
47871
|
+
frameCtx.testAABB = makeFrustumAABBIntersectionTest(scene.camera);
|
|
47872
|
+
|
|
47801
47873
|
const renderDrawables = function(drawables) {
|
|
47802
47874
|
|
|
47803
47875
|
let normalDrawSAOBinLen = 0;
|
|
@@ -48132,6 +48204,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
48132
48204
|
renderDrawables(uiDrawableList);
|
|
48133
48205
|
}
|
|
48134
48206
|
|
|
48207
|
+
frameCtx.testAABB = null;
|
|
48208
|
+
|
|
48135
48209
|
const endTime = Date.now();
|
|
48136
48210
|
const frameStats = stats.frame;
|
|
48137
48211
|
|
|
@@ -48240,11 +48314,16 @@ const Renderer$1 = function (scene, options) {
|
|
|
48240
48314
|
|
|
48241
48315
|
pickResult.canvasPos = params.canvasPos;
|
|
48242
48316
|
|
|
48317
|
+
math.canvasPosToWorldRay(canvas, pickViewMatrix, pickProjMatrix, projection, canvasPos, tempVec3a, tempVec3b);
|
|
48318
|
+
frameCtx.testAABB = makeRayAABBIntersectionTest(tempVec3a, tempVec3b);
|
|
48243
48319
|
} else {
|
|
48244
48320
|
|
|
48245
48321
|
// Picking with arbitrary World-space ray
|
|
48246
48322
|
// Align camera along ray and fire ray through center of canvas
|
|
48247
48323
|
|
|
48324
|
+
canvasPos[0] = canvas.clientWidth * 0.5;
|
|
48325
|
+
canvasPos[1] = canvas.clientHeight * 0.5;
|
|
48326
|
+
|
|
48248
48327
|
if (params.matrix) {
|
|
48249
48328
|
|
|
48250
48329
|
pickViewMatrix = params.matrix;
|
|
@@ -48254,6 +48333,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
48254
48333
|
nearAndFar[0] = camera.project.near;
|
|
48255
48334
|
nearAndFar[1] = camera.project.far;
|
|
48256
48335
|
|
|
48336
|
+
math.canvasPosToWorldRay(canvas, pickViewMatrix, pickProjMatrix, projection, canvasPos, tempVec3a, tempVec3b);
|
|
48337
|
+
frameCtx.testAABB = makeRayAABBIntersectionTest(tempVec3a, tempVec3b);
|
|
48257
48338
|
} else {
|
|
48258
48339
|
|
|
48259
48340
|
worldRayOrigin.set(params.origin || [0, 0, 0]);
|
|
@@ -48282,10 +48363,9 @@ const Renderer$1 = function (scene, options) {
|
|
|
48282
48363
|
|
|
48283
48364
|
pickResult.origin = worldRayOrigin;
|
|
48284
48365
|
pickResult.direction = worldRayDir;
|
|
48285
|
-
}
|
|
48286
48366
|
|
|
48287
|
-
|
|
48288
|
-
|
|
48367
|
+
frameCtx.testAABB = makeRayAABBIntersectionTest(pickResult.origin, pickResult.direction);
|
|
48368
|
+
}
|
|
48289
48369
|
}
|
|
48290
48370
|
|
|
48291
48371
|
pickBuffer.bind();
|
|
@@ -48322,6 +48402,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
48322
48402
|
renderDrawables(uiDrawableList);
|
|
48323
48403
|
}
|
|
48324
48404
|
|
|
48405
|
+
frameCtx.testAABB = null;
|
|
48406
|
+
|
|
48325
48407
|
const pickID = pixelToInt(pickBuffer.read(0, 0));
|
|
48326
48408
|
const pickable = (pickID >= 0) && pickIDs.items[pickID];
|
|
48327
48409
|
|