x_ite 8.6.6 → 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 +2299 -2123
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +1 -1
- package/docs/_posts/laboratory/x3d-file-converter.md +3 -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/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 +23 -24
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +0 -1
- package/src/x_ite/Components/Shape/UnlitMaterial.js +0 -1
- package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +10 -12
- package/src/x_ite/Components/Texturing/ImageTexture.js +4 -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 +5 -2
- package/src/x_ite/Rendering/X3DRenderObject.js +3 -4
- package/webpack.config.js +2 -0
|
@@ -47,15 +47,14 @@
|
|
|
47
47
|
|
|
48
48
|
import X3DParser from "./X3DParser.js";
|
|
49
49
|
import X3DOptimizer from "./X3DOptimizer.js";
|
|
50
|
+
import URLs from "../Browser/Networking/URLs.js";
|
|
50
51
|
import Vector2 from "../../standard/Math/Numbers/Vector2.js";
|
|
51
52
|
import Vector3 from "../../standard/Math/Numbers/Vector3.js";
|
|
52
53
|
import Quaternion from "../../standard/Math/Numbers/Quaternion.js";
|
|
53
54
|
import Rotation4 from "../../standard/Math/Numbers/Rotation4.js";
|
|
54
|
-
import Matrix3 from "../../standard/Math/Numbers/Matrix3.js";
|
|
55
55
|
import Matrix4 from "../../standard/Math/Numbers/Matrix4.js";
|
|
56
56
|
import Color3 from "../../standard/Math/Numbers/Color3.js";
|
|
57
57
|
import Color4 from "../../standard/Math/Numbers/Color4.js";
|
|
58
|
-
import Box3 from "../../standard/Math/Geometry/Box3.js";
|
|
59
58
|
import Algorithm from "../../standard/Math/Algorithm.js";
|
|
60
59
|
import DEBUG from "../DEBUG.js"
|
|
61
60
|
|
|
@@ -79,7 +78,7 @@ function GLTF2Parser (scene)
|
|
|
79
78
|
|
|
80
79
|
// Globals
|
|
81
80
|
|
|
82
|
-
this .
|
|
81
|
+
this .extensions = new Set ();
|
|
83
82
|
this .lights = [ ];
|
|
84
83
|
this .usedLights = 0;
|
|
85
84
|
this .buffers = [ ];
|
|
@@ -182,13 +181,17 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
182
181
|
|
|
183
182
|
// Parse root objects.
|
|
184
183
|
|
|
185
|
-
this .assetObject
|
|
186
|
-
this .
|
|
187
|
-
this .
|
|
184
|
+
this .assetObject (glTF .asset);
|
|
185
|
+
this .extensionsArray (glTF .extensionsUsed, this .extensions);
|
|
186
|
+
this .extensionsArray (glTF .extensionsRequired, this .extensions);
|
|
187
|
+
this .extensionsObject (glTF .extensions);
|
|
188
188
|
|
|
189
189
|
await this .loadComponents ();
|
|
190
190
|
await this .buffersArray (glTF .buffers);
|
|
191
191
|
|
|
192
|
+
if (this .extensions .has ("KHR_draco_mesh_compression"))
|
|
193
|
+
this .draco = await this .createDraco ();
|
|
194
|
+
|
|
192
195
|
this .bufferViewsArray (glTF .bufferViews);
|
|
193
196
|
this .accessorsArray (glTF .accessors);
|
|
194
197
|
this .samplersArray (glTF .samplers);
|
|
@@ -249,19 +252,19 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
249
252
|
|
|
250
253
|
scene .getRootNodes () .push (worldInfoNode);
|
|
251
254
|
},
|
|
252
|
-
|
|
255
|
+
extensionsArray: function (extensions, set)
|
|
253
256
|
{
|
|
254
|
-
if (!(
|
|
257
|
+
if (!(extensions instanceof Array))
|
|
255
258
|
return;
|
|
256
259
|
|
|
257
260
|
const
|
|
258
261
|
browser = this .getBrowser (),
|
|
259
262
|
scene = this .getExecutionContext ();
|
|
260
263
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
for (const extension of extensionsUsed)
|
|
264
|
+
for (const extension of extensions)
|
|
264
265
|
{
|
|
266
|
+
set .add (extension);
|
|
267
|
+
|
|
265
268
|
switch (extension)
|
|
266
269
|
{
|
|
267
270
|
case "KHR_texture_transform":
|
|
@@ -312,8 +315,10 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
312
315
|
scene = this .getExecutionContext (),
|
|
313
316
|
name = this .sanitizeName (light .name);
|
|
314
317
|
|
|
315
|
-
|
|
316
|
-
|
|
318
|
+
const color = new Color3 (1, 1, 1);
|
|
319
|
+
|
|
320
|
+
if (this .vectorValue (light .color, color))
|
|
321
|
+
lightNode ._color = color;
|
|
317
322
|
|
|
318
323
|
lightNode ._intensity = this .numberValue (light .intensity, 1);
|
|
319
324
|
|
|
@@ -375,20 +380,21 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
375
380
|
|
|
376
381
|
this .buffers = await Promise .all (buffers .map ((buffer, i) => this .bufferObject (buffer, i)));
|
|
377
382
|
},
|
|
378
|
-
bufferObject: function (buffer, i)
|
|
383
|
+
bufferObject: async function (buffer, i)
|
|
379
384
|
{
|
|
380
385
|
if (!(buffer instanceof Object))
|
|
381
386
|
return;
|
|
382
387
|
|
|
383
388
|
if (!buffer .uri)
|
|
384
|
-
return
|
|
389
|
+
return this .buffers [i];
|
|
385
390
|
|
|
386
|
-
const
|
|
391
|
+
const
|
|
392
|
+
url = new URL (buffer .uri, this .getExecutionContext () .getWorldURL ()),
|
|
393
|
+
response = await fetch (url),
|
|
394
|
+
blob = await response .blob (),
|
|
395
|
+
arrayBuffer = await blob .arrayBuffer ();
|
|
387
396
|
|
|
388
|
-
return
|
|
389
|
-
.then (response => response .blob ())
|
|
390
|
-
.then (blob => blob .arrayBuffer ())
|
|
391
|
-
.then (arrayBuffer => $.ungzip (arrayBuffer));
|
|
397
|
+
return $.ungzip (arrayBuffer);
|
|
392
398
|
},
|
|
393
399
|
bufferViewsArray: function (bufferViews)
|
|
394
400
|
{
|
|
@@ -459,7 +465,7 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
459
465
|
{
|
|
460
466
|
const
|
|
461
467
|
TypedArray = TypedArrays .get (accessor .componentType),
|
|
462
|
-
bufferView = this .bufferViews [accessor .bufferView],
|
|
468
|
+
bufferView = this .bufferViews [accessor .bufferView || 0],
|
|
463
469
|
byteOffset = accessor .byteOffset || 0,
|
|
464
470
|
byteStride = bufferView .byteStride || 0,
|
|
465
471
|
components = Components .get (accessor .type),
|
|
@@ -690,8 +696,7 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
690
696
|
if (name)
|
|
691
697
|
scene .addNamedNode (scene .getUniqueName (name), textureNode);
|
|
692
698
|
|
|
693
|
-
textureNode ._url
|
|
694
|
-
textureNode ._flipVertically = true;
|
|
699
|
+
textureNode ._url = [image .uri];
|
|
695
700
|
|
|
696
701
|
const sampler = this .samplers [texture .sampler];
|
|
697
702
|
|
|
@@ -921,14 +926,21 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
921
926
|
if (!(KHR_materials_emissive_strength instanceof Object))
|
|
922
927
|
return;
|
|
923
928
|
|
|
924
|
-
|
|
929
|
+
const emissiveStrength = this .numberValue (KHR_materials_emissive_strength .emissiveStrength, 1);
|
|
930
|
+
|
|
931
|
+
// Will not always get the desired result, because colors are clamped values,
|
|
932
|
+
// especially if there is an emissiveTexture.
|
|
933
|
+
|
|
934
|
+
materialNode ._emissiveColor .r *= emissiveStrength;
|
|
935
|
+
materialNode ._emissiveColor .g *= emissiveStrength;
|
|
936
|
+
materialNode ._emissiveColor .b *= emissiveStrength;
|
|
925
937
|
},
|
|
926
938
|
textureTransformObject: function (KHR_texture_transform, mapping)
|
|
927
939
|
{
|
|
928
940
|
if (!(KHR_texture_transform instanceof Object))
|
|
929
941
|
return;
|
|
930
942
|
|
|
931
|
-
if (!this .
|
|
943
|
+
if (!this .extensions .has ("KHR_texture_transform"))
|
|
932
944
|
return;
|
|
933
945
|
|
|
934
946
|
const
|
|
@@ -1009,6 +1021,8 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1009
1021
|
primitive .indices = this .accessors [primitive .indices];
|
|
1010
1022
|
primitive .material = this .materials [primitive .material];
|
|
1011
1023
|
|
|
1024
|
+
this .primitiveExtensionsObject (primitive .extensions, primitive)
|
|
1025
|
+
|
|
1012
1026
|
shapeNodes .push (this .createShape (primitive));
|
|
1013
1027
|
},
|
|
1014
1028
|
attributesObject: function (attributes)
|
|
@@ -1016,32 +1030,176 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
1016
1030
|
if (!(attributes instanceof Object))
|
|
1017
1031
|
return;
|
|
1018
1032
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
attributes .POSITION = this .accessors [attributes .POSITION];
|
|
1033
|
+
for (const key in attributes)
|
|
1034
|
+
attributes [key] = this .accessors [attributes [key]];
|
|
1022
1035
|
|
|
1023
1036
|
attributes .TEXCOORD = [ ];
|
|
1024
1037
|
attributes .COLOR = [ ];
|
|
1025
1038
|
attributes .JOINTS = [ ];
|
|
1026
1039
|
attributes .WEIGHTS = [ ];
|
|
1027
1040
|
|
|
1028
|
-
for (let i = 0;
|
|
1029
|
-
attributes .TEXCOORD .push (
|
|
1041
|
+
for (let i = 0; attributes ["TEXCOORD_" + i]; ++ i)
|
|
1042
|
+
attributes .TEXCOORD .push (attributes ["TEXCOORD_" + i]);
|
|
1030
1043
|
|
|
1031
|
-
for (let i = 0;
|
|
1032
|
-
attributes .COLOR .push (
|
|
1044
|
+
for (let i = 0; attributes ["COLOR_" + i]; ++ i)
|
|
1045
|
+
attributes .COLOR .push (attributes ["COLOR_" + i]);
|
|
1033
1046
|
|
|
1034
|
-
for (let i = 0;
|
|
1035
|
-
attributes .JOINTS .push (
|
|
1047
|
+
for (let i = 0; attributes ["JOINTS_" + i]; ++ i)
|
|
1048
|
+
attributes .JOINTS .push (attributes ["JOINTS_" + i]);
|
|
1036
1049
|
|
|
1037
|
-
for (let i = 0;
|
|
1038
|
-
attributes .WEIGHTS .push (
|
|
1050
|
+
for (let i = 0; attributes ["WEIGHTS_" + i]; ++ i)
|
|
1051
|
+
attributes .WEIGHTS .push (attributes ["WEIGHTS_" + i]);
|
|
1039
1052
|
},
|
|
1040
1053
|
targetsArray: function (targets)
|
|
1041
1054
|
{
|
|
1042
1055
|
if (!(targets instanceof Array))
|
|
1043
1056
|
return;
|
|
1044
1057
|
},
|
|
1058
|
+
primitiveExtensionsObject: function (extensions, primitive)
|
|
1059
|
+
{
|
|
1060
|
+
if (!(extensions instanceof Object))
|
|
1061
|
+
return;
|
|
1062
|
+
|
|
1063
|
+
for (const [key, value] of Object .entries (extensions))
|
|
1064
|
+
{
|
|
1065
|
+
switch (key)
|
|
1066
|
+
{
|
|
1067
|
+
case "KHR_draco_mesh_compression":
|
|
1068
|
+
return this .khrDracoMeshCompressionObject (value, primitive);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
khrDracoMeshCompressionObject: function (draco, primitive)
|
|
1073
|
+
{
|
|
1074
|
+
if (!(draco instanceof Object))
|
|
1075
|
+
return;
|
|
1076
|
+
|
|
1077
|
+
if (!this .draco)
|
|
1078
|
+
return;
|
|
1079
|
+
|
|
1080
|
+
function indicesCallback (array)
|
|
1081
|
+
{
|
|
1082
|
+
Object .defineProperty (primitive .indices, "array", { value: array });
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
function attributeCallback (key, array)
|
|
1086
|
+
{
|
|
1087
|
+
if (attributes [key])
|
|
1088
|
+
Object .defineProperty (attributes [key], "array", { value: array });
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
const
|
|
1092
|
+
attributes = primitive .attributes,
|
|
1093
|
+
dataView = new Uint8Array (this .bufferViews [draco .bufferView] .buffer);
|
|
1094
|
+
|
|
1095
|
+
this .dracoDecodeMesh (this .draco, dataView, draco .attributes, indicesCallback, attributeCallback);
|
|
1096
|
+
},
|
|
1097
|
+
dracoDecodeMesh: function (draco, dataView, attributes, indicesCallback, attributeCallback)
|
|
1098
|
+
{
|
|
1099
|
+
const
|
|
1100
|
+
buffer = new draco .DecoderBuffer (),
|
|
1101
|
+
decoder = new draco .Decoder ();
|
|
1102
|
+
|
|
1103
|
+
buffer .Init (dataView, dataView .byteLength);
|
|
1104
|
+
|
|
1105
|
+
let geometry, status;
|
|
1106
|
+
|
|
1107
|
+
try
|
|
1108
|
+
{
|
|
1109
|
+
const type = decoder .GetEncodedGeometryType (buffer);
|
|
1110
|
+
|
|
1111
|
+
switch (type)
|
|
1112
|
+
{
|
|
1113
|
+
case draco .TRIANGULAR_MESH:
|
|
1114
|
+
geometry = new draco .Mesh ();
|
|
1115
|
+
status = decoder .DecodeBufferToMesh (buffer, geometry);
|
|
1116
|
+
break;
|
|
1117
|
+
case draco .POINT_CLOUD:
|
|
1118
|
+
geometry = new draco .PointCloud ();
|
|
1119
|
+
status = decoder .DecodeBufferToPointCloud (buffer, geometry);
|
|
1120
|
+
break;
|
|
1121
|
+
default:
|
|
1122
|
+
throw new Error (`Invalid geometry type ${type}.`);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
if (!status .ok () || !geometry .ptr)
|
|
1126
|
+
throw new Error (status .error_msg ());
|
|
1127
|
+
|
|
1128
|
+
if (type === draco .TRIANGULAR_MESH)
|
|
1129
|
+
{
|
|
1130
|
+
const
|
|
1131
|
+
numFaces = geometry .num_faces (),
|
|
1132
|
+
numIndices = numFaces * 3,
|
|
1133
|
+
byteLength = numIndices * 4,
|
|
1134
|
+
ptr = draco ._malloc (byteLength);
|
|
1135
|
+
|
|
1136
|
+
try
|
|
1137
|
+
{
|
|
1138
|
+
const indices = new Uint32Array (numIndices);
|
|
1139
|
+
|
|
1140
|
+
decoder .GetTrianglesUInt32Array (geometry, byteLength, ptr);
|
|
1141
|
+
|
|
1142
|
+
indices .set (new Uint32Array (draco .HEAPF32 .buffer, ptr, numIndices));
|
|
1143
|
+
|
|
1144
|
+
indicesCallback (indices);
|
|
1145
|
+
}
|
|
1146
|
+
finally
|
|
1147
|
+
{
|
|
1148
|
+
draco ._free (ptr);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
for (const [key, id] of Object .entries (attributes))
|
|
1153
|
+
{
|
|
1154
|
+
const
|
|
1155
|
+
attribute = decoder .GetAttributeByUniqueId (geometry, id),
|
|
1156
|
+
numComponents = attribute .num_components (),
|
|
1157
|
+
numPoints = geometry .num_points (),
|
|
1158
|
+
numValues = numPoints * numComponents,
|
|
1159
|
+
byteLength = numValues * Float32Array .BYTES_PER_ELEMENT,
|
|
1160
|
+
ptr = draco ._malloc (byteLength);
|
|
1161
|
+
|
|
1162
|
+
try
|
|
1163
|
+
{
|
|
1164
|
+
const array = new Float32Array (numValues);
|
|
1165
|
+
|
|
1166
|
+
decoder .GetAttributeDataArrayForAllPoints (geometry, attribute, draco .DT_FLOAT32, byteLength, ptr);
|
|
1167
|
+
|
|
1168
|
+
array .set (new Float32Array (draco .HEAPF32 .buffer, ptr, numValues));
|
|
1169
|
+
|
|
1170
|
+
attributeCallback (key, array);
|
|
1171
|
+
}
|
|
1172
|
+
finally
|
|
1173
|
+
{
|
|
1174
|
+
draco ._free (ptr);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
finally
|
|
1179
|
+
{
|
|
1180
|
+
if (geometry)
|
|
1181
|
+
draco .destroy (geometry);
|
|
1182
|
+
|
|
1183
|
+
draco .destroy (decoder);
|
|
1184
|
+
draco .destroy (buffer);
|
|
1185
|
+
}
|
|
1186
|
+
},
|
|
1187
|
+
createDraco: async function ()
|
|
1188
|
+
{
|
|
1189
|
+
if (this .constructor .draco)
|
|
1190
|
+
{
|
|
1191
|
+
return this .constructor .draco;
|
|
1192
|
+
}
|
|
1193
|
+
else
|
|
1194
|
+
{
|
|
1195
|
+
const
|
|
1196
|
+
response = await fetch (URLs .getLibUrl ("draco_decoder_gltf.js")),
|
|
1197
|
+
text = await response .text (),
|
|
1198
|
+
draco = await new Function (text) () ();
|
|
1199
|
+
|
|
1200
|
+
return this .constructor .draco = draco;
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1045
1203
|
camerasArray: function (cameras)
|
|
1046
1204
|
{
|
|
1047
1205
|
if (!(cameras instanceof Array))
|
|
@@ -950,7 +950,7 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
950
950
|
shapeNode .geometry = geometryNode;
|
|
951
951
|
geometryNode .solid = this .solid;
|
|
952
952
|
geometryNode .index = this .triangulatePolygon (contours, coordinateNode);
|
|
953
|
-
geometryNode .texCoord = this .createTextureCoordinate (coordinateNode, bbox);
|
|
953
|
+
geometryNode .texCoord = this .createTextureCoordinate (coordinateNode, bbox, shapeNode .appearance);
|
|
954
954
|
geometryNode .coord = coordinateNode;
|
|
955
955
|
}
|
|
956
956
|
}
|
|
@@ -2678,8 +2678,11 @@ SVGParser .prototype = Object .assign (Object .create (X3DParser .prototype),
|
|
|
2678
2678
|
|
|
2679
2679
|
return texturePropertiesNode;
|
|
2680
2680
|
},
|
|
2681
|
-
createTextureCoordinate: function (coordinateNode, bbox)
|
|
2681
|
+
createTextureCoordinate: function (coordinateNode, bbox, appearance)
|
|
2682
2682
|
{
|
|
2683
|
+
if (!appearance || !appearance .texture)
|
|
2684
|
+
return null;
|
|
2685
|
+
|
|
2683
2686
|
const
|
|
2684
2687
|
scene = this .getExecutionContext (),
|
|
2685
2688
|
texCoordNode = scene .createNode ("TextureCoordinate"),
|
|
@@ -61,8 +61,6 @@ import StopWatch from "../../standard/Time/StopWatch.js";
|
|
|
61
61
|
|
|
62
62
|
const DEPTH_BUFFER_SIZE = 16;
|
|
63
63
|
|
|
64
|
-
function compareDistance (lhs, rhs) { return lhs .distance < rhs .distance; }
|
|
65
|
-
|
|
66
64
|
function X3DRenderObject (executionContext)
|
|
67
65
|
{
|
|
68
66
|
this .viewVolumes = [ ];
|
|
@@ -98,7 +96,7 @@ function X3DRenderObject (executionContext)
|
|
|
98
96
|
this .shadowShapes = [ ];
|
|
99
97
|
this .opaqueShapes = [ ];
|
|
100
98
|
this .transparentShapes = [ ];
|
|
101
|
-
this .transparencySorter = new MergeSort (this .transparentShapes,
|
|
99
|
+
this .transparencySorter = new MergeSort (this .transparentShapes, (a, b) => a .distance < b .distance);
|
|
102
100
|
this .speed = 0;
|
|
103
101
|
|
|
104
102
|
try
|
|
@@ -636,6 +634,8 @@ X3DRenderObject .prototype =
|
|
|
636
634
|
this .transparentShapes .push (this .createRenderContext (true));
|
|
637
635
|
|
|
638
636
|
var renderContext = this .transparentShapes [num];
|
|
637
|
+
|
|
638
|
+
renderContext .distance = bboxCenter .z;
|
|
639
639
|
}
|
|
640
640
|
else
|
|
641
641
|
{
|
|
@@ -653,7 +653,6 @@ X3DRenderObject .prototype =
|
|
|
653
653
|
renderContext .fogNode = this .localFogs .at (-1);
|
|
654
654
|
renderContext .shapeNode = shapeNode;
|
|
655
655
|
renderContext .appearanceNode = shapeNode .getAppearance ();
|
|
656
|
-
renderContext .distance = bboxCenter .z;
|
|
657
656
|
|
|
658
657
|
// Clip planes and local lights
|
|
659
658
|
|