@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.cjs.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
|
'use strict';
|
|
@@ -1973,7 +1973,7 @@ const tempVec3a$j = new FloatArrayType(3);
|
|
|
1973
1973
|
|
|
1974
1974
|
const tempMat1 = new FloatArrayType(16);
|
|
1975
1975
|
const tempMat2 = new FloatArrayType(16);
|
|
1976
|
-
const tempVec4$
|
|
1976
|
+
const tempVec4$4 = new FloatArrayType(4);
|
|
1977
1977
|
|
|
1978
1978
|
|
|
1979
1979
|
/**
|
|
@@ -4079,9 +4079,9 @@ const math = {
|
|
|
4079
4079
|
|
|
4080
4080
|
const sy = math.lenVec3(vec);
|
|
4081
4081
|
|
|
4082
|
-
vec[
|
|
4083
|
-
vec[
|
|
4084
|
-
vec[
|
|
4082
|
+
vec[0] = mat[8];
|
|
4083
|
+
vec[1] = mat[9];
|
|
4084
|
+
vec[2] = mat[10];
|
|
4085
4085
|
|
|
4086
4086
|
const sz = math.lenVec3(vec);
|
|
4087
4087
|
|
|
@@ -5188,7 +5188,7 @@ const math = {
|
|
|
5188
5188
|
},
|
|
5189
5189
|
|
|
5190
5190
|
quaternionToAngleAxis(q, angleAxis = math.vec4()) {
|
|
5191
|
-
q = math.normalizeQuaternion(q, tempVec4$
|
|
5191
|
+
q = math.normalizeQuaternion(q, tempVec4$4);
|
|
5192
5192
|
const q3 = q[3];
|
|
5193
5193
|
const angle = 2 * Math.acos(q3);
|
|
5194
5194
|
const s = Math.sqrt(1 - q3 * q3);
|
|
@@ -9618,6 +9618,7 @@ class Component {
|
|
|
9618
9618
|
this._eventCallDepth = 0;
|
|
9619
9619
|
this._ownedComponents = null;
|
|
9620
9620
|
this._updateScheduled = false;
|
|
9621
|
+
this._renderer = null;
|
|
9621
9622
|
}
|
|
9622
9623
|
}
|
|
9623
9624
|
|
|
@@ -20662,7 +20663,7 @@ const CompressedMediaType = 10003;
|
|
|
20662
20663
|
|
|
20663
20664
|
const ids$1 = new Map$1({});
|
|
20664
20665
|
const tempVec3a$f = math.vec3();
|
|
20665
|
-
const tempVec4$
|
|
20666
|
+
const tempVec4$3 = math.vec4();
|
|
20666
20667
|
const TEXTURE_DECODE_FUNCS = { [sRGBEncoding]: "sRGBToLinear" };
|
|
20667
20668
|
|
|
20668
20669
|
const iota$3 = function(n) {
|
|
@@ -21082,11 +21083,11 @@ const createLightSetup = function(programVariables, lightsState) {
|
|
|
21082
21083
|
const lightUniforms = {
|
|
21083
21084
|
color: programVariables.createUniform("vec4", `lightColor${i}`, (set) => {
|
|
21084
21085
|
const light = lights[i]; // in case it changed
|
|
21085
|
-
tempVec4$
|
|
21086
|
-
tempVec4$
|
|
21087
|
-
tempVec4$
|
|
21088
|
-
tempVec4$
|
|
21089
|
-
set(tempVec4$
|
|
21086
|
+
tempVec4$3[0] = light.color[0];
|
|
21087
|
+
tempVec4$3[1] = light.color[1];
|
|
21088
|
+
tempVec4$3[2] = light.color[2];
|
|
21089
|
+
tempVec4$3[3] = light.intensity;
|
|
21090
|
+
set(tempVec4$3);
|
|
21090
21091
|
}),
|
|
21091
21092
|
position: programVariables.createUniform("vec3", `lightPos${i}`, (set) => set(lights[i].pos)),
|
|
21092
21093
|
direction: programVariables.createUniform("vec3", `lightDir${i}`, (set) => set(lights[i].dir)),
|
|
@@ -21268,7 +21269,7 @@ const makeInputSetters = function(gl, handle) {
|
|
|
21268
21269
|
};
|
|
21269
21270
|
};
|
|
21270
21271
|
|
|
21271
|
-
const tempVec4$
|
|
21272
|
+
const tempVec4$2 = math.vec4();
|
|
21272
21273
|
|
|
21273
21274
|
const DrawShaderSource = function(meshDrawHash, programVariables, geometry, material, scene) {
|
|
21274
21275
|
const materialState = material._state;
|
|
@@ -21359,10 +21360,10 @@ const DrawShaderSource = function(meshDrawHash, programVariables, geometry, mate
|
|
|
21359
21360
|
const materialAlphaModeCutoff = setupUniform("materialAlphaModeCutoff", "vec4", mtl => {
|
|
21360
21361
|
const alpha = mtl.alpha;
|
|
21361
21362
|
if ((alpha !== undefined) && (alpha !== null)) {
|
|
21362
|
-
tempVec4$
|
|
21363
|
-
tempVec4$
|
|
21364
|
-
tempVec4$
|
|
21365
|
-
return tempVec4$
|
|
21363
|
+
tempVec4$2[0] = alpha;
|
|
21364
|
+
tempVec4$2[1] = (mtl.alphaMode === 1 ? 1 : 0);
|
|
21365
|
+
tempVec4$2[2] = mtl.alphaCutoff;
|
|
21366
|
+
return tempVec4$2;
|
|
21366
21367
|
} else {
|
|
21367
21368
|
return null;
|
|
21368
21369
|
}
|
|
@@ -31848,7 +31849,7 @@ const SnapProgram = function(programVariables, geometry, isSnapInit, isPoints) {
|
|
|
31848
31849
|
const coordinateScaler = programVariables.createUniform("vec3", "coordinateScaler", (set, state) => set(state.legacyFrameCtx.snapPickCoordinateScale));
|
|
31849
31850
|
|
|
31850
31851
|
const vWorldPosition = programVariables.createVarying("vec3", "vWorldPosition", () => `${geometry.attributes.position.world}.xyz`);
|
|
31851
|
-
const vPickColor = programVariables.createVarying("vec4", "vPickColor", () => geometry.attributes.pickColor
|
|
31852
|
+
const vPickColor = programVariables.createVarying("vec4", "vPickColor", () => geometry.attributes.pickColor); // Using `flat` causes an instability - see XEOK-385 and XEOK-401
|
|
31852
31853
|
|
|
31853
31854
|
const outCoords = programVariables.createOutput("highp ivec4", "outCoords", 0);
|
|
31854
31855
|
const outNormal = programVariables.createOutput("highp ivec4", "outNormal", 1);
|
|
@@ -31873,7 +31874,7 @@ const SnapProgram = function(programVariables, geometry, isSnapInit, isPoints) {
|
|
|
31873
31874
|
|
|
31874
31875
|
const tempVec2 = math.vec2();
|
|
31875
31876
|
const tempVec3$6 = math.vec3();
|
|
31876
|
-
const tempVec4 = math.vec4();
|
|
31877
|
+
const tempVec4$1 = math.vec4();
|
|
31877
31878
|
const tempMat4$2 = math.mat4();
|
|
31878
31879
|
const vec3zero = math.vec3([0,0,0]);
|
|
31879
31880
|
|
|
@@ -32356,6 +32357,15 @@ class Layer {
|
|
|
32356
32357
|
|
|
32357
32358
|
aabbChanged() { this._aabbDirty = true; }
|
|
32358
32359
|
|
|
32360
|
+
getAABB() {
|
|
32361
|
+
if (this._aabbDirty) { // Per-layer AABB for best RTC accuracy
|
|
32362
|
+
math.collapseAABB3(this._aabb);
|
|
32363
|
+
this._meshes.forEach(m => math.expandAABB3(this._aabb, m.aabb));
|
|
32364
|
+
this._aabbDirty = false;
|
|
32365
|
+
}
|
|
32366
|
+
return this._aabb;
|
|
32367
|
+
}
|
|
32368
|
+
|
|
32359
32369
|
__drawLayer(renderFlags, frameCtx, renderer, pass) {
|
|
32360
32370
|
if ((this._countsByFlag[ENTITY_FLAGS.CULLED].count < this._portions.length) && (this._countsByFlag[ENTITY_FLAGS.VISIBLE].count > 0)) {
|
|
32361
32371
|
const backfacePasses = (this.primitive !== "points") && (this.primitive !== "lines") && [
|
|
@@ -32428,7 +32438,7 @@ class Layer {
|
|
|
32428
32438
|
// ---------------------- SILHOUETTE RENDERING -----------------------------------
|
|
32429
32439
|
|
|
32430
32440
|
__drawSilhouette(renderFlags, frameCtx, material, renderPass) {
|
|
32431
|
-
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.fillColor, material.fillAlpha, tempVec4);
|
|
32441
|
+
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.fillColor, material.fillAlpha, tempVec4$1);
|
|
32432
32442
|
this.__drawLayer(renderFlags, frameCtx, this._renderers.silhouetteRenderer, renderPass);
|
|
32433
32443
|
}
|
|
32434
32444
|
|
|
@@ -32474,7 +32484,7 @@ class Layer {
|
|
|
32474
32484
|
__drawUniformEdges(renderFlags, frameCtx, material, renderPass) {
|
|
32475
32485
|
const renderer = this._renderers.edgesRenderers && this._renderers.edgesRenderers.uniform;
|
|
32476
32486
|
if (renderer) {
|
|
32477
|
-
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.edgeColor, material.edgeAlpha, tempVec4);
|
|
32487
|
+
frameCtx.programColor = this.__setVec4FromMaterialColorAlpha(material.edgeColor, material.edgeAlpha, tempVec4$1);
|
|
32478
32488
|
this.__drawLayer(renderFlags, frameCtx, renderer, renderPass);
|
|
32479
32489
|
}
|
|
32480
32490
|
}
|
|
@@ -32521,13 +32531,7 @@ class Layer {
|
|
|
32521
32531
|
drawSnap(renderFlags, frameCtx, isSnapInit) {
|
|
32522
32532
|
frameCtx.snapPickOrigin = [0, 0, 0];
|
|
32523
32533
|
|
|
32524
|
-
|
|
32525
|
-
math.collapseAABB3(this._aabb);
|
|
32526
|
-
this._meshes.forEach(m => math.expandAABB3(this._aabb, m.aabb));
|
|
32527
|
-
this._aabbDirty = false;
|
|
32528
|
-
}
|
|
32529
|
-
|
|
32530
|
-
const aabb = this._aabb;
|
|
32534
|
+
const aabb = this.getAABB();
|
|
32531
32535
|
frameCtx.snapPickCoordinateScale = math.mulVec3Scalar(
|
|
32532
32536
|
safeInvVec3([ aabb[3] - aabb[0], aabb[4] - aabb[1], aabb[5] - aabb[2] ]),
|
|
32533
32537
|
math.MAX_INT);
|
|
@@ -40972,34 +40976,37 @@ class SceneModel extends Component {
|
|
|
40972
40976
|
/**
|
|
40973
40977
|
* @private
|
|
40974
40978
|
*/
|
|
40975
|
-
_withEachVisibleLayer(testNumVisibleLayerPortions, cb) {
|
|
40979
|
+
_withEachVisibleLayer(frameCtx, testNumVisibleLayerPortions, cb) {
|
|
40976
40980
|
if (testNumVisibleLayerPortions && (this.numVisibleLayerPortions === 0)) {
|
|
40977
40981
|
return;
|
|
40978
40982
|
}
|
|
40983
|
+
const testLayerCull = frameCtx.testAABB;
|
|
40979
40984
|
const renderFlags = this.renderFlags;
|
|
40980
40985
|
for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {
|
|
40981
|
-
const
|
|
40982
|
-
|
|
40983
|
-
|
|
40984
|
-
|
|
40985
|
-
|
|
40986
|
-
|
|
40987
|
-
|
|
40988
|
-
|
|
40989
|
-
|
|
40990
|
-
|
|
40991
|
-
|
|
40992
|
-
|
|
40993
|
-
|
|
40994
|
-
|
|
40995
|
-
|
|
40996
|
-
|
|
40997
|
-
|
|
40998
|
-
|
|
40999
|
-
|
|
41000
|
-
|
|
41001
|
-
|
|
41002
|
-
|
|
40986
|
+
const layer = this.layerList[renderFlags.visibleLayers[i]];
|
|
40987
|
+
if ((! testLayerCull) || testLayerCull(layer.getAABB())) {
|
|
40988
|
+
cb(layer);
|
|
40989
|
+
}
|
|
40990
|
+
}
|
|
40991
|
+
}
|
|
40992
|
+
|
|
40993
|
+
drawColorOpaque (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawColorOpaque (this.renderFlags, frameCtx)); }
|
|
40994
|
+
drawColorTransparent (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawColorTransparent (this.renderFlags, frameCtx)); }
|
|
40995
|
+
drawDepth (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawDepth (this.renderFlags, frameCtx)); } // Dedicated to SAO because it skips transparent objects
|
|
40996
|
+
drawSilhouetteXRayed (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawSilhouetteXRayed (this.renderFlags, frameCtx)); }
|
|
40997
|
+
drawSilhouetteHighlighted(frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawSilhouetteHighlighted(this.renderFlags, frameCtx)); }
|
|
40998
|
+
drawSilhouetteSelected (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawSilhouetteSelected (this.renderFlags, frameCtx)); }
|
|
40999
|
+
drawEdgesColorOpaque (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesColorOpaque (this.renderFlags, frameCtx)); }
|
|
41000
|
+
drawEdgesColorTransparent(frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesColorTransparent(this.renderFlags, frameCtx)); }
|
|
41001
|
+
drawEdgesXRayed (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesXRayed (this.renderFlags, frameCtx)); }
|
|
41002
|
+
drawEdgesHighlighted (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesHighlighted (this.renderFlags, frameCtx)); }
|
|
41003
|
+
drawEdgesSelected (frameCtx) { this._withEachVisibleLayer(frameCtx, false, layer => layer.drawEdgesSelected (this.renderFlags, frameCtx)); }
|
|
41004
|
+
drawOcclusion (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawOcclusion (this.renderFlags, frameCtx)); }
|
|
41005
|
+
drawShadow (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawShadow (this.renderFlags, frameCtx)); }
|
|
41006
|
+
drawPickMesh (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawPickMesh (this.renderFlags, frameCtx)); }
|
|
41007
|
+
drawPickDepths (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawPickDepths (this.renderFlags, frameCtx)); }
|
|
41008
|
+
drawPickNormals (frameCtx) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawPickNormals (this.renderFlags, frameCtx)); }
|
|
41009
|
+
_drawSnap (frameCtx, isSnapInit) { this._withEachVisibleLayer(frameCtx, true, layer => layer.drawSnap (this.renderFlags, frameCtx, isSnapInit)); }
|
|
41003
41010
|
|
|
41004
41011
|
drawSnapInit(frameCtx) { this._drawSnap(frameCtx, true ); }
|
|
41005
41012
|
drawSnap (frameCtx) { this._drawSnap(frameCtx, false); }
|
|
@@ -47041,6 +47048,9 @@ const vec3_0 = math.vec3([0,0,0]);
|
|
|
47041
47048
|
|
|
47042
47049
|
const iota = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
|
|
47043
47050
|
|
|
47051
|
+
const tempPlanes = iota(6).map(() => math.vec4());
|
|
47052
|
+
const tempVec4 = math.vec4();
|
|
47053
|
+
|
|
47044
47054
|
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]);
|
|
47045
47055
|
|
|
47046
47056
|
const pixelToInt = pix => pix[0] + (pix[1] << 8) + (pix[2] << 16) + (pix[3] << 24);
|
|
@@ -47050,6 +47060,66 @@ const toWorldPos = (p, origin, scale) => math.vec3([ p[0] * scale[0] + origin
|
|
|
47050
47060
|
p[1] * scale[1] + origin[1],
|
|
47051
47061
|
p[2] * scale[2] + origin[2] ]);
|
|
47052
47062
|
|
|
47063
|
+
const makeFrustumAABBIntersectionTest = function(camera) {
|
|
47064
|
+
const m = math.mat4();
|
|
47065
|
+
math.mulMat4(camera.projMatrix, camera.viewMatrix, m);
|
|
47066
|
+
|
|
47067
|
+
for (let i = 0; i < 3; ++i) {
|
|
47068
|
+
tempPlanes[i * 2 + 0][0] = m[ 3] + m[i];
|
|
47069
|
+
tempPlanes[i * 2 + 0][1] = m[ 7] + m[i + 4];
|
|
47070
|
+
tempPlanes[i * 2 + 0][2] = m[11] + m[i + 8];
|
|
47071
|
+
tempPlanes[i * 2 + 0][3] = m[15] + m[i + 12];
|
|
47072
|
+
|
|
47073
|
+
tempPlanes[i * 2 + 1][0] = m[ 3] - m[i];
|
|
47074
|
+
tempPlanes[i * 2 + 1][1] = m[ 7] - m[i + 4];
|
|
47075
|
+
tempPlanes[i * 2 + 1][2] = m[11] - m[i + 8];
|
|
47076
|
+
tempPlanes[i * 2 + 1][3] = m[15] - m[i + 12];
|
|
47077
|
+
}
|
|
47078
|
+
|
|
47079
|
+
// Normalize each plane
|
|
47080
|
+
tempPlanes.forEach(p => math.divVec4Scalar(p, math.lenVec3(p), p));
|
|
47081
|
+
|
|
47082
|
+
return aabb => tempPlanes.every(p => {
|
|
47083
|
+
// Compute the positive vertex (farthest in direction of normal)
|
|
47084
|
+
tempVec4[0] = aabb[(p[0] >= 0) ? 3 : 0];
|
|
47085
|
+
tempVec4[1] = aabb[(p[1] >= 0) ? 4 : 1];
|
|
47086
|
+
tempVec4[2] = aabb[(p[2] >= 0) ? 5 : 2];
|
|
47087
|
+
tempVec4[3] = 1;
|
|
47088
|
+
return math.dotVec4(p, tempVec4) >= 0;
|
|
47089
|
+
});
|
|
47090
|
+
};
|
|
47091
|
+
|
|
47092
|
+
const makeRayAABBIntersectionTest = (O, D) => aabb => {
|
|
47093
|
+
let tmin = -Infinity;
|
|
47094
|
+
let tmax = Infinity;
|
|
47095
|
+
|
|
47096
|
+
for (let i = 0; i < 3; i++) {
|
|
47097
|
+
const origin = O[i];
|
|
47098
|
+
const direction = D[i];
|
|
47099
|
+
const minBound = aabb[i];
|
|
47100
|
+
const maxBound = aabb[i + 3];
|
|
47101
|
+
|
|
47102
|
+
if (Math.abs(direction) < 1e-8) {
|
|
47103
|
+
// Ray is parallel to plane
|
|
47104
|
+
if ((origin < minBound) || (origin > maxBound)) {
|
|
47105
|
+
return false; // No intersection
|
|
47106
|
+
}
|
|
47107
|
+
} else {
|
|
47108
|
+
const t1 = (minBound - origin) / direction;
|
|
47109
|
+
const t2 = (maxBound - origin) / direction;
|
|
47110
|
+
|
|
47111
|
+
tmin = Math.max(tmin, Math.min(t1, t2)); // near
|
|
47112
|
+
tmax = Math.min(tmax, Math.max(t1, t2)); // far
|
|
47113
|
+
|
|
47114
|
+
if (tmin > tmax) {
|
|
47115
|
+
return false; // No intersection
|
|
47116
|
+
}
|
|
47117
|
+
}
|
|
47118
|
+
}
|
|
47119
|
+
|
|
47120
|
+
return tmax >= 0; // Check if intersection is in front of ray
|
|
47121
|
+
};
|
|
47122
|
+
|
|
47053
47123
|
/**
|
|
47054
47124
|
* @private
|
|
47055
47125
|
*/
|
|
@@ -47802,6 +47872,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
47802
47872
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
47803
47873
|
}
|
|
47804
47874
|
|
|
47875
|
+
frameCtx.testAABB = makeFrustumAABBIntersectionTest(scene.camera);
|
|
47876
|
+
|
|
47805
47877
|
const renderDrawables = function(drawables) {
|
|
47806
47878
|
|
|
47807
47879
|
let normalDrawSAOBinLen = 0;
|
|
@@ -48136,6 +48208,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
48136
48208
|
renderDrawables(uiDrawableList);
|
|
48137
48209
|
}
|
|
48138
48210
|
|
|
48211
|
+
frameCtx.testAABB = null;
|
|
48212
|
+
|
|
48139
48213
|
const endTime = Date.now();
|
|
48140
48214
|
const frameStats = stats.frame;
|
|
48141
48215
|
|
|
@@ -48244,11 +48318,16 @@ const Renderer$1 = function (scene, options) {
|
|
|
48244
48318
|
|
|
48245
48319
|
pickResult.canvasPos = params.canvasPos;
|
|
48246
48320
|
|
|
48321
|
+
math.canvasPosToWorldRay(canvas, pickViewMatrix, pickProjMatrix, projection, canvasPos, tempVec3a, tempVec3b);
|
|
48322
|
+
frameCtx.testAABB = makeRayAABBIntersectionTest(tempVec3a, tempVec3b);
|
|
48247
48323
|
} else {
|
|
48248
48324
|
|
|
48249
48325
|
// Picking with arbitrary World-space ray
|
|
48250
48326
|
// Align camera along ray and fire ray through center of canvas
|
|
48251
48327
|
|
|
48328
|
+
canvasPos[0] = canvas.clientWidth * 0.5;
|
|
48329
|
+
canvasPos[1] = canvas.clientHeight * 0.5;
|
|
48330
|
+
|
|
48252
48331
|
if (params.matrix) {
|
|
48253
48332
|
|
|
48254
48333
|
pickViewMatrix = params.matrix;
|
|
@@ -48258,6 +48337,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
48258
48337
|
nearAndFar[0] = camera.project.near;
|
|
48259
48338
|
nearAndFar[1] = camera.project.far;
|
|
48260
48339
|
|
|
48340
|
+
math.canvasPosToWorldRay(canvas, pickViewMatrix, pickProjMatrix, projection, canvasPos, tempVec3a, tempVec3b);
|
|
48341
|
+
frameCtx.testAABB = makeRayAABBIntersectionTest(tempVec3a, tempVec3b);
|
|
48261
48342
|
} else {
|
|
48262
48343
|
|
|
48263
48344
|
worldRayOrigin.set(params.origin || [0, 0, 0]);
|
|
@@ -48286,10 +48367,9 @@ const Renderer$1 = function (scene, options) {
|
|
|
48286
48367
|
|
|
48287
48368
|
pickResult.origin = worldRayOrigin;
|
|
48288
48369
|
pickResult.direction = worldRayDir;
|
|
48289
|
-
}
|
|
48290
48370
|
|
|
48291
|
-
|
|
48292
|
-
|
|
48371
|
+
frameCtx.testAABB = makeRayAABBIntersectionTest(pickResult.origin, pickResult.direction);
|
|
48372
|
+
}
|
|
48293
48373
|
}
|
|
48294
48374
|
|
|
48295
48375
|
pickBuffer.bind();
|
|
@@ -48326,6 +48406,8 @@ const Renderer$1 = function (scene, options) {
|
|
|
48326
48406
|
renderDrawables(uiDrawableList);
|
|
48327
48407
|
}
|
|
48328
48408
|
|
|
48409
|
+
frameCtx.testAABB = null;
|
|
48410
|
+
|
|
48329
48411
|
const pickID = pixelToInt(pickBuffer.read(0, 0));
|
|
48330
48412
|
const pickable = (pickID >= 0) && pickIDs.items[pickID];
|
|
48331
48413
|
|