x_ite 8.6.8 → 8.6.10
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/tasks.json +1 -1
- 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 +25 -27
- 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 +907 -660
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/docs/_posts/getting-started.md +1 -1
- package/docs/laboratory/gltf-sample-viewer.html +4 -4
- package/package.json +1 -1
- package/src/assets/shaders/webgl1/Pointing.fs.js +1 -1
- package/src/assets/shaders/webgl1/include/Fragment.glsl.js +19 -2
- package/src/assets/shaders/webgl1/include/Point.glsl.js +10 -2
- package/src/assets/shaders/webgl1/include/Texture.glsl.js +31 -1
- package/src/assets/shaders/webgl1/include/Vertex.glsl.js +24 -0
- package/src/assets/shaders/webgl2/Pointing.fs.js +1 -1
- package/src/assets/shaders/webgl2/include/Fragment.glsl.js +20 -1
- package/src/assets/shaders/webgl2/include/Point.glsl.js +12 -4
- package/src/assets/shaders/webgl2/include/Texture.glsl.js +17 -20
- package/src/assets/shaders/webgl2/include/Vertex.glsl.js +24 -0
- package/src/bookmarks.js +1 -1
- package/src/tests.js +2 -1
- package/src/x_ite/Browser/Core/BrowserOptions.js +3 -0
- package/src/x_ite/Browser/Core/BrowserTimings.js +12 -11
- package/src/x_ite/Browser/Core/Context.js +66 -64
- package/src/x_ite/Browser/Core/ContextMenu.js +0 -9
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +1 -1
- package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +8 -0
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +1 -1
- package/src/x_ite/Components/Core/X3DBindableNode.js +0 -2
- package/src/x_ite/Components/Core/X3DNode.js +3 -8
- package/src/x_ite/Components/Layering/X3DLayerNode.js +6 -2
- package/src/x_ite/Components/Navigation/NavigationInfo.js +1 -0
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +34 -21
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +2 -4
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +5 -19
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +6 -12
- package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +4 -8
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +30 -27
- package/src/x_ite/Components/Shape/Material.js +4 -0
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +4 -0
- package/src/x_ite/Components/Shape/TwoSidedMaterial.js +1 -0
- package/src/x_ite/Components/Shape/X3DMaterialNode.js +21 -19
- package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +4 -0
- package/src/x_ite/Components/Texturing/ImageTexture.js +80 -46
- package/src/x_ite/Components/Texturing/MultiTexture.js +7 -4
- package/src/x_ite/Components/Texturing/MultiTextureCoordinate.js +19 -16
- package/src/x_ite/Components/Texturing/MultiTextureTransform.js +16 -32
- package/src/x_ite/Components/Texturing/TextureCoordinateGenerator.js +1 -1
- package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +2 -8
- package/src/x_ite/Components/Texturing/X3DSingleTextureTransformNode.js +2 -8
- package/src/x_ite/Execution/NamedNodesHandling.js +84 -0
- package/src/x_ite/Execution/X3DExecutionContext.js +7 -37
- package/src/x_ite/Execution/X3DScene.js +5 -0
- package/src/x_ite/InputOutput/FileLoader.js +1 -1
- package/src/x_ite/InputOutput/Generator.js +32 -81
- package/src/x_ite/Parser/GLTF2Parser.js +109 -43
- package/src/x_ite/Parser/OBJParser.js +42 -30
- package/src/x_ite/Parser/STLAParser.js +3 -0
- package/src/x_ite/Parser/SVGParser.js +4 -0
- package/src/x_ite/Rendering/X3DRenderObject.js +1 -0
- package/src/x_ite.html +53 -47
- package/x_ite.min.html +53 -47
- /package/docs/assets/X3D/{Michroma-Regular.ttf → teaser/Michroma-Regular.ttf} +0 -0
- /package/docs/assets/X3D/{peakpx.jpg → teaser/peakpx.jpg} +0 -0
- /package/docs/assets/X3D/{teaser.x3d → teaser/teaser.x3d} +0 -0
|
@@ -192,70 +192,72 @@ const Context =
|
|
|
192
192
|
|
|
193
193
|
// Async functions
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
195
|
+
Object .assign (gl, gl .getVersion () === 1
|
|
196
|
+
?
|
|
197
|
+
{
|
|
198
|
+
readPixelsAsync: gl .readPixels,
|
|
199
|
+
}
|
|
200
|
+
:
|
|
201
|
+
{
|
|
202
|
+
clientWaitAsync: function (sync, flags, timeout)
|
|
203
|
+
{
|
|
204
|
+
return new Promise ((resolve, reject) =>
|
|
205
|
+
{
|
|
206
|
+
const check = () =>
|
|
207
|
+
{
|
|
208
|
+
const result = this .clientWaitSync (sync, flags, 0);
|
|
209
|
+
|
|
210
|
+
switch (result)
|
|
211
|
+
{
|
|
212
|
+
case this .WAIT_FAILED:
|
|
213
|
+
{
|
|
214
|
+
reject ();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
case this .TIMEOUT_EXPIRED:
|
|
218
|
+
{
|
|
219
|
+
setTimeout (check, timeout);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
default:
|
|
223
|
+
{
|
|
224
|
+
resolve ();
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
check ();
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
getBufferSubDataAsync: async function (target, buffer, srcByteOffset, dstBuffer, /* optional */ dstOffset, /* optional */ length)
|
|
234
|
+
{
|
|
235
|
+
const sync = this .fenceSync (this .SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
236
|
+
|
|
237
|
+
this .flush ();
|
|
238
|
+
|
|
239
|
+
await this .clientWaitAsync (sync, 0, 10);
|
|
240
|
+
|
|
241
|
+
this .deleteSync (sync);
|
|
242
|
+
|
|
243
|
+
this .bindBuffer (target, buffer);
|
|
244
|
+
this .getBufferSubData (target, srcByteOffset, dstBuffer, dstOffset, length);
|
|
245
|
+
this .bindBuffer (target, null);
|
|
246
|
+
},
|
|
247
|
+
readPixelsAsync: async function (x, y, w, h, format, type, dest, dstOffset)
|
|
248
|
+
{
|
|
249
|
+
const buffer = this .createBuffer ();
|
|
250
|
+
|
|
251
|
+
this .bindBuffer (this .PIXEL_PACK_BUFFER, buffer);
|
|
252
|
+
this .bufferData (this .PIXEL_PACK_BUFFER, dest .byteLength, this .STREAM_READ);
|
|
253
|
+
this .readPixels (x, y, w, h, format, type, 0);
|
|
254
|
+
this .bindBuffer (this .PIXEL_PACK_BUFFER, null);
|
|
255
|
+
|
|
256
|
+
await this .getBufferSubDataAsync (this .PIXEL_PACK_BUFFER, buffer, 0, dest, dstOffset);
|
|
257
|
+
|
|
258
|
+
this .deleteBuffer (buffer);
|
|
259
|
+
},
|
|
260
|
+
});
|
|
259
261
|
|
|
260
262
|
// Return context.
|
|
261
263
|
|
|
@@ -150,18 +150,9 @@ ContextMenu .prototype = Object .assign (Object .create (X3DBaseNode .prototype)
|
|
|
150
150
|
browser .setBrowserOption ("StraightenHorizon", straightenHorizon);
|
|
151
151
|
|
|
152
152
|
if (straightenHorizon)
|
|
153
|
-
{
|
|
154
153
|
browser .getNotification () ._string = _("Straighten Horizon") + ": " + _("on");
|
|
155
|
-
|
|
156
|
-
const activeViewpoint = browser .getActiveViewpoint ();
|
|
157
|
-
|
|
158
|
-
if (activeViewpoint)
|
|
159
|
-
activeViewpoint .straighten (browser .getActiveLayer (), true);
|
|
160
|
-
}
|
|
161
154
|
else
|
|
162
|
-
{
|
|
163
155
|
browser .getNotification () ._string = _("Straighten Horizon") + ": " + _("off");
|
|
164
|
-
}
|
|
165
156
|
}
|
|
166
157
|
.bind (this),
|
|
167
158
|
},
|
|
@@ -789,7 +789,7 @@ ExamineViewer .prototype = Object .assign (Object .create (X3DViewer .prototype)
|
|
|
789
789
|
.multRight (orientationOffsetBefore);
|
|
790
790
|
|
|
791
791
|
if (straightenHorizon)
|
|
792
|
-
viewpoint .straightenHorizon (userOrientation
|
|
792
|
+
viewpoint .straightenHorizon (userOrientation);
|
|
793
793
|
|
|
794
794
|
const orientationOffsetAfter = orientationOffset
|
|
795
795
|
.assign (viewpoint .getOrientation ())
|
|
@@ -146,6 +146,14 @@ X3DTexturingContext .prototype =
|
|
|
146
146
|
{
|
|
147
147
|
return this [_maxTextures];
|
|
148
148
|
},
|
|
149
|
+
getMaxTextureTransforms: function ()
|
|
150
|
+
{
|
|
151
|
+
return 4;
|
|
152
|
+
},
|
|
153
|
+
getMaxTexCoords: function ()
|
|
154
|
+
{
|
|
155
|
+
return 4;
|
|
156
|
+
},
|
|
149
157
|
getMinTextureSize: function ()
|
|
150
158
|
{
|
|
151
159
|
return 16;
|
|
@@ -656,7 +656,7 @@ X3DBrowser .prototype = Object .assign (Object .create (X3DBrowserContext .proto
|
|
|
656
656
|
if (!layerNode)
|
|
657
657
|
return;
|
|
658
658
|
|
|
659
|
-
layerNode .
|
|
659
|
+
layerNode .viewAll (1, this .getBrowserOption ("StraightenHorizon"));
|
|
660
660
|
},
|
|
661
661
|
firstViewpoint: function (layerNode)
|
|
662
662
|
{
|
|
@@ -54,8 +54,6 @@ function X3DBindableNode (executionContext)
|
|
|
54
54
|
X3DChildNode .call (this, executionContext);
|
|
55
55
|
|
|
56
56
|
this .addType (X3DConstants .X3DBindableNode);
|
|
57
|
-
|
|
58
|
-
this .addChildObjects ("transitionActive", new Fields .SFBool ());
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
X3DBindableNode .prototype = Object .assign (Object .create (X3DChildNode .prototype),
|
|
@@ -173,15 +173,10 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
|
173
173
|
return copy;
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
|
-
getDisplayName:
|
|
176
|
+
getDisplayName: function ()
|
|
177
177
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return function ()
|
|
181
|
-
{
|
|
182
|
-
return this .getName () .replace (_TrailingNumber, "");
|
|
183
|
-
};
|
|
184
|
-
})(),
|
|
178
|
+
return this .getName () .replace (/_\d+$/, "");
|
|
179
|
+
},
|
|
185
180
|
getNeedsName: function ()
|
|
186
181
|
{
|
|
187
182
|
if (this .getName () .length)
|
|
@@ -221,13 +221,17 @@ X3DLayerNode .prototype = Object .assign (Object .create (X3DNode .prototype),
|
|
|
221
221
|
{
|
|
222
222
|
return this .collisionTime;
|
|
223
223
|
},
|
|
224
|
-
|
|
224
|
+
viewAll: function (factor = 1, straighten = false)
|
|
225
225
|
{
|
|
226
226
|
const
|
|
227
227
|
viewpointNode = this .getViewpoint (),
|
|
228
228
|
bbox = this .getBBox (new Box3 ()) .multRight (Matrix4 .inverse (viewpointNode .getModelMatrix ()));
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
viewpointNode .lookAt (this, bbox .center, viewpointNode .getLookAtDistance (bbox), factor, straighten);
|
|
231
|
+
},
|
|
232
|
+
straightenView: function ()
|
|
233
|
+
{
|
|
234
|
+
this .getViewpoint () .straightenView (this);
|
|
231
235
|
},
|
|
232
236
|
set_viewport__: function ()
|
|
233
237
|
{
|
|
@@ -66,6 +66,7 @@ function NavigationInfo (executionContext)
|
|
|
66
66
|
this .addType (X3DConstants .NavigationInfo);
|
|
67
67
|
|
|
68
68
|
this .addChildObjects ("transitionStart", new Fields .SFBool (),
|
|
69
|
+
"transitionActive", new Fields .SFBool (),
|
|
69
70
|
"availableViewers", new Fields .MFString (),
|
|
70
71
|
"viewer", new Fields .SFString ("EXAMINE"));
|
|
71
72
|
|
|
@@ -118,7 +118,6 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
118
118
|
this .scaleOrientationInterpolator .setup ();
|
|
119
119
|
this .fieldOfViewScaleInterpolator .setup ();
|
|
120
120
|
|
|
121
|
-
this .timeSensor ._isActive .addFieldInterest (this ._transitionActive);
|
|
122
121
|
this .timeSensor ._fraction_changed .addFieldInterest (this .easeInEaseOut ._set_fraction);
|
|
123
122
|
|
|
124
123
|
this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .positionInterpolator ._set_fraction);
|
|
@@ -186,10 +185,18 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
186
185
|
},
|
|
187
186
|
set_active__: function (navigationInfoNode, active)
|
|
188
187
|
{
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
if (active .getValue ())
|
|
189
|
+
return;
|
|
190
|
+
|
|
191
|
+
this .timeSensor ._isActive .removeInterest ("set_active__", this);
|
|
192
|
+
|
|
193
|
+
if (!this ._isBound .getValue ())
|
|
194
|
+
return;
|
|
195
|
+
|
|
196
|
+
if (this .timeSensor ._fraction_changed .getValue () !== 1)
|
|
197
|
+
return;
|
|
198
|
+
|
|
199
|
+
navigationInfoNode ._transitionComplete = true;
|
|
193
200
|
},
|
|
194
201
|
setInterpolators: function () { },
|
|
195
202
|
getPosition: function ()
|
|
@@ -272,6 +279,11 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
272
279
|
if (this ._viewAll .getValue ())
|
|
273
280
|
this .viewAll (layerNode .getBBox (new Box3 ()));
|
|
274
281
|
|
|
282
|
+
if (this .getBrowser () .getBrowserOption ("StraightenHorizon"))
|
|
283
|
+
{
|
|
284
|
+
this ._orientationOffset = this .straightenHorizon (this .getUserOrientation ()) .multLeft (this .getOrientation () .copy () .inverse ());
|
|
285
|
+
}
|
|
286
|
+
|
|
275
287
|
// Handle NavigationInfo.
|
|
276
288
|
|
|
277
289
|
const
|
|
@@ -320,7 +332,7 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
320
332
|
}
|
|
321
333
|
}
|
|
322
334
|
|
|
323
|
-
|
|
335
|
+
navigationInfoNode ._transitionStart = true;
|
|
324
336
|
|
|
325
337
|
this .timeSensor ._cycleInterval = transitionTime;
|
|
326
338
|
this .timeSensor ._stopTime = this .getBrowser () .getCurrentTime ();
|
|
@@ -339,11 +351,13 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
339
351
|
this ._scaleOrientationOffset = relative .scaleOrientation;
|
|
340
352
|
|
|
341
353
|
this .setInterpolators (fromViewpointNode, relative);
|
|
342
|
-
|
|
343
|
-
this ._transitionActive = true;
|
|
344
354
|
}
|
|
345
355
|
else
|
|
346
356
|
{
|
|
357
|
+
const navigationInfoNode = layerNode .getNavigationInfo ();
|
|
358
|
+
|
|
359
|
+
navigationInfoNode ._transitionComplete = true;
|
|
360
|
+
|
|
347
361
|
const relative = this .getRelativeTransformation (fromViewpointNode);
|
|
348
362
|
|
|
349
363
|
this ._positionOffset = relative .position;
|
|
@@ -368,6 +382,11 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
368
382
|
this ._centerOfRotationOffset = Vector3 .Zero;
|
|
369
383
|
this ._fieldOfViewScale = 1;
|
|
370
384
|
|
|
385
|
+
if (this .getBrowser () .getBrowserOption ("StraightenHorizon"))
|
|
386
|
+
{
|
|
387
|
+
this ._orientationOffset = this .straightenHorizon (this .getUserOrientation ()) .multLeft (this .getOrientation () .copy () .inverse ());
|
|
388
|
+
}
|
|
389
|
+
|
|
371
390
|
this .set_nearDistance__ ();
|
|
372
391
|
this .set_farDistance__ ();
|
|
373
392
|
},
|
|
@@ -413,7 +432,7 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
413
432
|
x .assign (up) .cross (z) .normalize ();
|
|
414
433
|
y .assign (z) .cross (x) .normalize ();
|
|
415
434
|
|
|
416
|
-
m .set (
|
|
435
|
+
m .set (... x, ... y, ... z);
|
|
417
436
|
r .setMatrix (m);
|
|
418
437
|
|
|
419
438
|
return r;
|
|
@@ -442,14 +461,10 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
442
461
|
const
|
|
443
462
|
offset = point .copy () .add (this .getUserOrientation () .multVecRot (new Vector3 (0, 0, distance))) .subtract (this .getPosition ());
|
|
444
463
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this .timeSensor ._cycleInterval = 0.2;
|
|
464
|
+
this .timeSensor ._cycleInterval = 1;
|
|
448
465
|
this .timeSensor ._stopTime = this .getBrowser () .getCurrentTime ();
|
|
449
466
|
this .timeSensor ._startTime = this .getBrowser () .getCurrentTime ();
|
|
450
467
|
|
|
451
|
-
this .timeSensor ._isActive .addInterest ("set_active__", this, layerNode .getNavigationInfo ());
|
|
452
|
-
|
|
453
468
|
this .easeInEaseOut ._easeInEaseOut = new Fields .MFVec2f (new Fields .SFVec2f (0, 1), new Fields .SFVec2f (1, 0));
|
|
454
469
|
|
|
455
470
|
const
|
|
@@ -472,19 +487,17 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
472
487
|
|
|
473
488
|
this ._fieldOfViewScale = 1;
|
|
474
489
|
this ._centerOfRotationOffset = Vector3 .subtract (point, this .getCenterOfRotation ());
|
|
490
|
+
this .nearDistance = Math .min (distance / 2, 0.125);
|
|
491
|
+
this .farDistance = this .nearDistance * this .getMaxFarValue () / 0.125;
|
|
475
492
|
|
|
476
493
|
this .setInterpolators (this, relative);
|
|
477
494
|
},
|
|
478
|
-
|
|
495
|
+
straightenView: function (layerNode)
|
|
479
496
|
{
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
this .timeSensor ._cycleInterval = 0.4;
|
|
497
|
+
this .timeSensor ._cycleInterval = 1;
|
|
483
498
|
this .timeSensor ._stopTime = this .getBrowser () .getCurrentTime ();
|
|
484
499
|
this .timeSensor ._startTime = this .getBrowser () .getCurrentTime ();
|
|
485
500
|
|
|
486
|
-
this .timeSensor ._isActive .addInterest ("set_active__", this, layerNode .getNavigationInfo ());
|
|
487
|
-
|
|
488
501
|
this .easeInEaseOut ._easeInEaseOut = new Fields .MFVec2f (new Fields .SFVec2f (0, 1), new Fields .SFVec2f (1, 0));
|
|
489
502
|
|
|
490
503
|
const rotation = Rotation4 .multRight (Rotation4 .inverse (this .getOrientation ()), this .straightenHorizon (this .getUserOrientation ()));
|
|
@@ -507,7 +520,7 @@ X3DViewpointNode .prototype = Object .assign (Object .create (X3DBindableNode .p
|
|
|
507
520
|
localZAxis = new Vector3 (0, 0, 0),
|
|
508
521
|
rotation = new Rotation4 (0, 0, 1, 0);
|
|
509
522
|
|
|
510
|
-
return function (orientation, upVector = this .getUpVector ())
|
|
523
|
+
return function (orientation, upVector = this .getUpVector (true))
|
|
511
524
|
{
|
|
512
525
|
orientation .multVecRot (localXAxis .assign (Vector3 .xAxis) .negate ());
|
|
513
526
|
orientation .multVecRot (localZAxis .assign (Vector3 .zAxis));
|
|
@@ -981,8 +981,7 @@ ParticleSystem .prototype = Object .assign (Object .create (X3DShapeNode .protot
|
|
|
981
981
|
|
|
982
982
|
const blendModeNode = appearanceNode .getBlendMode ();
|
|
983
983
|
|
|
984
|
-
|
|
985
|
-
blendModeNode .enable (gl);
|
|
984
|
+
blendModeNode?.enable (gl);
|
|
986
985
|
|
|
987
986
|
shaderNode .enable (gl);
|
|
988
987
|
shaderNode .setUniforms (gl, this .geometryContext, renderContext);
|
|
@@ -1027,8 +1026,7 @@ ParticleSystem .prototype = Object .assign (Object .create (X3DShapeNode .protot
|
|
|
1027
1026
|
|
|
1028
1027
|
gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, this .numParticles);
|
|
1029
1028
|
|
|
1030
|
-
|
|
1031
|
-
blendModeNode .disable (gl);
|
|
1029
|
+
blendModeNode?.disable (gl);
|
|
1032
1030
|
}
|
|
1033
1031
|
|
|
1034
1032
|
break;
|
|
@@ -178,7 +178,7 @@ X3DGeometryNode .prototype = Object .assign (Object .create (X3DNode .prototype)
|
|
|
178
178
|
this .backFace = new Map ([[gl .CCW, gl .CW], [gl .CW, gl .CCW]]);
|
|
179
179
|
this .attribBuffers = [ ];
|
|
180
180
|
this .textureCoordinateNode = browser .getDefaultTextureCoordinate ();
|
|
181
|
-
this .texCoordBuffers = Array .from ({length: browser .
|
|
181
|
+
this .texCoordBuffers = Array .from ({length: browser .getMaxTexCoords ()}, () => gl .createBuffer ());
|
|
182
182
|
this .fogDepthBuffer = gl .createBuffer ();
|
|
183
183
|
this .colorBuffer = gl .createBuffer ();
|
|
184
184
|
this .normalBuffer = gl .createBuffer ();
|
|
@@ -830,16 +830,6 @@ X3DGeometryNode .prototype = Object .assign (Object .create (X3DNode .prototype)
|
|
|
830
830
|
if (this .multiTexCoords .length === 0)
|
|
831
831
|
this .buildTexCoords ();
|
|
832
832
|
|
|
833
|
-
if (this .multiTexCoords .length)
|
|
834
|
-
{
|
|
835
|
-
const maxTextures = this .getBrowser () .getMaxTextures ();
|
|
836
|
-
|
|
837
|
-
for (let i = this .multiTexCoords .length; i < maxTextures; ++ i)
|
|
838
|
-
this .multiTexCoords [i] = this .multiTexCoords .at (-1);
|
|
839
|
-
|
|
840
|
-
this .multiTexCoords .length = maxTextures;
|
|
841
|
-
}
|
|
842
|
-
|
|
843
833
|
// Transfer arrays and update.
|
|
844
834
|
|
|
845
835
|
this .transfer ();
|
|
@@ -1019,8 +1009,7 @@ X3DGeometryNode .prototype = Object .assign (Object .create (X3DNode .prototype)
|
|
|
1019
1009
|
attribBuffers = this .attribBuffers,
|
|
1020
1010
|
primitiveMode = browser .getPrimitiveMode (this .primitiveMode);
|
|
1021
1011
|
|
|
1022
|
-
|
|
1023
|
-
blendModeNode .enable (gl);
|
|
1012
|
+
blendModeNode?.enable (gl);
|
|
1024
1013
|
|
|
1025
1014
|
shaderNode .enable (gl);
|
|
1026
1015
|
shaderNode .setUniforms (gl, this, renderContext, front);
|
|
@@ -1091,8 +1080,7 @@ X3DGeometryNode .prototype = Object .assign (Object .create (X3DNode .prototype)
|
|
|
1091
1080
|
}
|
|
1092
1081
|
}
|
|
1093
1082
|
|
|
1094
|
-
|
|
1095
|
-
blendModeNode .disable (gl);
|
|
1083
|
+
blendModeNode?.disable (gl);
|
|
1096
1084
|
},
|
|
1097
1085
|
displaySimpleParticles: function (gl, shaderNode, particleSystem)
|
|
1098
1086
|
{
|
|
@@ -1140,8 +1128,7 @@ X3DGeometryNode .prototype = Object .assign (Object .create (X3DNode .prototype)
|
|
|
1140
1128
|
attribBuffers = this .attribBuffers,
|
|
1141
1129
|
primitiveMode = browser .getPrimitiveMode (this .primitiveMode);
|
|
1142
1130
|
|
|
1143
|
-
|
|
1144
|
-
blendModeNode .enable (gl);
|
|
1131
|
+
blendModeNode?.enable (gl);
|
|
1145
1132
|
|
|
1146
1133
|
// Setup shader.
|
|
1147
1134
|
|
|
@@ -1211,8 +1198,7 @@ X3DGeometryNode .prototype = Object .assign (Object .create (X3DNode .prototype)
|
|
|
1211
1198
|
gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, particleSystem .numParticles);
|
|
1212
1199
|
}
|
|
1213
1200
|
|
|
1214
|
-
|
|
1215
|
-
blendModeNode .disable (gl);
|
|
1201
|
+
blendModeNode?.disable (gl);
|
|
1216
1202
|
},
|
|
1217
1203
|
});
|
|
1218
1204
|
|
|
@@ -306,8 +306,7 @@ X3DLineGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNode
|
|
|
306
306
|
|
|
307
307
|
// Render triangles.
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
blendModeNode .enable (gl);
|
|
309
|
+
blendModeNode?.enable (gl);
|
|
311
310
|
|
|
312
311
|
// Setup shader.
|
|
313
312
|
|
|
@@ -349,8 +348,7 @@ X3DLineGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNode
|
|
|
349
348
|
gl .enable (gl .CULL_FACE);
|
|
350
349
|
gl .drawArrays (primitiveMode, 0, this .vertexCount * 3);
|
|
351
350
|
|
|
352
|
-
|
|
353
|
-
blendModeNode .disable (gl);
|
|
351
|
+
blendModeNode?.disable (gl);
|
|
354
352
|
|
|
355
353
|
return;
|
|
356
354
|
}
|
|
@@ -358,8 +356,7 @@ X3DLineGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNode
|
|
|
358
356
|
|
|
359
357
|
const primitiveMode = browser .getPrimitiveMode (this .getPrimitiveMode ());
|
|
360
358
|
|
|
361
|
-
|
|
362
|
-
blendModeNode .enable (gl);
|
|
359
|
+
blendModeNode?.enable (gl);
|
|
363
360
|
|
|
364
361
|
// Setup shader.
|
|
365
362
|
|
|
@@ -389,8 +386,7 @@ X3DLineGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNode
|
|
|
389
386
|
|
|
390
387
|
gl .drawArrays (primitiveMode, 0, this .vertexCount);
|
|
391
388
|
|
|
392
|
-
|
|
393
|
-
blendModeNode .disable (gl);
|
|
389
|
+
blendModeNode?.disable (gl);
|
|
394
390
|
|
|
395
391
|
gl .lineWidth (1);
|
|
396
392
|
};
|
|
@@ -406,8 +402,7 @@ X3DLineGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNode
|
|
|
406
402
|
attribBuffers = this .getAttribBuffers (),
|
|
407
403
|
primitiveMode = browser .getPrimitiveMode (this .getPrimitiveMode ());
|
|
408
404
|
|
|
409
|
-
|
|
410
|
-
blendModeNode .enable (gl);
|
|
405
|
+
blendModeNode?.enable (gl);
|
|
411
406
|
|
|
412
407
|
// Setup shader.
|
|
413
408
|
|
|
@@ -446,8 +441,7 @@ X3DLineGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNode
|
|
|
446
441
|
|
|
447
442
|
gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, particleSystem .numParticles);
|
|
448
443
|
|
|
449
|
-
|
|
450
|
-
blendModeNode .disable (gl);
|
|
444
|
+
blendModeNode?.disable (gl);
|
|
451
445
|
|
|
452
446
|
gl .lineWidth (1);
|
|
453
447
|
},
|
|
@@ -81,8 +81,7 @@ X3DPointGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNod
|
|
|
81
81
|
attribNodes = this .getAttrib (),
|
|
82
82
|
attribBuffers = this .getAttribBuffers ();
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
blendModeNode .enable (gl);
|
|
84
|
+
blendModeNode?.enable (gl);
|
|
86
85
|
|
|
87
86
|
// Setup shader.
|
|
88
87
|
|
|
@@ -110,8 +109,7 @@ X3DPointGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNod
|
|
|
110
109
|
|
|
111
110
|
gl .drawArrays (this .primitiveMode, 0, this .vertexCount);
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
blendModeNode .disable (gl);
|
|
112
|
+
blendModeNode?.disable (gl);
|
|
115
113
|
},
|
|
116
114
|
displayParticles: function (gl, renderContext, particleSystem)
|
|
117
115
|
{
|
|
@@ -122,8 +120,7 @@ X3DPointGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNod
|
|
|
122
120
|
attribNodes = this .getAttrib (),
|
|
123
121
|
attribBuffers = this .getAttribBuffers ();
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
blendModeNode .enable (gl);
|
|
123
|
+
blendModeNode?.enable (gl);
|
|
127
124
|
|
|
128
125
|
// Setup shader.
|
|
129
126
|
|
|
@@ -162,8 +159,7 @@ X3DPointGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNod
|
|
|
162
159
|
|
|
163
160
|
gl .drawArraysInstanced (this .primitiveMode, 0, this .vertexCount, particleSystem .numParticles);
|
|
164
161
|
|
|
165
|
-
|
|
166
|
-
blendModeNode .disable (gl);
|
|
162
|
+
blendModeNode?.disable (gl);
|
|
167
163
|
},
|
|
168
164
|
});
|
|
169
165
|
|