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.
- package/Makefile +12 -12
- package/build/bin/version.pl +6 -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 +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 +40 -58
- 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 +28 -34
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +27 -26
- 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 +19 -19
- 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 +431 -487
- 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/laboratory/gltf-sample-viewer.html +4 -2
- package/package.json +1 -1
- package/src/assets/shaders/webgl1/include/Fragment.glsl.js +10 -2
- package/src/assets/shaders/webgl2/include/Fragment.glsl.js +10 -2
- package/src/standard/Math/Algorithm.js +8 -1
- package/src/standard/Utility/BitSet.js +33 -0
- package/src/tests.js +1 -1
- package/src/x_ite/Browser/Core/BrowserTimings.js +7 -1
- package/src/x_ite/Browser/Core/Context.js +5 -3
- package/src/x_ite/Browser/Rendering/GeometryContext.js +2 -0
- package/src/x_ite/Browser/Shape/AlphaMode.js +1 -1
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +2 -2
- package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +115 -139
- package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +1 -1
- package/src/x_ite/Components/Geometry3D/ElevationGrid.js +10 -31
- package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +3 -6
- package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +7 -25
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +1 -1
- package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +4 -10
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +0 -10
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +4 -3
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +11 -33
- package/src/x_ite/Components/Rendering/LineSet.js +12 -37
- package/src/x_ite/Components/Rendering/PointSet.js +11 -24
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +14 -39
- package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +1 -1
- package/src/x_ite/Components/Shape/Appearance.js +9 -5
- package/src/x_ite/Components/Shape/Material.js +1 -2
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +1 -2
- package/src/x_ite/Components/Shape/TwoSidedMaterial.js +1 -1
- package/src/x_ite/Components/Shape/UnlitMaterial.js +1 -1
- package/src/x_ite/Components/Shape/X3DMaterialNode.js +24 -9
- package/src/x_ite/Components/Shape/X3DShapeNode.js +1 -2
- package/src/x_ite/Components/Texturing/ImageTexture.js +8 -3
- package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +2 -0
- package/src/x_ite/Fields/SFImage.js +9 -9
- package/src/x_ite/Fields/SFInt32.js +2 -2
- package/src/x_ite/Rendering/X3DRenderObject.js +0 -2
- package/src/x_ite.html +1 -1
- package/x_ite.min.html +2 -2
- /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
|
@@ -49,8 +49,8 @@ import X3DBindableNode from "../Core/X3DBindableNode.js";
|
|
|
49
49
|
import GeometryContext from "../../Browser/Rendering/GeometryContext.js";
|
|
50
50
|
import VertexArray from "../../Rendering/VertexArray.js";
|
|
51
51
|
import TraverseType from "../../Rendering/TraverseType.js";
|
|
52
|
+
import AlphaMode from "../../Browser/Shape/AlphaMode.js";
|
|
52
53
|
import X3DConstants from "../../Base/X3DConstants.js";
|
|
53
|
-
import ViewVolume from "../../../standard/Math/Geometry/ViewVolume.js";
|
|
54
54
|
import Complex from "../../../standard/Math/Numbers/Complex.js";
|
|
55
55
|
import Vector3 from "../../../standard/Math/Numbers/Vector3.js";
|
|
56
56
|
import Rotation4 from "../../../standard/Math/Numbers/Rotation4.js";
|
|
@@ -71,8 +71,6 @@ function X3DBackgroundNode (executionContext)
|
|
|
71
71
|
this ._skyAngle .setUnit ("angle");
|
|
72
72
|
this ._groundAngle .setUnit ("angle");
|
|
73
73
|
|
|
74
|
-
const browser = this .getBrowser ();
|
|
75
|
-
|
|
76
74
|
this .hidden = false;
|
|
77
75
|
this .projectionMatrixArray = new Float32Array (16);
|
|
78
76
|
this .modelMatrix = new Matrix4 ();
|
|
@@ -80,9 +78,12 @@ function X3DBackgroundNode (executionContext)
|
|
|
80
78
|
this .clipPlanes = [ ];
|
|
81
79
|
this .colors = [ ];
|
|
82
80
|
this .sphere = [ ];
|
|
81
|
+
this .textureNodes = new Array (6);
|
|
83
82
|
this .textureBits = new BitSet ();
|
|
84
83
|
this .sphereContext = new GeometryContext ({ colorMaterial: true });
|
|
84
|
+
this .sphereAlphaContext = new GeometryContext ({ colorMaterial: true, alphaMode: AlphaMode .BLEND });
|
|
85
85
|
this .texturesContext = new GeometryContext ({ textureNode: true });
|
|
86
|
+
this .texturesAlphaContext = new GeometryContext ({ textureNode: true, alphaMode: AlphaMode .BLEND });
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .prototype),
|
|
@@ -96,32 +97,22 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
96
97
|
browser = this .getBrowser (),
|
|
97
98
|
gl = browser .getContext ();
|
|
98
99
|
|
|
99
|
-
this .colorBuffer
|
|
100
|
-
this .sphereBuffer
|
|
101
|
-
this .texCoordBuffers
|
|
102
|
-
this .
|
|
103
|
-
this .
|
|
104
|
-
this .
|
|
105
|
-
|
|
106
|
-
this .
|
|
107
|
-
this .
|
|
108
|
-
this .
|
|
109
|
-
this .
|
|
110
|
-
this .backArrayObject = new VertexArray (gl);
|
|
111
|
-
this .leftArrayObject = new VertexArray (gl);
|
|
112
|
-
this .rightArrayObject = new VertexArray (gl);
|
|
113
|
-
this .topArrayObject = new VertexArray (gl);
|
|
114
|
-
this .bottomArrayObject = new VertexArray (gl);
|
|
115
|
-
|
|
116
|
-
this ._groundAngle .addInterest ("build", this);
|
|
117
|
-
this ._groundColor .addInterest ("build", this);
|
|
118
|
-
this ._skyAngle .addInterest ("build", this);
|
|
119
|
-
this ._skyColor .addInterest ("build", this);
|
|
100
|
+
this .colorBuffer = gl .createBuffer ();
|
|
101
|
+
this .sphereBuffer = gl .createBuffer ();
|
|
102
|
+
this .texCoordBuffers = [gl .createBuffer ()];
|
|
103
|
+
this .textureBuffers = Array .from ({length: 6}, () => gl .createBuffer ());
|
|
104
|
+
this .sphereArrayObject = new VertexArray (gl);
|
|
105
|
+
this .textureArrayObjects = Array .from ({length: 6}, () => new VertexArray (gl));
|
|
106
|
+
|
|
107
|
+
this ._groundAngle .addInterest ("build", this);
|
|
108
|
+
this ._groundColor .addInterest ("build", this);
|
|
109
|
+
this ._skyAngle .addInterest ("build", this);
|
|
110
|
+
this ._skyColor .addInterest ("build", this);
|
|
120
111
|
|
|
121
112
|
this .build ();
|
|
122
113
|
this .transferRectangle ();
|
|
123
114
|
},
|
|
124
|
-
|
|
115
|
+
isHidden: function ()
|
|
125
116
|
{
|
|
126
117
|
return this .hidden;
|
|
127
118
|
},
|
|
@@ -131,36 +122,54 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
131
122
|
|
|
132
123
|
this .getBrowser () .addBrowserEvent ();
|
|
133
124
|
},
|
|
125
|
+
isTransparent: function ()
|
|
126
|
+
{
|
|
127
|
+
if (this .hidden)
|
|
128
|
+
return true;
|
|
129
|
+
|
|
130
|
+
if (this ._transparency .getValue () <= 0)
|
|
131
|
+
return false;
|
|
132
|
+
|
|
133
|
+
if (this .textureBits .size !== 6)
|
|
134
|
+
return true;
|
|
135
|
+
|
|
136
|
+
for (const i of this .textureBits)
|
|
137
|
+
{
|
|
138
|
+
if (this .textureNodes [i] ._transparent .getValue ())
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return false;
|
|
143
|
+
},
|
|
134
144
|
set_frontTexture__: function (value)
|
|
135
145
|
{
|
|
136
|
-
this .updateTexture (
|
|
146
|
+
this .updateTexture (0, value);
|
|
137
147
|
},
|
|
138
148
|
set_backTexture__: function (value)
|
|
139
149
|
{
|
|
140
|
-
this .updateTexture (
|
|
150
|
+
this .updateTexture (1, value);
|
|
141
151
|
},
|
|
142
152
|
set_leftTexture__: function (value)
|
|
143
153
|
{
|
|
144
|
-
this .updateTexture (
|
|
154
|
+
this .updateTexture (2, value);
|
|
145
155
|
},
|
|
146
156
|
set_rightTexture__: function (value)
|
|
147
157
|
{
|
|
148
|
-
this .updateTexture (
|
|
158
|
+
this .updateTexture (3, value);
|
|
149
159
|
},
|
|
150
160
|
set_topTexture__: function (value)
|
|
151
161
|
{
|
|
152
|
-
this .updateTexture (
|
|
162
|
+
this .updateTexture (4, value);
|
|
153
163
|
},
|
|
154
164
|
set_bottomTexture__: function (value)
|
|
155
165
|
{
|
|
156
|
-
this .updateTexture (
|
|
166
|
+
this .updateTexture (5, value);
|
|
157
167
|
},
|
|
158
|
-
updateTexture: function (
|
|
168
|
+
updateTexture: function (index, textureNode)
|
|
159
169
|
{
|
|
160
|
-
|
|
161
|
-
this [name] ._loadState .removeInterest ("setTextureBit", this);
|
|
170
|
+
this .textureNodes [index]?._loadState .removeInterest ("setTextureBit", this);
|
|
162
171
|
|
|
163
|
-
this [
|
|
172
|
+
this .textureNodes [index] = textureNode;
|
|
164
173
|
|
|
165
174
|
if (textureNode)
|
|
166
175
|
{
|
|
@@ -177,34 +186,6 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
177
186
|
{
|
|
178
187
|
this .textureBits .set (bit, loadState .getValue () === X3DConstants .COMPLETE_STATE || textureNode .getWidth ());
|
|
179
188
|
},
|
|
180
|
-
isTransparent: function ()
|
|
181
|
-
{
|
|
182
|
-
if (this .hidden)
|
|
183
|
-
return true;
|
|
184
|
-
|
|
185
|
-
if (this ._transparency .getValue () === 0)
|
|
186
|
-
return false;
|
|
187
|
-
|
|
188
|
-
if (! this .frontTexture || this .frontTexture ._transparent .getValue ())
|
|
189
|
-
return true;
|
|
190
|
-
|
|
191
|
-
if (! this .backTexture || this .backTexture ._transparent .getValue ())
|
|
192
|
-
return true;
|
|
193
|
-
|
|
194
|
-
if (! this .leftTexture || this .leftTexture ._transparent .getValue ())
|
|
195
|
-
return true;
|
|
196
|
-
|
|
197
|
-
if (! this .rightTexture || this .rightTexture ._transparent .getValue ())
|
|
198
|
-
return true;
|
|
199
|
-
|
|
200
|
-
if (! this .topTexture || this .topTexture ._transparent .getValue ())
|
|
201
|
-
return true;
|
|
202
|
-
|
|
203
|
-
if (! this .bottomTexture || this .bottomTexture ._transparent .getValue ())
|
|
204
|
-
return true;
|
|
205
|
-
|
|
206
|
-
return false;
|
|
207
|
-
},
|
|
208
189
|
getColor: function (theta, color, angle)
|
|
209
190
|
{
|
|
210
191
|
const index = Algorithm .upperBound (angle, 0, angle .length, theta);
|
|
@@ -237,10 +218,10 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
237
218
|
-s, -s, s, 1, s, -s, s, 1, -s, -s, -s, 1, // Bottom
|
|
238
219
|
-s, -s, -s, 1, s, -s, s, 1, s, -s, -s, 1);
|
|
239
220
|
|
|
240
|
-
const
|
|
221
|
+
const color = this ._skyColor [0];
|
|
241
222
|
|
|
242
223
|
for (let i = 0, vertices = this .sphere .vertices; i < vertices; ++ i)
|
|
243
|
-
this .colors .push (
|
|
224
|
+
this .colors .push (... color, 1);
|
|
244
225
|
}
|
|
245
226
|
else
|
|
246
227
|
{
|
|
@@ -337,13 +318,13 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
337
318
|
|
|
338
319
|
// Triangle 1 and 2
|
|
339
320
|
|
|
340
|
-
this .colors .push (
|
|
341
|
-
|
|
342
|
-
|
|
321
|
+
this .colors .push (... c1, 1,
|
|
322
|
+
... c2, 1,
|
|
323
|
+
... c2, 1,
|
|
343
324
|
// Triangle 2
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
325
|
+
... c1, 1,
|
|
326
|
+
... c1, 1,
|
|
327
|
+
... c2, 1);
|
|
347
328
|
|
|
348
329
|
this .sphere .push (y1 .imag, z1 .real, y1 .real, 1,
|
|
349
330
|
y3 .imag, z2 .real, y3 .real, 1,
|
|
@@ -376,67 +357,76 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
376
357
|
{
|
|
377
358
|
const s = SIZE;
|
|
378
359
|
|
|
379
|
-
const texCoords = [
|
|
360
|
+
const texCoords = new Float32Array ([
|
|
380
361
|
1, 1, 0, 1,
|
|
381
362
|
0, 1, 0, 1,
|
|
382
363
|
0, 0, 0, 1,
|
|
383
364
|
1, 1, 0, 1,
|
|
384
365
|
0, 0, 0, 1,
|
|
385
366
|
1, 0, 0, 1,
|
|
386
|
-
];
|
|
367
|
+
]);
|
|
387
368
|
|
|
388
|
-
const frontVertices = [
|
|
369
|
+
const frontVertices = new Float32Array ([
|
|
389
370
|
s, s, -s, 1,
|
|
390
371
|
-s, s, -s, 1,
|
|
391
372
|
-s, -s, -s, 1,
|
|
392
373
|
s, s, -s, 1,
|
|
393
374
|
-s, -s, -s, 1,
|
|
394
375
|
s, -s, -s, 1,
|
|
395
|
-
];
|
|
376
|
+
]);
|
|
396
377
|
|
|
397
|
-
const backVertices = [
|
|
378
|
+
const backVertices = new Float32Array ([
|
|
398
379
|
-s, s, s, 1,
|
|
399
380
|
s, s, s, 1,
|
|
400
381
|
s, -s, s, 1,
|
|
401
382
|
-s, s, s, 1,
|
|
402
383
|
s, -s, s, 1,
|
|
403
384
|
-s, -s, s, 1,
|
|
404
|
-
];
|
|
385
|
+
]);
|
|
405
386
|
|
|
406
|
-
const leftVertices = [
|
|
387
|
+
const leftVertices = new Float32Array ([
|
|
407
388
|
-s, s, -s, 1,
|
|
408
389
|
-s, s, s, 1,
|
|
409
390
|
-s, -s, s, 1,
|
|
410
391
|
-s, s, -s, 1,
|
|
411
392
|
-s, -s, s, 1,
|
|
412
393
|
-s, -s, -s, 1,
|
|
413
|
-
];
|
|
394
|
+
]);
|
|
414
395
|
|
|
415
|
-
const rightVertices = [
|
|
396
|
+
const rightVertices = new Float32Array ([
|
|
416
397
|
s, s, s, 1,
|
|
417
398
|
s, s, -s, 1,
|
|
418
399
|
s, -s, -s, 1,
|
|
419
400
|
s, s, s, 1,
|
|
420
401
|
s, -s, -s, 1,
|
|
421
402
|
s, -s, s, 1,
|
|
422
|
-
];
|
|
403
|
+
]);
|
|
423
404
|
|
|
424
|
-
const topVertices = [
|
|
405
|
+
const topVertices = new Float32Array ([
|
|
425
406
|
s, s, s, 1,
|
|
426
407
|
-s, s, s, 1,
|
|
427
408
|
-s, s, -s, 1,
|
|
428
409
|
s, s, s, 1,
|
|
429
410
|
-s, s, -s, 1,
|
|
430
411
|
s, s, -s, 1,
|
|
431
|
-
];
|
|
412
|
+
]);
|
|
432
413
|
|
|
433
|
-
const bottomVertices = [
|
|
414
|
+
const bottomVertices = new Float32Array ([
|
|
434
415
|
s, -s, -s, 1,
|
|
435
416
|
-s, -s, -s, 1,
|
|
436
417
|
-s, -s, s, 1,
|
|
437
418
|
s, -s, -s, 1,
|
|
438
419
|
-s, -s, s, 1,
|
|
439
420
|
s, -s, s, 1,
|
|
421
|
+
]);
|
|
422
|
+
|
|
423
|
+
const vertices = [
|
|
424
|
+
frontVertices,
|
|
425
|
+
backVertices,
|
|
426
|
+
leftVertices,
|
|
427
|
+
rightVertices,
|
|
428
|
+
topVertices,
|
|
429
|
+
bottomVertices,
|
|
440
430
|
];
|
|
441
431
|
|
|
442
432
|
return function ()
|
|
@@ -446,27 +436,15 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
446
436
|
// Transfer texCoords.
|
|
447
437
|
|
|
448
438
|
gl .bindBuffer (gl .ARRAY_BUFFER, this .texCoordBuffers [0]);
|
|
449
|
-
gl .bufferData (gl .ARRAY_BUFFER,
|
|
439
|
+
gl .bufferData (gl .ARRAY_BUFFER, texCoords, gl .DYNAMIC_DRAW);
|
|
450
440
|
|
|
451
441
|
// Transfer rectangle.
|
|
452
442
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
gl .bindBuffer (gl .ARRAY_BUFFER, this .leftBuffer);
|
|
460
|
-
gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (leftVertices), gl .DYNAMIC_DRAW);
|
|
461
|
-
|
|
462
|
-
gl .bindBuffer (gl .ARRAY_BUFFER, this .rightBuffer);
|
|
463
|
-
gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (rightVertices), gl .DYNAMIC_DRAW);
|
|
464
|
-
|
|
465
|
-
gl .bindBuffer (gl .ARRAY_BUFFER, this .topBuffer);
|
|
466
|
-
gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (topVertices), gl .DYNAMIC_DRAW);
|
|
467
|
-
|
|
468
|
-
gl .bindBuffer (gl .ARRAY_BUFFER, this .bottomBuffer);
|
|
469
|
-
gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (bottomVertices), gl .DYNAMIC_DRAW);
|
|
443
|
+
for (let i = 0; i < 6; ++ i)
|
|
444
|
+
{
|
|
445
|
+
gl .bindBuffer (gl .ARRAY_BUFFER, this .textureBuffers [i]);
|
|
446
|
+
gl .bufferData (gl .ARRAY_BUFFER, vertices [i], gl .DYNAMIC_DRAW);
|
|
447
|
+
}
|
|
470
448
|
};
|
|
471
449
|
})(),
|
|
472
450
|
traverse: function (type, renderObject)
|
|
@@ -483,21 +461,21 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
483
461
|
case TraverseType .DISPLAY:
|
|
484
462
|
{
|
|
485
463
|
const
|
|
486
|
-
|
|
487
|
-
|
|
464
|
+
localObjects = renderObject .getLocalObjects (),
|
|
465
|
+
clipPlanes = this .clipPlanes;
|
|
488
466
|
|
|
489
|
-
let
|
|
467
|
+
let c = 0;
|
|
490
468
|
|
|
491
|
-
for (let
|
|
469
|
+
for (let l = 0, length = localObjects .length; l < length; ++ l)
|
|
492
470
|
{
|
|
493
|
-
if (
|
|
494
|
-
|
|
471
|
+
if (localObjects [l] .isClipped)
|
|
472
|
+
clipPlanes [c ++] = localObjects [l];
|
|
495
473
|
}
|
|
496
474
|
|
|
497
|
-
|
|
475
|
+
clipPlanes .length = c;
|
|
498
476
|
|
|
499
|
-
this .sphereContext .objectsCount [0] =
|
|
500
|
-
this .texturesContext .objectsCount [0] =
|
|
477
|
+
this .sphereContext .objectsCount [0] = clipPlanes .length;
|
|
478
|
+
this .texturesContext .objectsCount [0] = clipPlanes .length;
|
|
501
479
|
return;
|
|
502
480
|
}
|
|
503
481
|
}
|
|
@@ -546,15 +524,15 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
546
524
|
})(),
|
|
547
525
|
drawSphere: function (renderObject)
|
|
548
526
|
{
|
|
549
|
-
const transparency = this ._transparency .getValue ();
|
|
527
|
+
const transparency = Algorithm .clamp (this ._transparency .getValue (), 0, 1);
|
|
550
528
|
|
|
551
|
-
if (transparency
|
|
529
|
+
if (transparency === 1)
|
|
552
530
|
return;
|
|
553
531
|
|
|
554
532
|
const
|
|
555
533
|
browser = this .getBrowser (),
|
|
556
534
|
gl = browser .getContext (),
|
|
557
|
-
shaderNode = browser .getDefaultMaterial () .getShader (this .sphereContext);
|
|
535
|
+
shaderNode = browser .getDefaultMaterial () .getShader (transparency ? this .sphereAlphaContext : this .sphereContext);
|
|
558
536
|
|
|
559
537
|
shaderNode .enable (gl);
|
|
560
538
|
shaderNode .setClipPlanes (gl, this .clipPlanes);
|
|
@@ -591,9 +569,10 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
591
569
|
return function (renderObject)
|
|
592
570
|
{
|
|
593
571
|
const
|
|
594
|
-
browser
|
|
595
|
-
gl
|
|
596
|
-
shaderNode
|
|
572
|
+
browser = this .getBrowser (),
|
|
573
|
+
gl = browser .getContext (),
|
|
574
|
+
shaderNode = browser .getDefaultMaterial () .getShader (this .texturesContext),
|
|
575
|
+
alphaShaderNode = browser .getDefaultMaterial () .getShader (this .texturesAlphaContext);
|
|
597
576
|
|
|
598
577
|
shaderNode .enable (gl);
|
|
599
578
|
shaderNode .setClipPlanes (gl, this .clipPlanes);
|
|
@@ -610,37 +589,34 @@ X3DBackgroundNode .prototype = Object .assign (Object .create (X3DBindableNode .
|
|
|
610
589
|
|
|
611
590
|
// Draw all textures.
|
|
612
591
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
592
|
+
for (const i of this .textureBits)
|
|
593
|
+
{
|
|
594
|
+
const textureNode = this .textureNodes [i];
|
|
595
|
+
|
|
596
|
+
this .drawRectangle (gl, browser, textureNode ._transparent .getValue () ? alphaShaderNode : shaderNode, renderObject, textureNode, this .textureBuffers [i], this .textureArrayObjects [i]);
|
|
597
|
+
}
|
|
619
598
|
};
|
|
620
599
|
})(),
|
|
621
600
|
drawRectangle: function (gl, browser, shaderNode, renderObject, textureNode, buffer, vertexArray)
|
|
622
601
|
{
|
|
623
|
-
|
|
624
|
-
{
|
|
625
|
-
textureNode .setShaderUniforms (gl, shaderNode, renderObject);
|
|
602
|
+
textureNode .setShaderUniforms (gl, shaderNode, renderObject);
|
|
626
603
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
604
|
+
if (vertexArray .enable (gl, shaderNode))
|
|
605
|
+
{
|
|
606
|
+
shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0);
|
|
607
|
+
shaderNode .enableVertexAttribute (gl, buffer, 0, 0);
|
|
608
|
+
}
|
|
632
609
|
|
|
633
|
-
|
|
610
|
+
// Draw.
|
|
634
611
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
612
|
+
if (textureNode ._transparent .getValue ())
|
|
613
|
+
gl .enable (gl .BLEND);
|
|
614
|
+
else
|
|
615
|
+
gl .disable (gl .BLEND);
|
|
639
616
|
|
|
640
|
-
|
|
617
|
+
gl .drawArrays (gl .TRIANGLES, 0, 6);
|
|
641
618
|
|
|
642
|
-
|
|
643
|
-
}
|
|
619
|
+
browser .resetTextureUnits ();
|
|
644
620
|
},
|
|
645
621
|
});
|
|
646
622
|
|
|
@@ -154,59 +154,39 @@ ElevationGrid .prototype = Object .assign (Object .create (X3DGeometryNode .prot
|
|
|
154
154
|
},
|
|
155
155
|
set_fogCoord__: function ()
|
|
156
156
|
{
|
|
157
|
-
|
|
158
|
-
this .fogCoordNode .removeInterest ("requestRebuild", this);
|
|
157
|
+
this .fogCoordNode?.removeInterest ("requestRebuild", this);
|
|
159
158
|
|
|
160
159
|
this .fogCoordNode = X3DCast (X3DConstants .FogCoordinate, this ._fogCoord);
|
|
161
160
|
|
|
162
|
-
|
|
163
|
-
this .fogCoordNode .addInterest ("requestRebuild", this);
|
|
161
|
+
this .fogCoordNode?.addInterest ("requestRebuild", this);
|
|
164
162
|
},
|
|
165
163
|
set_color__: function ()
|
|
166
164
|
{
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
this .colorNode .removeInterest ("requestRebuild", this);
|
|
170
|
-
this .colorNode ._transparent .removeInterest ("set_transparent__", this);
|
|
171
|
-
}
|
|
165
|
+
this .colorNode?.removeInterest ("requestRebuild", this);
|
|
172
166
|
|
|
173
167
|
this .colorNode = X3DCast (X3DConstants .X3DColorNode, this ._color);
|
|
174
168
|
|
|
175
|
-
|
|
176
|
-
{
|
|
177
|
-
this .colorNode .addInterest ("requestRebuild", this);
|
|
178
|
-
this .colorNode ._transparent .addInterest ("set_transparent__", this);
|
|
169
|
+
this .colorNode?.addInterest ("requestRebuild", this);
|
|
179
170
|
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
else
|
|
183
|
-
this .setTransparent (false);
|
|
184
|
-
},
|
|
185
|
-
set_transparent__: function ()
|
|
186
|
-
{
|
|
187
|
-
this .setTransparent (this .colorNode .isTransparent ());
|
|
171
|
+
this .setTransparent (this .colorNode?.isTransparent () ?? false);
|
|
188
172
|
},
|
|
189
173
|
set_texCoord__: function ()
|
|
190
174
|
{
|
|
191
|
-
|
|
192
|
-
this .texCoordNode .removeInterest ("requestRebuild", this);
|
|
175
|
+
this .texCoordNode?.removeInterest ("requestRebuild", this);
|
|
193
176
|
|
|
194
177
|
this .texCoordNode = X3DCast (X3DConstants .X3DTextureCoordinateNode, this ._texCoord);
|
|
195
178
|
|
|
196
|
-
|
|
197
|
-
this .texCoordNode .addInterest ("requestRebuild", this);
|
|
179
|
+
this .texCoordNode?.addInterest ("requestRebuild", this);
|
|
198
180
|
|
|
199
181
|
this .setTextureCoordinate (this .texCoordNode);
|
|
200
182
|
},
|
|
201
183
|
set_normal__: function ()
|
|
202
184
|
{
|
|
203
|
-
|
|
204
|
-
this .normalNode .removeInterest ("requestRebuild", this);
|
|
185
|
+
this .normalNode?.removeInterest ("requestRebuild", this);
|
|
205
186
|
|
|
206
187
|
this .normalNode = X3DCast (X3DConstants .X3DNormalNode, this ._normal);
|
|
207
188
|
|
|
208
|
-
|
|
209
|
-
this .normalNode .addInterest ("requestRebuild", this);
|
|
189
|
+
this .normalNode?.addInterest ("requestRebuild", this);
|
|
210
190
|
},
|
|
211
191
|
getColor: function ()
|
|
212
192
|
{
|
|
@@ -384,8 +364,7 @@ ElevationGrid .prototype = Object .assign (Object .create (X3DGeometryNode .prot
|
|
|
384
364
|
for (let a = 0; a < numAttribNodes; ++ a)
|
|
385
365
|
attribNodes [a] .addValue (index, attribArrays [a]);
|
|
386
366
|
|
|
387
|
-
|
|
388
|
-
fogCoordNode .addDepth (index, fogDepthArray);
|
|
367
|
+
fogCoordNode?.addDepth (index, fogDepthArray);
|
|
389
368
|
|
|
390
369
|
if (colorNode)
|
|
391
370
|
{
|
|
@@ -176,8 +176,7 @@ IndexedFaceSet .prototype = Object .assign (Object .create (X3DComposedGeometryN
|
|
|
176
176
|
normalArray = this .getNormals (),
|
|
177
177
|
vertexArray = this .getVertices ();
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
texCoordNode .init (multiTexCoordArray);
|
|
179
|
+
texCoordNode?.init (multiTexCoordArray);
|
|
181
180
|
|
|
182
181
|
for (const polygon of polygons)
|
|
183
182
|
{
|
|
@@ -192,8 +191,7 @@ IndexedFaceSet .prototype = Object .assign (Object .create (X3DComposedGeometryN
|
|
|
192
191
|
for (let a = 0; a < numAttribNodes; ++ a)
|
|
193
192
|
attribNodes [a] .addValue (index, attribArrays [a]);
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
fogCoordNode .addDepth (index, fogDepthArray);
|
|
194
|
+
fogCoordNode?.addDepth (index, fogDepthArray);
|
|
197
195
|
|
|
198
196
|
if (colorNode)
|
|
199
197
|
{
|
|
@@ -203,8 +201,7 @@ IndexedFaceSet .prototype = Object .assign (Object .create (X3DComposedGeometryN
|
|
|
203
201
|
colorNode .addColor (this .getColorIndex (face), colorArray);
|
|
204
202
|
}
|
|
205
203
|
|
|
206
|
-
|
|
207
|
-
texCoordNode .addPoint (this .getTexCoordPerVertexIndex (i), multiTexCoordArray);
|
|
204
|
+
texCoordNode?.addPoint (this .getTexCoordPerVertexIndex (i), multiTexCoordArray);
|
|
208
205
|
|
|
209
206
|
if (normalNode)
|
|
210
207
|
{
|
|
@@ -122,49 +122,31 @@ GeoElevationGrid .prototype = Object .assign (Object .create (X3DGeometryNode .p
|
|
|
122
122
|
},
|
|
123
123
|
set_color__: function ()
|
|
124
124
|
{
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
this .colorNode .removeInterest ("requestRebuild", this);
|
|
128
|
-
this .colorNode ._transparent .removeInterest ("set_transparent__", this);
|
|
129
|
-
}
|
|
125
|
+
this .colorNode?.removeInterest ("requestRebuild", this);
|
|
130
126
|
|
|
131
127
|
this .colorNode = X3DCast (X3DConstants .X3DColorNode, this ._color);
|
|
132
128
|
|
|
133
|
-
|
|
134
|
-
{
|
|
135
|
-
this .colorNode .addInterest ("requestRebuild", this);
|
|
136
|
-
this .colorNode ._transparent .addInterest ("set_transparent__", this);
|
|
129
|
+
this .colorNode?.addInterest ("requestRebuild", this);
|
|
137
130
|
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
else
|
|
141
|
-
this .setTransparent (false);
|
|
142
|
-
},
|
|
143
|
-
set_transparent__: function ()
|
|
144
|
-
{
|
|
145
|
-
this .setTransparent (this .colorNode .isTransparent ());
|
|
131
|
+
this .setTransparent (this .colorNode?.isTransparent () ?? false);
|
|
146
132
|
},
|
|
147
133
|
set_texCoord__: function ()
|
|
148
134
|
{
|
|
149
|
-
|
|
150
|
-
this .texCoordNode .removeInterest ("requestRebuild", this);
|
|
135
|
+
this .texCoordNode?.removeInterest ("requestRebuild", this);
|
|
151
136
|
|
|
152
137
|
this .texCoordNode = X3DCast (X3DConstants .X3DTextureCoordinateNode, this ._texCoord);
|
|
153
138
|
|
|
154
|
-
|
|
155
|
-
this .texCoordNode .addInterest ("requestRebuild", this);
|
|
139
|
+
this .texCoordNode?.addInterest ("requestRebuild", this);
|
|
156
140
|
|
|
157
141
|
this .setTextureCoordinate (this .texCoordNode);
|
|
158
142
|
},
|
|
159
143
|
set_normal__: function ()
|
|
160
144
|
{
|
|
161
|
-
|
|
162
|
-
this .normalNode .removeInterest ("requestRebuild", this);
|
|
145
|
+
this .normalNode?.removeInterest ("requestRebuild", this);
|
|
163
146
|
|
|
164
147
|
this .normalNode = X3DCast (X3DConstants .X3DNormalNode, this ._normal);
|
|
165
148
|
|
|
166
|
-
|
|
167
|
-
this .normalNode .addInterest ("requestRebuild", this);
|
|
149
|
+
this .normalNode?.addInterest ("requestRebuild", this);
|
|
168
150
|
},
|
|
169
151
|
getColor: function ()
|
|
170
152
|
{
|
|
@@ -105,7 +105,7 @@ X3DGroupingNode .prototype = Object .assign (Object .create (X3DChildNode .proto
|
|
|
105
105
|
|
|
106
106
|
return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ());
|
|
107
107
|
},
|
|
108
|
-
|
|
108
|
+
isHidden: function ()
|
|
109
109
|
{
|
|
110
110
|
return this .hidden;
|
|
111
111
|
},
|
|
@@ -89,20 +89,14 @@ X3DNurbsSurfaceGeometryNode .prototype = Object .assign (Object .create (X3DPara
|
|
|
89
89
|
},
|
|
90
90
|
set_texCoord__: function ()
|
|
91
91
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (this .nurbsTexCoordNode)
|
|
96
|
-
this .nurbsTexCoordNode .removeInterest ("requestRebuild", this);
|
|
92
|
+
this .texCoordNode ?.removeInterest ("requestRebuild", this);
|
|
93
|
+
this .nurbsTexCoordNode?.removeInterest ("requestRebuild", this);
|
|
97
94
|
|
|
98
95
|
this .texCoordNode = X3DCast (X3DConstants .X3DTextureCoordinateNode, this ._texCoord);
|
|
99
96
|
this .nurbsTexCoordNode = X3DCast (X3DConstants .NurbsTextureCoordinate, this ._texCoord);
|
|
100
97
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (this .nurbsTexCoordNode)
|
|
105
|
-
this .nurbsTexCoordNode .addInterest ("requestRebuild", this);
|
|
98
|
+
this .texCoordNode ?.addInterest ("requestRebuild", this);
|
|
99
|
+
this .nurbsTexCoordNode?.addInterest ("requestRebuild", this);
|
|
106
100
|
},
|
|
107
101
|
set_controlPoint__: function ()
|
|
108
102
|
{
|