x_ite 8.6.9 → 8.6.11

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.
Files changed (92) hide show
  1. package/Makefile +12 -12
  2. package/build/bin/version.pl +6 -0
  3. package/dist/assets/components/Annotation.js +13 -13
  4. package/dist/assets/components/Annotation.min.js +1 -1
  5. package/dist/assets/components/CADGeometry.js +13 -13
  6. package/dist/assets/components/CADGeometry.min.js +1 -1
  7. package/dist/assets/components/CubeMapTexturing.js +25 -25
  8. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  9. package/dist/assets/components/DIS.js +13 -13
  10. package/dist/assets/components/DIS.min.js +1 -1
  11. package/dist/assets/components/EventUtilities.js +9 -9
  12. package/dist/assets/components/EventUtilities.min.js +1 -1
  13. package/dist/assets/components/Geometry2D.js +19 -19
  14. package/dist/assets/components/Geometry2D.min.js +1 -1
  15. package/dist/assets/components/Geospatial.js +40 -58
  16. package/dist/assets/components/Geospatial.min.js +1 -1
  17. package/dist/assets/components/HAnim.js +18 -18
  18. package/dist/assets/components/HAnim.min.js +1 -1
  19. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  20. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  21. package/dist/assets/components/Layout.js +27 -27
  22. package/dist/assets/components/Layout.min.js +1 -1
  23. package/dist/assets/components/NURBS.js +28 -34
  24. package/dist/assets/components/NURBS.min.js +1 -1
  25. package/dist/assets/components/ParticleSystems.js +27 -26
  26. package/dist/assets/components/ParticleSystems.min.js +1 -1
  27. package/dist/assets/components/Picking.js +19 -19
  28. package/dist/assets/components/Picking.min.js +1 -1
  29. package/dist/assets/components/RigidBodyPhysics.js +19 -19
  30. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  31. package/dist/assets/components/Scripting.js +28 -28
  32. package/dist/assets/components/Scripting.min.js +1 -1
  33. package/dist/assets/components/Text.js +24 -24
  34. package/dist/assets/components/Text.min.js +1 -1
  35. package/dist/assets/components/TextureProjector.js +14 -14
  36. package/dist/assets/components/TextureProjector.min.js +1 -1
  37. package/dist/assets/components/Texturing3D.js +30 -30
  38. package/dist/assets/components/Texturing3D.min.js +1 -1
  39. package/dist/assets/components/VolumeRendering.js +19 -19
  40. package/dist/assets/components/VolumeRendering.min.js +1 -1
  41. package/dist/assets/components/X_ITE.js +9 -9
  42. package/dist/assets/components/X_ITE.min.js +1 -1
  43. package/dist/x_ite.css +1 -1
  44. package/dist/x_ite.js +431 -487
  45. package/dist/x_ite.min.js +1 -1
  46. package/dist/x_ite.zip +0 -0
  47. package/docs/_config.yml +1 -1
  48. package/docs/_posts/getting-started.md +1 -1
  49. package/docs/laboratory/gltf-sample-viewer.html +4 -2
  50. package/package.json +1 -1
  51. package/src/assets/shaders/webgl1/include/Fragment.glsl.js +10 -2
  52. package/src/assets/shaders/webgl2/include/Fragment.glsl.js +10 -2
  53. package/src/standard/Math/Algorithm.js +8 -1
  54. package/src/standard/Utility/BitSet.js +33 -0
  55. package/src/tests.js +1 -1
  56. package/src/x_ite/Browser/Core/BrowserTimings.js +7 -1
  57. package/src/x_ite/Browser/Core/Context.js +5 -3
  58. package/src/x_ite/Browser/Rendering/GeometryContext.js +2 -0
  59. package/src/x_ite/Browser/Shape/AlphaMode.js +1 -1
  60. package/src/x_ite/Browser/VERSION.js +1 -1
  61. package/src/x_ite/Browser/X3DBrowser.js +2 -2
  62. package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +115 -139
  63. package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +1 -1
  64. package/src/x_ite/Components/Geometry3D/ElevationGrid.js +10 -31
  65. package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +3 -6
  66. package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +7 -25
  67. package/src/x_ite/Components/Grouping/X3DGroupingNode.js +1 -1
  68. package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +4 -10
  69. package/src/x_ite/Components/Navigation/X3DViewpointNode.js +0 -10
  70. package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +4 -3
  71. package/src/x_ite/Components/Rendering/IndexedLineSet.js +11 -33
  72. package/src/x_ite/Components/Rendering/LineSet.js +12 -37
  73. package/src/x_ite/Components/Rendering/PointSet.js +11 -24
  74. package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +14 -39
  75. package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +1 -1
  76. package/src/x_ite/Components/Shape/Appearance.js +9 -5
  77. package/src/x_ite/Components/Shape/Material.js +1 -2
  78. package/src/x_ite/Components/Shape/PhysicalMaterial.js +1 -2
  79. package/src/x_ite/Components/Shape/TwoSidedMaterial.js +1 -1
  80. package/src/x_ite/Components/Shape/UnlitMaterial.js +1 -1
  81. package/src/x_ite/Components/Shape/X3DMaterialNode.js +24 -9
  82. package/src/x_ite/Components/Shape/X3DShapeNode.js +1 -2
  83. package/src/x_ite/Components/Texturing/ImageTexture.js +8 -3
  84. package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +2 -0
  85. package/src/x_ite/Fields/SFImage.js +9 -9
  86. package/src/x_ite/Fields/SFInt32.js +2 -2
  87. package/src/x_ite/Rendering/X3DRenderObject.js +0 -2
  88. package/src/x_ite.html +1 -1
  89. package/x_ite.min.html +2 -2
  90. /package/docs/assets/X3D/{Michroma-Regular.ttf → teaser/Michroma-Regular.ttf} +0 -0
  91. /package/docs/assets/X3D/{peakpx.jpg → teaser/peakpx.jpg} +0 -0
  92. /package/docs/assets/X3D/{teaser.x3d → teaser/teaser.x3d} +0 -0
@@ -279,11 +279,6 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
279
279
  if (this ._viewAll .getValue ())
280
280
  this .viewAll (layerNode .getBBox (new Box3 ()));
281
281
 
282
- if (this .getBrowser () .getBrowserOption ("StraightenHorizon"))
283
- {
284
- this ._orientationOffset = this .straightenHorizon (this .getUserOrientation ()) .multLeft (this .getOrientation () .copy () .inverse ());
285
- }
286
-
287
282
  // Handle NavigationInfo.
288
283
 
289
284
  const
@@ -382,11 +377,6 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
382
377
  this ._centerOfRotationOffset = Vector3 .Zero;
383
378
  this ._fieldOfViewScale = 1;
384
379
 
385
- if (this .getBrowser () .getBrowserOption ("StraightenHorizon"))
386
- {
387
- this ._orientationOffset = this .straightenHorizon (this .getUserOrientation ()) .multLeft (this .getOrientation () .copy () .inverse ());
388
- }
389
-
390
380
  this .set_nearDistance__ ();
391
381
  this .set_farDistance__ ();
392
382
  },
@@ -275,9 +275,10 @@ ParticleSystem .prototype = Object .assign (Object .create (X3DShapeNode .protot
275
275
  }
276
276
  default:
277
277
  {
278
- this .setTransparent (this .getAppearance () .isTransparent () ||
279
- (this .colorRampNode && this .colorRampNode .isTransparent ()) ||
280
- (this .geometryType === GeometryTypes .GEOMETRY && this .geometryNode && this .geometryNode .isTransparent ()));
278
+ this .setTransparent (!!(this .getAppearance () .isTransparent () ||
279
+ this .colorRampNode?.isTransparent () ||
280
+ (this .geometryType === GeometryTypes .GEOMETRY &&
281
+ this .geometryNode?.isTransparent ())));
281
282
  break;
282
283
  }
283
284
  }
@@ -140,57 +140,37 @@ IndexedLineSet .prototype = Object .assign (Object .create (X3DLineGeometryNode
140
140
  },
141
141
  set_fogCoord__: function ()
142
142
  {
143
- if (this .fogCoordNode)
144
- this .fogCoordNode .removeInterest ("requestRebuild", this);
143
+ this .fogCoordNode?.removeInterest ("requestRebuild", this);
145
144
 
146
145
  this .fogCoordNode = X3DCast (X3DConstants .FogCoordinate, this ._fogCoord);
147
146
 
148
- if (this .fogCoordNode)
149
- this .fogCoordNode .addInterest ("requestRebuild", this);
147
+ this .fogCoordNode?.addInterest ("requestRebuild", this);
150
148
  },
151
149
  set_color__: function ()
152
150
  {
153
- if (this .colorNode)
154
- {
155
- this .colorNode .removeInterest ("requestRebuild", this);
156
- this .colorNode ._transparent .removeInterest ("set_transparent__", this);
157
- }
151
+ this .colorNode?.removeInterest ("requestRebuild", this);
158
152
 
159
153
  this .colorNode = X3DCast (X3DConstants .X3DColorNode, this ._color);
160
154
 
161
- if (this .colorNode)
162
- {
163
- this .colorNode .addInterest ("requestRebuild", this);
164
- this .colorNode ._transparent .addInterest ("set_transparent__", this);
155
+ this .colorNode?.addInterest ("requestRebuild", this);
165
156
 
166
- this .set_transparent__ ();
167
- }
168
- else
169
- this .setTransparent (false);
170
- },
171
- set_transparent__: function ()
172
- {
173
- this .setTransparent (this .colorNode .isTransparent ());
157
+ this .setTransparent (this .colorNode?.isTransparent () ?? false);
174
158
  },
175
159
  set_normal__: function ()
176
160
  {
177
- if (this .normalNode)
178
- this .normalNode .removeInterest ("requestRebuild", this);
161
+ this .normalNode?.removeInterest ("requestRebuild", this);
179
162
 
180
163
  this .normalNode = X3DCast (X3DConstants .X3DNormalNode, this ._normal);
181
164
 
182
- if (this .normalNode)
183
- this .normalNode .addInterest ("requestRebuild", this);
165
+ this .normalNode?.addInterest ("requestRebuild", this);
184
166
  },
185
167
  set_coord__: function ()
186
168
  {
187
- if (this .coordNode)
188
- this .coordNode .removeInterest ("requestRebuild", this);
169
+ this .coordNode?.removeInterest ("requestRebuild", this);
189
170
 
190
171
  this .coordNode = X3DCast (X3DConstants .X3DCoordinateNode, this ._coord);
191
172
 
192
- if (this .coordNode)
193
- this .coordNode .addInterest ("requestRebuild", this);
173
+ this .coordNode?.addInterest ("requestRebuild", this);
194
174
  },
195
175
  getColorPerVertexIndex: function (index)
196
176
  {
@@ -284,8 +264,7 @@ IndexedLineSet .prototype = Object .assign (Object .create (X3DLineGeometryNode
284
264
  for (let a = 0; a < numAttribNodes; ++ a)
285
265
  attribNodes [a] .addValue (index, attribArrays [a]);
286
266
 
287
- if (fogCoordNode)
288
- fogCoordNode .addDepth (index, fogDepthArray);
267
+ fogCoordNode?.addDepth (index, fogDepthArray);
289
268
 
290
269
  if (colorNode)
291
270
  {
@@ -295,8 +274,7 @@ IndexedLineSet .prototype = Object .assign (Object .create (X3DLineGeometryNode
295
274
  colorNode .addColor (this .getColorIndex (face), colorArray);
296
275
  }
297
276
 
298
- if (normalNode)
299
- normalNode .addVector (index, normalArray);
277
+ normalNode?.addVector (index, normalArray);
300
278
 
301
279
  coordNode .addPoint (index, vertexArray);
302
280
  }
@@ -134,57 +134,37 @@ LineSet .prototype = Object .assign (Object .create (X3DLineGeometryNode .protot
134
134
  },
135
135
  set_fogCoord__: function ()
136
136
  {
137
- if (this .fogCoordNode)
138
- this .fogCoordNode .removeInterest ("requestRebuild", this);
137
+ this .fogCoordNode?.removeInterest ("requestRebuild", this);
139
138
 
140
139
  this .fogCoordNode = X3DCast (X3DConstants .FogCoordinate, this ._fogCoord);
141
140
 
142
- if (this .fogCoordNode)
143
- this .fogCoordNode .addInterest ("requestRebuild", this);
141
+ this .fogCoordNode?.addInterest ("requestRebuild", this);
144
142
  },
145
143
  set_color__: function ()
146
144
  {
147
- if (this .colorNode)
148
- {
149
- this .colorNode .removeInterest ("requestRebuild", this);
150
- this .colorNode ._transparent .removeInterest ("set_transparent__", this);
151
- }
145
+ this .colorNode?.removeInterest ("requestRebuild", this);
152
146
 
153
147
  this .colorNode = X3DCast (X3DConstants .X3DColorNode, this ._color);
154
148
 
155
- if (this .colorNode)
156
- {
157
- this .colorNode .addInterest ("requestRebuild", this);
158
- this .colorNode ._transparent .addInterest ("set_transparent__", this);
149
+ this .colorNode?.addInterest ("requestRebuild", this);
159
150
 
160
- this .set_transparent__ ();
161
- }
162
- else
163
- this .setTransparent (false);
164
- },
165
- set_transparent__: function ()
166
- {
167
- this .setTransparent (this .colorNode .isTransparent ());
151
+ this .setTransparent (this .colorNode?.isTransparent () ?? false);
168
152
  },
169
153
  set_normal__: function ()
170
154
  {
171
- if (this .normalNode)
172
- this .normalNode .removeInterest ("requestRebuild", this);
155
+ this .normalNode?.removeInterest ("requestRebuild", this);
173
156
 
174
157
  this .normalNode = X3DCast (X3DConstants .X3DNormalNode, this ._normal);
175
158
 
176
- if (this .normalNode)
177
- this .normalNode .addInterest ("requestRebuild", this);
159
+ this .normalNode?.addInterest ("requestRebuild", this);
178
160
  },
179
161
  set_coord__: function ()
180
162
  {
181
- if (this .coordNode)
182
- this .coordNode .removeInterest ("requestRebuild", this);
163
+ this .coordNode?.removeInterest ("requestRebuild", this);
183
164
 
184
165
  this .coordNode = X3DCast (X3DConstants .X3DCoordinateNode, this ._coord);
185
166
 
186
- if (this .coordNode)
187
- this .coordNode .addInterest ("requestRebuild", this);
167
+ this .coordNode?.addInterest ("requestRebuild", this);
188
168
  },
189
169
  build: function ()
190
170
  {
@@ -224,14 +204,9 @@ LineSet .prototype = Object .assign (Object .create (X3DLineGeometryNode .protot
224
204
  for (let a = 0; a < numAttribNodes; ++ a)
225
205
  attribNodes [a] .addValue (index, attribArrays [a]);
226
206
 
227
- if (fogCoordNode)
228
- fogCoordNode .addDepth (index, fogDepthArray);
229
-
230
- if (colorNode)
231
- colorNode .addColor (index, colorArray);
232
-
233
- if (normalNode)
234
- normalNode .addVector (index, normalArray);
207
+ fogCoordNode?.addDepth (index, fogDepthArray);
208
+ colorNode ?.addColor (index, colorArray);
209
+ normalNode ?.addVector (index, normalArray);
235
210
 
236
211
  coordNode .addPoint (index, vertexArray);
237
212
  }
@@ -137,43 +137,35 @@ PointSet .prototype = Object .assign (Object .create (X3DPointGeometryNode .prot
137
137
  },
138
138
  set_fogCoord__: function ()
139
139
  {
140
- if (this .fogCoordNode)
141
- this .fogCoordNode .removeInterest ("requestRebuild", this);
140
+ this .fogCoordNode?.removeInterest ("requestRebuild", this);
142
141
 
143
142
  this .fogCoordNode = X3DCast (X3DConstants .FogCoordinate, this ._fogCoord);
144
143
 
145
- if (this .fogCoordNode)
146
- this .fogCoordNode .addInterest ("requestRebuild", this);
144
+ this .fogCoordNode?.addInterest ("requestRebuild", this);
147
145
  },
148
146
  set_color__: function ()
149
147
  {
150
- if (this .colorNode)
151
- this .colorNode .removeInterest ("requestRebuild", this);
148
+ this .colorNode?.removeInterest ("requestRebuild", this);
152
149
 
153
150
  this .colorNode = X3DCast (X3DConstants .X3DColorNode, this ._color);
154
151
 
155
- if (this .colorNode)
156
- this .colorNode .addInterest ("requestRebuild", this);
152
+ this .colorNode?.addInterest ("requestRebuild", this);
157
153
  },
158
154
  set_normal__: function ()
159
155
  {
160
- if (this .normalNode)
161
- this .normalNode .removeInterest ("requestRebuild", this);
156
+ this .normalNode?.removeInterest ("requestRebuild", this);
162
157
 
163
158
  this .normalNode = X3DCast (X3DConstants .X3DNormalNode, this ._normal);
164
159
 
165
- if (this .normalNode)
166
- this .normalNode .addInterest ("requestRebuild", this);
160
+ this .normalNode?.addInterest ("requestRebuild", this);
167
161
  },
168
162
  set_coord__: function ()
169
163
  {
170
- if (this .coordNode)
171
- this .coordNode .removeInterest ("requestRebuild", this);
164
+ this .coordNode?.removeInterest ("requestRebuild", this);
172
165
 
173
166
  this .coordNode = X3DCast (X3DConstants .X3DCoordinateNode, this ._coord);
174
167
 
175
- if (this .coordNode)
176
- this .coordNode .addInterest ("requestRebuild", this);
168
+ this .coordNode?.addInterest ("requestRebuild", this);
177
169
  },
178
170
  build: function ()
179
171
  {
@@ -200,14 +192,9 @@ PointSet .prototype = Object .assign (Object .create (X3DPointGeometryNode .prot
200
192
  attribNodes [a] .addValue (i, attribArrays [a]);
201
193
  }
202
194
 
203
- if (fogCoordNode)
204
- fogCoordNode .addDepths (fogDepthArray, numPoints);
205
-
206
- if (colorNode)
207
- colorNode .addColors (colorArray, numPoints);
208
-
209
- if (normalNode)
210
- normalNode .addNormals (normalArray, numPoints);
195
+ fogCoordNode?.addDepths (fogDepthArray, numPoints);
196
+ colorNode ?.addColors (colorArray, numPoints);
197
+ normalNode ?.addNormals (normalArray, numPoints);
211
198
 
212
199
  coordNode .addPoints (vertexArray, numPoints);
213
200
  },
@@ -134,69 +134,47 @@ X3DComposedGeometryNode .prototype = Object .assign (Object .create (X3DGeometry
134
134
  },
135
135
  set_fogCoord__: function ()
136
136
  {
137
- if (this .fogCoordNode)
138
- this .fogCoordNode .removeInterest ("requestRebuild", this);
137
+ this .fogCoordNode?.removeInterest ("requestRebuild", this);
139
138
 
140
139
  this .fogCoordNode = X3DCast (X3DConstants .FogCoordinate, this ._fogCoord);
141
140
 
142
- if (this .fogCoordNode)
143
- this .fogCoordNode .addInterest ("requestRebuild", this);
141
+ this .fogCoordNode?.addInterest ("requestRebuild", this);
144
142
  },
145
143
  set_color__: function ()
146
144
  {
147
- if (this .colorNode)
148
- {
149
- this .colorNode .removeInterest ("requestRebuild", this);
150
- this .colorNode ._transparent .removeInterest ("set_transparent__", this);
151
- }
145
+ this .colorNode?.removeInterest ("requestRebuild", this);
152
146
 
153
147
  this .colorNode = X3DCast (X3DConstants .X3DColorNode, this ._color);
154
148
 
155
- if (this .colorNode)
156
- {
157
- this .colorNode .addInterest ("requestRebuild", this);
158
- this .colorNode ._transparent .addInterest ("set_transparent__", this);
149
+ this .colorNode?.addInterest ("requestRebuild", this);
159
150
 
160
- this .set_transparent__ ();
161
- }
162
- else
163
- this .setTransparent (false);
164
- },
165
- set_transparent__: function ()
166
- {
167
- this .setTransparent (this .colorNode .isTransparent ());
151
+ this .setTransparent (this .colorNode?.isTransparent () ?? false);
168
152
  },
169
153
  set_texCoord__: function ()
170
154
  {
171
- if (this .texCoordNode)
172
- this .texCoordNode .removeInterest ("requestRebuild", this);
155
+ this .texCoordNode?.removeInterest ("requestRebuild", this);
173
156
 
174
157
  this .texCoordNode = X3DCast (X3DConstants .X3DTextureCoordinateNode, this ._texCoord);
175
158
 
176
- if (this .texCoordNode)
177
- this .texCoordNode .addInterest ("requestRebuild", this);
159
+ this .texCoordNode?.addInterest ("requestRebuild", this);
178
160
 
179
161
  this .setTextureCoordinate (this .texCoordNode);
180
162
  },
181
163
  set_normal__: function ()
182
164
  {
183
- if (this .normalNode)
184
- this .normalNode .removeInterest ("requestRebuild", this);
165
+ this .normalNode?.removeInterest ("requestRebuild", this);
185
166
 
186
167
  this .normalNode = X3DCast (X3DConstants .X3DNormalNode, this ._normal);
187
168
 
188
- if (this .normalNode)
189
- this .normalNode .addInterest ("requestRebuild", this);
169
+ this .normalNode?.addInterest ("requestRebuild", this);
190
170
  },
191
171
  set_coord__: function ()
192
172
  {
193
- if (this .coordNode)
194
- this .coordNode .removeInterest ("requestRebuild", this);
173
+ this .coordNode?.removeInterest ("requestRebuild", this);
195
174
 
196
175
  this .coordNode = X3DCast (X3DConstants .X3DCoordinateNode, this ._coord);
197
176
 
198
- if (this .coordNode)
199
- this .coordNode .addInterest ("requestRebuild", this);
177
+ this .coordNode?.addInterest ("requestRebuild", this);
200
178
  },
201
179
  getPolygonIndex: function (index)
202
180
  {
@@ -233,8 +211,7 @@ X3DComposedGeometryNode .prototype = Object .assign (Object .create (X3DGeometry
233
211
  normalArray = this .getNormals (),
234
212
  vertexArray = this .getVertices ();
235
213
 
236
- if (texCoordNode)
237
- texCoordNode .init (multiTexCoordArray);
214
+ texCoordNode?.init (multiTexCoordArray);
238
215
 
239
216
  // Fill GeometryNode
240
217
 
@@ -247,8 +224,7 @@ X3DComposedGeometryNode .prototype = Object .assign (Object .create (X3DGeometry
247
224
  for (let a = 0; a < numAttribNodes; ++ a)
248
225
  attribNodes [a] .addValue (index, attribArrays [a]);
249
226
 
250
- if (fogCoordNode)
251
- fogCoordNode .addDepth (index, fogDepthArray);
227
+ fogCoordNode?.addDepth (index, fogDepthArray);
252
228
 
253
229
  if (colorNode)
254
230
  {
@@ -258,8 +234,7 @@ X3DComposedGeometryNode .prototype = Object .assign (Object .create (X3DGeometry
258
234
  colorNode .addColor (face, colorArray);
259
235
  }
260
236
 
261
- if (texCoordNode)
262
- texCoordNode .addPoint (index, multiTexCoordArray);
237
+ texCoordNode?.addPoint (index, multiTexCoordArray);
263
238
 
264
239
  if (normalNode)
265
240
  {
@@ -331,7 +331,7 @@ CollidableShape .prototype = Object .assign (Object .create (X3DNBodyCollidableN
331
331
  min = Math .min (min, value);
332
332
  max = Math .max (max, value);
333
333
 
334
- Ammo .HEAPF32 [heightField + i4 >> 2] = elevationGrid ._height [i];
334
+ Ammo .HEAPF32 [heightField + i4 >>> 2] = elevationGrid ._height [i];
335
335
 
336
336
  i4 += 4;
337
337
  }
@@ -138,6 +138,10 @@ Appearance .prototype = Object .assign (Object .create (X3DAppearanceNode .proto
138
138
  {
139
139
  return this .alphaMode;
140
140
  },
141
+ getNormalizedAlphaMode: function (transparent)
142
+ {
143
+ return this .alphaMode || (transparent ? AlphaMode .BLEND : AlphaMode .OPAQUE);
144
+ },
141
145
  getAlphaCutoff: function ()
142
146
  {
143
147
  return this .alphaCutoff;
@@ -411,11 +415,11 @@ Appearance .prototype = Object .assign (Object .create (X3DAppearanceNode .proto
411
415
  switch (this .alphaMode)
412
416
  {
413
417
  case AlphaMode .AUTO:
414
- this .setTransparent (Boolean (this .stylePropertiesNode [3] && this .stylePropertiesNode [3] .isTransparent () ||
415
- (this .materialNode && this .materialNode .isTransparent ()) ||
416
- (this .backMaterialNode && this .backMaterialNode .isTransparent ()) ||
417
- (this .textureNode && this .textureNode .isTransparent ()) ||
418
- this .blendModeNode));
418
+ this .setTransparent (!!(this .stylePropertiesNode [3]?.isTransparent () ||
419
+ this .materialNode?.isTransparent () ||
420
+ this .backMaterialNode?.isTransparent () ||
421
+ this .textureNode?.isTransparent () ||
422
+ this .blendModeNode));
419
423
  break;
420
424
  case AlphaMode .OPAQUE:
421
425
  this .setTransparent (false);
@@ -211,8 +211,7 @@ Material .prototype = Object .assign (Object .create (X3DOneSidedMaterialNode .p
211
211
  },
212
212
  set_transparent__: function ()
213
213
  {
214
- this .setTransparent (!!(this .getTransparency () ||
215
- (this .diffuseTextureNode && this .diffuseTextureNode .isTransparent ())));
214
+ this .setTransparent (!!(this .getTransparency () || this .diffuseTextureNode?.isTransparent ()));
216
215
  },
217
216
  getBaseTexture: function ()
218
217
  {
@@ -170,8 +170,7 @@ PhysicalMaterial .prototype = Object .assign (Object .create (X3DOneSidedMateria
170
170
  },
171
171
  set_transparent__: function ()
172
172
  {
173
- this .setTransparent (!!(this .getTransparency () ||
174
- (this .baseTextureNode && this .baseTextureNode .isTransparent ())));
173
+ this .setTransparent (!!(this .getTransparency () || this .baseTextureNode?.isTransparent ()));
175
174
  },
176
175
  getBaseTexture: function ()
177
176
  {
@@ -246,7 +246,7 @@ TwoSidedMaterial .prototype = Object .assign (Object .create (X3DMaterialNode .p
246
246
  },
247
247
  set_transparent__: function ()
248
248
  {
249
- this .setTransparent (Boolean (this ._transparency .getValue () || (this ._separateBackColor .getValue () && this ._backTransparency .getValue ())));
249
+ this .setTransparent (!!(this ._transparency .getValue () || (this ._separateBackColor .getValue () && this ._backTransparency .getValue ())));
250
250
  },
251
251
  getBaseTexture: Material .prototype .getBaseTexture,
252
252
  getMaterialKey: Material .prototype .getMaterialKey,
@@ -103,7 +103,7 @@ UnlitMaterial .prototype = Object .assign (Object .create (X3DOneSidedMaterialNo
103
103
  set_transparent__: function ()
104
104
  {
105
105
  this .setTransparent (!!(this .getTransparency () ||
106
- (this .getEmissiveTexture () && this .getEmissiveTexture () .isTransparent ())));
106
+ this .getEmissiveTexture ()?.isTransparent ()));
107
107
  },
108
108
  getMaterialKey: function ()
109
109
  {
@@ -47,6 +47,7 @@
47
47
 
48
48
  import Fields from "../../Fields.js";
49
49
  import X3DAppearanceChildNode from "./X3DAppearanceChildNode.js";
50
+ import AlphaMode from "../../Browser/Shape/AlphaMode.js";
50
51
  import X3DConstants from "../../Base/X3DConstants.js";
51
52
  import BitSet from "../../../standard/Utility/BitSet.js";
52
53
 
@@ -113,13 +114,17 @@ X3DMaterialNode .prototype = Object .assign (Object .create (X3DAppearanceChildN
113
114
 
114
115
  if (renderContext)
115
116
  {
116
- const { renderObject, shadows, fogNode, shapeNode, appearanceNode, textureNode, objectsCount } = renderContext;
117
+ const { renderObject, transparent, shadows, fogNode, shapeNode, appearanceNode, textureNode, objectsCount } = renderContext;
117
118
 
118
119
  key += this .logarithmicDepthBuffer || renderObject .getViewpoint () .getLogarithmicDepthBuffer () ? 1 : 0;
120
+ key += appearanceNode .getNormalizedAlphaMode (transparent);
121
+ key += this .getMaterialKey (shadows);
119
122
  key += shadows ? 1 : 0;
120
- key += fogNode ? fogNode .getFogType () : 0;
123
+ key += fogNode?.getFogType () ?? 0;
121
124
  key += shapeNode .getShapeKey ();
122
125
  key += appearanceNode .getStyleProperties (geometryContext .geometryType) ? 1 : 0;
126
+ key += appearanceNode .getTextureTransformMapping () .size || 1;
127
+ key += geometryContext .textureCoordinateMapping .size || 1;
123
128
  key += ".";
124
129
  key += objectsCount [0]; // Clip planes
125
130
  key += ".";
@@ -128,17 +133,16 @@ X3DMaterialNode .prototype = Object .assign (Object .create (X3DAppearanceChildN
128
133
  key += objectsCount [2]; // Texture projectors
129
134
  key += ".";
130
135
  key += textureNode ? 1 : appearanceNode .getTextureBits () .toString (4);
131
- key += ".";
132
- key += appearanceNode .getTextureTransformMapping () .size || 1;
133
- key += geometryContext .textureCoordinateMapping .size || 1;
134
- key += this .getMaterialKey (shadows);
135
136
  }
136
137
  else
137
138
  {
138
139
  const { textureNode, objectsCount } = geometryContext;
139
140
 
140
141
  key += this .logarithmicDepthBuffer ? 1 : 0;
141
- key += "0000.";
142
+ key += geometryContext .alphaMode;
143
+ key += this .getMaterialKey (false);
144
+ key += "000011";
145
+ key += ".";
142
146
  key += objectsCount [0]; // Clip planes
143
147
  key += ".";
144
148
  key += objectsCount [1]; // Lights
@@ -146,8 +150,6 @@ X3DMaterialNode .prototype = Object .assign (Object .create (X3DAppearanceChildN
146
150
  key += objectsCount [2]; // Texture projectors
147
151
  key += ".";
148
152
  key += textureNode ? 1 : 0;
149
- key += ".11";
150
- key += this .getMaterialKey (false);
151
153
  }
152
154
 
153
155
  return this .shaderNodes .get (key) || this .createShader (key, geometryContext, renderContext);
@@ -176,6 +178,19 @@ X3DMaterialNode .prototype = Object .assign (Object .create (X3DAppearanceChildN
176
178
  if (this .logarithmicDepthBuffer || renderObject .getViewpoint () .getLogarithmicDepthBuffer ())
177
179
  options .push ("X3D_LOGARITHMIC_DEPTH_BUFFER");
178
180
 
181
+ switch (appearanceNode .getNormalizedAlphaMode (renderContext .transparent))
182
+ {
183
+ case AlphaMode .OPAQUE:
184
+ options .push ("X3D_ALPHA_MODE_OPAQUE");
185
+ break;
186
+ case AlphaMode .MASK:
187
+ options .push ("X3D_ALPHA_MODE_MASK");
188
+ break;
189
+ case AlphaMode .BLEND:
190
+ options .push ("X3D_ALPHA_MODE_BLEND");
191
+ break;
192
+ }
193
+
179
194
  if (renderContext .shadows)
180
195
  options .push ("X3D_SHADOWS", "X3D_PCF_FILTERING");
181
196
 
@@ -177,8 +177,7 @@ X3DShapeNode .prototype = Object .assign (Object .create (X3DChildNode .prototyp
177
177
  {
178
178
  if (this .apparanceNode .getAlphaMode () === AlphaMode .AUTO)
179
179
  {
180
- this .transparent = this .apparanceNode .isTransparent () ||
181
- (this .geometryNode && this .geometryNode .isTransparent ());
180
+ this .transparent = !!(this .apparanceNode .isTransparent () || this .geometryNode?.isTransparent ());
182
181
  }
183
182
  else
184
183
  {
@@ -192,7 +192,7 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
192
192
  // Determine image alpha.
193
193
 
194
194
  const
195
- data = cx .getImageData (0, 0, width, height, { premultipliedAlpha: false }) .data,
195
+ data = cx .getImageData (0, 0, width, height) .data,
196
196
  transparent = this .isImageTransparent (data);
197
197
 
198
198
  // Upload image to GPU.
@@ -208,9 +208,14 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
208
208
  width = image .width,
209
209
  height = image .height;
210
210
 
211
+ // Flip Y if needed.
212
+
213
+ if (!this ._flipVertically .getValue ())
214
+ this .flipImage (data, width, height, 4);
215
+
211
216
  // Upload image to GPU.
212
217
 
213
- this .setTexture (width, height, transparent, data, !this ._flipVertically .getValue ());
218
+ this .setTexture (width, height, transparent, data, false);
214
219
  this .setLoadState (X3DConstants .COMPLETE_STATE);
215
220
  }
216
221
  }
@@ -251,7 +256,7 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
251
256
  flipImage (data, width, height, components)
252
257
  {
253
258
  const
254
- height1_2 = height >> 1,
259
+ height1_2 = height >>> 1,
255
260
  bytesPerRow = width * components,
256
261
  tmp = new Uint8Array (bytesPerRow);
257
262
 
@@ -111,8 +111,10 @@ X3DTexture2DNode .prototype = Object .assign (Object .create (X3DSingleTextureNo
111
111
 
112
112
  gl .bindTexture (gl .TEXTURE_2D, this .getTexture ());
113
113
  gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, flipY);
114
+ //gl .pixelStorei (gl .UNPACK_COLORSPACE_CONVERSION_WEBGL, colorspace ? gl .BROWSER_DEFAULT_WEBGL : gl .NONE);
114
115
  gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, data);
115
116
  gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, false);
117
+ //gl .pixelStorei (gl .UNPACK_COLORSPACE_CONVERSION_WEBGL, gl .BROWSER_DEFAULT_WEBGL);
116
118
 
117
119
  this .setTransparent (transparent);
118
120
  this .updateTextureParameters ();
@@ -57,9 +57,9 @@ function Image (width, height, comp, array)
57
57
  {
58
58
  const MFInt32 = ArrayFields .MFInt32;
59
59
 
60
- this .width = ~~width;
61
- this .height = ~~height;
62
- this .comp = ~~comp;
60
+ this .width = width|0;
61
+ this .height = height|0;
62
+ this .comp = comp|0;
63
63
  this .array = new MFInt32 ();
64
64
  this .array .setValue (array);
65
65
  this .array .length = this .width * this .height;
@@ -88,14 +88,14 @@ Image .prototype =
88
88
  },
89
89
  set: function (width, height, comp, array)
90
90
  {
91
- this .width = ~~width;
92
- this .height = ~~height;
93
- this .comp = ~~comp;
91
+ this .width = width|0;
92
+ this .height = height|0;
93
+ this .comp = comp|0;
94
94
  this .array .assign (array);
95
95
  },
96
96
  setWidth: function (value)
97
97
  {
98
- this .width = ~~value;
98
+ this .width = value|0;
99
99
  this .array .length = this .width * this .height;
100
100
  },
101
101
  getWidth: function ()
@@ -104,7 +104,7 @@ Image .prototype =
104
104
  },
105
105
  setHeight: function (value)
106
106
  {
107
- this .height = ~~value;
107
+ this .height = value|0;
108
108
  this .array .length = this .width * this .height;
109
109
  },
110
110
  getHeight: function ()
@@ -113,7 +113,7 @@ Image .prototype =
113
113
  },
114
114
  setComp: function (value)
115
115
  {
116
- this .comp = ~~value;
116
+ this .comp = value|0;
117
117
  },
118
118
  getComp: function ()
119
119
  {