sunrize 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/package.json +5 -5
  2. package/src/Application/Application.js +2 -9
  3. package/src/Application/Document.js +2 -0
  4. package/src/Controls/MaterialPreviewPopover.js +28 -25
  5. package/src/Controls/TexturePreviewPopover.js +14 -12
  6. package/src/Editors/Library.js +1 -1
  7. package/src/Editors/MaterialsLibrary.js +6 -50
  8. package/src/Editors/NodesLibrary.js +3 -3
  9. package/src/Editors/OutlineEditor.js +124 -29
  10. package/src/Editors/Panel.js +182 -40
  11. package/src/Editors/PrimitivesLibrary.js +2 -2
  12. package/src/Editors/ScriptEditor.js +9 -4
  13. package/src/Tools/Geometry2D/Arc2DTool.js +5 -5
  14. package/src/Tools/Geometry2D/Circle2DTool.js +5 -5
  15. package/src/Tools/Geometry2D/Polyline2DTool.js +2 -2
  16. package/src/Tools/Geometry2D/Polypoint2DTool.js +2 -2
  17. package/src/Tools/NURBS/NurbsCurveTool.js +2 -2
  18. package/src/Tools/Networking/InlineGeometryTool.js +7 -0
  19. package/src/Tools/Rendering/IndexedLineSetTool.js +2 -2
  20. package/src/Tools/Rendering/LineSetTool.js +2 -2
  21. package/src/Tools/Rendering/PointSetTool.js +2 -2
  22. package/src/Tools/Rendering/X3DGeometryNodeTool.js +39 -15
  23. package/src/Tools/Rendering/X3DGeometryNodeTool.x3d +43 -8
  24. package/src/Undo/Editor.js +52 -0
  25. package/src/assets/X3D/MaterialPreview.x3d +11 -6
  26. package/src/Tools/Rendering/X3DLineGeometryNodeTool.js +0 -40
  27. package/src/Tools/Rendering/X3DLineGeometryNodeTool.x3d +0 -64
  28. package/src/Tools/Rendering/X3DPointGeometryNodeTool.js +0 -40
  29. package/src/Tools/Rendering/X3DPointGeometryNodeTool.x3d +0 -54
  30. /package/src/{Editors → assets/X3D}/CannonExterior.avif +0 -0
  31. /package/src/{Editors → assets/X3D}/Materials.x3d +0 -0
@@ -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'>
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- const
4
- X3DGeometryNodeTool = require ("./X3DGeometryNodeTool"),
5
- ToolColors = require ("../Core/ToolColors");
6
-
7
- class X3DLineGeometryNodeTool extends X3DGeometryNodeTool
8
- {
9
- async initializeTool (type)
10
- {
11
- await super .loadTool ("tool", __dirname, "X3DLineGeometryNodeTool.x3d");
12
-
13
- this .tool .pointsColor = ToolColors .BLUE;
14
-
15
- if (type === "CUSTOM")
16
- return;
17
-
18
- this .node ._rebuild .addInterest ("set_toolRebuildGeometry", this);
19
-
20
- this .tool .pointsCoord = this .getToolScene () .createNode ("CoordinateDouble");
21
-
22
- this .set_toolRebuildGeometry ();
23
- }
24
-
25
- disposeTool ()
26
- {
27
- this .node ._rebuild .removeInterest ("set_toolRebuildGeometry", this);
28
-
29
- super .disposeTool ();
30
- }
31
-
32
- set_toolRebuildGeometry ()
33
- {
34
- const points = this .node .getVertices () .filter ((_, i) => i % 4 < 3);
35
-
36
- this .tool .pointsCoord .point = points;
37
- }
38
- }
39
-
40
- module .exports = X3DLineGeometryNodeTool;
@@ -1,64 +0,0 @@
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'>
4
- <head>
5
- <component name='X_ITE' level='1'/>
6
- <meta name='created' content='Tue, 28 Nov 2023 21:59:27 GMT'/>
7
- <meta name='comment' content='Rise and Shine'/>
8
- <meta name='creator' content='Holger Seelig'/>
9
- <meta name='generator' content='Sunrize X3D Editor V1.7.1, https://create3000.github.io/sunrize/'/>
10
- <meta name='modified' content='Sat, 29 Jun 2024 10:52:22 GMT'/>
11
- </head>
12
- <Scene>
13
- <ExternProtoDeclare name='ToolShader' url='"../Shaders/ToolShader.x3d"'/>
14
- <ProtoDeclare name='X3DLineGeometryNodeTool'>
15
- <ProtoInterface>
16
- <field accessType='inputOutput' type='SFBool' name='selected'/>
17
- <field accessType='inputOutput' type='SFString' name='group' value='NONE'/>
18
- <field accessType='inputOutput' type='SFBool' name='undo'/>
19
- <field accessType='inputOutput' type='SFBool' name='pointsDisplay' value='true'/>
20
- <field accessType='inputOutput' type='SFFloat' name='pointSize' value='5'/>
21
- <field accessType='inputOutput' type='SFColor' name='pointsColor' value='1 1 1'/>
22
- <field accessType='inputOutput' type='SFNode' name='pointsCoord'/>
23
- <field accessType='inputOnly' type='MFNode' name='addChildren'/>
24
- <field accessType='inputOnly' type='MFNode' name='removeChildren'/>
25
- </ProtoInterface>
26
- <ProtoBody>
27
- <Group>
28
- <IS>
29
- <connect nodeField='addChildren' protoField='addChildren'/>
30
- <connect nodeField='removeChildren' protoField='removeChildren'/>
31
- </IS>
32
- <Shape DEF='Lines'>
33
- <IS>
34
- <connect nodeField='visible' protoField='pointsDisplay'/>
35
- </IS>
36
- <Appearance>
37
- <PointProperties>
38
- <IS>
39
- <connect nodeField='pointSizeScaleFactor' protoField='pointSize'/>
40
- <connect nodeField='pointSizeMinValue' protoField='pointSize'/>
41
- <connect nodeField='pointSizeMaxValue' protoField='pointSize'/>
42
- </IS>
43
- </PointProperties>
44
- <Material
45
- diffuseColor='0 0 0'>
46
- <IS>
47
- <connect nodeField='emissiveColor' protoField='pointsColor'/>
48
- </IS>
49
- </Material>
50
- <ProtoInstance name='ToolShader' DEF='_999' containerField='shaders'/>
51
- <DepthMode
52
- polygonOffset='-1 -1'/>
53
- </Appearance>
54
- <PointSet>
55
- <IS>
56
- <connect nodeField='coord' protoField='pointsCoord'/>
57
- </IS>
58
- </PointSet>
59
- </Shape>
60
- </Group>
61
- </ProtoBody>
62
- </ProtoDeclare>
63
- </Scene>
64
- </X3D>
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- const
4
- X3DGeometryNodeTool = require ("./X3DGeometryNodeTool"),
5
- ToolColors = require ("../Core/ToolColors");
6
-
7
- class X3DPointGeometryNodeTool extends X3DGeometryNodeTool
8
- {
9
- async initializeTool (type)
10
- {
11
- await super .loadTool ("tool", __dirname, "X3DPointGeometryNodeTool.x3d");
12
-
13
- this .tool .pointsColor = ToolColors .BLUE;
14
-
15
- if (type === "CUSTOM")
16
- return;
17
-
18
- this .node ._rebuild .addInterest ("set_toolRebuildGeometry", this);
19
-
20
- this .tool .pointsCoord = this .getToolScene () .createNode ("CoordinateDouble");
21
-
22
- this .set_toolRebuildGeometry ();
23
- }
24
-
25
- disposeTool ()
26
- {
27
- this .node ._rebuild .removeInterest ("set_toolRebuildGeometry", this);
28
-
29
- super .disposeTool ();
30
- }
31
-
32
- set_toolRebuildGeometry ()
33
- {
34
- const points = this .node .getVertices () .filter ((_, i) => i % 4 < 3);
35
-
36
- this .tool .pointsCoord .point = points;
37
- }
38
- }
39
-
40
- module .exports = X3DPointGeometryNodeTool;
@@ -1,54 +0,0 @@
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'>
4
- <head>
5
- <component name='X_ITE' level='1'/>
6
- <meta name='created' content='Tue, 28 Nov 2023 21:59:27 GMT'/>
7
- <meta name='comment' content='Rise and Shine'/>
8
- <meta name='creator' content='Holger Seelig'/>
9
- <meta name='generator' content='Sunrize X3D Editor V1.7.1, https://create3000.github.io/sunrize/'/>
10
- <meta name='modified' content='Sat, 29 Jun 2024 10:52:33 GMT'/>
11
- </head>
12
- <Scene>
13
- <ExternProtoDeclare name='ToolShader' url='"../Shaders/ToolShader.x3d"'/>
14
- <ProtoDeclare name='X3DPointGeometryNodeTool'>
15
- <ProtoInterface>
16
- <field accessType='inputOutput' type='SFBool' name='selected'/>
17
- <field accessType='inputOutput' type='SFBool' name='pointsDisplay' value='true'/>
18
- <field accessType='inputOutput' type='SFFloat' name='pointSize' value='5'/>
19
- <field accessType='inputOutput' type='SFColor' name='pointsColor' value='1 1 1'/>
20
- <field accessType='inputOutput' type='SFNode' name='pointsCoord'/>
21
- </ProtoInterface>
22
- <ProtoBody>
23
- <Shape DEF='Lines'>
24
- <IS>
25
- <connect nodeField='visible' protoField='pointsDisplay'/>
26
- </IS>
27
- <Appearance>
28
- <PointProperties>
29
- <IS>
30
- <connect nodeField='pointSizeScaleFactor' protoField='pointSize'/>
31
- <connect nodeField='pointSizeMinValue' protoField='pointSize'/>
32
- <connect nodeField='pointSizeMaxValue' protoField='pointSize'/>
33
- </IS>
34
- </PointProperties>
35
- <Material
36
- diffuseColor='0 0 0'>
37
- <IS>
38
- <connect nodeField='emissiveColor' protoField='pointsColor'/>
39
- </IS>
40
- </Material>
41
- <ProtoInstance name='ToolShader' DEF='_999' containerField='shaders'/>
42
- <DepthMode
43
- polygonOffset='-1 -1'/>
44
- </Appearance>
45
- <PointSet>
46
- <IS>
47
- <connect nodeField='coord' protoField='pointsCoord'/>
48
- </IS>
49
- </PointSet>
50
- </Shape>
51
- </ProtoBody>
52
- </ProtoDeclare>
53
- </Scene>
54
- </X3D>
File without changes
File without changes