x_ite 8.12.5 → 9.0.0
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/README.md +4 -0
- package/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +14 -14
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +359 -117
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -13
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +9 -9
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +28 -26
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -33
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +23 -23
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +8 -8
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +33 -31
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +24 -24
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +35 -49
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +18 -18
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +17 -17
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +38 -38
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +27 -27
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/{TextureProjector.js → TextureProjection.js} +243 -193
- package/dist/assets/components/TextureProjection.min.js +1 -0
- package/dist/assets/components/Texturing3D.js +175 -136
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +46 -47
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +9 -9
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/assets/lib/README.md +16 -0
- package/dist/assets/lib/draco_decoder_gltf.js +1 -29
- package/dist/assets/lib/libktx.js +1 -0
- package/dist/assets/lib/libktx.wasm +0 -0
- package/dist/assets/lib/lut_ggx.png +0 -0
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +2505 -1767
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.min.mjs +1 -1
- package/dist/x_ite.mjs +2505 -1767
- package/dist/x_ite.zip +0 -0
- package/package.json +3 -2
- package/dist/assets/components/TextureProjector.min.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* X_ITE
|
|
1
|
+
/* X_ITE v9.0.0 */(() => { // webpackBootstrap
|
|
2
2
|
/******/ "use strict";
|
|
3
3
|
/******/ var __webpack_modules__ = ({
|
|
4
4
|
|
|
5
5
|
/***/ 355:
|
|
6
6
|
/***/ ((module) => {
|
|
7
7
|
|
|
8
|
-
module.exports = window [Symbol .for ("X_ITE.X3D-
|
|
8
|
+
module.exports = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("lib/jquery");
|
|
9
9
|
|
|
10
10
|
/***/ })
|
|
11
11
|
|
|
@@ -73,26 +73,111 @@ var __webpack_exports__ = {};
|
|
|
73
73
|
// UNUSED EXPORTS: default
|
|
74
74
|
|
|
75
75
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Components\")"
|
|
76
|
-
const Components_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
76
|
+
const Components_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Components");
|
|
77
77
|
var Components_default = /*#__PURE__*/__webpack_require__.n(Components_namespaceObject);
|
|
78
|
+
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Namespace\")"
|
|
79
|
+
const Namespace_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Namespace");
|
|
80
|
+
var Namespace_default = /*#__PURE__*/__webpack_require__.n(Namespace_namespaceObject);
|
|
81
|
+
;// CONCATENATED MODULE: ./src/x_ite/Browser/CubeMapTexturing/Panorama1.fs.js
|
|
82
|
+
const __default__ = /* glsl */ `precision highp float;precision highp int;precision highp sampler2D;const float M_PI=3.1415926535897932384626433832795;varying vec2 texCoord;uniform sampler2D x3d_PanoramaTexture;uniform int x3d_CurrentFace;vec3 uvToXYZ(const in int face,const in vec2 uv){vec3 xyz;if(face==0)xyz=vec3(1.0,uv.y,uv.x);else if(face==1)xyz=vec3(-1.0,uv.y,-uv.x);else if(face==2)xyz=vec3(uv.x,uv.y,-1.0);else if(face==3)xyz=vec3(-uv.x,uv.y,1.0);else if(face==4)xyz=vec3(uv.y,-1.0,uv.x);else xyz=vec3(-uv.y,1.0,uv.x);return xyz;}vec2 dirToUV(const in vec3 dir){return vec2(0.5+0.5*atan(dir.z,dir.x)/M_PI,1.0-acos(dir.y)/M_PI);}vec3 panoramaToCubeMap(const in int face,const in vec2 texCoord){vec3 scan=uvToXYZ(face,texCoord);vec3 direction=normalize(scan);vec2 src=dirToUV(direction);return texture2D(x3d_PanoramaTexture,src).rgb;}void main(){gl_FragColor=vec4(panoramaToCubeMap(x3d_CurrentFace,texCoord),1.0);}`
|
|
83
|
+
;
|
|
84
|
+
|
|
85
|
+
Namespace_default().add ("Panorama1.fs", "x_ite/Browser/CubeMapTexturing/Panorama1.fs", __default__);
|
|
86
|
+
/* harmony default export */ const Panorama1_fs = (__default__);
|
|
87
|
+
;// CONCATENATED MODULE: ./src/x_ite/Browser/CubeMapTexturing/Panorama2.fs.js
|
|
88
|
+
const Panorama2_fs_default_ = /* glsl */ `#version 300 es
|
|
89
|
+
precision highp float;precision highp int;precision highp sampler2D;const float M_PI=3.1415926535897932384626433832795;in vec2 texCoord;out vec4 x3d_FragColor;uniform sampler2D x3d_PanoramaTexture;uniform int x3d_CurrentFace;vec3 uvToXYZ(const in int face,const in vec2 uv){switch(face){case 0:return vec3(1.0,uv.y,uv.x);case 1:return vec3(-1.0,uv.y,-uv.x);case 2:return vec3(uv.x,uv.y,-1.0);case 3:return vec3(-uv.x,uv.y,1.0);case 4:return vec3(uv.y,-1.0,uv.x);default:return vec3(-uv.y,1.0,uv.x);}}vec2 dirToUV(const in vec3 dir){return vec2(0.5+0.5*atan(dir.z,dir.x)/M_PI,1.0-acos(dir.y)/M_PI);}vec3 panoramaToCubeMap(const in int face,const in vec2 texCoord){vec3 scan=uvToXYZ(face,texCoord);vec3 direction=normalize(scan);vec2 src=dirToUV(direction);return texture(x3d_PanoramaTexture,src).rgb;}void main(){x3d_FragColor=vec4(panoramaToCubeMap(x3d_CurrentFace,texCoord),1.0);}`
|
|
90
|
+
;
|
|
91
|
+
|
|
92
|
+
Namespace_default().add ("Panorama2.fs", "x_ite/Browser/CubeMapTexturing/Panorama2.fs", Panorama2_fs_default_);
|
|
93
|
+
/* harmony default export */ const Panorama2_fs = (Panorama2_fs_default_);
|
|
94
|
+
;// CONCATENATED MODULE: ./src/x_ite/Browser/CubeMapTexturing/X3DCubeMapTexturingContext.js
|
|
95
|
+
/*******************************************************************************
|
|
96
|
+
*
|
|
97
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
98
|
+
*
|
|
99
|
+
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022.
|
|
100
|
+
*
|
|
101
|
+
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
|
|
102
|
+
*
|
|
103
|
+
* The copyright notice above does not evidence any actual of intended
|
|
104
|
+
* publication of such source code, and is an unpublished work by create3000.
|
|
105
|
+
* This material contains CONFIDENTIAL INFORMATION that is the property of
|
|
106
|
+
* create3000.
|
|
107
|
+
*
|
|
108
|
+
* No permission is granted to copy, distribute, or create derivative works from
|
|
109
|
+
* the contents of this software, in whole or in part, without the prior written
|
|
110
|
+
* permission of create3000.
|
|
111
|
+
*
|
|
112
|
+
* NON-MILITARY USE ONLY
|
|
113
|
+
*
|
|
114
|
+
* All create3000 software are effectively free software with a non-military use
|
|
115
|
+
* restriction. It is free. Well commented source is provided. You may reuse the
|
|
116
|
+
* source in any way you please with the exception anything that uses it must be
|
|
117
|
+
* marked to indicate is contains 'non-military use only' components.
|
|
118
|
+
*
|
|
119
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
120
|
+
*
|
|
121
|
+
* Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>.
|
|
122
|
+
*
|
|
123
|
+
* This file is part of the X_ITE Project.
|
|
124
|
+
*
|
|
125
|
+
* X_ITE is free software: you can redistribute it and/or modify it under the
|
|
126
|
+
* terms of the GNU General Public License version 3 only, as published by the
|
|
127
|
+
* Free Software Foundation.
|
|
128
|
+
*
|
|
129
|
+
* X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
130
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
131
|
+
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
|
|
132
|
+
* details (a copy is included in the LICENSE file that accompanied this code).
|
|
133
|
+
*
|
|
134
|
+
* You should have received a copy of the GNU General Public License version 3
|
|
135
|
+
* along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a
|
|
136
|
+
* copy of the GPLv3 License.
|
|
137
|
+
*
|
|
138
|
+
* For Silvio, Joy and Adi.
|
|
139
|
+
*
|
|
140
|
+
******************************************************************************/
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
const
|
|
146
|
+
_panoramaShader = Symbol ();
|
|
147
|
+
|
|
148
|
+
function X3DCubeMapTexturingContext () { }
|
|
149
|
+
|
|
150
|
+
Object .assign (X3DCubeMapTexturingContext .prototype,
|
|
151
|
+
{
|
|
152
|
+
getPanoramaShader ()
|
|
153
|
+
{
|
|
154
|
+
if (this [_panoramaShader])
|
|
155
|
+
return this [_panoramaShader];
|
|
156
|
+
|
|
157
|
+
return this [_panoramaShader] = this .createShader ("Panorama", "FullScreen", "data:x-shader/x-fragment," + ["", Panorama1_fs, Panorama2_fs][this .getContext () .getVersion ()], [ ], ["x3d_PanoramaTexture", "x3d_CurrentFace"]);
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const X3DCubeMapTexturingContext_default_ = X3DCubeMapTexturingContext;
|
|
162
|
+
;
|
|
163
|
+
|
|
164
|
+
Namespace_default().add ("X3DCubeMapTexturingContext", "x_ite/Browser/CubeMapTexturing/X3DCubeMapTexturingContext", X3DCubeMapTexturingContext_default_);
|
|
165
|
+
/* harmony default export */ const CubeMapTexturing_X3DCubeMapTexturingContext = (X3DCubeMapTexturingContext_default_);
|
|
78
166
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Fields\")"
|
|
79
|
-
const Fields_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
167
|
+
const Fields_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Fields");
|
|
80
168
|
var Fields_default = /*#__PURE__*/__webpack_require__.n(Fields_namespaceObject);
|
|
81
169
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DFieldDefinition\")"
|
|
82
|
-
const X3DFieldDefinition_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
170
|
+
const X3DFieldDefinition_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Base/X3DFieldDefinition");
|
|
83
171
|
var X3DFieldDefinition_default = /*#__PURE__*/__webpack_require__.n(X3DFieldDefinition_namespaceObject);
|
|
84
172
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/FieldDefinitionArray\")"
|
|
85
|
-
const FieldDefinitionArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
173
|
+
const FieldDefinitionArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Base/FieldDefinitionArray");
|
|
86
174
|
var FieldDefinitionArray_default = /*#__PURE__*/__webpack_require__.n(FieldDefinitionArray_namespaceObject);
|
|
87
175
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Components/Texturing/X3DSingleTextureNode\")"
|
|
88
|
-
const X3DSingleTextureNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
176
|
+
const X3DSingleTextureNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Components/Texturing/X3DSingleTextureNode");
|
|
89
177
|
var X3DSingleTextureNode_default = /*#__PURE__*/__webpack_require__.n(X3DSingleTextureNode_namespaceObject);
|
|
90
178
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DConstants\")"
|
|
91
|
-
const X3DConstants_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
179
|
+
const X3DConstants_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Base/X3DConstants");
|
|
92
180
|
var X3DConstants_default = /*#__PURE__*/__webpack_require__.n(X3DConstants_namespaceObject);
|
|
93
|
-
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Namespace\")"
|
|
94
|
-
const Namespace_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Namespace");
|
|
95
|
-
var Namespace_default = /*#__PURE__*/__webpack_require__.n(Namespace_namespaceObject);
|
|
96
181
|
;// CONCATENATED MODULE: ./src/x_ite/Components/CubeMapTexturing/X3DEnvironmentTextureNode.js
|
|
97
182
|
/*******************************************************************************
|
|
98
183
|
*
|
|
@@ -162,6 +247,8 @@ function X3DEnvironmentTextureNode (executionContext)
|
|
|
162
247
|
gl .TEXTURE_CUBE_MAP_POSITIVE_Y, // Top
|
|
163
248
|
gl .TEXTURE_CUBE_MAP_NEGATIVE_Y, // Bottom
|
|
164
249
|
];
|
|
250
|
+
|
|
251
|
+
this .size = 1;
|
|
165
252
|
}
|
|
166
253
|
|
|
167
254
|
Object .assign (Object .setPrototypeOf (X3DEnvironmentTextureNode .prototype, (X3DSingleTextureNode_default()).prototype),
|
|
@@ -174,14 +261,18 @@ Object .assign (Object .setPrototypeOf (X3DEnvironmentTextureNode .prototype, (X
|
|
|
174
261
|
{
|
|
175
262
|
return 4;
|
|
176
263
|
},
|
|
177
|
-
getTextureTypeString ()
|
|
178
|
-
{
|
|
179
|
-
return "CUBE";
|
|
180
|
-
},
|
|
181
264
|
getTargets ()
|
|
182
265
|
{
|
|
183
266
|
return this .targets;
|
|
184
267
|
},
|
|
268
|
+
getSize ()
|
|
269
|
+
{
|
|
270
|
+
return this .size;
|
|
271
|
+
},
|
|
272
|
+
setSize (value)
|
|
273
|
+
{
|
|
274
|
+
this .size = value;
|
|
275
|
+
},
|
|
185
276
|
clearTexture: (() =>
|
|
186
277
|
{
|
|
187
278
|
const defaultData = new Uint8Array ([ 255, 255, 255, 255 ]);
|
|
@@ -195,7 +286,9 @@ Object .assign (Object .setPrototypeOf (X3DEnvironmentTextureNode .prototype, (X
|
|
|
195
286
|
for (const target of this .getTargets ())
|
|
196
287
|
gl .texImage2D (target, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData);
|
|
197
288
|
|
|
289
|
+
this .setSize (1);
|
|
198
290
|
this .setTransparent (false);
|
|
291
|
+
this .updateTextureParameters ();
|
|
199
292
|
};
|
|
200
293
|
})(),
|
|
201
294
|
updateTextureParameters ()
|
|
@@ -204,8 +297,8 @@ Object .assign (Object .setPrototypeOf (X3DEnvironmentTextureNode .prototype, (X
|
|
|
204
297
|
this .target,
|
|
205
298
|
this ._textureProperties .getValue (),
|
|
206
299
|
this .texturePropertiesNode,
|
|
207
|
-
|
|
208
|
-
|
|
300
|
+
this .size,
|
|
301
|
+
this .size,
|
|
209
302
|
false,
|
|
210
303
|
false,
|
|
211
304
|
false);
|
|
@@ -234,16 +327,16 @@ Object .defineProperties (X3DEnvironmentTextureNode,
|
|
|
234
327
|
},
|
|
235
328
|
});
|
|
236
329
|
|
|
237
|
-
const
|
|
330
|
+
const X3DEnvironmentTextureNode_default_ = X3DEnvironmentTextureNode;
|
|
238
331
|
;
|
|
239
332
|
|
|
240
|
-
Namespace_default().add ("X3DEnvironmentTextureNode", "x_ite/Components/CubeMapTexturing/X3DEnvironmentTextureNode",
|
|
241
|
-
/* harmony default export */ const CubeMapTexturing_X3DEnvironmentTextureNode = (
|
|
333
|
+
Namespace_default().add ("X3DEnvironmentTextureNode", "x_ite/Components/CubeMapTexturing/X3DEnvironmentTextureNode", X3DEnvironmentTextureNode_default_);
|
|
334
|
+
/* harmony default export */ const CubeMapTexturing_X3DEnvironmentTextureNode = (X3DEnvironmentTextureNode_default_);
|
|
242
335
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DCast\")"
|
|
243
|
-
const X3DCast_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
336
|
+
const X3DCast_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Base/X3DCast");
|
|
244
337
|
var X3DCast_default = /*#__PURE__*/__webpack_require__.n(X3DCast_namespaceObject);
|
|
245
338
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Utility/BitSet\")"
|
|
246
|
-
const BitSet_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
339
|
+
const BitSet_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Utility/BitSet");
|
|
247
340
|
var BitSet_default = /*#__PURE__*/__webpack_require__.n(BitSet_namespaceObject);
|
|
248
341
|
;// CONCATENATED MODULE: ./src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js
|
|
249
342
|
/*******************************************************************************
|
|
@@ -347,34 +440,34 @@ Object .assign (Object .setPrototypeOf (ComposedCubeMapTexture .prototype, CubeM
|
|
|
347
440
|
this ._bottomTexture .addInterest ("set_texture__", this, 4);
|
|
348
441
|
this ._update .addInterest ("update", this);
|
|
349
442
|
|
|
350
|
-
this .set_texture__ (this ._frontTexture
|
|
351
|
-
this .set_texture__ (this ._backTexture
|
|
352
|
-
this .set_texture__ (this ._leftTexture
|
|
353
|
-
this .set_texture__ (this ._rightTexture
|
|
354
|
-
this .set_texture__ (this ._topTexture
|
|
355
|
-
this .set_texture__ (this ._bottomTexture
|
|
443
|
+
this .set_texture__ (0, this ._frontTexture);
|
|
444
|
+
this .set_texture__ (1, this ._backTexture);
|
|
445
|
+
this .set_texture__ (2, this ._leftTexture);
|
|
446
|
+
this .set_texture__ (3, this ._rightTexture);
|
|
447
|
+
this .set_texture__ (4, this ._topTexture);
|
|
448
|
+
this .set_texture__ (5, this ._bottomTexture);
|
|
356
449
|
},
|
|
357
|
-
set_texture__ (
|
|
450
|
+
set_texture__ (index, node)
|
|
358
451
|
{
|
|
359
452
|
let textureNode = this .textureNodes [index];
|
|
360
453
|
|
|
361
|
-
textureNode ?.removeInterest (
|
|
454
|
+
textureNode ?.removeInterest (`set_loadState${index}__`, this);
|
|
362
455
|
|
|
363
456
|
textureNode = this .textureNodes [index] = X3DCast_default() ((X3DConstants_default()).X3DTexture2DNode, node);
|
|
364
457
|
|
|
365
|
-
textureNode ?.addInterest (
|
|
458
|
+
textureNode ?.addInterest (`set_loadState${index}__`, this, index, textureNode);
|
|
366
459
|
|
|
367
|
-
this .set_loadState__ (
|
|
460
|
+
this .set_loadState__ (index, textureNode);
|
|
368
461
|
},
|
|
369
|
-
set_loadState__ (
|
|
462
|
+
set_loadState__ (index, textureNode)
|
|
370
463
|
{
|
|
371
|
-
this .setTextureBit (index, textureNode
|
|
464
|
+
this .setTextureBit (index, textureNode ?.checkLoadState ());
|
|
372
465
|
|
|
373
466
|
this ._update .addEvent ();
|
|
374
467
|
},
|
|
375
|
-
setTextureBit (bit,
|
|
468
|
+
setTextureBit (bit, loadState)
|
|
376
469
|
{
|
|
377
|
-
this .textureBits .set (bit, loadState === (X3DConstants_default()).COMPLETE_STATE
|
|
470
|
+
this .textureBits .set (bit, loadState === (X3DConstants_default()).COMPLETE_STATE);
|
|
378
471
|
},
|
|
379
472
|
isComplete ()
|
|
380
473
|
{
|
|
@@ -403,50 +496,51 @@ Object .assign (Object .setPrototypeOf (ComposedCubeMapTexture .prototype, CubeM
|
|
|
403
496
|
const
|
|
404
497
|
gl = this .getBrowser () .getContext (),
|
|
405
498
|
textureNodes = this .textureNodes,
|
|
406
|
-
|
|
499
|
+
size = textureNodes [0] .getWidth ();
|
|
500
|
+
|
|
501
|
+
// Prepare faces. This is necessary for Chrome and Firefox.
|
|
502
|
+
|
|
503
|
+
if (size !== this .getSize ())
|
|
504
|
+
{
|
|
505
|
+
const defaultData = new Uint8Array (size * size * 4);
|
|
506
|
+
|
|
507
|
+
gl .bindTexture (this .getTarget (), this .getTexture ());
|
|
508
|
+
|
|
509
|
+
for (let i = 0; i < 6; ++ i)
|
|
510
|
+
gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, size, size, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData);
|
|
511
|
+
|
|
512
|
+
this .setSize (size);
|
|
513
|
+
this .updateTextureParameters ();
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Fill with texture data.
|
|
407
517
|
|
|
408
518
|
gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer);
|
|
409
519
|
|
|
410
520
|
for (let i = 0; i < 6; ++ i)
|
|
411
521
|
{
|
|
412
|
-
const
|
|
413
|
-
textureNode = textureNodes [i],
|
|
414
|
-
width = textureNode .getWidth (),
|
|
415
|
-
height = textureNode .getHeight ();
|
|
522
|
+
const textureNode = textureNodes [i];
|
|
416
523
|
|
|
417
524
|
// Copy color texture.
|
|
418
525
|
|
|
419
|
-
|
|
526
|
+
gl .bindTexture (gl .TEXTURE_2D, textureNode .getTexture ());
|
|
527
|
+
gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .TEXTURE_2D, textureNode .getTexture (), 0);
|
|
528
|
+
gl .bindTexture (this .getTarget (), this .getTexture ());
|
|
529
|
+
|
|
530
|
+
if (textureNode .getTextureType () === 1)
|
|
420
531
|
{
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
else
|
|
429
|
-
gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, gl .RGBA, gl .UNSIGNED_BYTE, textureNode .getElement ());
|
|
430
|
-
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
default:
|
|
434
|
-
{
|
|
435
|
-
gl .bindTexture (gl .TEXTURE_2D, textureNode .getTexture ());
|
|
436
|
-
gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .TEXTURE_2D, textureNode .getTexture (), 0);
|
|
437
|
-
|
|
438
|
-
gl .bindTexture (this .getTarget (), this .getTexture ());
|
|
439
|
-
gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, null);
|
|
440
|
-
gl .copyTexSubImage2D (this .getTargets () [i], 0, 0, 0, 0, 0, width, height);
|
|
441
|
-
break;
|
|
442
|
-
}
|
|
532
|
+
gl .copyTexSubImage2D (this .getTargets () [i], 0, 0, 0, 0, 0, size, size);
|
|
533
|
+
}
|
|
534
|
+
else
|
|
535
|
+
{
|
|
536
|
+
// Copy and flip Y.
|
|
537
|
+
for (let y = 0; y < size; ++ y)
|
|
538
|
+
gl .copyTexSubImage2D (this .getTargets () [i], 0, 0, size - y - 1, 0, y, size, 1);
|
|
443
539
|
}
|
|
444
540
|
}
|
|
445
|
-
|
|
446
|
-
gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, false);
|
|
447
|
-
gl .bindFramebuffer (gl .FRAMEBUFFER, lastBuffer);
|
|
448
|
-
|
|
541
|
+
|
|
449
542
|
this .setTransparent (textureNodes .some (textureNode => textureNode .isTransparent ()));
|
|
543
|
+
this .setLinear (textureNodes .some (textureNode => textureNode .isLinear ()));
|
|
450
544
|
this .updateTextureParameters ();
|
|
451
545
|
}
|
|
452
546
|
else
|
|
@@ -495,19 +589,27 @@ Object .defineProperties (ComposedCubeMapTexture,
|
|
|
495
589
|
},
|
|
496
590
|
});
|
|
497
591
|
|
|
592
|
+
for (let index = 0; index < 6; ++ index)
|
|
593
|
+
{
|
|
594
|
+
ComposedCubeMapTexture .prototype [`set_loadState${index}__`] = function (index, textureNode)
|
|
595
|
+
{
|
|
596
|
+
this .set_loadState__ (index, textureNode);
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
|
|
498
600
|
const ComposedCubeMapTexture_default_ = ComposedCubeMapTexture;
|
|
499
601
|
;
|
|
500
602
|
|
|
501
603
|
Namespace_default().add ("ComposedCubeMapTexture", "x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture", ComposedCubeMapTexture_default_);
|
|
502
604
|
/* harmony default export */ const CubeMapTexturing_ComposedCubeMapTexture = (ComposedCubeMapTexture_default_);
|
|
503
605
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DBaseNode\")"
|
|
504
|
-
const X3DBaseNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
606
|
+
const X3DBaseNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Base/X3DBaseNode");
|
|
505
607
|
var X3DBaseNode_default = /*#__PURE__*/__webpack_require__.n(X3DBaseNode_namespaceObject);
|
|
506
608
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Rendering/X3DRenderObject\")"
|
|
507
|
-
const X3DRenderObject_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
609
|
+
const X3DRenderObject_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Rendering/X3DRenderObject");
|
|
508
610
|
var X3DRenderObject_default = /*#__PURE__*/__webpack_require__.n(X3DRenderObject_namespaceObject);
|
|
509
611
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Rendering/TraverseType\")"
|
|
510
|
-
const TraverseType_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
612
|
+
const TraverseType_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Rendering/TraverseType");
|
|
511
613
|
var TraverseType_default = /*#__PURE__*/__webpack_require__.n(TraverseType_namespaceObject);
|
|
512
614
|
;// CONCATENATED MODULE: ./src/x_ite/Rendering/DependentRenderer.js
|
|
513
615
|
/*******************************************************************************
|
|
@@ -647,28 +749,28 @@ const DependentRenderer_default_ = DependentRenderer;
|
|
|
647
749
|
Namespace_default().add ("DependentRenderer", "x_ite/Rendering/DependentRenderer", DependentRenderer_default_);
|
|
648
750
|
/* harmony default export */ const Rendering_DependentRenderer = (DependentRenderer_default_);
|
|
649
751
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Rendering/TextureBuffer\")"
|
|
650
|
-
const TextureBuffer_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
752
|
+
const TextureBuffer_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Rendering/TextureBuffer");
|
|
651
753
|
var TextureBuffer_default = /*#__PURE__*/__webpack_require__.n(TextureBuffer_namespaceObject);
|
|
652
754
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Geometry/Camera\")"
|
|
653
|
-
const Camera_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
755
|
+
const Camera_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Geometry/Camera");
|
|
654
756
|
var Camera_default = /*#__PURE__*/__webpack_require__.n(Camera_namespaceObject);
|
|
655
757
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Geometry/ViewVolume\")"
|
|
656
|
-
const ViewVolume_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
758
|
+
const ViewVolume_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Geometry/ViewVolume");
|
|
657
759
|
var ViewVolume_default = /*#__PURE__*/__webpack_require__.n(ViewVolume_namespaceObject);
|
|
658
760
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Numbers/Rotation4\")"
|
|
659
|
-
const Rotation4_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
761
|
+
const Rotation4_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Numbers/Rotation4");
|
|
660
762
|
var Rotation4_default = /*#__PURE__*/__webpack_require__.n(Rotation4_namespaceObject);
|
|
661
763
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Numbers/Vector3\")"
|
|
662
|
-
const Vector3_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
764
|
+
const Vector3_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Numbers/Vector3");
|
|
663
765
|
var Vector3_default = /*#__PURE__*/__webpack_require__.n(Vector3_namespaceObject);
|
|
664
766
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Numbers/Vector4\")"
|
|
665
|
-
const Vector4_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
767
|
+
const Vector4_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Numbers/Vector4");
|
|
666
768
|
var Vector4_default = /*#__PURE__*/__webpack_require__.n(Vector4_namespaceObject);
|
|
667
769
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Numbers/Matrix4\")"
|
|
668
|
-
const Matrix4_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
770
|
+
const Matrix4_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Numbers/Matrix4");
|
|
669
771
|
var Matrix4_default = /*#__PURE__*/__webpack_require__.n(Matrix4_namespaceObject);
|
|
670
772
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Algorithm\")"
|
|
671
|
-
const Algorithm_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
773
|
+
const Algorithm_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Algorithm");
|
|
672
774
|
var Algorithm_default = /*#__PURE__*/__webpack_require__.n(Algorithm_namespaceObject);
|
|
673
775
|
;// CONCATENATED MODULE: ./src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js
|
|
674
776
|
/*******************************************************************************
|
|
@@ -787,10 +889,14 @@ Object .assign (Object .setPrototypeOf (GeneratedCubeMapTexture .prototype, Cube
|
|
|
787
889
|
|
|
788
890
|
this .viewport = new (Vector4_default()) (0, 0, size, size);
|
|
789
891
|
this .frameBuffer = new (TextureBuffer_default()) (this .getBrowser (), size, size);
|
|
892
|
+
|
|
893
|
+
this .setSize (size);
|
|
790
894
|
}
|
|
791
895
|
else
|
|
792
896
|
{
|
|
793
897
|
this .frameBuffer = null;
|
|
898
|
+
|
|
899
|
+
this .setSize (0);
|
|
794
900
|
}
|
|
795
901
|
},
|
|
796
902
|
traverse (type, renderObject)
|
|
@@ -910,8 +1016,6 @@ Object .assign (Object .setPrototypeOf (GeneratedCubeMapTexture .prototype, Cube
|
|
|
910
1016
|
dependentRenderer .getProjectionMatrix () .pop ();
|
|
911
1017
|
dependentRenderer .getViewVolumes () .pop ();
|
|
912
1018
|
|
|
913
|
-
this .frameBuffer .unbind ();
|
|
914
|
-
|
|
915
1019
|
if (this ._update .getValue () === "NEXT_FRAME_ONLY")
|
|
916
1020
|
this ._update = "NONE";
|
|
917
1021
|
};
|
|
@@ -971,13 +1075,13 @@ const GeneratedCubeMapTexture_default_ = GeneratedCubeMapTexture;
|
|
|
971
1075
|
Namespace_default().add ("GeneratedCubeMapTexture", "x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture", GeneratedCubeMapTexture_default_);
|
|
972
1076
|
/* harmony default export */ const CubeMapTexturing_GeneratedCubeMapTexture = (GeneratedCubeMapTexture_default_);
|
|
973
1077
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Components/Networking/X3DUrlObject\")"
|
|
974
|
-
const X3DUrlObject_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
1078
|
+
const X3DUrlObject_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/Components/Networking/X3DUrlObject");
|
|
975
1079
|
var X3DUrlObject_default = /*#__PURE__*/__webpack_require__.n(X3DUrlObject_namespaceObject);
|
|
976
1080
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"standard/Math/Numbers/Vector2\")"
|
|
977
|
-
const Vector2_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
1081
|
+
const Vector2_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("standard/Math/Numbers/Vector2");
|
|
978
1082
|
var Vector2_default = /*#__PURE__*/__webpack_require__.n(Vector2_namespaceObject);
|
|
979
1083
|
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/DEVELOPMENT\")"
|
|
980
|
-
const DEVELOPMENT_namespaceObject = window [Symbol .for ("X_ITE.X3D-
|
|
1084
|
+
const DEVELOPMENT_namespaceObject = window [Symbol .for ("X_ITE.X3D-9.0.0")] .require ("x_ite/DEVELOPMENT");
|
|
981
1085
|
var DEVELOPMENT_default = /*#__PURE__*/__webpack_require__.n(DEVELOPMENT_namespaceObject);
|
|
982
1086
|
;// CONCATENATED MODULE: ./src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js
|
|
983
1087
|
/* provided dependency */ var $ = __webpack_require__(355);
|
|
@@ -1040,15 +1144,6 @@ var DEVELOPMENT_default = /*#__PURE__*/__webpack_require__.n(DEVELOPMENT_namespa
|
|
|
1040
1144
|
|
|
1041
1145
|
const defaultData = new Uint8Array ([ 255, 255, 255, 255 ]);
|
|
1042
1146
|
|
|
1043
|
-
const offsets = [
|
|
1044
|
-
new (Vector2_default()) (1, 1), // Front
|
|
1045
|
-
new (Vector2_default()) (3, 1), // Back
|
|
1046
|
-
new (Vector2_default()) (0, 1), // Left
|
|
1047
|
-
new (Vector2_default()) (2, 1), // Right
|
|
1048
|
-
new (Vector2_default()) (1, 0), // Bottom, must be exchanged with top
|
|
1049
|
-
new (Vector2_default()) (1, 2), // Top, must be exchanged with bottom
|
|
1050
|
-
];
|
|
1051
|
-
|
|
1052
1147
|
function ImageCubeMapTexture (executionContext)
|
|
1053
1148
|
{
|
|
1054
1149
|
CubeMapTexturing_X3DEnvironmentTextureNode .call (this, executionContext);
|
|
@@ -1114,7 +1209,21 @@ Object .assign (Object .setPrototypeOf (ImageCubeMapTexture .prototype, CubeMapT
|
|
|
1114
1209
|
this .URL .searchParams .set ("_", Date .now ());
|
|
1115
1210
|
}
|
|
1116
1211
|
|
|
1117
|
-
this .
|
|
1212
|
+
if (this .URL .pathname .match (/\.ktx2?(?:\.gz)?$/))
|
|
1213
|
+
{
|
|
1214
|
+
this .setLinear (true);
|
|
1215
|
+
|
|
1216
|
+
this .getBrowser () .getKTXDecoder ()
|
|
1217
|
+
.then (decoder => decoder .loadKTXFromURL (this .URL))
|
|
1218
|
+
.then (texture => this .setKTXTexture (texture))
|
|
1219
|
+
.catch (error => this .setError ({ type: error .message }));
|
|
1220
|
+
}
|
|
1221
|
+
else
|
|
1222
|
+
{
|
|
1223
|
+
this .setLinear (false);
|
|
1224
|
+
|
|
1225
|
+
this .image .attr ("src", this .URL .href);
|
|
1226
|
+
}
|
|
1118
1227
|
},
|
|
1119
1228
|
setError (event)
|
|
1120
1229
|
{
|
|
@@ -1123,15 +1232,85 @@ Object .assign (Object .setPrototypeOf (ImageCubeMapTexture .prototype, CubeMapT
|
|
|
1123
1232
|
|
|
1124
1233
|
this .loadNext ();
|
|
1125
1234
|
},
|
|
1235
|
+
setKTXTexture (texture)
|
|
1236
|
+
{
|
|
1237
|
+
if (texture .target !== this .getTarget ())
|
|
1238
|
+
return this .setError ({ type: "Invalid KTX texture target, must be 'TEXTURE_CUBE_MAP'." });
|
|
1239
|
+
|
|
1240
|
+
if ((DEVELOPMENT_default()))
|
|
1241
|
+
{
|
|
1242
|
+
if (this .URL .protocol !== "data:")
|
|
1243
|
+
console .info (`Done loading image cube map texture '${decodeURI (this .URL .href)}'`);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
try
|
|
1247
|
+
{
|
|
1248
|
+
this .setTexture (texture);
|
|
1249
|
+
this .setTransparent (false);
|
|
1250
|
+
this .setLevels (texture .levels);
|
|
1251
|
+
this .setSize (texture .baseWidth);
|
|
1252
|
+
this .setGenerateMipMaps (false);
|
|
1253
|
+
this .updateTextureParameters ();
|
|
1254
|
+
|
|
1255
|
+
this .setLoadState ((X3DConstants_default()).COMPLETE_STATE);
|
|
1256
|
+
}
|
|
1257
|
+
catch (error)
|
|
1258
|
+
{
|
|
1259
|
+
// Catch security error from cross origin requests.
|
|
1260
|
+
this .setError ({ type: error .message });
|
|
1261
|
+
}
|
|
1262
|
+
},
|
|
1126
1263
|
setImage ()
|
|
1127
1264
|
{
|
|
1128
1265
|
if ((DEVELOPMENT_default()))
|
|
1129
1266
|
{
|
|
1130
|
-
|
|
1267
|
+
if (this .URL .protocol !== "data:")
|
|
1131
1268
|
console .info (`Done loading image cube map texture '${decodeURI (this .URL .href)}'`);
|
|
1132
1269
|
}
|
|
1133
1270
|
|
|
1134
1271
|
try
|
|
1272
|
+
{
|
|
1273
|
+
const aspectRatio = this .image .prop ("width") / this .image .prop ("height");
|
|
1274
|
+
|
|
1275
|
+
if (Math .abs (aspectRatio - 4/3) < 0.01)
|
|
1276
|
+
this .skyBoxToCubeMap ();
|
|
1277
|
+
|
|
1278
|
+
if (Math .abs (aspectRatio - 2/1) < 0.01)
|
|
1279
|
+
this .panoramaToCubeMap ();
|
|
1280
|
+
|
|
1281
|
+
this .setGenerateMipMaps (true);
|
|
1282
|
+
this .updateTextureParameters ();
|
|
1283
|
+
|
|
1284
|
+
// Update load state.
|
|
1285
|
+
|
|
1286
|
+
this .setLoadState ((X3DConstants_default()).COMPLETE_STATE);
|
|
1287
|
+
}
|
|
1288
|
+
catch (error)
|
|
1289
|
+
{
|
|
1290
|
+
// Catch security error from cross origin requests.
|
|
1291
|
+
this .setError ({ type: error .message });
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
skyBoxToCubeMap: (function ()
|
|
1295
|
+
{
|
|
1296
|
+
const offsets = [
|
|
1297
|
+
new (Vector2_default()) (1, 1), // Front
|
|
1298
|
+
new (Vector2_default()) (3, 1), // Back
|
|
1299
|
+
new (Vector2_default()) (0, 1), // Left
|
|
1300
|
+
new (Vector2_default()) (2, 1), // Right
|
|
1301
|
+
new (Vector2_default()) (1, 0), // Top
|
|
1302
|
+
new (Vector2_default()) (1, 2), // Bottom
|
|
1303
|
+
];
|
|
1304
|
+
|
|
1305
|
+
// -----
|
|
1306
|
+
// | t |
|
|
1307
|
+
// -----------------
|
|
1308
|
+
// | l | f | r | b |
|
|
1309
|
+
// -----------------
|
|
1310
|
+
// | b |
|
|
1311
|
+
// -----
|
|
1312
|
+
|
|
1313
|
+
return function ()
|
|
1135
1314
|
{
|
|
1136
1315
|
const
|
|
1137
1316
|
image = this .image [0],
|
|
@@ -1146,7 +1325,7 @@ Object .assign (Object .setPrototypeOf (ImageCubeMapTexture .prototype, CubeMapT
|
|
|
1146
1325
|
|
|
1147
1326
|
// Scale image.
|
|
1148
1327
|
|
|
1149
|
-
if (!
|
|
1328
|
+
if (!Algorithm_default().isPowerOfTwo (width1_4) || !Algorithm_default().isPowerOfTwo (height1_3) || width1_4 * 4 !== width || height1_3 * 3 !== height)
|
|
1150
1329
|
{
|
|
1151
1330
|
width1_4 = Algorithm_default().nextPowerOfTwo (width1_4);
|
|
1152
1331
|
height1_3 = Algorithm_default().nextPowerOfTwo (height1_3);
|
|
@@ -1170,7 +1349,7 @@ Object .assign (Object .setPrototypeOf (ImageCubeMapTexture .prototype, CubeMapT
|
|
|
1170
1349
|
|
|
1171
1350
|
const gl = this .getBrowser () .getContext ();
|
|
1172
1351
|
|
|
1173
|
-
let
|
|
1352
|
+
let transparent = false;
|
|
1174
1353
|
|
|
1175
1354
|
gl .bindTexture (this .getTarget (), this .getTexture ());
|
|
1176
1355
|
|
|
@@ -1180,38 +1359,99 @@ Object .assign (Object .setPrototypeOf (ImageCubeMapTexture .prototype, CubeMapT
|
|
|
1180
1359
|
|
|
1181
1360
|
// Determine image alpha.
|
|
1182
1361
|
|
|
1183
|
-
if (
|
|
1184
|
-
|
|
1185
|
-
for (let a = 3; a < data .length; a += 4)
|
|
1186
|
-
{
|
|
1187
|
-
if (data [a] !== 255)
|
|
1188
|
-
{
|
|
1189
|
-
opaque = false;
|
|
1190
|
-
break;
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1362
|
+
if (!transparent)
|
|
1363
|
+
transparent = this .isImageTransparent (data);
|
|
1194
1364
|
|
|
1195
1365
|
// Transfer image.
|
|
1196
1366
|
|
|
1197
1367
|
gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, width1_4, height1_3, false, gl .RGBA, gl .UNSIGNED_BYTE, new Uint8Array (data .buffer));
|
|
1198
1368
|
}
|
|
1199
1369
|
|
|
1200
|
-
|
|
1370
|
+
// Update size and transparent field.
|
|
1201
1371
|
|
|
1202
|
-
|
|
1372
|
+
this .setTransparent (transparent);
|
|
1373
|
+
this .setSize (width1_4);
|
|
1374
|
+
};
|
|
1375
|
+
})(),
|
|
1376
|
+
panoramaToCubeMap ()
|
|
1377
|
+
{
|
|
1378
|
+
// Mercator Projection
|
|
1203
1379
|
|
|
1204
|
-
|
|
1380
|
+
const
|
|
1381
|
+
browser = this .getBrowser (),
|
|
1382
|
+
gl = browser .getContext (),
|
|
1383
|
+
shaderNode = browser .getPanoramaShader (),
|
|
1384
|
+
framebuffer = gl .createFramebuffer (),
|
|
1385
|
+
panoramaTexture = gl .createTexture (),
|
|
1386
|
+
textureUnit = browser .getTextureCubeUnit (),
|
|
1387
|
+
cubeMapSize = this .image .prop ("height") / 2;
|
|
1205
1388
|
|
|
1206
|
-
|
|
1389
|
+
// Create panorama texture.
|
|
1207
1390
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1391
|
+
gl .bindTexture (gl .TEXTURE_2D, panoramaTexture);
|
|
1392
|
+
gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA, gl .RGBA, gl .UNSIGNED_BYTE, this .image [0]);
|
|
1393
|
+
|
|
1394
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .MIRRORED_REPEAT);
|
|
1395
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .MIRRORED_REPEAT);
|
|
1396
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .LINEAR);
|
|
1397
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .LINEAR);
|
|
1398
|
+
|
|
1399
|
+
// Init cube map texture.
|
|
1400
|
+
|
|
1401
|
+
gl .bindTexture (this .getTarget (), this .getTexture ());
|
|
1402
|
+
|
|
1403
|
+
for (let i = 0; i < 6; ++ i)
|
|
1404
|
+
gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, cubeMapSize, cubeMapSize, 0, gl .RGBA, gl .UNSIGNED_BYTE, null);
|
|
1405
|
+
|
|
1406
|
+
// Render faces.
|
|
1407
|
+
|
|
1408
|
+
gl .useProgram (shaderNode .getProgram ());
|
|
1409
|
+
|
|
1410
|
+
gl .activeTexture (gl .TEXTURE0 + textureUnit);
|
|
1411
|
+
gl .bindTexture (gl .TEXTURE_2D, panoramaTexture);
|
|
1412
|
+
gl .uniform1i (shaderNode .x3d_PanoramaTexture, textureUnit);
|
|
1413
|
+
|
|
1414
|
+
gl .bindFramebuffer (gl .FRAMEBUFFER, framebuffer);
|
|
1415
|
+
gl .viewport (0, 0, cubeMapSize, cubeMapSize);
|
|
1416
|
+
gl .disable (gl .DEPTH_TEST);
|
|
1417
|
+
gl .enable (gl .CULL_FACE);
|
|
1418
|
+
gl .frontFace (gl .CCW);
|
|
1419
|
+
gl .clearColor (0, 0, 0, 0);
|
|
1420
|
+
gl .bindVertexArray (browser .getFullscreenVertexArrayObject ());
|
|
1421
|
+
|
|
1422
|
+
for (let i = 0; i < 6; ++ i)
|
|
1211
1423
|
{
|
|
1212
|
-
|
|
1213
|
-
|
|
1424
|
+
gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, this .getTargets () [i], this .getTexture (), 0);
|
|
1425
|
+
gl .clear (gl .COLOR_BUFFER_BIT);
|
|
1426
|
+
|
|
1427
|
+
gl .uniform1i (shaderNode .x3d_CurrentFace, i);
|
|
1428
|
+
|
|
1429
|
+
gl .drawArrays (gl .TRIANGLES, 0, 6);
|
|
1214
1430
|
}
|
|
1431
|
+
|
|
1432
|
+
gl .deleteFramebuffer (framebuffer);
|
|
1433
|
+
gl .deleteTexture (panoramaTexture);
|
|
1434
|
+
|
|
1435
|
+
browser .resetTextureUnits ();
|
|
1436
|
+
|
|
1437
|
+
// Determine image alpha.
|
|
1438
|
+
|
|
1439
|
+
const
|
|
1440
|
+
image = this .image [0],
|
|
1441
|
+
canvas = this .canvas [0],
|
|
1442
|
+
cx = canvas .getContext ("2d", { willReadFrequently: true });
|
|
1443
|
+
|
|
1444
|
+
canvas .width = image .width;
|
|
1445
|
+
canvas .height = image .height;
|
|
1446
|
+
|
|
1447
|
+
cx .drawImage (image, 0, 0);
|
|
1448
|
+
|
|
1449
|
+
const data = cx .getImageData (0, 0, image .width, image .height) .data;
|
|
1450
|
+
|
|
1451
|
+
// Update size and transparent field.
|
|
1452
|
+
|
|
1453
|
+
this .setTransparent (this .isImageTransparent (data));
|
|
1454
|
+
this .setSize (cubeMapSize);
|
|
1215
1455
|
},
|
|
1216
1456
|
dispose ()
|
|
1217
1457
|
{
|
|
@@ -1316,6 +1556,7 @@ Namespace_default().add ("ImageCubeMapTexture", "x_ite/Components/CubeMapTexturi
|
|
|
1316
1556
|
|
|
1317
1557
|
|
|
1318
1558
|
|
|
1559
|
+
|
|
1319
1560
|
Components_default().add ({
|
|
1320
1561
|
name: "CubeMapTexturing",
|
|
1321
1562
|
concreteNodes:
|
|
@@ -1328,6 +1569,7 @@ Components_default().add ({
|
|
|
1328
1569
|
[
|
|
1329
1570
|
CubeMapTexturing_X3DEnvironmentTextureNode,
|
|
1330
1571
|
],
|
|
1572
|
+
browserContext: CubeMapTexturing_X3DCubeMapTexturingContext,
|
|
1331
1573
|
});
|
|
1332
1574
|
|
|
1333
1575
|
const CubeMapTexturing_default_ = undefined;
|