x_ite 8.6.5 → 8.6.7
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/Makefile +1 -0
- package/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +13 -13
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +26 -26
- 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 +19 -19
- 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 +18 -18
- 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 +27 -27
- 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 +23 -23
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +19 -19
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +18 -18
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +28 -28
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +24 -24
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/TextureProjector.js +14 -14
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +34 -34
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +19 -19
- 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/draco_decoder_gltf.js +29 -0
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +2693 -2428
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +1 -1
- package/docs/_posts/components/Navigation/NavigationInfo.md +8 -3
- package/docs/_posts/laboratory/x3d-file-converter.md +5 -0
- package/docs/_tabs/laboratory.md +2 -2
- package/docs/laboratory/gltf-sample-viewer.html +72 -3
- package/package.json +2 -2
- package/src/assets/lib/draco_decoder_gltf.js +29 -0
- package/src/assets/shaders/webgl1/include/Particle.glsl.js +7 -0
- package/src/assets/shaders/webgl1/include/Vertex.glsl.js +3 -2
- package/src/assets/shaders/webgl2/include/Particle.glsl.js +18 -5
- package/src/standard/Utility/ObjectCache.js +9 -10
- package/src/x_ite/Base/Events.js +10 -23
- package/src/x_ite/Base/X3DObject.js +29 -16
- package/src/x_ite/Browser/Networking/URLs.js +4 -0
- package/src/x_ite/Browser/Picking/X3DPickingContext.js +1 -1
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +1 -1
- package/src/x_ite/Browser/Shaders/Shaders.js +2 -0
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +7 -0
- package/src/x_ite/Browser/X3DBrowserContext.js +3 -3
- package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +1 -1
- package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +6 -7
- package/src/x_ite/Components/Layering/X3DLayerNode.js +1 -3
- package/src/x_ite/Components/Navigation/OrthoViewpoint.js +1 -1
- package/src/x_ite/Components/Shape/Material.js +25 -26
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +2 -3
- package/src/x_ite/Components/Shape/UnlitMaterial.js +2 -3
- package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +10 -12
- package/src/x_ite/Components/Texturing/ImageTexture.js +7 -17
- package/src/x_ite/Components/Texturing/MovieTexture.js +4 -5
- package/src/x_ite/Parser/GLTF2Parser.js +194 -36
- package/src/x_ite/Parser/SVGParser.js +341 -252
- package/src/x_ite/Rendering/X3DRenderObject.js +3 -4
- package/webpack.config.js +2 -0
|
@@ -72,6 +72,7 @@ varying vec3 vertex;
|
|
|
72
72
|
|
|
73
73
|
// Main
|
|
74
74
|
|
|
75
|
+
#pragma X3D include "Particle.glsl"
|
|
75
76
|
#pragma X3D include "PointSize.glsl"
|
|
76
77
|
|
|
77
78
|
void
|
|
@@ -100,11 +101,11 @@ vertex_main ()
|
|
|
100
101
|
#if ! defined (X3D_GEOMETRY_0D) && ! defined (X3D_GEOMETRY_1D)
|
|
101
102
|
#if defined (X3D_TEXTURE) || defined (X3D_MATERIAL_TEXTURES)
|
|
102
103
|
#if X3D_NUM_TEXTURE_COORDINATES > 0
|
|
103
|
-
texCoord0 = x3d_TexCoord0;
|
|
104
|
+
texCoord0 = getTexCoord (x3d_TexCoord0);
|
|
104
105
|
#endif
|
|
105
106
|
|
|
106
107
|
#if X3D_NUM_TEXTURE_COORDINATES > 1
|
|
107
|
-
texCoord1 = x3d_TexCoord1;
|
|
108
|
+
texCoord1 = getTexCoord (x3d_TexCoord1);
|
|
108
109
|
#endif
|
|
109
110
|
#endif
|
|
110
111
|
#endif
|
|
@@ -4,8 +4,6 @@ export default /* glsl */ `
|
|
|
4
4
|
in vec4 x3d_Particle;
|
|
5
5
|
in mat4 x3d_ParticleMatrix;
|
|
6
6
|
|
|
7
|
-
uniform sampler2D x3d_TexCoordRamp;
|
|
8
|
-
|
|
9
7
|
vec4
|
|
10
8
|
texelFetch (const in sampler2D sampler, const in int index, const in int lod)
|
|
11
9
|
{
|
|
@@ -17,8 +15,11 @@ texelFetch (const in sampler2D sampler, const in int index, const in int lod)
|
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
#if defined (X3D_TEX_COORD_RAMP)
|
|
18
|
+
|
|
19
|
+
uniform sampler2D x3d_TexCoordRamp;
|
|
20
|
+
|
|
20
21
|
vec4
|
|
21
|
-
|
|
22
|
+
getParticleTexCoord (const in vec4 texCoord)
|
|
22
23
|
{
|
|
23
24
|
const int map [6] = int [6] (0, 1, 2, 0, 2, 3);
|
|
24
25
|
|
|
@@ -27,7 +28,7 @@ getTexCoord (const in vec4 texCoord)
|
|
|
27
28
|
return texelFetch (x3d_TexCoordRamp, index0 + map [gl_VertexID % 6], 0);
|
|
28
29
|
}
|
|
29
30
|
#else
|
|
30
|
-
#define
|
|
31
|
+
#define getParticleTexCoord(texCoord) (texCoord)
|
|
31
32
|
#endif
|
|
32
33
|
|
|
33
34
|
vec4
|
|
@@ -39,7 +40,19 @@ getVertex (const in vec4 vertex)
|
|
|
39
40
|
#else
|
|
40
41
|
|
|
41
42
|
#define getVertex(vertex) (vertex)
|
|
42
|
-
#define
|
|
43
|
+
#define getParticleTexCoord(texCoord) (texCoord)
|
|
44
|
+
|
|
45
|
+
#endif
|
|
43
46
|
|
|
47
|
+
#if defined (X3D_PHYSICAL_MATERIAL)
|
|
48
|
+
vec4
|
|
49
|
+
getTexCoord (const in vec4 texCoord)
|
|
50
|
+
{
|
|
51
|
+
vec4 t = getParticleTexCoord (texCoord);
|
|
52
|
+
|
|
53
|
+
return vec4 (t .x, 1.0 - t .y, t .z, t .w);
|
|
54
|
+
}
|
|
55
|
+
#else
|
|
56
|
+
#define getTexCoord(texCoord) getParticleTexCoord(texCoord)
|
|
44
57
|
#endif
|
|
45
58
|
`;
|
|
@@ -47,27 +47,26 @@
|
|
|
47
47
|
|
|
48
48
|
function ObjectCache (Type)
|
|
49
49
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
size: 0,
|
|
50
|
+
return Object .assign ([ ],
|
|
51
|
+
{
|
|
52
|
+
top: 0,
|
|
54
53
|
pop: function ()
|
|
55
54
|
{
|
|
56
|
-
if (this .
|
|
57
|
-
return
|
|
55
|
+
if (this .top !== 0)
|
|
56
|
+
return this [-- this .top];
|
|
58
57
|
|
|
59
58
|
return new Type ();
|
|
60
59
|
},
|
|
61
60
|
push: function (object)
|
|
62
61
|
{
|
|
63
|
-
|
|
62
|
+
this [this .top ++] = object;
|
|
64
63
|
},
|
|
65
64
|
clear: function ()
|
|
66
65
|
{
|
|
67
|
-
|
|
68
|
-
this .
|
|
66
|
+
this .length = 0;
|
|
67
|
+
this .top = 0;
|
|
69
68
|
},
|
|
70
|
-
};
|
|
69
|
+
});
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
export default ObjectCache;
|
package/src/x_ite/Base/Events.js
CHANGED
|
@@ -45,20 +45,13 @@
|
|
|
45
45
|
*
|
|
46
46
|
******************************************************************************/
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
function Events ()
|
|
51
|
-
{
|
|
52
|
-
this [_stack] = [ ];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
Events .prototype =
|
|
48
|
+
const Events = Object .assign ([ ],
|
|
56
49
|
{
|
|
57
50
|
create: function (field)
|
|
58
51
|
{
|
|
59
|
-
if (this
|
|
52
|
+
if (this .length)
|
|
60
53
|
{
|
|
61
|
-
const event = this
|
|
54
|
+
const event = this .pop ();
|
|
62
55
|
|
|
63
56
|
event .field = field;
|
|
64
57
|
event .clear ();
|
|
@@ -74,9 +67,9 @@ Events .prototype =
|
|
|
74
67
|
},
|
|
75
68
|
copy: function (event)
|
|
76
69
|
{
|
|
77
|
-
if (this
|
|
70
|
+
if (this .length)
|
|
78
71
|
{
|
|
79
|
-
const copy = this
|
|
72
|
+
const copy = this .pop ();
|
|
80
73
|
|
|
81
74
|
copy .field = event .field;
|
|
82
75
|
copy .clear ();
|
|
@@ -95,19 +88,13 @@ Events .prototype =
|
|
|
95
88
|
|
|
96
89
|
return copy;
|
|
97
90
|
},
|
|
98
|
-
push: function (event)
|
|
99
|
-
{
|
|
100
|
-
this [_stack] .push (event);
|
|
101
|
-
},
|
|
102
91
|
clear: function ()
|
|
103
92
|
{
|
|
104
|
-
this
|
|
93
|
+
this .length = 0;
|
|
105
94
|
},
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
for (const key of Reflect .ownKeys (Events .prototype))
|
|
109
|
-
Object .defineProperty (Events .prototype, key, { enumerable: false });
|
|
95
|
+
});
|
|
110
96
|
|
|
111
|
-
const
|
|
97
|
+
for (const key of Reflect .ownKeys (Events))
|
|
98
|
+
Object .defineProperty (Events, key, { enumerable: false });
|
|
112
99
|
|
|
113
|
-
export default
|
|
100
|
+
export default Events;
|
|
@@ -83,13 +83,16 @@ X3DObject .prototype =
|
|
|
83
83
|
},
|
|
84
84
|
getInterestId: function (callbackName, object)
|
|
85
85
|
{
|
|
86
|
+
if (typeof callbackName === "symbol")
|
|
87
|
+
return X3DObject .getId (object) + ".Symbol(" + SymbolId (callbackName) + ")";
|
|
88
|
+
|
|
86
89
|
return X3DObject .getId (object) + "." + String (callbackName);
|
|
87
90
|
},
|
|
88
91
|
hasInterest: function (callbackName, object)
|
|
89
92
|
{
|
|
90
93
|
return this [_interests] .has (this .getInterestId (callbackName, object));
|
|
91
94
|
},
|
|
92
|
-
addInterest: function (callbackName, object)
|
|
95
|
+
addInterest: function (callbackName, object, ... args)
|
|
93
96
|
{
|
|
94
97
|
if (this [_interests] === X3DObject .prototype [_interests])
|
|
95
98
|
{
|
|
@@ -101,19 +104,7 @@ X3DObject .prototype =
|
|
|
101
104
|
interestId = this .getInterestId (callbackName, object),
|
|
102
105
|
callback = object [callbackName];
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
const args = Array .prototype .slice .call (arguments, 2);
|
|
107
|
-
|
|
108
|
-
args .unshift (object);
|
|
109
|
-
args .push (this);
|
|
110
|
-
|
|
111
|
-
this [_interests] .set (interestId, Function .prototype .bind .apply (callback, args));
|
|
112
|
-
}
|
|
113
|
-
else
|
|
114
|
-
{
|
|
115
|
-
this [_interests] .set (interestId, callback .bind (object, this));
|
|
116
|
-
}
|
|
107
|
+
this [_interests] .set (interestId, callback .bind (object, ... args, this));
|
|
117
108
|
},
|
|
118
109
|
removeInterest: function (callbackName, object)
|
|
119
110
|
{
|
|
@@ -185,9 +176,31 @@ X3DObject .prototype =
|
|
|
185
176
|
for (const key of Reflect .ownKeys (X3DObject .prototype))
|
|
186
177
|
Object .defineProperty (X3DObject .prototype, key, { enumerable: false });
|
|
187
178
|
|
|
188
|
-
|
|
179
|
+
Object .assign (X3DObject,
|
|
180
|
+
{
|
|
181
|
+
getId: (function ()
|
|
182
|
+
{
|
|
183
|
+
const map = new WeakMap ();
|
|
184
|
+
|
|
185
|
+
let counter = 0;
|
|
186
|
+
|
|
187
|
+
return function (object)
|
|
188
|
+
{
|
|
189
|
+
const id = map .get (object);
|
|
190
|
+
|
|
191
|
+
if (id !== undefined)
|
|
192
|
+
return id;
|
|
193
|
+
|
|
194
|
+
map .set (object, ++ counter);
|
|
195
|
+
|
|
196
|
+
return counter;
|
|
197
|
+
};
|
|
198
|
+
})(),
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const SymbolId = (function ()
|
|
189
202
|
{
|
|
190
|
-
const map = new
|
|
203
|
+
const map = new Map ();
|
|
191
204
|
|
|
192
205
|
let counter = 0;
|
|
193
206
|
|
|
@@ -86,6 +86,10 @@ const URLs = {
|
|
|
86
86
|
{
|
|
87
87
|
return new URL ("assets/hatching/" + index + ".png", this .getScriptUrl ()) .href;
|
|
88
88
|
},
|
|
89
|
+
getLibUrl: function (file)
|
|
90
|
+
{
|
|
91
|
+
return new URL ("assets/lib/" + file, this .getScriptUrl ()) .href;
|
|
92
|
+
},
|
|
89
93
|
};
|
|
90
94
|
|
|
91
95
|
export default URLs;
|
|
@@ -111,7 +111,7 @@ X3DPickingContext .prototype =
|
|
|
111
111
|
{
|
|
112
112
|
this [_pickingTime] .start ();
|
|
113
113
|
|
|
114
|
-
this .getWorld () .traverse (TraverseType .PICKING
|
|
114
|
+
this .getWorld () .traverse (TraverseType .PICKING);
|
|
115
115
|
|
|
116
116
|
for (const transformSensorNode of this [_transformSensorNodes])
|
|
117
117
|
{
|
|
@@ -220,7 +220,7 @@ X3DPointingDeviceSensorContext .prototype =
|
|
|
220
220
|
this [_pointer] .set (x, y);
|
|
221
221
|
this [_pointingBuffer] .bind ();
|
|
222
222
|
|
|
223
|
-
this .getWorld () .traverse (TraverseType .POINTER
|
|
223
|
+
this .getWorld () .traverse (TraverseType .POINTER);
|
|
224
224
|
|
|
225
225
|
this [_pointingBuffer] .getHit (hit);
|
|
226
226
|
this [_pointingBuffer] .unbind ();
|
|
@@ -53,6 +53,7 @@ import Fragment1 from "../../../assets/shaders/webgl1/include/Fragm
|
|
|
53
53
|
import Hatch1 from "../../../assets/shaders/webgl1/include/Hatch.glsl.js";
|
|
54
54
|
import Material1 from "../../../assets/shaders/webgl1/include/Material.glsl.js";
|
|
55
55
|
import Normal1 from "../../../assets/shaders/webgl1/include/Normal.glsl.js";
|
|
56
|
+
import Particle1 from "../../../assets/shaders/webgl1/include/Particle.glsl.js";
|
|
56
57
|
import Perlin1 from "../../../assets/shaders/webgl1/include/Perlin.glsl.js";
|
|
57
58
|
import Point1 from "../../../assets/shaders/webgl1/include/Point.glsl.js";
|
|
58
59
|
import PointSize1 from "../../../assets/shaders/webgl1/include/PointSize.glsl.js";
|
|
@@ -116,6 +117,7 @@ const Shaders = {
|
|
|
116
117
|
Hatch: Hatch1,
|
|
117
118
|
Material: Material1,
|
|
118
119
|
Normal: Normal1,
|
|
120
|
+
Particle: Particle1,
|
|
119
121
|
Perlin: Perlin1,
|
|
120
122
|
Point: Point1,
|
|
121
123
|
PointSize: PointSize1,
|
|
@@ -871,6 +871,13 @@ Object .defineProperty (X3DBrowser .prototype, "version",
|
|
|
871
871
|
configurable: false
|
|
872
872
|
});
|
|
873
873
|
|
|
874
|
+
Object .defineProperty (X3DBrowser .prototype, "providerUrl",
|
|
875
|
+
{
|
|
876
|
+
get: function () { return this .getProviderUrl (); },
|
|
877
|
+
enumerable: true,
|
|
878
|
+
configurable: false
|
|
879
|
+
});
|
|
880
|
+
|
|
874
881
|
Object .defineProperty (X3DBrowser .prototype, "currentFrameRate",
|
|
875
882
|
{
|
|
876
883
|
get: function () { return this .getCurrentFrameRate (); },
|
|
@@ -276,7 +276,7 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
|
|
|
276
276
|
// Camera
|
|
277
277
|
|
|
278
278
|
this [_cameraTime] .start ();
|
|
279
|
-
this [_world] .traverse (TraverseType .CAMERA
|
|
279
|
+
this [_world] .traverse (TraverseType .CAMERA);
|
|
280
280
|
this [_cameraTime] .stop ();
|
|
281
281
|
|
|
282
282
|
// Collision
|
|
@@ -284,7 +284,7 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
|
|
|
284
284
|
this [_collisionTime] .start ();
|
|
285
285
|
|
|
286
286
|
if (this .getCollisionCount ())
|
|
287
|
-
this [_world] .traverse (TraverseType .COLLISION
|
|
287
|
+
this [_world] .traverse (TraverseType .COLLISION);
|
|
288
288
|
|
|
289
289
|
this [_collisionTime] .stop ();
|
|
290
290
|
|
|
@@ -304,7 +304,7 @@ X3DBrowserContext .prototype = Object .assign (Object .create (X3DBaseNode .prot
|
|
|
304
304
|
gl .clearColor (0, 0, 0, 0);
|
|
305
305
|
gl .clear (gl .COLOR_BUFFER_BIT);
|
|
306
306
|
|
|
307
|
-
this [_world] .traverse (TraverseType .DISPLAY
|
|
307
|
+
this [_world] .traverse (TraverseType .DISPLAY);
|
|
308
308
|
|
|
309
309
|
this .getFrameBuffer () .blit ();
|
|
310
310
|
|
|
@@ -203,7 +203,7 @@ ComposedCubeMapTexture .prototype = Object .assign (Object .create (X3DEnvironme
|
|
|
203
203
|
case X3DConstants .MovieTexture:
|
|
204
204
|
{
|
|
205
205
|
gl .bindTexture (this .getTarget (), this .getTexture ());
|
|
206
|
-
gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL,
|
|
206
|
+
gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, false);
|
|
207
207
|
gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, textureNode .getElement ());
|
|
208
208
|
break;
|
|
209
209
|
}
|
|
@@ -68,13 +68,12 @@ SquadOrientationInterpolator .prototype = Object .assign (Object .create (X3DInt
|
|
|
68
68
|
{
|
|
69
69
|
constructor: SquadOrientationInterpolator,
|
|
70
70
|
[Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
|
|
71
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "metadata",
|
|
72
|
-
new X3DFieldDefinition (X3DConstants .inputOnly, "set_fraction",
|
|
73
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "closed",
|
|
74
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "key",
|
|
75
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "keyValue",
|
|
76
|
-
new X3DFieldDefinition (X3DConstants .
|
|
77
|
-
new X3DFieldDefinition (X3DConstants .outputOnly, "value_changed", new Fields .SFRotation ()),
|
|
71
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
|
|
72
|
+
new X3DFieldDefinition (X3DConstants .inputOnly, "set_fraction", new Fields .SFFloat ()),
|
|
73
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "closed", new Fields .SFBool ()),
|
|
74
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "key", new Fields .MFFloat ()),
|
|
75
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "keyValue", new Fields .MFRotation ()),
|
|
76
|
+
new X3DFieldDefinition (X3DConstants .outputOnly, "value_changed", new Fields .SFRotation ()),
|
|
78
77
|
]),
|
|
79
78
|
getTypeName: function ()
|
|
80
79
|
{
|
|
@@ -258,10 +258,8 @@ X3DLayerNode .prototype = Object .assign (Object .create (X3DNode .prototype),
|
|
|
258
258
|
if (viewpointNode ._viewAll .getValue ())
|
|
259
259
|
viewpointNode .viewAll (this .getBBox (new Box3 ()));
|
|
260
260
|
},
|
|
261
|
-
traverse: function (type, renderObject)
|
|
261
|
+
traverse: function (type, renderObject = this)
|
|
262
262
|
{
|
|
263
|
-
renderObject = renderObject || this;
|
|
264
|
-
|
|
265
263
|
const viewpointNode = this .getViewpoint ();
|
|
266
264
|
|
|
267
265
|
this .getProjectionMatrix () .pushMatrix (viewpointNode .getProjectionMatrix (this));
|
|
@@ -71,30 +71,29 @@ Material .prototype = Object .assign (Object .create (X3DOneSidedMaterialNode .p
|
|
|
71
71
|
{
|
|
72
72
|
constructor: Material,
|
|
73
73
|
[Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
|
|
74
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "metadata",
|
|
75
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "ambientIntensity",
|
|
76
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTextureMapping",
|
|
77
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTexture",
|
|
78
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseColor",
|
|
79
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTextureMapping",
|
|
80
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTexture",
|
|
81
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "specularColor",
|
|
82
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "specularTextureMapping",
|
|
83
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "specularTexture",
|
|
84
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor",
|
|
85
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
86
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
87
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
88
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
89
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
90
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
91
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
92
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
93
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
94
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
95
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
96
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "
|
|
97
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "transparency", new Fields .SFFloat ()),
|
|
74
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
|
|
75
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "ambientIntensity", new Fields .SFFloat (0.2)),
|
|
76
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTextureMapping", new Fields .SFString ()),
|
|
77
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTexture", new Fields .SFNode ()),
|
|
78
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseColor", new Fields .SFColor (0.8, 0.8, 0.8)),
|
|
79
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTextureMapping", new Fields .SFString ()),
|
|
80
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTexture", new Fields .SFNode ()),
|
|
81
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "specularColor", new Fields .SFColor ()),
|
|
82
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "specularTextureMapping", new Fields .SFString ()),
|
|
83
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "specularTexture", new Fields .SFNode ()),
|
|
84
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor", new Fields .SFColor ()),
|
|
85
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTextureMapping", new Fields .SFString ()),
|
|
86
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTexture", new Fields .SFNode ()),
|
|
87
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "shininess", new Fields .SFFloat (0.2)),
|
|
88
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "shininessTextureMapping", new Fields .SFString ()),
|
|
89
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "shininessTexture", new Fields .SFNode ()),
|
|
90
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionStrength", new Fields .SFFloat (1)),
|
|
91
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionTextureMapping", new Fields .SFString ()),
|
|
92
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionTexture", new Fields .SFNode ()),
|
|
93
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "normalScale", new Fields .SFFloat (1)),
|
|
94
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "normalTextureMapping", new Fields .SFString ()),
|
|
95
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "normalTexture", new Fields .SFNode ()),
|
|
96
|
+
new X3DFieldDefinition (X3DConstants .inputOutput, "transparency", new Fields .SFFloat ()),
|
|
98
97
|
]),
|
|
99
98
|
getTypeName: function ()
|
|
100
99
|
{
|
|
@@ -211,8 +210,8 @@ Material .prototype = Object .assign (Object .create (X3DOneSidedMaterialNode .p
|
|
|
211
210
|
},
|
|
212
211
|
set_transparent__: function ()
|
|
213
212
|
{
|
|
214
|
-
this .setTransparent (
|
|
215
|
-
|
|
213
|
+
this .setTransparent (!!(this .getTransparency () ||
|
|
214
|
+
(this .diffuseTextureNode && this .diffuseTextureNode .isTransparent ())));
|
|
216
215
|
},
|
|
217
216
|
getTextureIndices: (function ()
|
|
218
217
|
{
|
|
@@ -71,7 +71,6 @@ PhysicalMaterial .prototype = Object .assign (Object .create (X3DOneSidedMateria
|
|
|
71
71
|
new X3DFieldDefinition (X3DConstants .inputOutput, "baseTextureMapping", new Fields .SFString ()),
|
|
72
72
|
new X3DFieldDefinition (X3DConstants .inputOutput, "baseTexture", new Fields .SFNode ()),
|
|
73
73
|
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor", new Fields .SFColor (0, 0, 0)),
|
|
74
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveStrength", new Fields .SFFloat (1)),
|
|
75
74
|
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTextureMapping", new Fields .SFString ()),
|
|
76
75
|
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTexture", new Fields .SFNode ()),
|
|
77
76
|
new X3DFieldDefinition (X3DConstants .inputOutput, "metallic", new Fields .SFFloat (1)),
|
|
@@ -170,8 +169,8 @@ PhysicalMaterial .prototype = Object .assign (Object .create (X3DOneSidedMateria
|
|
|
170
169
|
},
|
|
171
170
|
set_transparent__: function ()
|
|
172
171
|
{
|
|
173
|
-
this .setTransparent (
|
|
174
|
-
|
|
172
|
+
this .setTransparent (!!(this .getTransparency () ||
|
|
173
|
+
(this .baseTextureNode && this .baseTextureNode .isTransparent ())));
|
|
175
174
|
},
|
|
176
175
|
getTextureIndices: (function ()
|
|
177
176
|
{
|
|
@@ -64,7 +64,6 @@ UnlitMaterial .prototype = Object .assign (Object .create (X3DOneSidedMaterialNo
|
|
|
64
64
|
[Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
|
|
65
65
|
new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
|
|
66
66
|
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor", new Fields .SFColor (1, 1, 1)),
|
|
67
|
-
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveStrength", new Fields .SFFloat (1)),
|
|
68
67
|
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTextureMapping", new Fields .SFString ()),
|
|
69
68
|
new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTexture", new Fields .SFNode ()),
|
|
70
69
|
new X3DFieldDefinition (X3DConstants .inputOutput, "normalScale", new Fields .SFFloat (1)),
|
|
@@ -102,8 +101,8 @@ UnlitMaterial .prototype = Object .assign (Object .create (X3DOneSidedMaterialNo
|
|
|
102
101
|
},
|
|
103
102
|
set_transparent__: function ()
|
|
104
103
|
{
|
|
105
|
-
this .setTransparent (
|
|
106
|
-
|
|
104
|
+
this .setTransparent (!!(this .getTransparency () ||
|
|
105
|
+
(this .getEmissiveTexture () && this .getEmissiveTexture () .isTransparent ())));
|
|
107
106
|
},
|
|
108
107
|
getMaterialKey: function ()
|
|
109
108
|
{
|
|
@@ -69,12 +69,11 @@ X3DOneSidedMaterialNode .prototype = Object .assign (Object .create (X3DMaterial
|
|
|
69
69
|
{
|
|
70
70
|
X3DMaterialNode .prototype .initialize .call (this);
|
|
71
71
|
|
|
72
|
-
this ._emissiveColor
|
|
73
|
-
this .
|
|
74
|
-
this .
|
|
75
|
-
this .
|
|
76
|
-
this ._transparency
|
|
77
|
-
this ._transparency .addInterest ("set_transparent__", this);
|
|
72
|
+
this ._emissiveColor .addInterest ("set_emissiveColor__", this);
|
|
73
|
+
this ._emissiveTexture .addInterest ("set_emissiveTexture__", this);
|
|
74
|
+
this ._normalTexture .addInterest ("set_normalTexture__", this);
|
|
75
|
+
this ._transparency .addInterest ("set_transparency__", this);
|
|
76
|
+
this ._transparency .addInterest ("set_transparent__", this);
|
|
78
77
|
|
|
79
78
|
this .set_emissiveColor__ ();
|
|
80
79
|
this .set_emissiveTexture__ ();
|
|
@@ -87,13 +86,12 @@ X3DOneSidedMaterialNode .prototype = Object .assign (Object .create (X3DMaterial
|
|
|
87
86
|
//this .emissiveColor .set (this ._emissiveColor .getValue ());
|
|
88
87
|
|
|
89
88
|
const
|
|
90
|
-
emissiveColor
|
|
91
|
-
emissiveColor_
|
|
92
|
-
emissiveStrength = this ._emissiveStrength .getValue ();
|
|
89
|
+
emissiveColor = this .emissiveColor,
|
|
90
|
+
emissiveColor_ = this ._emissiveColor .getValue ();
|
|
93
91
|
|
|
94
|
-
emissiveColor [0] = emissiveColor_ .r
|
|
95
|
-
emissiveColor [1] = emissiveColor_ .g
|
|
96
|
-
emissiveColor [2] = emissiveColor_ .b
|
|
92
|
+
emissiveColor [0] = emissiveColor_ .r;
|
|
93
|
+
emissiveColor [1] = emissiveColor_ .g;
|
|
94
|
+
emissiveColor [2] = emissiveColor_ .b;
|
|
97
95
|
},
|
|
98
96
|
set_emissiveTexture__: function ()
|
|
99
97
|
{
|
|
@@ -77,7 +77,6 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
77
77
|
new X3DFieldDefinition (X3DConstants .inputOutput, "url", new Fields .MFString ()),
|
|
78
78
|
new X3DFieldDefinition (X3DConstants .inputOutput, "autoRefresh", new Fields .SFTime ()),
|
|
79
79
|
new X3DFieldDefinition (X3DConstants .inputOutput, "autoRefreshTimeLimit", new Fields .SFTime (3600)),
|
|
80
|
-
new X3DFieldDefinition (X3DConstants .initializeOnly, "flipVertically", new Fields .SFBool ()),
|
|
81
80
|
new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatS", new Fields .SFBool (true)),
|
|
82
81
|
new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatT", new Fields .SFBool (true)),
|
|
83
82
|
new X3DFieldDefinition (X3DConstants .initializeOnly, "textureProperties", new Fields .SFNode ()),
|
|
@@ -99,8 +98,6 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
99
98
|
X3DTexture2DNode .prototype .initialize .call (this);
|
|
100
99
|
X3DUrlObject .prototype .initialize .call (this);
|
|
101
100
|
|
|
102
|
-
this ._flipVertically .addInterest ("set_url__", this);
|
|
103
|
-
|
|
104
101
|
this .image .on ("load", this .setImage .bind (this));
|
|
105
102
|
this .image .on ("abort error", this .setError .bind (this));
|
|
106
103
|
this .image .prop ("crossOrigin", "Anonymous");
|
|
@@ -168,6 +165,9 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
168
165
|
width = image .width,
|
|
169
166
|
height = image .height;
|
|
170
167
|
|
|
168
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap
|
|
169
|
+
// createImageBitmap
|
|
170
|
+
|
|
171
171
|
// Scale image if needed and flip vertically.
|
|
172
172
|
|
|
173
173
|
if (gl .getVersion () >= 2 || (Algorithm .isPowerOfTwo (width) && Algorithm .isPowerOfTwo (height)))
|
|
@@ -179,13 +179,8 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
179
179
|
|
|
180
180
|
cx .clearRect (0, 0, width, height);
|
|
181
181
|
cx .save ();
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{
|
|
185
|
-
cx .translate (0, height);
|
|
186
|
-
cx .scale (1, -1);
|
|
187
|
-
}
|
|
188
|
-
|
|
182
|
+
cx .translate (0, height);
|
|
183
|
+
cx .scale (1, -1);
|
|
189
184
|
cx .drawImage (image, 0, 0);
|
|
190
185
|
cx .restore ();
|
|
191
186
|
}
|
|
@@ -201,13 +196,8 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
201
196
|
|
|
202
197
|
cx .clearRect (0, 0, width, height);
|
|
203
198
|
cx .save ();
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
{
|
|
207
|
-
cx .translate (0, height);
|
|
208
|
-
cx .scale (1, -1);
|
|
209
|
-
}
|
|
210
|
-
|
|
199
|
+
cx .translate (0, height);
|
|
200
|
+
cx .scale (1, -1);
|
|
211
201
|
cx .drawImage (image, 0, 0, image .width, image .height, 0, 0, width, height);
|
|
212
202
|
cx .restore ();
|
|
213
203
|
}
|
|
@@ -93,7 +93,6 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
93
93
|
new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
|
|
94
94
|
new X3DFieldDefinition (X3DConstants .outputOnly, "elapsedTime", new Fields .SFTime ()),
|
|
95
95
|
new X3DFieldDefinition (X3DConstants .outputOnly, "duration_changed", new Fields .SFTime (-1)),
|
|
96
|
-
new X3DFieldDefinition (X3DConstants .initializeOnly, "flipVertically", new Fields .SFBool ()),
|
|
97
96
|
new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatS", new Fields .SFBool (true)),
|
|
98
97
|
new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatT", new Fields .SFBool (true)),
|
|
99
98
|
new X3DFieldDefinition (X3DConstants .initializeOnly, "textureProperties", new Fields .SFNode ()),
|
|
@@ -220,7 +219,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
220
219
|
throw new Error ("The movie texture is a non power-of-two texture.");
|
|
221
220
|
|
|
222
221
|
this .setMedia (this .video [0]);
|
|
223
|
-
this .setTexture (width, height, false, video,
|
|
222
|
+
this .setTexture (width, height, false, video, true);
|
|
224
223
|
this .setLoadState (X3DConstants .COMPLETE_STATE);
|
|
225
224
|
}
|
|
226
225
|
catch (error)
|
|
@@ -240,7 +239,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
240
239
|
gif .pause ();
|
|
241
240
|
|
|
242
241
|
this .setMedia (gif);
|
|
243
|
-
this .setTexture (gif .get_canvas () .width, gif .get_canvas () .height, false, gif .get_frames () [0] .data,
|
|
242
|
+
this .setTexture (gif .get_canvas () .width, gif .get_canvas () .height, false, gif .get_frames () [0] .data, true);
|
|
244
243
|
this .setLoadState (X3DConstants .COMPLETE_STATE);
|
|
245
244
|
}
|
|
246
245
|
catch (error)
|
|
@@ -257,9 +256,9 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
|
|
|
257
256
|
return;
|
|
258
257
|
|
|
259
258
|
if (this .gif)
|
|
260
|
-
this .updateTexture (this .gif .currentFrame .data,
|
|
259
|
+
this .updateTexture (this .gif .currentFrame .data, true);
|
|
261
260
|
else
|
|
262
|
-
this .updateTexture (this .video [0],
|
|
261
|
+
this .updateTexture (this .video [0], true);
|
|
263
262
|
},
|
|
264
263
|
traverse: X3DTexture2DNode .prototype .traverse,
|
|
265
264
|
dispose: function ()
|