x_ite 8.6.3 → 8.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +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 +30 -30
- 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 +200 -122
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +1 -1
- package/docs/_posts/getting-started.md +1 -1
- package/docs/_posts/laboratory/x3d-file-converter.md +1 -1
- package/docs/_tabs/laboratory.md +6 -0
- package/package.json +1 -1
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Parser/OBJParser.js +29 -22
- package/src/x_ite/Parser/SVGParser.js +116 -45
package/dist/x_ite.zip
CHANGED
|
Binary file
|
package/docs/_config.yml
CHANGED
|
@@ -645,7 +645,7 @@ X_ITE can load several file formats, either directly as the source of the \<x3d-
|
|
|
645
645
|
>**Tip:** All files can be compressed using GZip compression. This saves bandwidth and speeds up download time.
|
|
646
646
|
{: .prompt-tip }
|
|
647
647
|
|
|
648
|
-
If you have an own web-server see [How to Configure Your Web Server](how-to-configure-your-web-server). If you are looking for an online file format converter [see here](laboratory/x3d-file-converter).
|
|
648
|
+
If you have an own web-server see [How to Configure Your Web Server](how-to-configure-your-web-server). If you are looking for an online X3D file format converter [see here](laboratory/x3d-file-converter).
|
|
649
649
|
|
|
650
650
|
### Fallback Content
|
|
651
651
|
|
|
@@ -180,4 +180,4 @@ Your converted files will appear here.
|
|
|
180
180
|
|
|
181
181
|
## Command Line Tool
|
|
182
182
|
|
|
183
|
-
If you are looking for a command line tool to convert files, have a look at [x3d-tidy](https://www.npmjs.com/package/x3d-tidy){:target="_blank"}. It is a Node program and it can be run via `npx x3d-tidy`.
|
|
183
|
+
If you are looking for a command line tool to convert files, have a look at [x3d-tidy](https://www.npmjs.com/package/x3d-tidy){:target="_blank"}. It is a [Node](https://nodejs.org/) program and it can be run via `npx x3d-tidy`.
|
package/docs/_tabs/laboratory.md
CHANGED
|
@@ -41,6 +41,12 @@ table.examples td {
|
|
|
41
41
|
</tr>
|
|
42
42
|
</table>
|
|
43
43
|
|
|
44
|
+
Also have a look at the [Online X3D File Format Converter](x3d-file-converter).
|
|
45
|
+
|
|
46
|
+
## X3D-Tidy
|
|
47
|
+
|
|
48
|
+
[x3d-tidy](https://www.npmjs.com/package/x3d-tidy){:target="_blank"} is a command line X3D file format converter, compressor and beautifier and available on NPM.
|
|
49
|
+
|
|
44
50
|
## D3-X3D
|
|
45
51
|
|
|
46
52
|
[D3-X3D](https://github.com/jamesleesaunders/d3-x3d#d3-x3d){:target="_blank"} is an external JavaScript library that combines the power of **D3.js** with X3D and can be found on GitHub.
|
package/package.json
CHANGED
|
@@ -272,37 +272,44 @@ OBJParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
272
272
|
},
|
|
273
273
|
mtllib: async function (path)
|
|
274
274
|
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
try
|
|
276
|
+
{
|
|
277
|
+
const
|
|
278
|
+
scene = this .getExecutionContext (),
|
|
279
|
+
url = new URL (path, scene .getWorldURL ());
|
|
278
280
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
const input = await fetch (url)
|
|
282
|
+
.then (response => response .arrayBuffer ())
|
|
283
|
+
.then (arrayBuffer => $.decodeText ($.ungzip (arrayBuffer)))
|
|
284
|
+
.catch (Function .prototype);
|
|
283
285
|
|
|
284
|
-
|
|
286
|
+
const parser = new MaterialParser (scene, input);
|
|
285
287
|
|
|
286
|
-
|
|
288
|
+
parser .parse ();
|
|
287
289
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
290
|
+
for (const [name, material] of parser .materials)
|
|
291
|
+
{
|
|
292
|
+
const nodeName = this .sanitizeName (name);
|
|
291
293
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
if (nodeName)
|
|
295
|
+
scene .addNamedNode (scene .getUniqueName (nodeName), material);
|
|
294
296
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
+
this .materials .set (name, material);
|
|
298
|
+
}
|
|
297
299
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
for (const [name, texture] of parser .textures)
|
|
301
|
+
{
|
|
302
|
+
const nodeName = this .sanitizeName (name);
|
|
301
303
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
+
if (nodeName)
|
|
305
|
+
scene .addNamedNode (scene .getUniqueName (nodeName), texture);
|
|
304
306
|
|
|
305
|
-
|
|
307
|
+
this .textures .set (name, texture);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
catch (error)
|
|
311
|
+
{
|
|
312
|
+
console .warn (error);
|
|
306
313
|
}
|
|
307
314
|
},
|
|
308
315
|
usemtl: function ()
|
|
@@ -143,7 +143,7 @@ function SVGParser (scene)
|
|
|
143
143
|
fillURL: "",
|
|
144
144
|
fillOpacity: 1,
|
|
145
145
|
fillRule: "nonzero",
|
|
146
|
-
strokeType: "
|
|
146
|
+
strokeType: "none",
|
|
147
147
|
strokeColor: Color4 .Black,
|
|
148
148
|
strokeURL: "",
|
|
149
149
|
strokeOpacity: 1,
|
|
@@ -151,6 +151,7 @@ function SVGParser (scene)
|
|
|
151
151
|
opacity: 1,
|
|
152
152
|
stopColor: Color4 .Black,
|
|
153
153
|
stopOpacity: 1,
|
|
154
|
+
vectorEffect: "none",
|
|
154
155
|
}];
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -260,17 +261,31 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
260
261
|
// Get attributes of svg element.
|
|
261
262
|
|
|
262
263
|
const
|
|
263
|
-
defaultWidth = this .lengthAttribute (xmlElement .getAttribute ("width",
|
|
264
|
-
defaultHeight = this .lengthAttribute (xmlElement .getAttribute ("height",
|
|
264
|
+
defaultWidth = this .lengthAttribute (xmlElement .getAttribute ("width"), 300),
|
|
265
|
+
defaultHeight = this .lengthAttribute (xmlElement .getAttribute ("height"), 150),
|
|
265
266
|
defaultViewBox = new Vector4 (0, 0, defaultWidth, defaultHeight),
|
|
266
267
|
viewBox = this .viewBoxAttribute (xmlElement .getAttribute ("viewBox"), defaultViewBox),
|
|
267
|
-
width = this .lengthAttribute (xmlElement .getAttribute ("width", viewBox [2])
|
|
268
|
-
height = this .lengthAttribute (xmlElement .getAttribute ("height", viewBox [3])
|
|
268
|
+
width = this .lengthAttribute (xmlElement .getAttribute ("width"), viewBox [2]),
|
|
269
|
+
height = this .lengthAttribute (xmlElement .getAttribute ("height"), viewBox [3]);
|
|
270
|
+
|
|
271
|
+
if (true) // default
|
|
272
|
+
{
|
|
273
|
+
// preserveAspectRatio="xMidYMid meet"
|
|
274
|
+
|
|
275
|
+
const
|
|
276
|
+
r = width / height,
|
|
277
|
+
rv = viewBox [2] / viewBox [3];
|
|
278
|
+
|
|
279
|
+
if (rv > r)
|
|
280
|
+
viewBox [3] += viewBox [2] / r - viewBox [3];
|
|
281
|
+
else
|
|
282
|
+
viewBox [2] += viewBox [3] * r - viewBox [2];
|
|
283
|
+
}
|
|
269
284
|
|
|
270
285
|
// Create viewpoint.
|
|
271
286
|
|
|
272
287
|
const
|
|
273
|
-
viewpoint = scene .createNode ("OrthoViewpoint"
|
|
288
|
+
viewpoint = scene .createNode ("OrthoViewpoint"),
|
|
274
289
|
x = (viewBox .x + width / 2) * PIXEL,
|
|
275
290
|
y = -(viewBox .y + height / 2) * PIXEL;
|
|
276
291
|
|
|
@@ -512,7 +527,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
512
527
|
|
|
513
528
|
// Create nodes.
|
|
514
529
|
|
|
515
|
-
if (this .style .fillType !== "
|
|
530
|
+
if (this .style .fillType !== "none")
|
|
516
531
|
{
|
|
517
532
|
const
|
|
518
533
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -526,7 +541,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
526
541
|
transformNode .children .push (shapeNode);
|
|
527
542
|
}
|
|
528
543
|
|
|
529
|
-
if (this .style .strokeType !== "
|
|
544
|
+
if (this .style .strokeType !== "none")
|
|
530
545
|
{
|
|
531
546
|
const
|
|
532
547
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -574,7 +589,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
574
589
|
|
|
575
590
|
// Create nodes.
|
|
576
591
|
|
|
577
|
-
if (this .style .fillType !== "
|
|
592
|
+
if (this .style .fillType !== "none")
|
|
578
593
|
{
|
|
579
594
|
const
|
|
580
595
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -588,7 +603,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
588
603
|
transformNode .children .push (shapeNode);
|
|
589
604
|
}
|
|
590
605
|
|
|
591
|
-
if (this .style .strokeType !== "
|
|
606
|
+
if (this .style .strokeType !== "none")
|
|
592
607
|
{
|
|
593
608
|
const
|
|
594
609
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -631,7 +646,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
631
646
|
|
|
632
647
|
// Create nodes.
|
|
633
648
|
|
|
634
|
-
if (this .style .fillType !== "
|
|
649
|
+
if (this .style .fillType !== "none")
|
|
635
650
|
{
|
|
636
651
|
const
|
|
637
652
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -645,7 +660,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
645
660
|
transformNode .children .push (shapeNode);
|
|
646
661
|
}
|
|
647
662
|
|
|
648
|
-
if (this .style .strokeType !== "
|
|
663
|
+
if (this .style .strokeType !== "none")
|
|
649
664
|
{
|
|
650
665
|
const
|
|
651
666
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -732,7 +747,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
732
747
|
|
|
733
748
|
coordinateNode .point .push (... points);
|
|
734
749
|
|
|
735
|
-
if (this .style .fillType !== "
|
|
750
|
+
if (this .style .fillType !== "none")
|
|
736
751
|
{
|
|
737
752
|
const
|
|
738
753
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -748,7 +763,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
748
763
|
transformNode .children .push (shapeNode);
|
|
749
764
|
}
|
|
750
765
|
|
|
751
|
-
if (this .style .strokeType !== "
|
|
766
|
+
if (this .style .strokeType !== "none")
|
|
752
767
|
{
|
|
753
768
|
const
|
|
754
769
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -804,7 +819,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
804
819
|
for (const points of contours)
|
|
805
820
|
coordinateNode .point .push (... points);
|
|
806
821
|
|
|
807
|
-
if (this .style .fillType !== "
|
|
822
|
+
if (this .style .fillType !== "none")
|
|
808
823
|
{
|
|
809
824
|
const
|
|
810
825
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -820,7 +835,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
820
835
|
transformNode .children .push (shapeNode);
|
|
821
836
|
}
|
|
822
837
|
|
|
823
|
-
if (this .style .strokeType !== "
|
|
838
|
+
if (this .style .strokeType !== "none")
|
|
824
839
|
{
|
|
825
840
|
const
|
|
826
841
|
shapeNode = scene .createNode ("Shape"),
|
|
@@ -858,7 +873,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
858
873
|
for (const [o, c, a] of g .stops)
|
|
859
874
|
gradient .addColorStop (o, `rgba(${c .r * 255},${c .g * 255},${c .b * 255},${a})`);
|
|
860
875
|
|
|
861
|
-
return this .drawGradient (gradient, g
|
|
876
|
+
return this .drawGradient (gradient, g, bbox);
|
|
862
877
|
},
|
|
863
878
|
linearGradientElement: function (xmlElement, gradient)
|
|
864
879
|
{
|
|
@@ -897,7 +912,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
897
912
|
for (const [o, c, a] of g .stops)
|
|
898
913
|
gradient .addColorStop (o, `rgba(${c .r * 255},${c .g * 255},${c .b * 255},${a})`);
|
|
899
914
|
|
|
900
|
-
return this .drawGradient (gradient, g
|
|
915
|
+
return this .drawGradient (gradient, g, bbox);
|
|
901
916
|
},
|
|
902
917
|
radialGradientElement: function (xmlElement, gradient)
|
|
903
918
|
{
|
|
@@ -958,7 +973,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
958
973
|
|
|
959
974
|
this .styles .pop ();
|
|
960
975
|
},
|
|
961
|
-
drawGradient: function (gradient,
|
|
976
|
+
drawGradient: function (gradient, g, bbox)
|
|
962
977
|
{
|
|
963
978
|
const m = new Matrix3 ();
|
|
964
979
|
|
|
@@ -966,12 +981,12 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
966
981
|
m .translate (Vector2 .One);
|
|
967
982
|
m .scale (new Vector2 (1, -1));
|
|
968
983
|
|
|
969
|
-
if (units === "userSpaceOnUse")
|
|
984
|
+
if (g .units === "userSpaceOnUse")
|
|
970
985
|
m .multLeft (Matrix3 .inverse (bbox .matrix));
|
|
971
986
|
else
|
|
972
987
|
m .multLeft (new Matrix3 (2, 0, 0, 0, 2, 0, -1, -1, 1));
|
|
973
988
|
|
|
974
|
-
m .multLeft (transform);
|
|
989
|
+
m .multLeft (g .transform);
|
|
975
990
|
|
|
976
991
|
// Paint.
|
|
977
992
|
|
|
@@ -1764,16 +1779,20 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1764
1779
|
{
|
|
1765
1780
|
if (this .double ())
|
|
1766
1781
|
{
|
|
1767
|
-
|
|
1782
|
+
var ty = this .value;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
else
|
|
1786
|
+
{
|
|
1787
|
+
var ty = 0;
|
|
1788
|
+
}
|
|
1768
1789
|
|
|
1769
|
-
|
|
1790
|
+
this .whitespaces ();
|
|
1770
1791
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1792
|
+
if (Grammar .closeParenthesis .parse (this))
|
|
1793
|
+
{
|
|
1794
|
+
matrix .translate (new Vector2 (tx, ty));
|
|
1795
|
+
continue;
|
|
1777
1796
|
}
|
|
1778
1797
|
}
|
|
1779
1798
|
}
|
|
@@ -1840,16 +1859,20 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1840
1859
|
{
|
|
1841
1860
|
if (this .double ())
|
|
1842
1861
|
{
|
|
1843
|
-
|
|
1862
|
+
var sy = this .value;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
else
|
|
1866
|
+
{
|
|
1867
|
+
var sy = sx;
|
|
1868
|
+
}
|
|
1844
1869
|
|
|
1845
|
-
|
|
1870
|
+
this .whitespaces ();
|
|
1846
1871
|
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1872
|
+
if (Grammar .closeParenthesis .parse (this))
|
|
1873
|
+
{
|
|
1874
|
+
matrix .scale (new Vector2 (sx, sy));
|
|
1875
|
+
continue;
|
|
1853
1876
|
}
|
|
1854
1877
|
}
|
|
1855
1878
|
}
|
|
@@ -1913,6 +1936,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1913
1936
|
"opacity",
|
|
1914
1937
|
"stop-color",
|
|
1915
1938
|
"stop-opacity",
|
|
1939
|
+
"vector-effect",
|
|
1916
1940
|
];
|
|
1917
1941
|
|
|
1918
1942
|
return function (xmlElement)
|
|
@@ -1991,6 +2015,9 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1991
2015
|
case "stop-opacity":
|
|
1992
2016
|
this .stopOpacityStyle (value);
|
|
1993
2017
|
break;
|
|
2018
|
+
case "vector-effect":
|
|
2019
|
+
this .vectorEffectStyle (value);
|
|
2020
|
+
break;
|
|
1994
2021
|
}
|
|
1995
2022
|
},
|
|
1996
2023
|
displayStyle: function (value)
|
|
@@ -2020,13 +2047,13 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2020
2047
|
|
|
2021
2048
|
if (value === "transparent")
|
|
2022
2049
|
{
|
|
2023
|
-
this .style .fillType = "
|
|
2050
|
+
this .style .fillType = "none";
|
|
2024
2051
|
return;
|
|
2025
2052
|
}
|
|
2026
2053
|
|
|
2027
2054
|
if (value === "none")
|
|
2028
2055
|
{
|
|
2029
|
-
this .style .fillType ="
|
|
2056
|
+
this .style .fillType ="none";
|
|
2030
2057
|
return;
|
|
2031
2058
|
}
|
|
2032
2059
|
|
|
@@ -2079,13 +2106,13 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2079
2106
|
|
|
2080
2107
|
if (value === "transparent")
|
|
2081
2108
|
{
|
|
2082
|
-
this .style .strokeType = "
|
|
2109
|
+
this .style .strokeType = "none";
|
|
2083
2110
|
return;
|
|
2084
2111
|
}
|
|
2085
2112
|
|
|
2086
2113
|
if (value === "none")
|
|
2087
2114
|
{
|
|
2088
|
-
this .style .strokeType ="
|
|
2115
|
+
this .style .strokeType ="none";
|
|
2089
2116
|
return;
|
|
2090
2117
|
}
|
|
2091
2118
|
|
|
@@ -2127,7 +2154,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2127
2154
|
{
|
|
2128
2155
|
if (this .double ())
|
|
2129
2156
|
{
|
|
2130
|
-
this .style .strokeWidth = this .
|
|
2157
|
+
this .style .strokeWidth = this .lengthAttribute (this .value);
|
|
2131
2158
|
return;
|
|
2132
2159
|
}
|
|
2133
2160
|
|
|
@@ -2177,6 +2204,18 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2177
2204
|
return;
|
|
2178
2205
|
}
|
|
2179
2206
|
},
|
|
2207
|
+
vectorEffectStyle: function (value)
|
|
2208
|
+
{
|
|
2209
|
+
if (value !== "inherit")
|
|
2210
|
+
{
|
|
2211
|
+
this .style .vectorEffect = value;
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
// inherit
|
|
2216
|
+
|
|
2217
|
+
this .style .vectorEffect = this .styles .at (-1) .vectorEffect;
|
|
2218
|
+
},
|
|
2180
2219
|
parseValue: function (value)
|
|
2181
2220
|
{
|
|
2182
2221
|
this .input = value;
|
|
@@ -2291,7 +2330,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2291
2330
|
|
|
2292
2331
|
switch (this .style .fillType)
|
|
2293
2332
|
{
|
|
2294
|
-
case "
|
|
2333
|
+
case "none":
|
|
2295
2334
|
{
|
|
2296
2335
|
return null;
|
|
2297
2336
|
}
|
|
@@ -2356,16 +2395,28 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2356
2395
|
materialNode .emissiveColor = new Color3 (... this .style .strokeColor);
|
|
2357
2396
|
materialNode .transparency = 1 - this .style .strokeOpacity * this .style .opacity;
|
|
2358
2397
|
|
|
2359
|
-
|
|
2398
|
+
const strokeWidth = this .vectorEffect === "non-scaling-stroke"
|
|
2399
|
+
? this .style .strokeWidth
|
|
2400
|
+
: this .getStokeWidth ();
|
|
2401
|
+
|
|
2402
|
+
if (strokeWidth > 1)
|
|
2360
2403
|
{
|
|
2361
2404
|
const lineProperties = scene .createNode ("LineProperties");
|
|
2362
2405
|
|
|
2363
2406
|
appearanceNode .lineProperties = lineProperties;
|
|
2364
|
-
lineProperties .linewidthScaleFactor =
|
|
2407
|
+
lineProperties .linewidthScaleFactor = strokeWidth;
|
|
2365
2408
|
}
|
|
2366
2409
|
|
|
2367
2410
|
return appearanceNode;
|
|
2368
2411
|
},
|
|
2412
|
+
getStokeWidth: function ()
|
|
2413
|
+
{
|
|
2414
|
+
const
|
|
2415
|
+
modelMatrix = this .getModelMatrix (),
|
|
2416
|
+
strokeWidth = modelMatrix .multDirMatrix (new Vector3 (this .style .strokeWidth, this .style .strokeWidth, 0));
|
|
2417
|
+
|
|
2418
|
+
return (strokeWidth .x + strokeWidth .y) / 2;
|
|
2419
|
+
},
|
|
2369
2420
|
createTextureProperties: function ()
|
|
2370
2421
|
{
|
|
2371
2422
|
const
|
|
@@ -2394,6 +2445,26 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2394
2445
|
|
|
2395
2446
|
return texCoordNode;
|
|
2396
2447
|
},
|
|
2448
|
+
getModelMatrix: function ()
|
|
2449
|
+
{
|
|
2450
|
+
const modelMatrix = new Matrix4 ();
|
|
2451
|
+
|
|
2452
|
+
for (let i = 1; i < this .groupNodes .length; ++ i)
|
|
2453
|
+
{
|
|
2454
|
+
const
|
|
2455
|
+
node = this .groupNodes [i],
|
|
2456
|
+
matrix = new Matrix4 ();
|
|
2457
|
+
|
|
2458
|
+
matrix .set (node .translation .getValue (),
|
|
2459
|
+
node .rotation .getValue (),
|
|
2460
|
+
node .scale .getValue (),
|
|
2461
|
+
node .scaleOrientation .getValue ());
|
|
2462
|
+
|
|
2463
|
+
modelMatrix .multLeft (matrix);
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
return modelMatrix;
|
|
2467
|
+
},
|
|
2397
2468
|
createTesselator: function ()
|
|
2398
2469
|
{
|
|
2399
2470
|
// Function called for each vertex of tessellator output.
|