x_ite 8.6.0 → 8.6.2
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/settings.json +7 -7
- 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 +25 -25
- 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 +39 -48
- 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 +32 -32
- 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/x_ite.css +1 -1
- package/dist/x_ite.js +690 -936
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/docs/_includes/scripts.html +2 -2
- package/docs/_posts/components/CADGeometry/IndexedQuadSet.md +1 -1
- package/docs/_posts/components/CADGeometry/QuadSet.md +1 -1
- package/docs/_posts/components/Geometry3D/ElevationGrid.md +1 -1
- package/docs/_posts/components/Geometry3D/Extrusion.md +1 -1
- package/docs/_posts/components/Geometry3D/IndexedFaceSet.md +1 -1
- package/docs/_posts/components/Geospatial/GeoElevationGrid.md +1 -1
- package/docs/_posts/components/NURBS/NurbsSweptSurface.md +1 -1
- package/docs/_posts/components/NURBS/NurbsSwungSurface.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleFanSet.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleSet.md +1 -1
- package/docs/_posts/components/Rendering/IndexedTriangleStripSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleFanSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleSet.md +1 -1
- package/docs/_posts/components/Rendering/TriangleStripSet.md +1 -1
- package/docs/_posts/components/Shape/Material.md +1 -1
- package/docs/_posts/getting-started.md +1 -1
- package/docs/_posts/laboratory/x3d-file-converter.md +178 -0
- package/docs/_tabs/playground.html +80 -133
- package/docs/assets/css/style.scss +2 -42
- package/docs/laboratory/3d-l-system-generator.html +1 -1
- package/docs/laboratory/gltf-sample-viewer.html +1 -1
- package/docs/laboratory/online-dicom-and-nrrd-file-viewer.html +1 -1
- package/docs/laboratory/real-time-earth-quake-information.html +1 -1
- package/docs/laboratory/x3d-visual-blend-mode-editor.html +1 -1
- package/package.json +1 -1
- package/src/standard/Math/Algorithms/Bezier.js +133 -182
- package/src/standard/Math/Geometry/Box2.js +0 -1
- package/src/standard/Math/Geometry/Box3.js +0 -1
- package/src/standard/Math/Geometry/Cylinder3.js +1 -1
- package/src/standard/Math/Geometry/Line2.js +2 -4
- package/src/standard/Math/Geometry/Line3.js +2 -4
- package/src/standard/Math/Geometry/Plane3.js +1 -3
- package/src/standard/Math/Geometry/Sphere3.js +8 -12
- package/src/standard/Math/Geometry/Triangle3.js +8 -0
- package/src/standard/Math/Geometry/ViewVolume.js +17 -27
- package/src/standard/Math/Numbers/Color3.js +4 -7
- package/src/standard/Math/Numbers/Complex.js +8 -9
- package/src/standard/Math/Numbers/Matrix2.js +31 -42
- package/src/standard/Math/Numbers/Matrix3.js +54 -97
- package/src/standard/Math/Numbers/Matrix4.js +49 -160
- package/src/standard/Math/Numbers/Quaternion.js +20 -24
- package/src/standard/Math/Numbers/Rotation4.js +1 -2
- package/src/standard/Math/Numbers/Vector2.js +4 -12
- package/src/standard/Math/Numbers/Vector3.js +6 -18
- package/src/standard/Math/Numbers/Vector4.js +4 -20
- package/src/standard/Time/StopWatch.js +9 -14
- package/src/tests.js +11 -0
- package/src/x_ite/Browser/Core/BrowserTimings.js +10 -10
- package/src/x_ite/Browser/Core/X3DCoreContext.js +4 -6
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +94 -88
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +2 -3
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +17 -14
- package/src/x_ite/Browser/Text/PolygonText.js +15 -24
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Components/Core/X3DNode.js +12 -0
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +18 -0
- package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +8 -7
- package/src/x_ite/Configuration/UnitInfo.js +2 -0
- package/src/x_ite/Execution/X3DExportedNode.js +4 -0
- package/src/x_ite/Execution/X3DImportedNode.js +14 -0
- package/src/x_ite/Execution/X3DScene.js +4 -0
- package/src/x_ite/Fields/SFString.js +4 -6
- package/src/x_ite/InputOutput/FileLoader.js +1 -1
- package/src/x_ite/InputOutput/Generator.js +35 -55
- package/src/x_ite/Parser/GLTF2Parser.js +4 -4
- package/src/x_ite/Parser/SVGParser.js +24 -47
- package/src/x_ite/Parser/X3DParser.js +1 -1
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +4 -0
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +4 -0
- package/src/x_ite/Routing/X3DRoute.js +8 -0
|
@@ -157,7 +157,7 @@ BrowserTimings .prototype = Object .assign (Object .create (X3DBaseNode .prototy
|
|
|
157
157
|
|
|
158
158
|
let r = 0;
|
|
159
159
|
|
|
160
|
-
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Frame rate") + ":")) .append ($("<td></td>") .text (f2(this .fps .
|
|
160
|
+
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Frame rate") + ":")) .append ($("<td></td>") .text (f2(1000 / this .fps .averageTime) .toLocaleString (language, fixed) + " " + _("fps")));
|
|
161
161
|
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Speed") + ":")) .append ($("<td></td>") .text (f2(this .getSpeed (browser .currentSpeed)) .toLocaleString (language, fixed) + " " + this .getSpeedUnit (browser .currentSpeed)));
|
|
162
162
|
|
|
163
163
|
if (this .localStorage .type === "MORE")
|
|
@@ -165,9 +165,9 @@ BrowserTimings .prototype = Object .assign (Object .create (X3DBaseNode .prototy
|
|
|
165
165
|
const
|
|
166
166
|
layers = browser .getWorld () .getLayerSet () .getLayers (),
|
|
167
167
|
activeLayer = browser .getActiveLayer (),
|
|
168
|
-
navigationTime = activeLayer && browser .getCollisionCount () ? activeLayer .getCollisionTime () .averageTime
|
|
169
|
-
collisionTime = browser .getCollisionTime () .averageTime
|
|
170
|
-
routingTime = Math .max (0, browser .getBrowserTime () .averageTime
|
|
168
|
+
navigationTime = activeLayer && browser .getCollisionCount () ? activeLayer .getCollisionTime () .averageTime : 0,
|
|
169
|
+
collisionTime = browser .getCollisionTime () .averageTime + navigationTime,
|
|
170
|
+
routingTime = Math .max (0, browser .getBrowserTime () .averageTime - (browser .getCameraTime () .averageTime + browser .getCollisionTime () .averageTime + browser .getDisplayTime () .averageTime)),
|
|
171
171
|
prepareEvents = browser .prepareEvents () .getInterests () .size - 1,
|
|
172
172
|
sensors = browser .sensorEvents () .getInterests () .size;
|
|
173
173
|
|
|
@@ -183,14 +183,14 @@ BrowserTimings .prototype = Object .assign (Object .create (X3DBaseNode .prototy
|
|
|
183
183
|
|
|
184
184
|
rows [1] .addClass ("x_ite-private-more");
|
|
185
185
|
|
|
186
|
-
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Browser") + ":")) .append ($("<td></td>") .text (f2(browser .getSystemTime () .averageTime
|
|
187
|
-
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("X3D total") + ":")) .append ($("<td></td>") .text (f2(browser .getBrowserTime () .averageTime
|
|
186
|
+
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Browser") + ":")) .append ($("<td></td>") .text (f2(browser .getSystemTime () .averageTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
187
|
+
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("X3D total") + ":")) .append ($("<td></td>") .text (f2(browser .getBrowserTime () .averageTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
188
188
|
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Event Processing") + ":")) .append ($("<td></td>") .text (f2(routingTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
189
|
-
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Pointer") + ":")) .append ($("<td></td>") .text (f2(browser .getPointingTime () .averageTime
|
|
190
|
-
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Camera") + ":")) .append ($("<td></td>") .text (f2(browser .getCameraTime () .averageTime
|
|
191
|
-
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Picking") + ":")) .append ($("<td></td>") .text (f2(browser .getPickingTime () .averageTime
|
|
189
|
+
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Pointer") + ":")) .append ($("<td></td>") .text (f2(browser .getPointingTime () .averageTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
190
|
+
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Camera") + ":")) .append ($("<td></td>") .text (f2(browser .getCameraTime () .averageTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
191
|
+
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Picking") + ":")) .append ($("<td></td>") .text (f2(browser .getPickingTime () .averageTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
192
192
|
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Collision Detection") + ":")) .append ($("<td></td>") .text (f2(collisionTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
193
|
-
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Rendering") + ":")) .append ($("<td></td>") .text (f2(browser .getDisplayTime () .averageTime
|
|
193
|
+
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Rendering") + ":")) .append ($("<td></td>") .text (f2(browser .getDisplayTime () .averageTime) .toLocaleString (language, fixed) + " " + _("ms")));
|
|
194
194
|
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Number of Shapes") + ":")) .append ($("<td></td>") .text (opaqueShapes + " + " + transparentShapes));
|
|
195
195
|
rows [r++] = $("<tr></tr>") .append ($("<td></td>") .text (_("Number of Sensors") + ":")) .append ($("<td></td>") .text (prepareEvents + sensors));
|
|
196
196
|
|
|
@@ -121,7 +121,9 @@ function X3DCoreContext (element)
|
|
|
121
121
|
this [_notification] = new Notification (this .getPrivateScene ());
|
|
122
122
|
this [_contextMenu] = new ContextMenu (this .getPrivateScene ());
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
const inches = $("<div></div>") .hide () .css ("height", "10in") .appendTo ($("body"));
|
|
125
|
+
this [_pixelPerPoint] = inches .height () / 720 || 1;
|
|
126
|
+
inches .remove ();
|
|
125
127
|
|
|
126
128
|
this .addChildObjects ("controlKey", new Fields .SFBool (),
|
|
127
129
|
"shiftKey", new Fields .SFBool (),
|
|
@@ -261,11 +263,7 @@ X3DCoreContext .prototype =
|
|
|
261
263
|
return this [_pixelPerPoint] * this .getRenderingProperty ("ContentScale");
|
|
262
264
|
},
|
|
263
265
|
connectedCallback: function ()
|
|
264
|
-
{
|
|
265
|
-
const inches = $("<div></div>") .hide () .css ("height", "10in") .appendTo (this [_shadow]);
|
|
266
|
-
this [_pixelPerPoint] = inches .height () / 720 || 1;
|
|
267
|
-
inches .remove ();
|
|
268
|
-
},
|
|
266
|
+
{ },
|
|
269
267
|
attributeChangedCallback: function (name, oldValue, newValue)
|
|
270
268
|
{
|
|
271
269
|
switch (name)
|
|
@@ -48,17 +48,6 @@
|
|
|
48
48
|
import Vector4 from "../../../standard/Math/Numbers/Vector4.js";
|
|
49
49
|
import Matrix4 from "../../../standard/Math/Numbers/Matrix4.js";
|
|
50
50
|
|
|
51
|
-
const
|
|
52
|
-
T = [ ],
|
|
53
|
-
Fp = [ ],
|
|
54
|
-
Fm = [ ],
|
|
55
|
-
S = new Vector4 (0, 0, 0, 0);
|
|
56
|
-
|
|
57
|
-
const H = new Matrix4 ( 2, -2, 1, 1,
|
|
58
|
-
-3, 3, -2, -1,
|
|
59
|
-
0, 0, 1, 0,
|
|
60
|
-
1, 0, 0, 0);
|
|
61
|
-
|
|
62
51
|
function CatmullRomSplineInterpolator ()
|
|
63
52
|
{
|
|
64
53
|
this .T0 = [ ];
|
|
@@ -68,114 +57,131 @@ function CatmullRomSplineInterpolator ()
|
|
|
68
57
|
CatmullRomSplineInterpolator .prototype =
|
|
69
58
|
{
|
|
70
59
|
constructor: CatmullRomSplineInterpolator,
|
|
71
|
-
generate: function (
|
|
60
|
+
generate: (function ()
|
|
72
61
|
{
|
|
73
62
|
const
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
T = [ ],
|
|
64
|
+
Fp = [ ],
|
|
65
|
+
Fm = [ ];
|
|
76
66
|
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
return function (closed, key, keyValue, keyVelocity, normalizeVelocity)
|
|
68
|
+
{
|
|
69
|
+
const
|
|
70
|
+
T0 = this .T0,
|
|
71
|
+
T1 = this .T1;
|
|
79
72
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Fm .length = 0;
|
|
73
|
+
T0 .length = 0;
|
|
74
|
+
T1 .length = 0;
|
|
83
75
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
T .length = 0;
|
|
77
|
+
Fp .length = 0;
|
|
78
|
+
Fm .length = 0;
|
|
87
79
|
|
|
88
|
-
if (
|
|
80
|
+
if (key .length > 1)
|
|
89
81
|
{
|
|
90
|
-
|
|
91
|
-
T .push (this .divide (this .subtract (keyValue [1], keyValue [keyValue .length - 2]), 2));
|
|
82
|
+
// T
|
|
92
83
|
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
if (keyVelocity .length === 0)
|
|
85
|
+
{
|
|
86
|
+
if (closed)
|
|
87
|
+
T .push (this .divide (this .subtract (keyValue [1], keyValue [keyValue .length - 2]), 2));
|
|
95
88
|
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
else
|
|
90
|
+
T .push (this .create ());
|
|
98
91
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
else
|
|
102
|
-
{
|
|
103
|
-
for (let i = 0, length = keyVelocity .length; i < length; ++ i)
|
|
104
|
-
T .push (this .copy (keyVelocity [i]));
|
|
92
|
+
for (let i = 1, length = keyValue .length - 1; i < length; ++ i)
|
|
93
|
+
T .push (this .divide (this .subtract (keyValue [i + 1], keyValue [i - 1]), 2));
|
|
105
94
|
|
|
106
|
-
|
|
95
|
+
T .push (this .copy (T [0]));
|
|
96
|
+
}
|
|
97
|
+
else
|
|
107
98
|
{
|
|
108
|
-
let
|
|
109
|
-
|
|
110
|
-
for (let i = 0, length = keyValue .length - 1; i < length; ++ i)
|
|
111
|
-
Dtot += this .abs (this .subtract (keyValue [i], keyValue [i + 1]));
|
|
99
|
+
for (let i = 0, length = keyVelocity .length; i < length; ++ i)
|
|
100
|
+
T .push (this .copy (keyVelocity [i]));
|
|
112
101
|
|
|
113
|
-
|
|
102
|
+
if (normalizeVelocity)
|
|
114
103
|
{
|
|
115
|
-
|
|
104
|
+
let Dtot = 0;
|
|
105
|
+
|
|
106
|
+
for (let i = 0, length = keyValue .length - 1; i < length; ++ i)
|
|
107
|
+
Dtot += this .magnitude (this .subtract (keyValue [i], keyValue [i + 1]));
|
|
108
|
+
|
|
109
|
+
for (let i = 0, length = T .length - 1; i < length; ++ i)
|
|
110
|
+
{
|
|
111
|
+
const Tia = this .magnitude (T [i]);
|
|
116
112
|
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
if (Tia)
|
|
114
|
+
T [i] = this .multiply (T [i], Dtot / Tia);
|
|
115
|
+
}
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Fm, Fp
|
|
124
118
|
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
const i_1 = key .length - 1;
|
|
128
|
-
const i_2 = key .length - 2;
|
|
119
|
+
// Fm, Fp
|
|
129
120
|
|
|
130
|
-
|
|
121
|
+
if (closed)
|
|
122
|
+
{
|
|
123
|
+
const i_1 = key .length - 1;
|
|
124
|
+
const i_2 = key .length - 2;
|
|
131
125
|
|
|
132
|
-
|
|
133
|
-
Fp .push (2 * (key [i_1] - key [i_2]) / d);
|
|
126
|
+
const d = key [1] - key [0] + key [i_1] - key [i_2];
|
|
134
127
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
Fm .push (2 * (key [1] - key [0]) / d);
|
|
129
|
+
Fp .push (2 * (key [i_1] - key [i_2]) / d);
|
|
130
|
+
}
|
|
131
|
+
else
|
|
132
|
+
{
|
|
133
|
+
Fm .push (1);
|
|
134
|
+
Fp .push (1);
|
|
135
|
+
}
|
|
141
136
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
for (let i = 1, length = key .length - 1; i < length; ++ i)
|
|
138
|
+
{
|
|
139
|
+
const d = key [i + 1] - key [i - 1];
|
|
145
140
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
Fm .push (2 * (key [i + 1] - key [i]) / d);
|
|
142
|
+
Fp .push (2 * (key [i] - key [i - 1]) / d);
|
|
143
|
+
}
|
|
149
144
|
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
Fm .push (Fm [0]);
|
|
146
|
+
Fp .push (Fp [0]);
|
|
152
147
|
|
|
153
|
-
|
|
148
|
+
// T0, T1
|
|
154
149
|
|
|
155
|
-
|
|
150
|
+
for (let i = 0, length = T .length; i < length; ++ i)
|
|
151
|
+
{
|
|
152
|
+
T0 .push (this .multiply (T [i], Fp [i]));
|
|
153
|
+
T1 .push (this .multiply (T [i], Fm [i]));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else
|
|
156
157
|
{
|
|
157
|
-
T0 .push (this .
|
|
158
|
-
T1 .push (this .
|
|
158
|
+
T0 .push (this .create ());
|
|
159
|
+
T1 .push (this .create ());
|
|
159
160
|
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
T0 .push (this .create ());
|
|
164
|
-
T1 .push (this .create ());
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
interpolate: function (index0, index1, weight, keyValue)
|
|
161
|
+
};
|
|
162
|
+
})(),
|
|
163
|
+
interpolate: (function ()
|
|
168
164
|
{
|
|
169
|
-
S
|
|
165
|
+
const S = new Vector4 (0, 0, 0, 0);
|
|
166
|
+
|
|
167
|
+
const H = new Matrix4 ( 2, -2, 1, 1,
|
|
168
|
+
-3, 3, -2, -1,
|
|
169
|
+
0, 0, 1, 0,
|
|
170
|
+
1, 0, 0, 0);
|
|
171
|
+
|
|
172
|
+
return function (index0, index1, weight, keyValue)
|
|
173
|
+
{
|
|
174
|
+
S .set (Math .pow (weight, 3), Math .pow (weight, 2), weight, 1);
|
|
170
175
|
|
|
171
|
-
|
|
176
|
+
// Taking dot product from SH and C;
|
|
172
177
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
return this .dot (H .multVecMatrix (S),
|
|
179
|
+
keyValue [index0],
|
|
180
|
+
keyValue [index1],
|
|
181
|
+
this .T0 [index0],
|
|
182
|
+
this .T1 [index1]);
|
|
183
|
+
};
|
|
184
|
+
})(),
|
|
179
185
|
};
|
|
180
186
|
|
|
181
187
|
export default CatmullRomSplineInterpolator;
|
|
@@ -49,8 +49,7 @@ import CatmullRomSplineInterpolator from "./CatmullRomSplineInterpolator.js";
|
|
|
49
49
|
|
|
50
50
|
function CatmullRomSplineInterpolator1 ()
|
|
51
51
|
{
|
|
52
|
-
|
|
53
|
-
this .T1 = [ ];
|
|
52
|
+
CatmullRomSplineInterpolator .call (this);
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
CatmullRomSplineInterpolator1 .prototype = Object .assign (Object .create (CatmullRomSplineInterpolator .prototype),
|
|
@@ -76,7 +75,7 @@ CatmullRomSplineInterpolator1 .prototype = Object .assign (Object .create (Catmu
|
|
|
76
75
|
{
|
|
77
76
|
return lhs / rhs;
|
|
78
77
|
},
|
|
79
|
-
|
|
78
|
+
magnitude: function (value)
|
|
80
79
|
{
|
|
81
80
|
return Math .abs (value);
|
|
82
81
|
},
|
|
@@ -49,12 +49,6 @@ import CatmullRomSplineInterpolator from "./CatmullRomSplineInterpolator.js";
|
|
|
49
49
|
|
|
50
50
|
function CatmullRomSplineInterpolatorTemplate (Type)
|
|
51
51
|
{
|
|
52
|
-
const
|
|
53
|
-
c0 = new Type (0, 0, 0, 0),
|
|
54
|
-
c1 = new Type (0, 0, 0, 0),
|
|
55
|
-
c2 = new Type (0, 0, 0, 0),
|
|
56
|
-
c3 = new Type (0, 0, 0, 0);
|
|
57
|
-
|
|
58
52
|
function CatmullRomSplineInterpolatorInstance ()
|
|
59
53
|
{
|
|
60
54
|
this .T0 = [ ];
|
|
@@ -84,19 +78,28 @@ function CatmullRomSplineInterpolatorTemplate (Type)
|
|
|
84
78
|
{
|
|
85
79
|
return Type .divide (lhs, rhs);
|
|
86
80
|
},
|
|
87
|
-
|
|
81
|
+
magnitude: function (value)
|
|
88
82
|
{
|
|
89
83
|
return value .magnitude ();
|
|
90
84
|
},
|
|
91
|
-
dot: function (
|
|
85
|
+
dot: (function ()
|
|
92
86
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
const
|
|
88
|
+
c0 = new Type (0, 0, 0, 0),
|
|
89
|
+
c1 = new Type (0, 0, 0, 0),
|
|
90
|
+
c2 = new Type (0, 0, 0, 0),
|
|
91
|
+
c3 = new Type (0, 0, 0, 0);
|
|
97
92
|
|
|
98
|
-
return
|
|
99
|
-
|
|
93
|
+
return function (SH, C0, C1, C2, C3)
|
|
94
|
+
{
|
|
95
|
+
c0 .assign (C0) .multiply (SH [0]);
|
|
96
|
+
c1 .assign (C1) .multiply (SH [1]);
|
|
97
|
+
c2 .assign (C2) .multiply (SH [2]);
|
|
98
|
+
c3 .assign (C3) .multiply (SH [3]);
|
|
99
|
+
|
|
100
|
+
return c0 .add (c1) .add (c2) .add (c3);
|
|
101
|
+
};
|
|
102
|
+
})(),
|
|
100
103
|
});
|
|
101
104
|
|
|
102
105
|
return CatmullRomSplineInterpolatorInstance;
|
|
@@ -256,59 +256,44 @@ PolygonText .prototype = Object .assign (Object .create (X3DTextGeometry .protot
|
|
|
256
256
|
x = 0,
|
|
257
257
|
y = 0;
|
|
258
258
|
|
|
259
|
-
for (const
|
|
259
|
+
for (const { type, x1, y1, x2, y2, x: cx, y: cy } of path .commands)
|
|
260
260
|
{
|
|
261
|
-
switch (
|
|
261
|
+
switch (type)
|
|
262
262
|
{
|
|
263
263
|
case "M": // Start
|
|
264
264
|
case "Z": // End
|
|
265
265
|
{
|
|
266
|
-
// Filter consecutive identical points.
|
|
267
|
-
points = points .filter ((p, i, a) => !p .equals (a [(i + 1) % a .length]));
|
|
268
|
-
|
|
269
266
|
if (points .length > 2)
|
|
270
267
|
contours .push (points);
|
|
271
268
|
|
|
272
269
|
points = [ ];
|
|
273
270
|
|
|
274
|
-
if (
|
|
275
|
-
points .push (new Vector3 (
|
|
271
|
+
if (type === "M")
|
|
272
|
+
points .push (new Vector3 (cx, -cy, 0));
|
|
276
273
|
|
|
277
274
|
break;
|
|
278
275
|
}
|
|
279
276
|
case "L": // Linear
|
|
280
277
|
{
|
|
281
|
-
points .push (new Vector3 (
|
|
278
|
+
points .push (new Vector3 (cx, -cy, 0));
|
|
282
279
|
break;
|
|
283
280
|
}
|
|
284
281
|
case "Q": // Quadric
|
|
285
282
|
{
|
|
286
|
-
|
|
287
|
-
curve = new Bezier (x, -y, command .x1, -command .y1, command .x, -command .y),
|
|
288
|
-
lut = curve .getPoints ("quadric", steps);
|
|
289
|
-
|
|
290
|
-
for (const p of lut)
|
|
291
|
-
points .push (new Vector3 (p .x, p .y, 0));
|
|
292
|
-
|
|
283
|
+
Bezier .quadric (x, -y, 0, x1, -y1, 0, cx, -cy, 0, steps, points);
|
|
293
284
|
break;
|
|
294
285
|
}
|
|
295
286
|
case "C": // Cubic
|
|
296
287
|
{
|
|
297
|
-
|
|
298
|
-
curve = new Bezier (x, -y, command .x1, -command .y1, command .x2, -command .y2, command .x, -command .y),
|
|
299
|
-
lut = curve .getPoints ("cubic", steps);
|
|
300
|
-
|
|
301
|
-
for (const p of lut)
|
|
302
|
-
points .push (new Vector3 (p .x, p .y, 0));
|
|
303
|
-
|
|
288
|
+
Bezier .cubic (x, -y, 0, x1, -y1, 0, x2, -y2, 0, cx, -cy, 0, steps, points);
|
|
304
289
|
break;
|
|
305
290
|
}
|
|
306
291
|
default:
|
|
307
292
|
continue;
|
|
308
293
|
}
|
|
309
294
|
|
|
310
|
-
x =
|
|
311
|
-
y =
|
|
295
|
+
x = cx;
|
|
296
|
+
y = cy;
|
|
312
297
|
}
|
|
313
298
|
|
|
314
299
|
return this .triangulatePolygon (contours, vertices);
|
|
@@ -334,9 +319,15 @@ PolygonText .prototype = Object .assign (Object .create (X3DTextGeometry .protot
|
|
|
334
319
|
triangles .push (point);
|
|
335
320
|
}
|
|
336
321
|
|
|
322
|
+
function combineCallback (coords, data, weight)
|
|
323
|
+
{
|
|
324
|
+
return new Vector3 (... coords);
|
|
325
|
+
}
|
|
326
|
+
|
|
337
327
|
const tessy = new libtess .GluTesselator ();
|
|
338
328
|
|
|
339
329
|
tessy .gluTessCallback (libtess .gluEnum .GLU_TESS_VERTEX_DATA, vertexCallback);
|
|
330
|
+
tessy .gluTessCallback (libtess .gluEnum .GLU_TESS_COMBINE, combineCallback);
|
|
340
331
|
tessy .gluTessProperty (libtess .gluEnum .GLU_TESS_WINDING_RULE, libtess .windingRule .GLU_TESS_WINDING_ODD);
|
|
341
332
|
tessy .gluTessNormal (0, 0, 1);
|
|
342
333
|
|
|
@@ -804,7 +804,9 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
|
804
804
|
generator .string += '"';
|
|
805
805
|
generator .string += ':';
|
|
806
806
|
generator .string += generator .TidySpace ();
|
|
807
|
+
generator .string += '"';
|
|
807
808
|
generator .string += generator .JSONEncode (name);
|
|
809
|
+
generator .string += '"';
|
|
808
810
|
generator .string += generator .TidyBreak ();
|
|
809
811
|
generator .string += generator .DecIndent ();
|
|
810
812
|
generator .string += generator .Indent ();
|
|
@@ -847,7 +849,9 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
|
847
849
|
generator .string += '"';
|
|
848
850
|
generator .string += ':';
|
|
849
851
|
generator .string += generator .TidySpace ();
|
|
852
|
+
generator .string += '"';
|
|
850
853
|
generator .string += generator .JSONEncode (name);
|
|
854
|
+
generator .string += '"';
|
|
851
855
|
generator .string += ',';
|
|
852
856
|
generator .string += generator .TidyBreak ();
|
|
853
857
|
}
|
|
@@ -1008,7 +1012,9 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
|
1008
1012
|
generator .string += '"';
|
|
1009
1013
|
generator .string += ':';
|
|
1010
1014
|
generator .string += generator .TidySpace ();
|
|
1015
|
+
generator .string += '"';
|
|
1011
1016
|
generator .string += generator .JSONEncode (field .getName ());
|
|
1017
|
+
generator .string += '"';
|
|
1012
1018
|
|
|
1013
1019
|
// If the field is a inputOutput and we have as reference only inputOnly or outputOnly we must output the value
|
|
1014
1020
|
// for this field.
|
|
@@ -1131,7 +1137,9 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
|
1131
1137
|
for (let i = 0, length = sourceTextLines .length; i < length; ++ i)
|
|
1132
1138
|
{
|
|
1133
1139
|
generator .string += generator .ListIndent ();
|
|
1140
|
+
generator .string += '"';
|
|
1134
1141
|
generator .string += generator .JSONEncode (sourceTextLines [i]);
|
|
1142
|
+
generator .string += '"';
|
|
1135
1143
|
|
|
1136
1144
|
if (i !== length - 1)
|
|
1137
1145
|
generator .string += ',';
|
|
@@ -1187,7 +1195,9 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
|
1187
1195
|
generator .string += '"';
|
|
1188
1196
|
generator .string += ':';
|
|
1189
1197
|
generator .string += generator .TidySpace ();
|
|
1198
|
+
generator .string += '"';
|
|
1190
1199
|
generator .string += generator .JSONEncode (field .getName ());
|
|
1200
|
+
generator .string += '"';
|
|
1191
1201
|
generator .string += ',';
|
|
1192
1202
|
generator .string += generator .TidyBreak ();
|
|
1193
1203
|
|
|
@@ -1197,7 +1207,9 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
|
1197
1207
|
generator .string += '"';
|
|
1198
1208
|
generator .string += ':';
|
|
1199
1209
|
generator .string += generator .TidySpace ();
|
|
1210
|
+
generator .string += '"';
|
|
1200
1211
|
generator .string += generator .JSONEncode (protoField .getName ());
|
|
1212
|
+
generator .string += '"';
|
|
1201
1213
|
generator .string += generator .TidyBreak ();
|
|
1202
1214
|
|
|
1203
1215
|
generator .string += generator .DecIndent ();
|
|
@@ -663,7 +663,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
663
663
|
generator .string += '"';
|
|
664
664
|
generator .string += ':';
|
|
665
665
|
generator .string += generator .TidySpace ();
|
|
666
|
+
generator .string += '"';
|
|
666
667
|
generator .string += generator .JSONEncode (this .getTypeName ());
|
|
668
|
+
generator .string += '"';
|
|
667
669
|
generator .string += ',';
|
|
668
670
|
generator .string += generator .TidyBreak ();
|
|
669
671
|
|
|
@@ -673,7 +675,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
673
675
|
generator .string += '"';
|
|
674
676
|
generator .string += ':';
|
|
675
677
|
generator .string += generator .TidySpace ();
|
|
678
|
+
generator .string += '"';
|
|
676
679
|
generator .string += generator .JSONEncode (name);
|
|
680
|
+
generator .string += '"';
|
|
677
681
|
generator .string += generator .TidyBreak ();
|
|
678
682
|
|
|
679
683
|
generator .string += generator .DecIndent ();
|
|
@@ -717,7 +721,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
717
721
|
generator .string += '"';
|
|
718
722
|
generator .string += ':';
|
|
719
723
|
generator .string += generator .TidySpace ();
|
|
724
|
+
generator .string += '"';
|
|
720
725
|
generator .string += generator .JSONEncode (name);
|
|
726
|
+
generator .string += '"';
|
|
721
727
|
generator .string += ',';
|
|
722
728
|
generator .string += generator .TidyBreak ();
|
|
723
729
|
}
|
|
@@ -731,7 +737,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
731
737
|
generator .string += '"';
|
|
732
738
|
generator .string += ':';
|
|
733
739
|
generator .string += generator .TidySpace ();
|
|
740
|
+
generator .string += '"';
|
|
734
741
|
generator .string += generator .JSONEncode (this .getTypeName ());
|
|
742
|
+
generator .string += '"';
|
|
735
743
|
generator .string += ',';
|
|
736
744
|
generator .string += generator .TidyBreak ();
|
|
737
745
|
|
|
@@ -804,7 +812,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
804
812
|
generator .string += '"';
|
|
805
813
|
generator .string += ':';
|
|
806
814
|
generator .string += generator .TidySpace ();
|
|
815
|
+
generator .string += '"';
|
|
807
816
|
generator .string += generator .JSONEncode (field .getName ());
|
|
817
|
+
generator .string += '"';
|
|
808
818
|
generator .string += ',';
|
|
809
819
|
generator .string += generator .TidyBreak ();
|
|
810
820
|
generator .string += generator .Indent ();
|
|
@@ -842,7 +852,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
842
852
|
generator .string += '"';
|
|
843
853
|
generator .string += ':';
|
|
844
854
|
generator .string += generator .TidySpace ();
|
|
855
|
+
generator .string += '"';
|
|
845
856
|
generator .string += generator .JSONEncode (field .getName ());
|
|
857
|
+
generator .string += '"';
|
|
846
858
|
generator .string += ',';
|
|
847
859
|
generator .string += generator .TidyBreak ();
|
|
848
860
|
generator .string += generator .Indent ();
|
|
@@ -872,7 +884,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
872
884
|
generator .string += '"';
|
|
873
885
|
generator .string += ':';
|
|
874
886
|
generator .string += generator .TidySpace ();
|
|
887
|
+
generator .string += '"';
|
|
875
888
|
generator .string += generator .JSONEncode (field .getName ());
|
|
889
|
+
generator .string += '"';
|
|
876
890
|
generator .string += ',';
|
|
877
891
|
generator .string += generator .TidyBreak ();
|
|
878
892
|
generator .string += generator .Indent ();
|
|
@@ -945,7 +959,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
945
959
|
generator .string += '"';
|
|
946
960
|
generator .string += ':';
|
|
947
961
|
generator .string += generator .TidySpace ();
|
|
962
|
+
generator .string += '"';
|
|
948
963
|
generator .string += generator .JSONEncode (field .getName ());
|
|
964
|
+
generator .string += '"';
|
|
949
965
|
generator .string += ',';
|
|
950
966
|
generator .string += generator .TidyBreak ();
|
|
951
967
|
|
|
@@ -955,7 +971,9 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
|
|
|
955
971
|
generator .string += '"';
|
|
956
972
|
generator .string += ':';
|
|
957
973
|
generator .string += generator .TidySpace ();
|
|
974
|
+
generator .string += '"';
|
|
958
975
|
generator .string += generator .JSONEncode (protoField .getName ());
|
|
976
|
+
generator .string += '"';
|
|
959
977
|
generator .string += generator .TidyBreak ();
|
|
960
978
|
|
|
961
979
|
generator .string += generator .DecIndent ();
|
|
@@ -68,12 +68,13 @@ 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 .
|
|
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 .inputOutput, "normalizeVelocity", new Fields .SFBool ()),
|
|
77
|
+
new X3DFieldDefinition (X3DConstants .outputOnly, "value_changed", new Fields .SFRotation ()),
|
|
77
78
|
]),
|
|
78
79
|
getTypeName: function ()
|
|
79
80
|
{
|
|
@@ -91,7 +92,7 @@ SquadOrientationInterpolator .prototype = Object .assign (Object .create (X3DInt
|
|
|
91
92
|
{
|
|
92
93
|
X3DInterpolatorNode .prototype .initialize .call (this);
|
|
93
94
|
|
|
94
|
-
this ._keyValue
|
|
95
|
+
this ._keyValue .addInterest ("set_keyValue__", this);
|
|
95
96
|
},
|
|
96
97
|
set_keyValue__: function ()
|
|
97
98
|
{
|
|
@@ -122,7 +122,9 @@ UnitInfo .prototype = Object .assign (Object .create (X3DObject .prototype),
|
|
|
122
122
|
generator .string += '"';
|
|
123
123
|
generator .string += ':';
|
|
124
124
|
generator .string += generator .TidySpace ();
|
|
125
|
+
generator .string += '"';
|
|
125
126
|
generator .string += generator .JSONEncode (this .name);
|
|
127
|
+
generator .string += '"';
|
|
126
128
|
generator .string += ',';
|
|
127
129
|
generator .string += generator .TidyBreak ();
|
|
128
130
|
|