x_ite 4.7.5 → 4.7.9
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/launch.json +15 -0
- package/.vscode/settings.json +2 -5
- package/Makefile +1 -0
- package/README.md +1 -1
- package/build/components/annotation.build.js +2 -2
- package/build/components/cad-geometry.build.js +2 -2
- package/build/components/cube-map-texturing.build.js +2 -2
- package/build/components/dis.build.js +2 -2
- package/build/components/event-utilities.build.js +2 -2
- package/build/components/geometry2d.build.js +2 -2
- package/build/components/geospatial.build.js +2 -2
- package/build/components/h-anim.build.js +2 -2
- package/build/components/key-device-sensor.build.js +2 -2
- package/build/components/layout.build.js +2 -2
- package/build/components/nurbs.build.js +2 -2
- package/build/components/particle-systems.build.js +2 -2
- package/build/components/picking.build.js +2 -2
- package/build/components/projective-texture-mapping.build.js +2 -2
- package/build/components/rigid-body-physics.build.js +2 -2
- package/build/components/scripting.build.js +2 -2
- package/build/components/texturing-3d.build.js +2 -2
- package/build/components/volume-rendering.build.js +2 -2
- package/build/components/x_ite.build.js +2 -2
- package/build/parts/default.end.frag.js +2 -0
- package/build/parts/default.start.frag.js +8 -0
- package/build/parts/{x_ite.end.frag → x_ite.end.frag.js} +4 -2
- package/build/parts/x_ite.start.frag.js +16 -0
- package/build/x_ite.build.js +2 -2
- package/dist/assets/components/annotation.js +9 -7
- package/dist/assets/components/annotation.min.js +1 -1
- package/dist/assets/components/cad-geometry.js +9 -7
- package/dist/assets/components/cad-geometry.min.js +1 -1
- package/dist/assets/components/cube-map-texturing.js +9 -7
- package/dist/assets/components/cube-map-texturing.min.js +1 -1
- package/dist/assets/components/dis.js +9 -7
- package/dist/assets/components/dis.min.js +1 -1
- package/dist/assets/components/event-utilities.js +9 -7
- package/dist/assets/components/event-utilities.min.js +1 -1
- package/dist/assets/components/geometry2d.js +9 -7
- package/dist/assets/components/geometry2d.min.js +1 -1
- package/dist/assets/components/geospatial.js +9 -7
- package/dist/assets/components/geospatial.min.js +2 -2
- package/dist/assets/components/h-anim.js +9 -7
- package/dist/assets/components/h-anim.min.js +1 -1
- package/dist/assets/components/key-device-sensor.js +9 -7
- package/dist/assets/components/key-device-sensor.min.js +1 -1
- package/dist/assets/components/layout.js +9 -7
- package/dist/assets/components/layout.min.js +1 -1
- package/dist/assets/components/nurbs.js +9 -7
- package/dist/assets/components/nurbs.min.js +2 -2
- package/dist/assets/components/particle-systems.js +9 -7
- package/dist/assets/components/particle-systems.min.js +2 -2
- package/dist/assets/components/picking.js +13 -11
- package/dist/assets/components/picking.min.js +1 -1
- package/dist/assets/components/projective-texture-mapping.js +9 -7
- package/dist/assets/components/projective-texture-mapping.min.js +1 -1
- package/dist/assets/components/rigid-body-physics.js +9 -7
- package/dist/assets/components/rigid-body-physics.min.js +17 -17
- package/dist/assets/components/scripting.js +16 -9
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/assets/components/texturing-3d.js +9 -7
- package/dist/assets/components/texturing-3d.min.js +3 -3
- package/dist/assets/components/volume-rendering.js +11 -9
- package/dist/assets/components/volume-rendering.min.js +3 -3
- package/dist/assets/components/x_ite.js +9 -7
- package/dist/assets/components/x_ite.min.js +1 -1
- package/dist/assets/shaders/webgl1/FallbackUnlit.fs +3 -4
- package/dist/assets/shaders/webgl1/Gouraud.vs +0 -1
- package/dist/assets/shaders/webgl1/Phong.fs +0 -1
- package/dist/assets/shaders/webgl1/Unlit.fs +0 -3
- package/dist/assets/shaders/webgl2/Gouraud.vs +0 -1
- package/dist/assets/shaders/webgl2/Phong.fs +0 -1
- package/dist/assets/shaders/webgl2/Unlit.fs +0 -3
- package/dist/example.html +2 -2
- package/dist/x_ite.css +4 -3
- package/dist/x_ite.js +28281 -27706
- package/dist/x_ite.min.js +41 -41
- package/dist/x_ite.zip +0 -0
- package/docs/Accessing-the-External-Browser.md +32 -3
- package/docs/Custom-Shaders.md +165 -174
- package/docs/What's-New.md +61 -6
- package/docs/_config.yml +1 -1
- package/docs/index.md +21 -14
- package/docs/reference/Browser-Services.md +36 -8
- package/docs/reference/Script-Node-Authoring-Interface.md +12 -4
- package/package.json +13 -6
- package/src/assets/components/picking.js +2 -2
- package/src/assets/components/volume-rendering.js +2 -2
- package/src/assets/shaders/webgl1/FallbackUnlit.fs +3 -4
- package/src/assets/shaders/webgl1/Gouraud.vs +0 -1
- package/src/assets/shaders/webgl1/Phong.fs +0 -1
- package/src/assets/shaders/webgl1/Unlit.fs +0 -3
- package/src/assets/shaders/webgl2/Gouraud.vs +0 -1
- package/src/assets/shaders/webgl2/Phong.fs +0 -1
- package/src/assets/shaders/webgl2/Unlit.fs +0 -3
- package/src/bookmarks.js +8 -11
- package/src/examples.js +1 -1
- package/src/locale/de.po +19 -75
- package/src/locale/fr.po +18 -75
- package/src/standard/Time/MicroTime.js +3 -1
- package/src/standard/Utility/DataStorage.js +7 -10
- package/src/tests.js +2 -1
- package/src/x_ite/Browser/Core/BrowserOptions.js +40 -28
- package/src/x_ite/Browser/Core/BrowserTimings.js +13 -24
- package/src/x_ite/Browser/Core/ContextMenu.js +26 -12
- package/src/x_ite/Browser/Core/X3DCoreContext.js +95 -42
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +3 -0
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +3 -0
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +3 -0
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +3 -0
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +1 -3
- package/src/x_ite/Browser/Networking/urls.js +25 -0
- package/src/x_ite/Browser/Picking/VolumePicker.js +1 -1
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +4 -1
- package/src/x_ite/Browser/Shaders/ShaderTest.js +3 -3
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +70 -50
- package/src/x_ite/Components/Grouping/Switch.js +1 -1
- package/src/x_ite/Components/Lighting/DirectionalLight.js +1 -1
- package/src/x_ite/Components/Navigation/Collision.js +1 -1
- package/src/x_ite/Components/Navigation/LOD.js +1 -1
- package/src/x_ite/Components/Picking/PointPickSensor.js +1 -1
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +25 -11
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +35 -1
- package/src/x_ite/Components/Scripting/Script.js +7 -2
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +10 -12
- package/src/x_ite/Components/Shaders.js +9 -9
- package/src/x_ite/Execution/X3DExecutionContext.js +9 -11
- package/src/x_ite/Fields/SFColor.js +20 -7
- package/src/x_ite/Fields/SFColorRGBA.js +6 -6
- package/src/x_ite/Fields/SFDouble.js +2 -2
- package/src/x_ite/Fields/SFFloat.js +2 -2
- package/src/x_ite/Fields/SFImage.js +13 -13
- package/src/x_ite/Fields/SFMatrix3.js +5 -5
- package/src/x_ite/Fields/SFMatrix4.js +6 -6
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +14 -3
- package/src/x_ite/Fields/SFNode.js +23 -19
- package/src/x_ite/Fields/SFNodeCache.js +14 -10
- package/src/x_ite/Fields/SFRotation.js +10 -10
- package/src/x_ite/Fields/SFString.js +1 -1
- package/src/x_ite/Fields/SFTime.js +1 -1
- package/src/x_ite/Fields/SFVec2.js +6 -6
- package/src/x_ite/Fields/SFVec3.js +7 -7
- package/src/x_ite/Fields/SFVec4.js +8 -8
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +7 -6
- package/src/x_ite/InputOutput/Generator.js +85 -65
- package/src/x_ite/Parser/X3DParser.js +6 -0
- package/src/x_ite/Parser/XMLParser.js +1 -1
- package/src/x_ite/X3D.js +8 -2
- package/src/x_ite.config.js +0 -5
- package/src/x_ite.css +2 -1
- package/src/x_ite.html +3 -3
- package/src/x_ite.js +21 -12
- package/x_ite.min.html +3 -3
- package/build/parts/default.end.frag +0 -2
- package/build/parts/default.start.frag +0 -6
- package/build/parts/x_ite.start.frag +0 -8
|
@@ -51,10 +51,12 @@ define ([
|
|
|
51
51
|
"standard/Math/Numbers/Color3",
|
|
52
52
|
"x_ite/Basic/X3DField",
|
|
53
53
|
"x_ite/Bits/X3DConstants",
|
|
54
|
+
"x_ite/InputOutput/Generator",
|
|
54
55
|
],
|
|
55
56
|
function (Color3,
|
|
56
57
|
X3DField,
|
|
57
|
-
X3DConstants
|
|
58
|
+
X3DConstants,
|
|
59
|
+
Generator)
|
|
58
60
|
{
|
|
59
61
|
"use strict";
|
|
60
62
|
|
|
@@ -116,14 +118,14 @@ function (Color3,
|
|
|
116
118
|
},
|
|
117
119
|
lerp: (function ()
|
|
118
120
|
{
|
|
119
|
-
|
|
121
|
+
const
|
|
120
122
|
s = [ ],
|
|
121
123
|
d = [ ],
|
|
122
124
|
r = [ ];
|
|
123
125
|
|
|
124
126
|
return function (destination, t)
|
|
125
127
|
{
|
|
126
|
-
|
|
128
|
+
const result = new SFColor ();
|
|
127
129
|
|
|
128
130
|
this .getValue () .getHSV (s),
|
|
129
131
|
destination .getValue () .getHSV (d),
|
|
@@ -136,7 +138,18 @@ function (Color3,
|
|
|
136
138
|
})(),
|
|
137
139
|
toStream: function (stream)
|
|
138
140
|
{
|
|
139
|
-
|
|
141
|
+
const
|
|
142
|
+
generator = Generator .Get (stream),
|
|
143
|
+
value = this .getValue (),
|
|
144
|
+
last = value .length - 1;
|
|
145
|
+
|
|
146
|
+
for (let i = 0; i < last; ++ i)
|
|
147
|
+
{
|
|
148
|
+
stream .string += generator .Precision (value [i]);
|
|
149
|
+
stream .string += " ";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
stream .string += generator .Precision (value [last]);
|
|
140
153
|
},
|
|
141
154
|
toVRMLStream: function (stream)
|
|
142
155
|
{
|
|
@@ -148,7 +161,7 @@ function (Color3,
|
|
|
148
161
|
},
|
|
149
162
|
});
|
|
150
163
|
|
|
151
|
-
|
|
164
|
+
const r = {
|
|
152
165
|
get: function ()
|
|
153
166
|
{
|
|
154
167
|
return this .getValue () .r;
|
|
@@ -162,7 +175,7 @@ function (Color3,
|
|
|
162
175
|
configurable: false
|
|
163
176
|
};
|
|
164
177
|
|
|
165
|
-
|
|
178
|
+
const g = {
|
|
166
179
|
get: function ()
|
|
167
180
|
{
|
|
168
181
|
return this .getValue () .g;
|
|
@@ -176,7 +189,7 @@ function (Color3,
|
|
|
176
189
|
configurable: false
|
|
177
190
|
};
|
|
178
191
|
|
|
179
|
-
|
|
192
|
+
const b = {
|
|
180
193
|
get: function ()
|
|
181
194
|
{
|
|
182
195
|
return this .getValue () .b;
|
|
@@ -113,14 +113,14 @@ function (X3DField,
|
|
|
113
113
|
},
|
|
114
114
|
lerp: (function ()
|
|
115
115
|
{
|
|
116
|
-
|
|
116
|
+
const
|
|
117
117
|
s = [ ],
|
|
118
118
|
d = [ ],
|
|
119
119
|
r = [ ];
|
|
120
120
|
|
|
121
121
|
return function (destination, t)
|
|
122
122
|
{
|
|
123
|
-
|
|
123
|
+
const result = new SFColorRGBA ();
|
|
124
124
|
|
|
125
125
|
this .getValue () .getHSVA (s),
|
|
126
126
|
destination .getValue () .getHSVA (d),
|
|
@@ -136,7 +136,7 @@ function (X3DField,
|
|
|
136
136
|
toXMLStream: SFColor .prototype .toXMLStream,
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
const r = {
|
|
140
140
|
get: function ()
|
|
141
141
|
{
|
|
142
142
|
return this .getValue () .r;
|
|
@@ -150,7 +150,7 @@ function (X3DField,
|
|
|
150
150
|
configurable: false
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
const g = {
|
|
154
154
|
get: function ()
|
|
155
155
|
{
|
|
156
156
|
return this .getValue () .g;
|
|
@@ -164,7 +164,7 @@ function (X3DField,
|
|
|
164
164
|
configurable: false
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
const b = {
|
|
168
168
|
get: function ()
|
|
169
169
|
{
|
|
170
170
|
return this .getValue () .b;
|
|
@@ -178,7 +178,7 @@ function (X3DField,
|
|
|
178
178
|
configurable: false
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
const a = {
|
|
182
182
|
get: function ()
|
|
183
183
|
{
|
|
184
184
|
return this .getValue () .a;
|
|
@@ -89,11 +89,11 @@ function (X3DField,
|
|
|
89
89
|
valueOf: X3DField .prototype .getValue,
|
|
90
90
|
toStream: function (stream)
|
|
91
91
|
{
|
|
92
|
-
|
|
92
|
+
const
|
|
93
93
|
generator = Generator .Get (stream),
|
|
94
94
|
category = generator .Unit (this .getUnit ());
|
|
95
95
|
|
|
96
|
-
stream .string +=
|
|
96
|
+
stream .string += generator .DoublePrecision (generator .ToUnit (category, this .getValue ()));
|
|
97
97
|
},
|
|
98
98
|
toVRMLStream: function (stream)
|
|
99
99
|
{
|
|
@@ -89,11 +89,11 @@ function (X3DField,
|
|
|
89
89
|
valueOf: X3DField .prototype .getValue,
|
|
90
90
|
toStream: function (stream)
|
|
91
91
|
{
|
|
92
|
-
|
|
92
|
+
const
|
|
93
93
|
generator = Generator .Get (stream),
|
|
94
94
|
category = generator .Unit (this .getUnit ());
|
|
95
95
|
|
|
96
|
-
stream .string +=
|
|
96
|
+
stream .string += generator .Precision (generator .ToUnit (category, this .getValue ()));
|
|
97
97
|
},
|
|
98
98
|
toVRMLStream: function (stream)
|
|
99
99
|
{
|
|
@@ -64,7 +64,7 @@ function (X3DField,
|
|
|
64
64
|
|
|
65
65
|
function Image (width, height, comp, array)
|
|
66
66
|
{
|
|
67
|
-
|
|
67
|
+
const MFInt32 = require ("x_ite/Fields/ArrayFields") .MFInt32;
|
|
68
68
|
|
|
69
69
|
this .width = ~~width;
|
|
70
70
|
this .height = ~~height;
|
|
@@ -73,7 +73,7 @@ function (X3DField,
|
|
|
73
73
|
this .array .setValue (array);
|
|
74
74
|
this .array .length = this .width * this .height;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
Image .prototype =
|
|
78
78
|
{
|
|
79
79
|
constructor: Image,
|
|
@@ -105,7 +105,7 @@ function (X3DField,
|
|
|
105
105
|
setWidth: function (value)
|
|
106
106
|
{
|
|
107
107
|
this .width = ~~value;
|
|
108
|
-
this .array .length = this .width * this .height;
|
|
108
|
+
this .array .length = this .width * this .height;
|
|
109
109
|
},
|
|
110
110
|
getWidth: function ()
|
|
111
111
|
{
|
|
@@ -114,7 +114,7 @@ function (X3DField,
|
|
|
114
114
|
setHeight: function (value)
|
|
115
115
|
{
|
|
116
116
|
this .height = ~~value;
|
|
117
|
-
this .array .length = this .width * this .height;
|
|
117
|
+
this .array .length = this .width * this .height;
|
|
118
118
|
},
|
|
119
119
|
getHeight: function ()
|
|
120
120
|
{
|
|
@@ -131,7 +131,7 @@ function (X3DField,
|
|
|
131
131
|
setArray: function (value)
|
|
132
132
|
{
|
|
133
133
|
this .array .assign (value);
|
|
134
|
-
this .array .length = this .width * this .height;
|
|
134
|
+
this .array .length = this .width * this .height;
|
|
135
135
|
},
|
|
136
136
|
getArray: function ()
|
|
137
137
|
{
|
|
@@ -145,8 +145,8 @@ function (X3DField,
|
|
|
145
145
|
|
|
146
146
|
function SFImage (width, height, comp, array)
|
|
147
147
|
{
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
const MFInt32 = require ("x_ite/Fields/ArrayFields") .MFInt32;
|
|
149
|
+
|
|
150
150
|
if (arguments [0] instanceof Image)
|
|
151
151
|
X3DField .call (this, arguments [0]);
|
|
152
152
|
else if (arguments .length === 4)
|
|
@@ -195,13 +195,13 @@ function (X3DField,
|
|
|
195
195
|
},
|
|
196
196
|
toStream: function (stream)
|
|
197
197
|
{
|
|
198
|
-
|
|
198
|
+
const
|
|
199
199
|
array = this .array,
|
|
200
200
|
int = new SFInt32 ();
|
|
201
201
|
|
|
202
202
|
stream .string += this .width + " " + this .height + " " + this .comp;
|
|
203
203
|
|
|
204
|
-
for (
|
|
204
|
+
for (let i = 0, length = this .width * this .height; i < length; ++ i)
|
|
205
205
|
{
|
|
206
206
|
stream .string += " 0x";
|
|
207
207
|
|
|
@@ -219,7 +219,7 @@ function (X3DField,
|
|
|
219
219
|
},
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
const width = {
|
|
223
223
|
get: function ()
|
|
224
224
|
{
|
|
225
225
|
return this .getValue () .getWidth ();
|
|
@@ -233,7 +233,7 @@ function (X3DField,
|
|
|
233
233
|
configurable: false
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
const height = {
|
|
237
237
|
get: function ()
|
|
238
238
|
{
|
|
239
239
|
return this .getValue () .getHeight ();
|
|
@@ -247,7 +247,7 @@ function (X3DField,
|
|
|
247
247
|
configurable: false
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
const comp = {
|
|
251
251
|
get: function ()
|
|
252
252
|
{
|
|
253
253
|
return this .getValue () .getComp ();
|
|
@@ -261,7 +261,7 @@ function (X3DField,
|
|
|
261
261
|
configurable: false
|
|
262
262
|
};
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
const array = {
|
|
265
265
|
get: function ()
|
|
266
266
|
{
|
|
267
267
|
return this .getValue () .getArray ();
|
|
@@ -63,7 +63,7 @@ function (X3DField,
|
|
|
63
63
|
{
|
|
64
64
|
"use strict";
|
|
65
65
|
|
|
66
|
-
function SFMatrix3Template (TypeName, Type, SFVec2)
|
|
66
|
+
function SFMatrix3Template (TypeName, Type, SFVec2, double)
|
|
67
67
|
{
|
|
68
68
|
function SFMatrix3 (m00, m01, m02,
|
|
69
69
|
m10, m11, m12,
|
|
@@ -87,7 +87,7 @@ function (X3DField,
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
SFMatrix3 .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
90
|
-
SFMatrixPrototypeTemplate (Matrix3, SFVec2),
|
|
90
|
+
SFMatrixPrototypeTemplate (Matrix3, SFVec2, double),
|
|
91
91
|
{
|
|
92
92
|
constructor: SFMatrix3,
|
|
93
93
|
getTypeName: function ()
|
|
@@ -128,14 +128,14 @@ function (X3DField,
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
for (
|
|
131
|
+
for (let i = 0; i < Matrix3 .prototype .length; ++ i)
|
|
132
132
|
defineProperty (i);
|
|
133
133
|
|
|
134
134
|
return SFMatrix3;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
return {
|
|
138
|
-
SFMatrix3d: SFMatrix3Template ("SFMatrix3d", X3DConstants .SFMatrix3d, SFVec2 .SFVec2d),
|
|
139
|
-
SFMatrix3f: SFMatrix3Template ("SFMatrix3f", X3DConstants .SFMatrix3f, SFVec2 .SFVec2f),
|
|
138
|
+
SFMatrix3d: SFMatrix3Template ("SFMatrix3d", X3DConstants .SFMatrix3d, SFVec2 .SFVec2d, true),
|
|
139
|
+
SFMatrix3f: SFMatrix3Template ("SFMatrix3f", X3DConstants .SFMatrix3f, SFVec2 .SFVec2f, false),
|
|
140
140
|
};
|
|
141
141
|
});
|
|
@@ -62,7 +62,7 @@ function (X3DField,
|
|
|
62
62
|
{
|
|
63
63
|
"use strict";
|
|
64
64
|
|
|
65
|
-
function SFMatrix4Template (TypeName, Type, SFVec3)
|
|
65
|
+
function SFMatrix4Template (TypeName, Type, SFVec3, double)
|
|
66
66
|
{
|
|
67
67
|
function SFMatrix4 (m00, m01, m02, m03,
|
|
68
68
|
m10, m11, m12, m13,
|
|
@@ -88,7 +88,7 @@ function (X3DField,
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
SFMatrix4 .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
91
|
-
SFMatrixPrototypeTemplate (Matrix4, SFVec3),
|
|
91
|
+
SFMatrixPrototypeTemplate (Matrix4, SFVec3, double),
|
|
92
92
|
{
|
|
93
93
|
constructor: SFMatrix4,
|
|
94
94
|
getTypeName: function ()
|
|
@@ -119,15 +119,15 @@ function (X3DField,
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
for (
|
|
122
|
+
for (let i = 0; i < Matrix4 .prototype .length; ++ i)
|
|
123
123
|
defineProperty (i);
|
|
124
124
|
|
|
125
125
|
return SFMatrix4;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
return {
|
|
129
|
-
SFMatrix4d: SFMatrix4Template ("SFMatrix4d", X3DConstants .SFMatrix4d, SFVec3 .SFVec3d),
|
|
130
|
-
SFMatrix4f: SFMatrix4Template ("SFMatrix4f", X3DConstants .SFMatrix4f, SFVec3 .SFVec3f),
|
|
131
|
-
VrmlMatrix: SFMatrix4Template ("VrmlMatrix", X3DConstants .VrmlMatrix, SFVec3 .SFVec3f),
|
|
129
|
+
SFMatrix4d: SFMatrix4Template ("SFMatrix4d", X3DConstants .SFMatrix4d, SFVec3 .SFVec3d, true),
|
|
130
|
+
SFMatrix4f: SFMatrix4Template ("SFMatrix4f", X3DConstants .SFMatrix4f, SFVec3 .SFVec3f, false),
|
|
131
|
+
VrmlMatrix: SFMatrix4Template ("VrmlMatrix", X3DConstants .VrmlMatrix, SFVec3 .SFVec3f, false),
|
|
132
132
|
};
|
|
133
133
|
});
|
|
@@ -54,7 +54,7 @@ function (X3DField)
|
|
|
54
54
|
{
|
|
55
55
|
"use strict";
|
|
56
56
|
|
|
57
|
-
return function (Matrix, SFVec)
|
|
57
|
+
return function (Matrix, SFVec, double)
|
|
58
58
|
{
|
|
59
59
|
return Object .assign (Object .create (X3DField .prototype),
|
|
60
60
|
{
|
|
@@ -132,9 +132,20 @@ function (X3DField)
|
|
|
132
132
|
},
|
|
133
133
|
toStream: function (stream)
|
|
134
134
|
{
|
|
135
|
-
|
|
135
|
+
const
|
|
136
|
+
generator = Generator .Get (stream),
|
|
137
|
+
value = this .getValue (),
|
|
138
|
+
last = value .length - 1;
|
|
139
|
+
|
|
140
|
+
for (let i = 0; i < last; ++ i)
|
|
141
|
+
{
|
|
142
|
+
stream .string += double ? generator .DoublePrecision (value [i]) : generator .Precision (value [i]);
|
|
143
|
+
stream .string += " ";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
stream .string += double ? generator .DoublePrecision (value [last]) : generator .Precision (value [last]);
|
|
136
147
|
},
|
|
137
|
-
|
|
148
|
+
toVRMLStream: function (stream)
|
|
138
149
|
{
|
|
139
150
|
this .toStream (stream);
|
|
140
151
|
},
|
|
@@ -60,18 +60,18 @@ function (X3DField,
|
|
|
60
60
|
{
|
|
61
61
|
"use strict";
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
const handler =
|
|
64
64
|
{
|
|
65
65
|
get: function (target, key)
|
|
66
66
|
{
|
|
67
67
|
try
|
|
68
68
|
{
|
|
69
|
-
|
|
69
|
+
const value = target [key];
|
|
70
70
|
|
|
71
71
|
if (value !== undefined)
|
|
72
72
|
return value;
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
const
|
|
75
75
|
field = target .getValue () .getField (key),
|
|
76
76
|
accessType = field .getAccessType ();
|
|
77
77
|
|
|
@@ -97,7 +97,7 @@ function (X3DField,
|
|
|
97
97
|
|
|
98
98
|
try
|
|
99
99
|
{
|
|
100
|
-
|
|
100
|
+
const
|
|
101
101
|
field = target .getValue () .getField (key),
|
|
102
102
|
accessType = field .getAccessType ();
|
|
103
103
|
|
|
@@ -127,6 +127,8 @@ function (X3DField,
|
|
|
127
127
|
|
|
128
128
|
function SFNode (value)
|
|
129
129
|
{
|
|
130
|
+
// Node need to test for X3DBaseNode, because there is a special version of SFNode in Script.
|
|
131
|
+
|
|
130
132
|
if (value)
|
|
131
133
|
{
|
|
132
134
|
value .addParent (this);
|
|
@@ -151,7 +153,7 @@ function (X3DField,
|
|
|
151
153
|
},
|
|
152
154
|
copy: function (instance)
|
|
153
155
|
{
|
|
154
|
-
|
|
156
|
+
const value = this .getValue ();
|
|
155
157
|
|
|
156
158
|
if (value)
|
|
157
159
|
return new SFNode (value .copy (instance));
|
|
@@ -179,7 +181,7 @@ function (X3DField,
|
|
|
179
181
|
},
|
|
180
182
|
set: function (value)
|
|
181
183
|
{
|
|
182
|
-
|
|
184
|
+
const current = this .getValue ();
|
|
183
185
|
|
|
184
186
|
if (current)
|
|
185
187
|
{
|
|
@@ -187,6 +189,8 @@ function (X3DField,
|
|
|
187
189
|
current .removeParent (this);
|
|
188
190
|
}
|
|
189
191
|
|
|
192
|
+
// Node need to test for X3DBaseNode, because there is a special version of SFNode in Script.
|
|
193
|
+
|
|
190
194
|
if (value)
|
|
191
195
|
{
|
|
192
196
|
value .addParent (this);
|
|
@@ -201,7 +205,7 @@ function (X3DField,
|
|
|
201
205
|
},
|
|
202
206
|
getNodeTypeName: function ()
|
|
203
207
|
{
|
|
204
|
-
|
|
208
|
+
const value = this .getValue ();
|
|
205
209
|
|
|
206
210
|
if (value)
|
|
207
211
|
return value .getTypeName ();
|
|
@@ -210,7 +214,7 @@ function (X3DField,
|
|
|
210
214
|
},
|
|
211
215
|
getNodeName: function ()
|
|
212
216
|
{
|
|
213
|
-
|
|
217
|
+
const value = this .getValue ();
|
|
214
218
|
|
|
215
219
|
if (value)
|
|
216
220
|
return value .getName ();
|
|
@@ -219,7 +223,7 @@ function (X3DField,
|
|
|
219
223
|
},
|
|
220
224
|
getNodeType: function ()
|
|
221
225
|
{
|
|
222
|
-
|
|
226
|
+
const value = this .getValue ();
|
|
223
227
|
|
|
224
228
|
if (value)
|
|
225
229
|
return value .getType () .slice ();
|
|
@@ -228,7 +232,7 @@ function (X3DField,
|
|
|
228
232
|
},
|
|
229
233
|
getFieldDefinitions: function ()
|
|
230
234
|
{
|
|
231
|
-
|
|
235
|
+
const value = this .getValue ();
|
|
232
236
|
|
|
233
237
|
if (value)
|
|
234
238
|
return value .getFieldDefinitions ();
|
|
@@ -245,7 +249,7 @@ function (X3DField,
|
|
|
245
249
|
}
|
|
246
250
|
case 3:
|
|
247
251
|
{
|
|
248
|
-
|
|
252
|
+
const value = this .getValue ();
|
|
249
253
|
|
|
250
254
|
if (value)
|
|
251
255
|
return value .getField (name) .addFieldCallback (string, object);
|
|
@@ -264,7 +268,7 @@ function (X3DField,
|
|
|
264
268
|
}
|
|
265
269
|
case 2:
|
|
266
270
|
{
|
|
267
|
-
|
|
271
|
+
const value = this .getValue ();
|
|
268
272
|
|
|
269
273
|
if (value)
|
|
270
274
|
return value .getField (name) .removeFieldCallback (string);
|
|
@@ -275,7 +279,7 @@ function (X3DField,
|
|
|
275
279
|
},
|
|
276
280
|
addCloneCount: function (count)
|
|
277
281
|
{
|
|
278
|
-
|
|
282
|
+
const value = this .getValue ();
|
|
279
283
|
|
|
280
284
|
this ._cloneCount += count;
|
|
281
285
|
|
|
@@ -284,7 +288,7 @@ function (X3DField,
|
|
|
284
288
|
},
|
|
285
289
|
removeCloneCount: function (count)
|
|
286
290
|
{
|
|
287
|
-
|
|
291
|
+
const value = this .getValue ();
|
|
288
292
|
|
|
289
293
|
this ._cloneCount -= count;
|
|
290
294
|
|
|
@@ -293,7 +297,7 @@ function (X3DField,
|
|
|
293
297
|
},
|
|
294
298
|
valueOf: function ()
|
|
295
299
|
{
|
|
296
|
-
|
|
300
|
+
const value = this .getValue ();
|
|
297
301
|
|
|
298
302
|
if (value)
|
|
299
303
|
return SFNodeCache .get (value);
|
|
@@ -302,7 +306,7 @@ function (X3DField,
|
|
|
302
306
|
},
|
|
303
307
|
toStream: function (stream)
|
|
304
308
|
{
|
|
305
|
-
|
|
309
|
+
const value = this .getValue ();
|
|
306
310
|
|
|
307
311
|
if (value)
|
|
308
312
|
value .toStream (stream);
|
|
@@ -311,7 +315,7 @@ function (X3DField,
|
|
|
311
315
|
},
|
|
312
316
|
toVRMLStream: function (stream)
|
|
313
317
|
{
|
|
314
|
-
|
|
318
|
+
const value = this .getValue ();
|
|
315
319
|
|
|
316
320
|
if (value)
|
|
317
321
|
value .toVRMLStream (stream);
|
|
@@ -320,7 +324,7 @@ function (X3DField,
|
|
|
320
324
|
},
|
|
321
325
|
toXMLString: function ()
|
|
322
326
|
{
|
|
323
|
-
|
|
327
|
+
const
|
|
324
328
|
stream = { string: "" },
|
|
325
329
|
generator = Generator .Get (stream),
|
|
326
330
|
value = this .getValue ();
|
|
@@ -335,7 +339,7 @@ function (X3DField,
|
|
|
335
339
|
},
|
|
336
340
|
toXMLStream: function (stream)
|
|
337
341
|
{
|
|
338
|
-
|
|
342
|
+
const value = this .getValue ();
|
|
339
343
|
|
|
340
344
|
if (value)
|
|
341
345
|
value .toXMLStream (stream);
|
|
@@ -51,7 +51,7 @@ define (function ()
|
|
|
51
51
|
{
|
|
52
52
|
"use strict";
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
const cache = new WeakMap ();
|
|
55
55
|
|
|
56
56
|
function SFNodeCache () { }
|
|
57
57
|
|
|
@@ -59,9 +59,9 @@ define (function ()
|
|
|
59
59
|
{
|
|
60
60
|
add: function (baseNode, node)
|
|
61
61
|
{
|
|
62
|
-
|
|
62
|
+
const SFNode = require ("x_ite/Fields/SFNode");
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
node = node ? SFNode .call (node, baseNode) : new SFNode (baseNode);
|
|
65
65
|
|
|
66
66
|
cache .set (baseNode, node);
|
|
67
67
|
|
|
@@ -69,19 +69,23 @@ define (function ()
|
|
|
69
69
|
},
|
|
70
70
|
get: function (baseNode)
|
|
71
71
|
{
|
|
72
|
-
|
|
72
|
+
const node = cache .get (baseNode);
|
|
73
73
|
|
|
74
74
|
if (node)
|
|
75
|
+
{
|
|
75
76
|
return node;
|
|
77
|
+
}
|
|
78
|
+
else
|
|
79
|
+
{
|
|
80
|
+
const SFNode = require ("x_ite/Fields/SFNode");
|
|
76
81
|
|
|
77
|
-
|
|
82
|
+
// Always create new instance!
|
|
83
|
+
const node = new SFNode (baseNode);
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
node = new SFNode (baseNode);
|
|
85
|
+
cache .set (baseNode, node);
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return node;
|
|
87
|
+
return node;
|
|
88
|
+
}
|
|
85
89
|
},
|
|
86
90
|
};
|
|
87
91
|
|
|
@@ -62,7 +62,7 @@ function (SFVec3,
|
|
|
62
62
|
{
|
|
63
63
|
"use strict";
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
const SFVec3f = SFVec3 .SFVec3f;
|
|
66
66
|
|
|
67
67
|
function SFRotation (x, y, z, angle)
|
|
68
68
|
{
|
|
@@ -141,14 +141,14 @@ function (SFVec3,
|
|
|
141
141
|
},
|
|
142
142
|
toStream: function (stream)
|
|
143
143
|
{
|
|
144
|
-
|
|
144
|
+
const
|
|
145
145
|
generator = Generator .Get (stream),
|
|
146
146
|
rotation = this .getValue ();
|
|
147
147
|
|
|
148
|
-
stream .string +=
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
stream .string += generator .DoublePrecision (rotation .x) + " " +
|
|
149
|
+
generator .DoublePrecision (rotation .y) + " " +
|
|
150
|
+
generator .DoublePrecision (rotation .z) + " " +
|
|
151
|
+
generator .DoublePrecision (generator .ToUnit ("angle", rotation .angle));
|
|
152
152
|
},
|
|
153
153
|
toVRMLStream: function (stream)
|
|
154
154
|
{
|
|
@@ -160,7 +160,7 @@ function (SFVec3,
|
|
|
160
160
|
},
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
const x = {
|
|
164
164
|
get: function ()
|
|
165
165
|
{
|
|
166
166
|
return this .getValue () .x;
|
|
@@ -174,7 +174,7 @@ function (SFVec3,
|
|
|
174
174
|
configurable: false
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
const y = {
|
|
178
178
|
get: function ()
|
|
179
179
|
{
|
|
180
180
|
return this .getValue () .y;
|
|
@@ -188,7 +188,7 @@ function (SFVec3,
|
|
|
188
188
|
configurable: false
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
const z = {
|
|
192
192
|
get: function ()
|
|
193
193
|
{
|
|
194
194
|
return this .getValue () .z;
|
|
@@ -202,7 +202,7 @@ function (SFVec3,
|
|
|
202
202
|
configurable: false
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
const angle = {
|
|
206
206
|
get: function ()
|
|
207
207
|
{
|
|
208
208
|
return this .getValue () .angle;
|