sunrize 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2009 Holger Seelig and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sunrize",
3
3
  "productName": "Sunrize X3D Editor",
4
- "version": "2.0.5",
4
+ "version": "2.0.7",
5
5
  "description": "A Multi-Platform X3D Editor",
6
6
  "main": "src/main.js",
7
7
  "bin": {
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "files": [
11
11
  "bin/*",
12
- "src/*"
12
+ "src/*",
13
+ "LICENSES/*"
13
14
  ],
14
15
  "scripts": {
15
16
  "start": "electron .",
@@ -91,7 +92,7 @@
91
92
  "@vscode/codicons": "^0.0.44",
92
93
  "capitalize": "^2.0.4",
93
94
  "console": "^0.7.2",
94
- "electron": "^40.6.1",
95
+ "electron": "^40.8.0",
95
96
  "electron-prompt": "^1.7.0",
96
97
  "electron-squirrel-startup": "^1.0.1",
97
98
  "electron-tabs": "^1.0.4",
@@ -110,7 +111,7 @@
110
111
  "string-similarity": "^4.0.4",
111
112
  "tweakpane": "^3.1.10",
112
113
  "update-electron-app": "^3.1.2",
113
- "x_ite": "^14.0.5",
114
+ "x_ite": "^14.0.8",
114
115
  "x3d-traverse": "^1.0.22"
115
116
  }
116
117
  }
@@ -4,9 +4,10 @@ const
4
4
  $ = require ("jquery"),
5
5
  X3D = require ("../X3D"),
6
6
  LibraryPane = require ("./LibraryPane"),
7
+ Editor = require("../Undo/Editor"),
7
8
  _ = require ("../Application/GetText");
8
9
 
9
- module .exports = class Materials extends LibraryPane
10
+ module .exports = class MaterialsLibrary extends LibraryPane
10
11
  {
11
12
  id = "MATERIALS";
12
13
  description = "Materials";
@@ -36,7 +37,7 @@ module .exports = class Materials extends LibraryPane
36
37
  const
37
38
  canvas = $("<x3d-canvas preserveDrawingBuffer='true' xrSessionMode='NONE'></x3d-canvas>"),
38
39
  browser = canvas .prop ("browser"),
39
- scene = await browser .createX3DFromURL (new X3D .MFString (`file://${__dirname}/Materials.x3d`));
40
+ scene = await browser .createX3DFromURL (new X3D .MFString (`file://${__dirname}/../assets/X3D/Materials.x3d`));
40
41
 
41
42
  // Buttons
42
43
 
@@ -113,7 +114,7 @@ module .exports = class Materials extends LibraryPane
113
114
  const
114
115
  canvas = $("<x3d-canvas preserveDrawingBuffer='true' xrSessionMode='NONE'></x3d-canvas>"),
115
116
  browser = canvas .prop ("browser"),
116
- scene = await browser .createX3DFromURL (new X3D .MFString (`file://${__dirname}/Materials.x3d`));
117
+ scene = await browser .createX3DFromURL (new X3D .MFString (`file://${__dirname}/../assets/X3D/Materials.x3d`));
117
118
 
118
119
  scene .addComponent (browser .getComponent ("X_ITE"));
119
120
 
@@ -146,7 +147,7 @@ module .exports = class Materials extends LibraryPane
146
147
 
147
148
  if (this .config .global .convertToPhysical)
148
149
  {
149
- const material = this .convertPhongToPhysical (scene, appearance .material);
150
+ const material = Editor .convertPhongToPhysical (scene, appearance .material, null);
150
151
 
151
152
  scene .updateNamedNode (appearance .material .getNodeName (), material);
152
153
 
@@ -170,49 +171,4 @@ module .exports = class Materials extends LibraryPane
170
171
  browser .dispose ();
171
172
  canvas .remove ();
172
173
  }
173
-
174
- convertPhongToPhysical (executionContext, phong)
175
- {
176
- let
177
- physical = executionContext .createNode ("PhysicalMaterial"),
178
- baseColor = phong .diffuseColor .sRGBToLinear (),
179
- specularColor = phong .specularColor .sRGBToLinear (),
180
- specularIntensity = Math .max (... specularColor),
181
- metallic = Math .min (Math .max ((specularIntensity - 0.04) / (1.0 - 0.04), 0), 1) * 0.5,
182
- roughness = 1 - phong .shininess,
183
- emissiveColor = phong .emissiveColor .sRGBToLinear (),
184
- transparency = phong .transparency,
185
- transmission = transparency ** (1/3);
186
-
187
- if ([... specularColor] .some (Boolean) && roughness)
188
- {
189
- const specularMaterial = executionContext .createNode ("SpecularMaterialExtension");
190
-
191
- specularMaterial .specularColor = specularColor;
192
- specularMaterial .specularStrength = 10 * roughness;
193
-
194
- physical .extensions .push (specularMaterial);
195
-
196
- metallic *= 0.1;
197
- roughness *= 0.5;
198
- }
199
-
200
- if (transparency)
201
- {
202
- const transmissionMaterial = executionContext .createNode ("TransmissionMaterialExtension");
203
-
204
- transmissionMaterial .transmission = transmission;
205
-
206
- physical .extensions .push (transmissionMaterial);
207
-
208
- roughness *= 0.5 * (1 - transparency);
209
- }
210
-
211
- physical .baseColor = baseColor;
212
- physical .metallic = metallic;
213
- physical .roughness = roughness;
214
- physical .emissiveColor = emissiveColor;
215
-
216
- return physical;
217
- }
218
174
  };
@@ -305,6 +305,14 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
305
305
  });
306
306
  }
307
307
 
308
+ if (!node .getType () .includes (X3D .X3DConstants .InlineGeometry))
309
+ {
310
+ menu .push ({
311
+ label: _("Convert Node to InlineGeometry..."),
312
+ args: ["convertNodeToInlineFile", element .attr ("id"), executionContext .getId (), node .getId (), "InlineGeometry"],
313
+ });
314
+ }
315
+
308
316
  continue;
309
317
  }
310
318
  case X3D .X3DConstants .ImageTexture:
@@ -334,6 +342,21 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
334
342
 
335
343
  continue;
336
344
  }
345
+ case X3D .X3DConstants .InlineGeometry:
346
+ {
347
+ menu .push ({
348
+ label: _("Open InlineGeometry Scene in New Tab"),
349
+ enabled: node .checkLoadState () === X3D .X3DConstants .COMPLETE_STATE,
350
+ args: ["openFileInNewTab", node .getInternalScene () ?.worldURL],
351
+ },
352
+ {
353
+ label: _("Fold InlineGeometry Back into Scene"),
354
+ enabled: node .checkLoadState () === X3D .X3DConstants .COMPLETE_STATE && !!node .getGeometry (),
355
+ args: ["foldInlineGeometryBackIntoScene", element .attr ("id"), executionContext .getId (), node .getId ()],
356
+ });
357
+
358
+ continue;
359
+ }
337
360
  case X3D .X3DConstants .PixelTexture:
338
361
  {
339
362
  menu .push ({
@@ -360,6 +383,15 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
360
383
 
361
384
  continue;
362
385
  }
386
+ case X3D .X3DConstants .Material:
387
+ {
388
+ menu .push ({
389
+ label: _("Convert Node to PhysicalMaterial"),
390
+ args: ["convertToPhysicalMaterial", element .attr ("id"), executionContext .getId (), node .getId ()],
391
+ });
392
+
393
+ continue;
394
+ }
363
395
  case X3D .X3DConstants .X3DPrototypeInstance:
364
396
  {
365
397
  if (!$.try (() => node .getInnerNode ()))
@@ -379,7 +411,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
379
411
  {
380
412
  menu .push ({
381
413
  label: _("Convert Node to Inline File..."),
382
- args: ["convertNodeToInlineFile", element .attr ("id"), executionContext .getId (), node .getId ()],
414
+ args: ["convertNodeToInlineFile", element .attr ("id"), executionContext .getId (), node .getId (), "Inline"],
383
415
  });
384
416
 
385
417
  continue;
@@ -1438,6 +1470,26 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1438
1470
  UndoManager .shared .endUndo ();
1439
1471
  }
1440
1472
 
1473
+ convertToPhysicalMaterial (id, executionContextId, nodeId)
1474
+ {
1475
+ const
1476
+ executionContext = this .objects .get (executionContextId),
1477
+ materialNode = this .objects .get (nodeId);
1478
+
1479
+ // Add undo step.
1480
+
1481
+ UndoManager .shared .beginUndo (_("Convert Node to PhysicalMaterial"));
1482
+
1483
+ const physicalMaterialNode = Editor .convertPhongToPhysical (executionContext, new X3D .SFNode (materialNode))
1484
+
1485
+ if (materialNode .getName ())
1486
+ Editor .updateNamedNode (executionContext, materialNode .getName (), physicalMaterialNode);
1487
+
1488
+ Editor .replaceAllOccurrences (executionContext, materialNode, physicalMaterialNode);
1489
+
1490
+ UndoManager .shared .endUndo ();
1491
+ }
1492
+
1441
1493
  async convertPixelTextureToImageTexture (id, executionContextId, nodeId)
1442
1494
  {
1443
1495
  const
@@ -1511,8 +1563,8 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1511
1563
 
1512
1564
  const
1513
1565
  rootNodes = executionContext .rootNodes .copy (),
1514
- nodesToImport = [... inlineNode .getInternalScene () .rootNodes] .map (node => node .getValue ()),
1515
- x3dSyntax = await Editor .exportX3D (inlineNode .getInternalScene (), nodesToImport, { importedNodes: true }),
1566
+ nodesToExport = [... inlineNode .getInternalScene () .rootNodes] .map (node => node .getValue ()),
1567
+ x3dSyntax = await Editor .exportX3D (inlineNode .getInternalScene (), nodesToExport, { importedNodes: true }),
1516
1568
  nodes = await Editor .importX3D (executionContext, x3dSyntax);
1517
1569
 
1518
1570
  // Remove imported nodes from root nodes.
@@ -1557,6 +1609,36 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1557
1609
  this .expandTo (childNode, { expandObject: true });
1558
1610
  }
1559
1611
 
1612
+ async foldInlineGeometryBackIntoScene (id, executionContextId, nodeId)
1613
+ {
1614
+ const
1615
+ executionContext = this .objects .get (executionContextId),
1616
+ inlineGeometryNode = this .objects .get (nodeId);
1617
+
1618
+ UndoManager .shared .beginUndo (_("Fold InlineGeometry Back into Scene"));
1619
+
1620
+ const
1621
+ rootNodes = executionContext .rootNodes .copy (),
1622
+ nodesToExport = [inlineGeometryNode .getGeometry ()],
1623
+ x3dSyntax = await Editor .exportX3D (inlineGeometryNode .getInternalScene (), nodesToExport),
1624
+ nodes = await Editor .importX3D (executionContext, x3dSyntax),
1625
+ geometryNode = nodes [0];
1626
+
1627
+ // Remove imported nodes from root nodes.
1628
+
1629
+ Editor .setFieldValue (executionContext, executionContext, executionContext .rootNodes, rootNodes);
1630
+
1631
+ // Insert InlineGeometry node.
1632
+
1633
+ Editor .replaceAllOccurrences (executionContext, inlineGeometryNode, geometryNode);
1634
+
1635
+ UndoManager .shared .endUndo ();
1636
+
1637
+ await this .browser .nextFrame ();
1638
+
1639
+ this .expandTo (geometryNode, { expandObject: true });
1640
+ }
1641
+
1560
1642
  protocolToMimeType = new Map ([
1561
1643
  ["ecmascript:", "application/ecmascript"],
1562
1644
  ["javascript:", "application/javascript"],
@@ -1707,7 +1789,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1707
1789
  UndoManager .shared .endUndo ();
1708
1790
  }
1709
1791
 
1710
- async convertNodeToInlineFile (id, executionContextId, nodeId)
1792
+ async convertNodeToInlineFile (id, executionContextId, nodeId, typeName)
1711
1793
  {
1712
1794
  const
1713
1795
  executionContext = this .objects .get (executionContextId),
@@ -1719,7 +1801,15 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1719
1801
  if (response .canceled)
1720
1802
  return;
1721
1803
 
1722
- UndoManager .shared .beginUndo (_("Convert Node to Inline File"));
1804
+ switch (typeName)
1805
+ {
1806
+ case "Inline":
1807
+ UndoManager .shared .beginUndo (_("Convert Node to Inline File"));
1808
+ break;
1809
+ case "InlineGeometry":
1810
+ UndoManager .shared .beginUndo (_("Convert Node to InlineGeometry"));
1811
+ break;
1812
+ }
1723
1813
 
1724
1814
  // Create inline file.
1725
1815
 
@@ -1729,7 +1819,7 @@ module .exports = class OutlineEditor extends OutlineRouteGraph
1729
1819
 
1730
1820
  await Editor .addComponent (executionContext, "Networking");
1731
1821
 
1732
- const inlineNode = executionContext .createNode ("Inline") .getValue ();
1822
+ const inlineNode = executionContext .createNode (typeName) .getValue ();
1733
1823
 
1734
1824
  inlineNode ._url = [Editor .relativePath (executionContext, response .filePath)];
1735
1825
 
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ const X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool");
4
+
5
+ class InlineGeometryTool extends X3DGeometryNodeTool { }
6
+
7
+ module .exports = InlineGeometryTool;
@@ -2551,6 +2551,58 @@ ${scene .toXMLString ({ html: true, indent: " " .repeat (6) }) .trimEnd () }
2551
2551
  return Math .abs (target - value) < epsilon;
2552
2552
  }
2553
2553
 
2554
+ static convertPhongToPhysical (executionContext, phong, undoManager = UndoManager .shared)
2555
+ {
2556
+ let
2557
+ browser = executionContext .getBrowser (),
2558
+ physical = executionContext .createNode ("PhysicalMaterial"),
2559
+ baseColor = phong .diffuseColor .sRGBToLinear (),
2560
+ specularColor = phong .specularColor .sRGBToLinear (),
2561
+ specularIntensity = Math .max (... specularColor),
2562
+ metallic = Math .min (Math .max ((specularIntensity - 0.04) / (1.0 - 0.04), 0), 1) * 0.5,
2563
+ roughness = 1 - phong .shininess,
2564
+ emissiveColor = phong .emissiveColor .sRGBToLinear (),
2565
+ transparency = phong .transparency,
2566
+ transmission = transparency ** (1/3);
2567
+
2568
+ if ([... specularColor] .some (Boolean) && roughness)
2569
+ {
2570
+ if (undoManager && !executionContext .hasComponent ("X_ITE"))
2571
+ this .addComponent (executionContext, browser .getComponent ("X_ITE"), undoManager);
2572
+
2573
+ const specularMaterial = executionContext .createNode ("SpecularMaterialExtension");
2574
+
2575
+ specularMaterial .specularColor = specularColor;
2576
+ specularMaterial .specularStrength = 10 * roughness;
2577
+
2578
+ physical .extensions .push (specularMaterial);
2579
+
2580
+ metallic *= 0.1;
2581
+ roughness *= 0.5;
2582
+ }
2583
+
2584
+ if (transparency)
2585
+ {
2586
+ if (undoManager && !executionContext .hasComponent ("X_ITE"))
2587
+ this .addComponent (executionContext, browser .getComponent ("X_ITE"), undoManager);
2588
+
2589
+ const transmissionMaterial = executionContext .createNode ("TransmissionMaterialExtension");
2590
+
2591
+ transmissionMaterial .transmission = transmission;
2592
+
2593
+ physical .extensions .push (transmissionMaterial);
2594
+
2595
+ roughness *= 0.5 * (1 - transparency);
2596
+ }
2597
+
2598
+ physical .baseColor = baseColor;
2599
+ physical .metallic = metallic;
2600
+ physical .roughness = roughness;
2601
+ physical .emissiveColor = emissiveColor;
2602
+
2603
+ return physical;
2604
+ }
2605
+
2554
2606
  static moveViewpoint (viewpointNode, position, orientation, centerOfRotation, fieldOfView, undoManager = UndoManager .shared)
2555
2607
  {
2556
2608
  viewpointNode = viewpointNode .valueOf ();
@@ -1,16 +1,17 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "http://www.web3d.org/specifications/x3d-4.0.dtd">
3
- <X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-4.0.xsd'>
2
+ <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.1//EN" "https://www.web3d.org/specifications/x3d-4.1.dtd">
3
+ <X3D profile='Interchange' version='4.1' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.1.xsd'>
4
4
  <head>
5
- <component name='Geometry2D' level='2'/>
5
+ <component name='CubeMapTexturing' level='2'/>
6
+ <component name='Geometry2D' level='1'/>
6
7
  <component name='Layering' level='1'/>
7
- <component name='Layout' level='2'/>
8
+ <component name='Layout' level='1'/>
8
9
  <component name='PointingDeviceSensor' level='1'/>
9
10
  <component name='Scripting' level='1'/>
10
11
  <meta name='created' content='Thu, 10 Jul 2014 17:28:33 GMT'/>
11
12
  <meta name='creator' content='Holger Seelig'/>
12
- <meta name='generator' content='Sunrize X3D Editor V1.7.6, https://create3000.github.io/sunrize/'/>
13
- <meta name='modified' content='Fri, 19 Jul 2024 18:04:50 GMT'/>
13
+ <meta name='generator' content='Sunrize X3D Editor V2.0.6, https://create3000.github.io/sunrize/'/>
14
+ <meta name='modified' content='Mon, 02 Mar 2026 11:28:07 GMT'/>
14
15
  </head>
15
16
  <Scene>
16
17
  <LayerSet
@@ -44,6 +45,10 @@
44
45
  position='0 0 3'>
45
46
  <NavigationInfo USE='_1' containerField='navigationInfo'/>
46
47
  </Viewpoint>
48
+ <EnvironmentLight DEF='CannonExterior_1'>
49
+ <ImageCubeMapTexture containerField='specularTexture'
50
+ url='"CannonExterior.avif"'/>
51
+ </EnvironmentLight>
47
52
  <DirectionalLight
48
53
  ambientIntensity='0.4'/>
49
54
  <Group DEF='Models'>
File without changes
File without changes