x_ite 4.7.5 → 4.7.9
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/.vscode/launch.json +15 -0
- package/.vscode/settings.json +2 -5
- package/Makefile +1 -0
- package/README.md +1 -1
- package/build/components/annotation.build.js +2 -2
- package/build/components/cad-geometry.build.js +2 -2
- package/build/components/cube-map-texturing.build.js +2 -2
- package/build/components/dis.build.js +2 -2
- package/build/components/event-utilities.build.js +2 -2
- package/build/components/geometry2d.build.js +2 -2
- package/build/components/geospatial.build.js +2 -2
- package/build/components/h-anim.build.js +2 -2
- package/build/components/key-device-sensor.build.js +2 -2
- package/build/components/layout.build.js +2 -2
- package/build/components/nurbs.build.js +2 -2
- package/build/components/particle-systems.build.js +2 -2
- package/build/components/picking.build.js +2 -2
- package/build/components/projective-texture-mapping.build.js +2 -2
- package/build/components/rigid-body-physics.build.js +2 -2
- package/build/components/scripting.build.js +2 -2
- package/build/components/texturing-3d.build.js +2 -2
- package/build/components/volume-rendering.build.js +2 -2
- package/build/components/x_ite.build.js +2 -2
- package/build/parts/default.end.frag.js +2 -0
- package/build/parts/default.start.frag.js +8 -0
- package/build/parts/{x_ite.end.frag → x_ite.end.frag.js} +4 -2
- package/build/parts/x_ite.start.frag.js +16 -0
- package/build/x_ite.build.js +2 -2
- package/dist/assets/components/annotation.js +9 -7
- package/dist/assets/components/annotation.min.js +1 -1
- package/dist/assets/components/cad-geometry.js +9 -7
- package/dist/assets/components/cad-geometry.min.js +1 -1
- package/dist/assets/components/cube-map-texturing.js +9 -7
- package/dist/assets/components/cube-map-texturing.min.js +1 -1
- package/dist/assets/components/dis.js +9 -7
- package/dist/assets/components/dis.min.js +1 -1
- package/dist/assets/components/event-utilities.js +9 -7
- package/dist/assets/components/event-utilities.min.js +1 -1
- package/dist/assets/components/geometry2d.js +9 -7
- package/dist/assets/components/geometry2d.min.js +1 -1
- package/dist/assets/components/geospatial.js +9 -7
- package/dist/assets/components/geospatial.min.js +2 -2
- package/dist/assets/components/h-anim.js +9 -7
- package/dist/assets/components/h-anim.min.js +1 -1
- package/dist/assets/components/key-device-sensor.js +9 -7
- package/dist/assets/components/key-device-sensor.min.js +1 -1
- package/dist/assets/components/layout.js +9 -7
- package/dist/assets/components/layout.min.js +1 -1
- package/dist/assets/components/nurbs.js +9 -7
- package/dist/assets/components/nurbs.min.js +2 -2
- package/dist/assets/components/particle-systems.js +9 -7
- package/dist/assets/components/particle-systems.min.js +2 -2
- package/dist/assets/components/picking.js +13 -11
- package/dist/assets/components/picking.min.js +1 -1
- package/dist/assets/components/projective-texture-mapping.js +9 -7
- package/dist/assets/components/projective-texture-mapping.min.js +1 -1
- package/dist/assets/components/rigid-body-physics.js +9 -7
- package/dist/assets/components/rigid-body-physics.min.js +17 -17
- package/dist/assets/components/scripting.js +16 -9
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/assets/components/texturing-3d.js +9 -7
- package/dist/assets/components/texturing-3d.min.js +3 -3
- package/dist/assets/components/volume-rendering.js +11 -9
- package/dist/assets/components/volume-rendering.min.js +3 -3
- package/dist/assets/components/x_ite.js +9 -7
- package/dist/assets/components/x_ite.min.js +1 -1
- package/dist/assets/shaders/webgl1/FallbackUnlit.fs +3 -4
- package/dist/assets/shaders/webgl1/Gouraud.vs +0 -1
- package/dist/assets/shaders/webgl1/Phong.fs +0 -1
- package/dist/assets/shaders/webgl1/Unlit.fs +0 -3
- package/dist/assets/shaders/webgl2/Gouraud.vs +0 -1
- package/dist/assets/shaders/webgl2/Phong.fs +0 -1
- package/dist/assets/shaders/webgl2/Unlit.fs +0 -3
- package/dist/example.html +2 -2
- package/dist/x_ite.css +4 -3
- package/dist/x_ite.js +28281 -27706
- package/dist/x_ite.min.js +41 -41
- package/dist/x_ite.zip +0 -0
- package/docs/Accessing-the-External-Browser.md +32 -3
- package/docs/Custom-Shaders.md +165 -174
- package/docs/What's-New.md +61 -6
- package/docs/_config.yml +1 -1
- package/docs/index.md +21 -14
- package/docs/reference/Browser-Services.md +36 -8
- package/docs/reference/Script-Node-Authoring-Interface.md +12 -4
- package/package.json +13 -6
- package/src/assets/components/picking.js +2 -2
- package/src/assets/components/volume-rendering.js +2 -2
- package/src/assets/shaders/webgl1/FallbackUnlit.fs +3 -4
- package/src/assets/shaders/webgl1/Gouraud.vs +0 -1
- package/src/assets/shaders/webgl1/Phong.fs +0 -1
- package/src/assets/shaders/webgl1/Unlit.fs +0 -3
- package/src/assets/shaders/webgl2/Gouraud.vs +0 -1
- package/src/assets/shaders/webgl2/Phong.fs +0 -1
- package/src/assets/shaders/webgl2/Unlit.fs +0 -3
- package/src/bookmarks.js +8 -11
- package/src/examples.js +1 -1
- package/src/locale/de.po +19 -75
- package/src/locale/fr.po +18 -75
- package/src/standard/Time/MicroTime.js +3 -1
- package/src/standard/Utility/DataStorage.js +7 -10
- package/src/tests.js +2 -1
- package/src/x_ite/Browser/Core/BrowserOptions.js +40 -28
- package/src/x_ite/Browser/Core/BrowserTimings.js +13 -24
- package/src/x_ite/Browser/Core/ContextMenu.js +26 -12
- package/src/x_ite/Browser/Core/X3DCoreContext.js +95 -42
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +3 -0
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +3 -0
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +3 -0
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +3 -0
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +1 -3
- package/src/x_ite/Browser/Networking/urls.js +25 -0
- package/src/x_ite/Browser/Picking/VolumePicker.js +1 -1
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +4 -1
- package/src/x_ite/Browser/Shaders/ShaderTest.js +3 -3
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +70 -50
- package/src/x_ite/Components/Grouping/Switch.js +1 -1
- package/src/x_ite/Components/Lighting/DirectionalLight.js +1 -1
- package/src/x_ite/Components/Navigation/Collision.js +1 -1
- package/src/x_ite/Components/Navigation/LOD.js +1 -1
- package/src/x_ite/Components/Picking/PointPickSensor.js +1 -1
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +25 -11
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +35 -1
- package/src/x_ite/Components/Scripting/Script.js +7 -2
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +10 -12
- package/src/x_ite/Components/Shaders.js +9 -9
- package/src/x_ite/Execution/X3DExecutionContext.js +9 -11
- package/src/x_ite/Fields/SFColor.js +20 -7
- package/src/x_ite/Fields/SFColorRGBA.js +6 -6
- package/src/x_ite/Fields/SFDouble.js +2 -2
- package/src/x_ite/Fields/SFFloat.js +2 -2
- package/src/x_ite/Fields/SFImage.js +13 -13
- package/src/x_ite/Fields/SFMatrix3.js +5 -5
- package/src/x_ite/Fields/SFMatrix4.js +6 -6
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +14 -3
- package/src/x_ite/Fields/SFNode.js +23 -19
- package/src/x_ite/Fields/SFNodeCache.js +14 -10
- package/src/x_ite/Fields/SFRotation.js +10 -10
- package/src/x_ite/Fields/SFString.js +1 -1
- package/src/x_ite/Fields/SFTime.js +1 -1
- package/src/x_ite/Fields/SFVec2.js +6 -6
- package/src/x_ite/Fields/SFVec3.js +7 -7
- package/src/x_ite/Fields/SFVec4.js +8 -8
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +7 -6
- package/src/x_ite/InputOutput/Generator.js +85 -65
- package/src/x_ite/Parser/X3DParser.js +6 -0
- package/src/x_ite/Parser/XMLParser.js +1 -1
- package/src/x_ite/X3D.js +8 -2
- package/src/x_ite.config.js +0 -5
- package/src/x_ite.css +2 -1
- package/src/x_ite.html +3 -3
- package/src/x_ite.js +21 -12
- package/x_ite.min.html +3 -3
- package/build/parts/default.end.frag +0 -2
- package/build/parts/default.start.frag +0 -6
- package/build/parts/x_ite.start.frag +0 -8
|
@@ -61,6 +61,9 @@ define (function ()
|
|
|
61
61
|
if (getScriptURL () .match (/\.min\.js$/))
|
|
62
62
|
file += ".min";
|
|
63
63
|
|
|
64
|
+
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
65
|
+
return this .getPath ("assets", "components", file + ".js");
|
|
66
|
+
|
|
64
67
|
return new URL ("assets/components/" + file + ".js", getScriptURL ()) .href;
|
|
65
68
|
}
|
|
66
69
|
|
|
@@ -68,20 +71,42 @@ define (function ()
|
|
|
68
71
|
},
|
|
69
72
|
getShaderUrl: function (file)
|
|
70
73
|
{
|
|
74
|
+
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
75
|
+
return this .getPath ("assets", "shaders", file);
|
|
76
|
+
|
|
71
77
|
return new URL ("assets/shaders/" + file, getScriptURL ()) .href;
|
|
72
78
|
},
|
|
73
79
|
getFontsUrl: function (file)
|
|
74
80
|
{
|
|
81
|
+
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
82
|
+
return this .getPath ("assets", "fonts", file);
|
|
83
|
+
|
|
75
84
|
return new URL ("assets/fonts/" + file, getScriptURL ()) .href;
|
|
76
85
|
},
|
|
77
86
|
getLinetypeUrl: function (index)
|
|
78
87
|
{
|
|
88
|
+
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
89
|
+
return this .getPath ("assets", "linetype", index + ".png");
|
|
90
|
+
|
|
79
91
|
return new URL ("assets/linetype/" + index + ".png", getScriptURL ()) .href;
|
|
80
92
|
},
|
|
81
93
|
getHatchingUrl: function (index)
|
|
82
94
|
{
|
|
95
|
+
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
96
|
+
return this .getPath ("assets", "hatching", index + ".png");
|
|
97
|
+
|
|
83
98
|
return new URL ("assets/hatching/" + index + ".png", getScriptURL ()) .href;
|
|
84
99
|
},
|
|
100
|
+
getPath: function ()
|
|
101
|
+
{
|
|
102
|
+
const
|
|
103
|
+
path = globalRequire ("path"),
|
|
104
|
+
args = Array .prototype .slice .call (arguments);
|
|
105
|
+
|
|
106
|
+
args .unshift (path .dirname (getScriptURL ()));
|
|
107
|
+
|
|
108
|
+
return path .join .apply (path, args);
|
|
109
|
+
},
|
|
85
110
|
};
|
|
86
111
|
|
|
87
112
|
return new URLs ();
|
|
@@ -51,7 +51,7 @@ define ([
|
|
|
51
51
|
"standard/Math/Numbers/Vector3",
|
|
52
52
|
"standard/Math/Numbers/Rotation4",
|
|
53
53
|
"standard/Math/Numbers/Matrix4",
|
|
54
|
-
|
|
54
|
+
require .getComponentUrl ("rigid-body-physics"),
|
|
55
55
|
],
|
|
56
56
|
function (Vector3,
|
|
57
57
|
Rotation4,
|
|
@@ -92,10 +92,13 @@ function ($,
|
|
|
92
92
|
},
|
|
93
93
|
mousedown: function (event)
|
|
94
94
|
{
|
|
95
|
-
|
|
95
|
+
const browser = this .getBrowser ();
|
|
96
96
|
|
|
97
97
|
browser .getElement () .focus ();
|
|
98
98
|
|
|
99
|
+
if (browser .getContextMenu () .getActive ())
|
|
100
|
+
return;
|
|
101
|
+
|
|
99
102
|
if (browser .getShiftKey () && browser .getControlKey ())
|
|
100
103
|
return;
|
|
101
104
|
|
|
@@ -105,8 +105,8 @@ function (TextureBuffer,
|
|
|
105
105
|
// Matrices
|
|
106
106
|
|
|
107
107
|
gl .uniformMatrix4fv (shaderNode .x3d_ProjectionMatrix, false, new Float32Array (Camera .ortho (-1, 1, -1, 1, -1, 1, new Matrix4 ())));
|
|
108
|
-
gl .uniformMatrix4fv (shaderNode .x3d_ModelViewMatrix, false, new Float32Array (
|
|
109
|
-
gl .uniformMatrix3fv (shaderNode .x3d_NormalMatrix, false, new Float32Array (
|
|
108
|
+
gl .uniformMatrix4fv (shaderNode .x3d_ModelViewMatrix, false, new Float32Array (Matrix4 .Identity));
|
|
109
|
+
gl .uniformMatrix3fv (shaderNode .x3d_NormalMatrix, false, new Float32Array (Matrix3 .Identity));
|
|
110
110
|
|
|
111
111
|
// Set clip planes and lights to none.
|
|
112
112
|
|
|
@@ -149,7 +149,7 @@ function (TextureBuffer,
|
|
|
149
149
|
|
|
150
150
|
frameBuffer .unbind ();
|
|
151
151
|
|
|
152
|
-
return data [0] == 255 && data [1] == 0 && data [2] == 0 && data [3] == 255;
|
|
152
|
+
return true || (data [0] == 255 && data [1] == 0 && data [2] == 0 && data [3] == 255);
|
|
153
153
|
};
|
|
154
154
|
})(),
|
|
155
155
|
};
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
define ([
|
|
51
51
|
"jquery",
|
|
52
52
|
"x_ite/Browser/VERSION",
|
|
53
|
-
"x_ite/Base/Events",
|
|
54
53
|
"x_ite/Fields",
|
|
55
54
|
"x_ite/Components",
|
|
56
55
|
"x_ite/Components/Layering/X3DLayerNode",
|
|
@@ -70,7 +69,6 @@ define ([
|
|
|
70
69
|
],
|
|
71
70
|
function ($,
|
|
72
71
|
VERSION,
|
|
73
|
-
Events,
|
|
74
72
|
Fields,
|
|
75
73
|
Components,
|
|
76
74
|
X3DLayerNode,
|
|
@@ -143,6 +141,8 @@ function ($,
|
|
|
143
141
|
|
|
144
142
|
// Print welcome message.
|
|
145
143
|
|
|
144
|
+
if (this .getNumber () > 1) return;
|
|
145
|
+
|
|
146
146
|
this .print ("Welcome to " + this .name + " X3D Browser " + this .version + ":\n" +
|
|
147
147
|
" Current Graphics Renderer\n" +
|
|
148
148
|
" Name: " + this .getVendor () + " " + this .getRenderer () + "\n" +
|
|
@@ -247,9 +247,6 @@ function ($,
|
|
|
247
247
|
this .callBrowserEventHandler ("onshutdown");
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
// Clear event cache.
|
|
251
|
-
Events .clear ();
|
|
252
|
-
|
|
253
250
|
// Replace world.
|
|
254
251
|
|
|
255
252
|
if (scene instanceof Fields .MFNode)
|
|
@@ -402,68 +399,91 @@ function ($,
|
|
|
402
399
|
},
|
|
403
400
|
loadURL: function (url, parameter)
|
|
404
401
|
{
|
|
405
|
-
|
|
402
|
+
const promise = new Promise (function (resolve, reject)
|
|
403
|
+
{
|
|
404
|
+
// Cancel any loading.
|
|
406
405
|
|
|
407
|
-
|
|
408
|
-
|
|
406
|
+
this .loadCount_ .removeInterest ("set_loadCount__", this);
|
|
407
|
+
this .prepareEvents () .removeInterest ("bind", this);
|
|
409
408
|
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
if (this .loader)
|
|
410
|
+
this .loader .abort ();
|
|
412
411
|
|
|
413
|
-
|
|
412
|
+
// Start loading.
|
|
414
413
|
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
this .setBrowserLoading (true);
|
|
415
|
+
this .addLoadCount (this);
|
|
417
416
|
|
|
418
|
-
|
|
417
|
+
const loader = this .loader = new FileLoader (this .getWorld ());
|
|
419
418
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
419
|
+
loader .createX3DFromURL (url, parameter,
|
|
420
|
+
function (scene)
|
|
421
|
+
{
|
|
422
|
+
if (loader !== this .loader)
|
|
423
|
+
{
|
|
424
|
+
reject ();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
425
427
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
+
if (! this .getBrowserOptions () .getSplashScreen ())
|
|
429
|
+
this .getCanvas () .fadeIn (0);
|
|
428
430
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
if (scene)
|
|
432
|
+
{
|
|
433
|
+
this .replaceWorld (scene);
|
|
434
|
+
this .removeLoadCount (this);
|
|
435
|
+
|
|
436
|
+
resolve ();
|
|
437
|
+
}
|
|
438
|
+
else
|
|
439
|
+
{
|
|
440
|
+
this .callBrowserCallbacks (X3DConstants .CONNECTION_ERROR);
|
|
441
|
+
this .callBrowserEventHandler ("onerror");
|
|
442
|
+
|
|
443
|
+
setTimeout (function () { this .getSplashScreen () .find (".x_ite-private-spinner-text") .text (_ ("Failed loading world.")); } .bind (this), 31);
|
|
444
|
+
|
|
445
|
+
reject ();
|
|
446
|
+
}
|
|
433
447
|
}
|
|
434
|
-
|
|
448
|
+
.bind (this),
|
|
449
|
+
function (fragment)
|
|
435
450
|
{
|
|
436
|
-
|
|
437
|
-
|
|
451
|
+
if (loader !== this .loader)
|
|
452
|
+
{
|
|
453
|
+
reject ();
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
438
456
|
|
|
439
|
-
|
|
457
|
+
this .changeViewpoint (fragment);
|
|
458
|
+
this .removeLoadCount (this);
|
|
459
|
+
this .setBrowserLoading (false);
|
|
460
|
+
|
|
461
|
+
resolve ();
|
|
440
462
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
463
|
+
.bind (this),
|
|
464
|
+
function (url, target)
|
|
465
|
+
{
|
|
466
|
+
if (loader !== this .loader)
|
|
467
|
+
{
|
|
468
|
+
reject ();
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
447
471
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
.bind (this),
|
|
453
|
-
function (url, target)
|
|
454
|
-
{
|
|
455
|
-
if (loader !== this .loader)
|
|
456
|
-
return;
|
|
472
|
+
if (target)
|
|
473
|
+
window .open (url, target);
|
|
474
|
+
else
|
|
475
|
+
location = url;
|
|
457
476
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
else
|
|
461
|
-
location = url;
|
|
477
|
+
this .removeLoadCount (this);
|
|
478
|
+
this .setBrowserLoading (false);
|
|
462
479
|
|
|
463
|
-
|
|
464
|
-
|
|
480
|
+
resolve ();
|
|
481
|
+
}
|
|
482
|
+
.bind (this));
|
|
465
483
|
}
|
|
466
484
|
.bind (this));
|
|
485
|
+
|
|
486
|
+
return promise;
|
|
467
487
|
},
|
|
468
488
|
addBrowserListener: function (callback, object)
|
|
469
489
|
{
|
|
@@ -72,7 +72,7 @@ function (Fields,
|
|
|
72
72
|
|
|
73
73
|
this .addType (X3DConstants .Switch);
|
|
74
74
|
|
|
75
|
-
if (executionContext .getSpecificationVersion ()
|
|
75
|
+
if (executionContext .getSpecificationVersion () === "2.0")
|
|
76
76
|
this .addAlias ("choice", this .children_);
|
|
77
77
|
|
|
78
78
|
this .childNode = null;
|
|
@@ -76,7 +76,7 @@ function (Fields,
|
|
|
76
76
|
|
|
77
77
|
this .addType (X3DConstants .LOD);
|
|
78
78
|
|
|
79
|
-
if (executionContext .getSpecificationVersion ()
|
|
79
|
+
if (executionContext .getSpecificationVersion () === "2.0")
|
|
80
80
|
this .addAlias ("level", this .children_); // VRML2
|
|
81
81
|
|
|
82
82
|
this .center_ .setUnit ("length");
|
|
@@ -59,7 +59,7 @@ define ([
|
|
|
59
59
|
"standard/Math/Numbers/Vector3",
|
|
60
60
|
"standard/Math/Numbers/Rotation4",
|
|
61
61
|
"standard/Math/Geometry/Box3",
|
|
62
|
-
|
|
62
|
+
require .getComponentUrl ("rigid-body-physics"),
|
|
63
63
|
],
|
|
64
64
|
function (Fields,
|
|
65
65
|
X3DFieldDefinition,
|
|
@@ -912,7 +912,7 @@ function (Fields,
|
|
|
912
912
|
backMaterialNode = appearanceNode .backMaterialNode,
|
|
913
913
|
frontShaderNode = appearanceNode .shaderNode || materialNode .getShader (context .browser, context .shadow);
|
|
914
914
|
|
|
915
|
-
if (this .solid || !backMaterialNode ||
|
|
915
|
+
if (this .solid || !backMaterialNode || frontShaderNode .wireframe)
|
|
916
916
|
{
|
|
917
917
|
this .displayGeometry (gl, context, appearanceNode, frontShaderNode, true, true);
|
|
918
918
|
}
|
|
@@ -962,12 +962,19 @@ function (Fields,
|
|
|
962
962
|
|
|
963
963
|
// Draw depending on wireframe, solid and transparent.
|
|
964
964
|
|
|
965
|
-
if (
|
|
965
|
+
if (shaderNode .wireframe)
|
|
966
966
|
{
|
|
967
|
-
//
|
|
967
|
+
// Points and Wireframes.
|
|
968
968
|
|
|
969
|
-
|
|
970
|
-
|
|
969
|
+
if (shaderNode .primitiveMode === gl .POINTS)
|
|
970
|
+
{
|
|
971
|
+
gl .drawArrays (shaderNode .primitiveMode, 0, this .vertexCount);
|
|
972
|
+
}
|
|
973
|
+
else
|
|
974
|
+
{
|
|
975
|
+
for (let i = 0, length = this .vertexCount; i < length; i += 3)
|
|
976
|
+
gl .drawArrays (shaderNode .primitiveMode, i, 3);
|
|
977
|
+
}
|
|
971
978
|
}
|
|
972
979
|
else
|
|
973
980
|
{
|
|
@@ -983,7 +990,7 @@ function (Fields,
|
|
|
983
990
|
|
|
984
991
|
// Render back.
|
|
985
992
|
|
|
986
|
-
if (back)
|
|
993
|
+
if (back && !this .solid)
|
|
987
994
|
{
|
|
988
995
|
gl .cullFace (gl .FRONT);
|
|
989
996
|
gl .drawArrays (shaderNode .primitiveMode, 0, this .vertexCount);
|
|
@@ -1071,7 +1078,7 @@ function (Fields,
|
|
|
1071
1078
|
backMaterialNode = appearanceNode .backMaterialNode,
|
|
1072
1079
|
frontShaderNode = appearanceNode .shaderNode || materialNode .getShader (context .browser, context .shadow);
|
|
1073
1080
|
|
|
1074
|
-
if (this .solid || !backMaterialNode ||
|
|
1081
|
+
if (this .solid || !backMaterialNode || frontShaderNode .wireframe)
|
|
1075
1082
|
{
|
|
1076
1083
|
this .displayParticlesGeometry (gl, context, appearanceNode, frontShaderNode, true, true, particles, numParticles);
|
|
1077
1084
|
}
|
|
@@ -1131,7 +1138,7 @@ function (Fields,
|
|
|
1131
1138
|
|
|
1132
1139
|
if (shaderNode .wireframe)
|
|
1133
1140
|
{
|
|
1134
|
-
//
|
|
1141
|
+
// Points and Wireframes.
|
|
1135
1142
|
|
|
1136
1143
|
for (let p = 0; p < numParticles; ++ p)
|
|
1137
1144
|
{
|
|
@@ -1145,8 +1152,15 @@ function (Fields,
|
|
|
1145
1152
|
|
|
1146
1153
|
shaderNode .setParticle (gl, particle, modelViewMatrix);
|
|
1147
1154
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1155
|
+
if (shaderNode .primitiveMode === gl .POINTS)
|
|
1156
|
+
{
|
|
1157
|
+
gl .drawArrays (shaderNode .primitiveMode, 0, this .vertexCount);
|
|
1158
|
+
}
|
|
1159
|
+
else
|
|
1160
|
+
{
|
|
1161
|
+
for (let i = 0, length = this .vertexCount; i < length; i += 3)
|
|
1162
|
+
gl .drawArrays (shaderNode .primitiveMode, i, 3);
|
|
1163
|
+
}
|
|
1150
1164
|
}
|
|
1151
1165
|
}
|
|
1152
1166
|
else
|
|
@@ -1173,7 +1187,7 @@ function (Fields,
|
|
|
1173
1187
|
|
|
1174
1188
|
gl .enable (gl .CULL_FACE);
|
|
1175
1189
|
|
|
1176
|
-
if (back)
|
|
1190
|
+
if (back && !this .solid)
|
|
1177
1191
|
{
|
|
1178
1192
|
gl .cullFace (gl .FRONT);
|
|
1179
1193
|
gl .drawArrays (shaderNode .primitiveMode, 0, this .vertexCount);
|
|
@@ -80,6 +80,35 @@ function (X3DGeometryNode,
|
|
|
80
80
|
{
|
|
81
81
|
return false;
|
|
82
82
|
},
|
|
83
|
+
transfer: function ()
|
|
84
|
+
{
|
|
85
|
+
// Line stipple support.
|
|
86
|
+
|
|
87
|
+
if (this .getGeometryType () === 1)
|
|
88
|
+
{
|
|
89
|
+
const
|
|
90
|
+
texCoords = this .getTexCoords (),
|
|
91
|
+
vertices = this .getVertices ();
|
|
92
|
+
|
|
93
|
+
this .getMultiTexCoords () .push (texCoords);
|
|
94
|
+
|
|
95
|
+
for (let i = 0, length = vertices .length; i < length; i += 8)
|
|
96
|
+
{
|
|
97
|
+
texCoords .push (vertices [i],
|
|
98
|
+
vertices [i + 1],
|
|
99
|
+
vertices [i + 2],
|
|
100
|
+
vertices [i + 3],
|
|
101
|
+
vertices [i],
|
|
102
|
+
vertices [i + 1],
|
|
103
|
+
vertices [i + 2],
|
|
104
|
+
vertices [i + 3]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
texCoords .shrinkToFit ();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
X3DGeometryNode .prototype .transfer .call (this);
|
|
111
|
+
},
|
|
83
112
|
display: function (gl, context)
|
|
84
113
|
{
|
|
85
114
|
try
|
|
@@ -115,6 +144,9 @@ function (X3DGeometryNode,
|
|
|
115
144
|
if (this .colorMaterial)
|
|
116
145
|
shaderNode .enableColorAttribute (gl, this .colorBuffer);
|
|
117
146
|
|
|
147
|
+
if (this .getMultiTexCoords () .length)
|
|
148
|
+
shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, true);
|
|
149
|
+
|
|
118
150
|
shaderNode .enableVertexAttribute (gl, this .vertexBuffer);
|
|
119
151
|
|
|
120
152
|
// Wireframes are always solid so only one drawing call is needed.
|
|
@@ -130,7 +162,9 @@ function (X3DGeometryNode,
|
|
|
130
162
|
if (this .colorMaterial)
|
|
131
163
|
shaderNode .disableColorAttribute (gl);
|
|
132
164
|
|
|
133
|
-
|
|
165
|
+
if (this .getMultiTexCoords () .length)
|
|
166
|
+
shaderNode .disableTexCoordAttribute (gl);
|
|
167
|
+
|
|
134
168
|
shaderNode .disable (gl);
|
|
135
169
|
|
|
136
170
|
if (blendModeNode)
|
|
@@ -221,9 +221,10 @@ function ($,
|
|
|
221
221
|
text += "\n;var " + callbacks .join (",") + ";";
|
|
222
222
|
text += "\n[" + callbacks .join (",") + "];";
|
|
223
223
|
|
|
224
|
+
this .global = this .getGlobal ();
|
|
225
|
+
|
|
224
226
|
const
|
|
225
|
-
|
|
226
|
-
result = evaluate (global, text),
|
|
227
|
+
result = this .evaluate (text),
|
|
227
228
|
context = { };
|
|
228
229
|
|
|
229
230
|
for (let i = 0; i < callbacks .length; ++ i)
|
|
@@ -238,6 +239,10 @@ function ($,
|
|
|
238
239
|
return { };
|
|
239
240
|
}
|
|
240
241
|
},
|
|
242
|
+
evaluate: function (text)
|
|
243
|
+
{
|
|
244
|
+
return evaluate (this .global, text);
|
|
245
|
+
},
|
|
241
246
|
getGlobal: function ()
|
|
242
247
|
{
|
|
243
248
|
const
|
|
@@ -383,10 +383,6 @@ function (X3DCast,
|
|
|
383
383
|
|
|
384
384
|
if (location)
|
|
385
385
|
{
|
|
386
|
-
field ._uniformLocation = location;
|
|
387
|
-
|
|
388
|
-
field .addInterest ("set_field__", this);
|
|
389
|
-
|
|
390
386
|
switch (field .getType ())
|
|
391
387
|
{
|
|
392
388
|
case X3DConstants .SFImage:
|
|
@@ -480,6 +476,13 @@ function (X3DCast,
|
|
|
480
476
|
}
|
|
481
477
|
}
|
|
482
478
|
|
|
479
|
+
if (location .array)
|
|
480
|
+
field ._uniformLocation = location .array .length ? location : null;
|
|
481
|
+
else
|
|
482
|
+
field ._uniformLocation = location;
|
|
483
|
+
|
|
484
|
+
field .addInterest ("set_field__", this);
|
|
485
|
+
|
|
483
486
|
this .set_field__ (field);
|
|
484
487
|
}
|
|
485
488
|
},
|
|
@@ -686,12 +689,7 @@ function (X3DCast,
|
|
|
686
689
|
}
|
|
687
690
|
case X3DConstants .MFImage:
|
|
688
691
|
{
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
const numImages = this .getImagesLength (field);
|
|
692
|
-
|
|
693
|
-
if (numImages !== array .length)
|
|
694
|
-
array = location .array = new Int32Array (numImages);
|
|
692
|
+
const array = location .array;
|
|
695
693
|
|
|
696
694
|
for (let i = 0, a = 0, length = field .length; i < length; ++ i)
|
|
697
695
|
{
|
|
@@ -864,8 +862,8 @@ function (X3DCast,
|
|
|
864
862
|
|
|
865
863
|
let length = 3 * images .length;
|
|
866
864
|
|
|
867
|
-
for (
|
|
868
|
-
length +=
|
|
865
|
+
for (const image of images)
|
|
866
|
+
length += image .array .length;
|
|
869
867
|
|
|
870
868
|
return length;
|
|
871
869
|
},
|
|
@@ -52,10 +52,10 @@ define ([
|
|
|
52
52
|
"x_ite/Components/Shaders/FloatVertexAttribute",
|
|
53
53
|
"x_ite/Components/Shaders/Matrix3VertexAttribute",
|
|
54
54
|
"x_ite/Components/Shaders/Matrix4VertexAttribute",
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
"x_ite/Components/Shaders/PackagedShader",
|
|
56
|
+
"x_ite/Components/Shaders/ProgramShader",
|
|
57
57
|
"x_ite/Components/Shaders/ShaderPart",
|
|
58
|
-
|
|
58
|
+
"x_ite/Components/Shaders/ShaderProgram",
|
|
59
59
|
"x_ite/Components/Shaders/X3DProgrammableShaderObject",
|
|
60
60
|
"x_ite/Components/Shaders/X3DShaderNode",
|
|
61
61
|
"x_ite/Components/Shaders/X3DVertexAttributeNode",
|
|
@@ -65,10 +65,10 @@ function (SupportedNodes,
|
|
|
65
65
|
FloatVertexAttribute,
|
|
66
66
|
Matrix3VertexAttribute,
|
|
67
67
|
Matrix4VertexAttribute,
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
PackagedShader,
|
|
69
|
+
ProgramShader,
|
|
70
70
|
ShaderPart,
|
|
71
|
-
|
|
71
|
+
ShaderProgram,
|
|
72
72
|
X3DProgrammableShaderObject,
|
|
73
73
|
X3DShaderNode,
|
|
74
74
|
X3DVertexAttributeNode)
|
|
@@ -81,10 +81,10 @@ function (SupportedNodes,
|
|
|
81
81
|
FloatVertexAttribute: FloatVertexAttribute,
|
|
82
82
|
Matrix3VertexAttribute: Matrix3VertexAttribute,
|
|
83
83
|
Matrix4VertexAttribute: Matrix4VertexAttribute,
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
PackagedShader: PackagedShader,
|
|
85
|
+
ProgramShader: ProgramShader,
|
|
86
86
|
ShaderPart: ShaderPart,
|
|
87
|
-
|
|
87
|
+
ShaderProgram: ShaderProgram,
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
const AbstractTypes =
|
|
@@ -80,7 +80,8 @@ function (Fields,
|
|
|
80
80
|
{
|
|
81
81
|
X3DBaseNode .call (this, executionContext);
|
|
82
82
|
|
|
83
|
-
this .addChildObjects ("rootNodes",
|
|
83
|
+
this .addChildObjects ("rootNodes", new Fields .MFNode (),
|
|
84
|
+
"worldInfos", new Fields .MFNode ());
|
|
84
85
|
|
|
85
86
|
this .rootNodes_ .setAccessType (X3DConstants .initializeOnly);
|
|
86
87
|
this .rootNodes_ .addCloneCount (1);
|
|
@@ -91,7 +92,6 @@ function (Fields,
|
|
|
91
92
|
this ._externprotos = new ExternProtoDeclarationArray ();
|
|
92
93
|
this ._routes = new RouteArray ();
|
|
93
94
|
this ._routeIndex = new Map ();
|
|
94
|
-
this ._worldInfoNodes = [ ];
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
X3DExecutionContext .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
@@ -639,22 +639,20 @@ function (Fields,
|
|
|
639
639
|
{
|
|
640
640
|
return this ._routes;
|
|
641
641
|
},
|
|
642
|
-
|
|
642
|
+
getWorldInfos: function ()
|
|
643
643
|
{
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
if (length)
|
|
647
|
-
return this ._worldInfoNodes [length - 1];
|
|
648
|
-
|
|
649
|
-
return null;
|
|
644
|
+
return this .worldInfos_;
|
|
650
645
|
},
|
|
651
646
|
addWorldInfo: function (worldInfoNode)
|
|
652
647
|
{
|
|
653
|
-
this .
|
|
648
|
+
this .worldInfos_ .push (worldInfoNode);
|
|
654
649
|
},
|
|
655
650
|
removeWorldInfo: function (worldInfoNode)
|
|
656
651
|
{
|
|
657
|
-
|
|
652
|
+
const index = this .worldInfos_ .getValue () .indexOf (worldInfoNode);
|
|
653
|
+
|
|
654
|
+
if (index !== -1)
|
|
655
|
+
this .worldInfos_ .splice (index, 1);
|
|
658
656
|
},
|
|
659
657
|
toVRMLStream: function (stream)
|
|
660
658
|
{
|