@xeokit/xeokit-sdk 2.6.99 → 2.6.100
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 +62 -6
- package/dist/xeokit-sdk.es.js +62 -6
- package/dist/xeokit-sdk.es5.js +31 -9
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +5 -5
- package/package.json +1 -1
- package/src/plugins/NavCubePlugin/NavCubePlugin.js +1 -0
- package/src/viewer/scene/materials/Texture.js +2 -0
- package/src/viewer/scene/math/math.js +48 -2
- package/src/viewer/scene/webgl/Texture2D.js +7 -0
- package/types/viewer/scene/materials/Texture.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeokit/xeokit-sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.100",
|
|
4
4
|
"description": "3D BIM IFC Viewer SDK for AEC engineering applications. Open Source JavaScript Toolkit based on pure WebGL for top performance, real-world coordinates and full double precision",
|
|
5
5
|
"module": "./dist/xeokit-sdk.es.js",
|
|
6
6
|
"main": "./dist/xeokit-sdk.cjs.js",
|
|
@@ -103,6 +103,7 @@ class Texture extends Component {
|
|
|
103
103
|
* @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
|
|
104
104
|
* @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.
|
|
105
105
|
* Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.
|
|
106
|
+
* @param {Number} [cfg.maxAnisotropy=false] Max anisotropy to use for texture filtering (see EXT_texture_filter_anisotropic).
|
|
106
107
|
* @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.
|
|
107
108
|
* @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
|
|
108
109
|
* @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..
|
|
@@ -120,6 +121,7 @@ class Texture extends Component {
|
|
|
120
121
|
texture: new Texture2D({gl: this.scene.canvas.gl}),
|
|
121
122
|
matrix: math.identityMat4(),
|
|
122
123
|
hasMatrix: (cfg.translate && (cfg.translate[0] !== 0 || cfg.translate[1] !== 0)) || (!!cfg.rotate) || (cfg.scale && (cfg.scale[0] !== 0 || cfg.scale[1] !== 0)),
|
|
124
|
+
maxAnisotropy: cfg.maxAnisotropy,
|
|
123
125
|
minFilter: this._checkMinFilter(cfg.minFilter),
|
|
124
126
|
magFilter: this._checkMagFilter(cfg.magFilter),
|
|
125
127
|
wrapS: this._checkWrapS(cfg.wrapS),
|
|
@@ -253,6 +253,16 @@ const math = {
|
|
|
253
253
|
return a;
|
|
254
254
|
},
|
|
255
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Returns true if the two 2-element vectors are the same.
|
|
258
|
+
* @param v1
|
|
259
|
+
* @param v2
|
|
260
|
+
* @returns {Boolean}
|
|
261
|
+
*/
|
|
262
|
+
compareVec2(v1, v2) {
|
|
263
|
+
return (v1[0] === v2[0] && v1[1] === v2[1]);
|
|
264
|
+
},
|
|
265
|
+
|
|
256
266
|
/**
|
|
257
267
|
* Returns true if the two 3-element vectors are the same.
|
|
258
268
|
* @param v1
|
|
@@ -350,6 +360,24 @@ const math = {
|
|
|
350
360
|
return dest;
|
|
351
361
|
},
|
|
352
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Adds one two-element vector to another.
|
|
365
|
+
* @method addVec3
|
|
366
|
+
* @static
|
|
367
|
+
* @param {Array(Number)} u First vector
|
|
368
|
+
* @param {Array(Number)} v Second vector
|
|
369
|
+
* @param {Array(Number)} [dest] Destination vector
|
|
370
|
+
* @return {Array(Number)} dest if specified, u otherwise
|
|
371
|
+
*/
|
|
372
|
+
addVec2(u, v, dest) {
|
|
373
|
+
if (!dest) {
|
|
374
|
+
dest = u;
|
|
375
|
+
}
|
|
376
|
+
dest[0] = u[0] + v[0];
|
|
377
|
+
dest[1] = u[1] + v[1];
|
|
378
|
+
return dest;
|
|
379
|
+
},
|
|
380
|
+
|
|
353
381
|
/**
|
|
354
382
|
* Adds one three-element vector to another.
|
|
355
383
|
* @method addVec3
|
|
@@ -504,8 +532,26 @@ const math = {
|
|
|
504
532
|
},
|
|
505
533
|
|
|
506
534
|
/**
|
|
507
|
-
* Multiplies one
|
|
508
|
-
* @method
|
|
535
|
+
* Multiplies one two-element vector by another.
|
|
536
|
+
* @method mulVec2
|
|
537
|
+
* @static
|
|
538
|
+
* @param {Array(Number)} u First vector
|
|
539
|
+
* @param {Array(Number)} v Second vector
|
|
540
|
+
* @param {Array(Number)} [dest] Destination vector
|
|
541
|
+
* @return {Array(Number)} dest if specified, u otherwise
|
|
542
|
+
*/
|
|
543
|
+
mulVec2(u, v, dest) {
|
|
544
|
+
if (!dest) {
|
|
545
|
+
dest = u;
|
|
546
|
+
}
|
|
547
|
+
dest[0] = u[0] * v[0];
|
|
548
|
+
dest[1] = u[1] * v[1];
|
|
549
|
+
return dest;
|
|
550
|
+
},
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Multiplies one four-element vector by another.
|
|
554
|
+
* @method mulVec4
|
|
509
555
|
* @static
|
|
510
556
|
* @param {Array(Number)} u First vector
|
|
511
557
|
* @param {Array(Number)} v Second vector
|
|
@@ -108,6 +108,7 @@ class Texture2D {
|
|
|
108
108
|
if (props.unpackAlignment !== undefined) {
|
|
109
109
|
this.unpackAlignment = props.unpackAlignment;
|
|
110
110
|
}
|
|
111
|
+
this.maxAnisotropy = props.maxAnisotropy;
|
|
111
112
|
if (props.minFilter !== undefined) {
|
|
112
113
|
this.minFilter = props.minFilter;
|
|
113
114
|
}
|
|
@@ -140,6 +141,12 @@ class Texture2D {
|
|
|
140
141
|
const bak4 = gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL);;
|
|
141
142
|
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
|
|
142
143
|
|
|
144
|
+
const anisoExt = this.maxAnisotropy && getExtension(gl, "EXT_texture_filter_anisotropic");
|
|
145
|
+
if (anisoExt) {
|
|
146
|
+
const max = gl.getParameter(anisoExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
|
|
147
|
+
gl.texParameterf(gl.TEXTURE_2D, anisoExt.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(max, this.maxAnisotropy));
|
|
148
|
+
}
|
|
149
|
+
|
|
143
150
|
const minFilter = convertConstant(gl, this.minFilter);
|
|
144
151
|
gl.texParameteri(this.target, gl.TEXTURE_MIN_FILTER, minFilter);
|
|
145
152
|
|
|
@@ -7,6 +7,8 @@ export declare type TextureConfiguration = {
|
|
|
7
7
|
src?: string;
|
|
8
8
|
/** HTML Image object to load into this Texture. See the {@link Texture#image} property for more info. */
|
|
9
9
|
image?: HTMLImageElement;
|
|
10
|
+
/** Max anisotropy to use for texture filtering (see EXT_texture_filter_anisotropic). */
|
|
11
|
+
maxAnisotropy?: number;
|
|
10
12
|
/** How the texture is sampled when a texel covers less than one pixel. */
|
|
11
13
|
minFilter?: "LinearFilter" | "LinearMipMapNearestFilter" | "NearestMipMapNearestFilter" | "NearestMipMapLinearFilter" | "LinearMipMapLinearFilter";
|
|
12
14
|
/** How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}. */
|