sunrize 1.5.13 → 1.6.0

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 (41) hide show
  1. package/package.json +5 -5
  2. package/src/Application/Application.js +2 -7
  3. package/src/Application/Dashboard.js +10 -10
  4. package/src/Application/DataStorage.js +177 -177
  5. package/src/Application/Document.js +72 -127
  6. package/src/Application/Interface.js +4 -0
  7. package/src/Application/Tabs.js +3 -3
  8. package/src/Controls/Dialog.js +3 -1
  9. package/src/Editors/BrowserFrame.js +171 -0
  10. package/src/Editors/OutlineEditor.js +149 -123
  11. package/src/Editors/OutlineRouteGraph.js +493 -493
  12. package/src/Editors/OutlineView.js +102 -64
  13. package/src/Editors/SceneProperties.js +137 -136
  14. package/src/Editors/ScriptEditor.js +1 -1
  15. package/src/Tools/Core/X3DNodeTool.js +66 -12
  16. package/src/Tools/Grids/AngleGridTool.js +0 -5
  17. package/src/Tools/Grids/AngleGridTool.x3d +1 -0
  18. package/src/Tools/Grids/AxonometricGrid.x3d +5 -5
  19. package/src/Tools/Grids/AxonometricGridTool.js +0 -5
  20. package/src/Tools/Grids/AxonometricGridTool.x3d +1 -0
  21. package/src/Tools/Grids/GridTool.js +0 -5
  22. package/src/Tools/Grids/GridTool.x3d +1 -0
  23. package/src/Tools/Grids/X3DGridNodeTool.js +131 -84
  24. package/src/Tools/Grouping/X3DTransformNodeTool.js +19 -21
  25. package/src/Tools/Grouping/X3DTransformNodeTool.x3d +20 -15
  26. package/src/Tools/Layering/X3DActiveLayerNodeTool.js +16 -21
  27. package/src/Tools/Lighting/DirectionalLightTool.js +32 -1
  28. package/src/Tools/Lighting/X3DLightNodeTool.x3d +4 -21
  29. package/src/Tools/Shaders/TextureShader.x3d +16 -3
  30. package/src/Tools/SnapTool/{SnapSourceTool.js → SnapSource.js} +2 -7
  31. package/src/Tools/SnapTool/SnapTarget.js +650 -0
  32. package/src/Tools/SnapTool/SnapTool.x3d +28 -27
  33. package/src/Tools/SnapTool/X3DSnapNodeTool.js +16 -15
  34. package/src/Tools/Sound/SoundTool.x3d +4 -21
  35. package/src/Tools/TextureProjection/X3DTextureProjectorNodeTool.x3d +19 -26
  36. package/src/Undo/Editor.js +185 -46
  37. package/src/assets/Info.plist +56 -56
  38. package/src/assets/themes/default-template.css +1 -0
  39. package/src/assets/themes/default.css +1 -0
  40. package/src/Editors/BrowserSize.js +0 -101
  41. package/src/Tools/SnapTool/SnapTargetTool.js +0 -20
@@ -11,8 +11,8 @@
11
11
  <meta name='comment' content='Rise and Shine'/>
12
12
  <meta name='created' content='Fri, 29 Aug 2014 13:13:27 GMT'/>
13
13
  <meta name='creator' content='Holger Seelig'/>
14
- <meta name='generator' content='Sunrize X3D Editor V1.5.2, https://create3000.github.io/sunrize/'/>
15
- <meta name='modified' content='Tue, 20 Feb 2024 13:24:38 GMT'/>
14
+ <meta name='generator' content='Sunrize X3D Editor V1.5.13, https://create3000.github.io/sunrize/'/>
15
+ <meta name='modified' content='Tue, 27 Feb 2024 17:59:07 GMT'/>
16
16
  </head>
17
17
  <Scene>
18
18
  <ExternProtoDeclare name='ToolShader' url='"../Shaders/ToolShader.x3d"'>
@@ -33,6 +33,7 @@
33
33
  <field accessType='inputOutput' type='SFString' name='group' value='Transform'/>
34
34
  <field accessType='inputOutput' type='SFBool' name='grouping'/>
35
35
  <field accessType='inputOutput' type='SFBool' name='undo' value='true'/>
36
+ <field accessType='inputOutput' type='SFBool' name='active'/>
36
37
  <field accessType='inputOutput' type='SFVec3f' name='translation'/>
37
38
  <field accessType='inputOutput' type='SFRotation' name='rotation'/>
38
39
  <field accessType='inputOutput' type='SFVec3f' name='scale' value='1 1 1'/>
@@ -647,7 +648,7 @@
647
648
  </IS>
648
649
  <ProtoInstance name='BooleanSwitch' DEF='CenterLine'>
649
650
  <fieldValue name='children'>
650
- <Shape
651
+ <Shape DEF='_1'
651
652
  castShadow='false'>
652
653
  <Appearance DEF='CenterLineStyle'>
653
654
  <LineProperties
@@ -1054,6 +1055,7 @@ function set_tool (value)
1054
1055
  <field accessType='inputOutput' type='SFVec3f' name='center'/>
1055
1056
  <field accessType='inputOutput' type='SFString' name='translateMode'/>
1056
1057
  <field accessType='inputOutput' type='SFBool' name='keepCenter'/>
1058
+ <field accessType='outputOnly' type='SFString' name='activeHandle'/>
1057
1059
  <field accessType='initializeOnly' type='SFVec3f' name='initialTranslation'/>
1058
1060
  <field accessType='initializeOnly' type='SFVec3f' name='initialCenter'/>
1059
1061
  <field accessType='initializeOnly' type='SFInt32' name='events'/>
@@ -1064,6 +1066,7 @@ function set_tool (value)
1064
1066
  <connect nodeField='scaleOrientation' protoField='scaleOrientation'/>
1065
1067
  <connect nodeField='center' protoField='center'/>
1066
1068
  <connect nodeField='translateMode' protoField='translateMode'/>
1069
+ <connect nodeField='activeHandle' protoField='activeHandle'/>
1067
1070
  </IS>
1068
1071
  <![CDATA[ecmascript:
1069
1072
 
@@ -1184,7 +1187,7 @@ function set_zTranslation (value)
1184
1187
 
1185
1188
  function translate (value)
1186
1189
  {
1187
- // Prevent accidentially move.
1190
+ // Prevent accidentally move.
1188
1191
  if (events)
1189
1192
  {
1190
1193
  -- events;
@@ -1302,7 +1305,7 @@ function rotate (value)
1302
1305
  {
1303
1306
  if (events)
1304
1307
  {
1305
- // Prevent accidentially move.
1308
+ // Prevent accidentally move.
1306
1309
  -- events;
1307
1310
  return;
1308
1311
  }
@@ -1632,18 +1635,18 @@ function scaleTransformAxis (axis, value, sgn)
1632
1635
 
1633
1636
  function connectAxes (axis, vector, offset)
1634
1637
  {
1635
- for (const connectedAxis of connectedAxes)
1636
- {
1637
- const
1638
- lhs = connectedAxis [0] .toLowerCase (),
1639
- rhs = connectedAxis [1] .toLowerCase ();
1638
+ for (const connectedAxis of connectedAxes)
1639
+ {
1640
+ const
1641
+ lhs = connectedAxis [0] .toLowerCase (),
1642
+ rhs = connectedAxis [1] .toLowerCase ();
1640
1643
 
1641
- if (rhs !== axis)
1644
+ if (rhs !== axis)
1642
1645
  continue;
1643
1646
 
1644
- vector [lhs] = vector [rhs];
1645
- offset [lhs] = offset [rhs];
1646
- }
1647
+ vector [lhs] = vector [rhs];
1648
+ offset [lhs] = offset [rhs];
1649
+ }
1647
1650
  }
1648
1651
 
1649
1652
  function scaleTransformUniform (value, sgn, centerOffset, axis)
@@ -1675,7 +1678,7 @@ function scaleTransform (value, centerOffset)
1675
1678
  {
1676
1679
  if (events)
1677
1680
  {
1678
- // Prevent accidentially move.
1681
+ // Prevent accidentally move.
1679
1682
  -- events;
1680
1683
  return;
1681
1684
  }
@@ -1735,6 +1738,7 @@ function translate (scaledMatrix, distanceFromCenter)
1735
1738
  <field accessType='inputOutput' type='SFVec3f' name='center'/>
1736
1739
  <field accessType='inputOutput' type='SFVec3f' name='bboxCenter'/>
1737
1740
  <field accessType='outputOnly' type='SFBool' name='keepCenter'/>
1741
+ <field accessType='outputOnly' type='SFString' name='activeHandle'/>
1738
1742
  <field accessType='outputOnly' type='SFString' name='activeTool'/>
1739
1743
  <field accessType='outputOnly' type='SFBool' name='isActive'/>
1740
1744
  <field accessType='initializeOnly' type='SFMatrix4f' name='initialMatrix'/>
@@ -1755,6 +1759,7 @@ function translate (scaledMatrix, distanceFromCenter)
1755
1759
  <connect nodeField='center' protoField='center'/>
1756
1760
  <connect nodeField='bboxCenter' protoField='bboxCenter'/>
1757
1761
  <connect nodeField='keepCenter' protoField='keepCenter'/>
1762
+ <connect nodeField='activeHandle' protoField='activeHandle'/>
1758
1763
  <connect nodeField='activeTool' protoField='activeTool'/>
1759
1764
  <connect nodeField='isActive' protoField='isActive'/>
1760
1765
  </IS>
@@ -12,6 +12,8 @@ class X3DActiveLayerNodeTool extends X3DChildNodeTool
12
12
  {
13
13
  const node = executionContext .createNode ("Group", false);
14
14
 
15
+ node ._visible = false;
16
+
15
17
  node .setup ();
16
18
 
17
19
  super (node);
@@ -21,17 +23,17 @@ class X3DActiveLayerNodeTool extends X3DChildNodeTool
21
23
  {
22
24
  await super .initializeTool (... args);
23
25
 
24
- this .getBrowser () .getActiveLayer () .addInterest ("set_activeLayer", this);
26
+ this .getBrowser () ._activeLayer .addInterest ("set_activeLayer", this);
25
27
 
26
28
  this ._visible .addInterest ("set_visible", this);
27
29
 
28
- this .set_activeLayer ();
29
30
  this .set_visible ();
31
+ this .set_activeLayer ();
30
32
  }
31
33
 
32
34
  disposeTool ()
33
35
  {
34
- this .getBrowser () .getActiveLayer () .removeInterest ("set_activeLayer", this);
36
+ this .getBrowser () ._activeLayer .removeInterest ("set_activeLayer", this);
35
37
 
36
38
  this .disconnectTool ();
37
39
  this .removeFromLayer (this .toolLayerNode);
@@ -39,13 +41,22 @@ class X3DActiveLayerNodeTool extends X3DChildNodeTool
39
41
  super .disposeTool ();
40
42
  }
41
43
 
44
+ set_visible ()
45
+ {
46
+ if (this ._visible .getValue ())
47
+ this .connectTool ();
48
+ else
49
+ this .disconnectTool ();
50
+ }
51
+
42
52
  set_activeLayer ()
43
53
  {
44
54
  this .removeFromLayer (this .toolLayerNode);
45
55
 
46
56
  this .toolLayerNode = this .getBrowser () .getActiveLayer ();
47
57
 
48
- this .addToLayer (this .toolLayerNode)
58
+ this .addToLayer (this .toolLayerNode);
59
+ this .configureTool ();
49
60
  }
50
61
 
51
62
  addToLayer (layerNode)
@@ -67,27 +78,11 @@ class X3DActiveLayerNodeTool extends X3DChildNodeTool
67
78
  layerNode .getGroups () ._children .splice (index, 1);
68
79
  }
69
80
 
70
- set_visible ()
71
- {
72
- if (this ._visible .getValue ())
73
- this .connectTool ();
74
- else
75
- this .disconnectTool ();
76
- }
77
-
78
81
  connectTool () { }
79
82
 
80
83
  disconnectTool () { }
81
84
 
82
- getModelMatrix ()
83
- {
84
- const layoutGroupNode = X3D .X3DCast (X3D .X3DConstants .LayoutGroup, this .toolLayerNode .getGroups () ._children [0]);
85
-
86
- if (layoutGroupNode)
87
- return layoutGroupNode .getMatrix ();
88
-
89
- return new X3D .Matrix4 ();
90
- }
85
+ configureTool () { }
91
86
  }
92
87
 
93
88
  module .exports = X3DActiveLayerNodeTool;
@@ -4,18 +4,49 @@ const X3DLightNodeTool = require ("./X3DLightNodeTool");
4
4
 
5
5
  class DirectionalLightTool extends X3DLightNodeTool
6
6
  {
7
+ #changing = false;
8
+
7
9
  async initializeTool ()
8
10
  {
9
11
  await super .initializeTool ();
10
12
 
13
+ this .tool .getField ("location") .addInterest ("set_location", this);
11
14
  this .tool .getField ("direction") .addReference (this .node ._direction);
12
15
 
16
+ this .addMetaDataCallback (this, "DirectionalLight/location", this .set_meta_location .bind (this));
17
+ this .getMetaData ("DirectionalLight/location", this .tool .location);
18
+
13
19
  this .tool .type = 0;
14
20
  }
15
21
 
22
+ disposeTool ()
23
+ {
24
+ this .removeMetaDataCallback (this, "DirectionalLight/location");
25
+
26
+ super .disposeTool ();
27
+ }
28
+
16
29
  beginUndo ()
17
30
  {
18
- this .undoSaveInitialValues (["direction"]);
31
+ this .undoSaveInitialValues (["location", "direction"]);
32
+ }
33
+
34
+ set_location ()
35
+ {
36
+ this .#changing = true;
37
+
38
+ this .setMetaData ("DirectionalLight/location", this .tool .location);
39
+ }
40
+
41
+ set_meta_location ()
42
+ {
43
+ if (this .#changing)
44
+ {
45
+ this .#changing = false;
46
+ return;
47
+ }
48
+
49
+ this .getMetaData ("DirectionalLight/location", this .tool .location);
19
50
  }
20
51
  }
21
52
 
@@ -234,6 +234,7 @@
234
234
  <field accessType='inputOutput' type='SFFloat' name='emissiveStrength' value='0.67'/>
235
235
  <field accessType='inputOutput' type='SFFloat' name='intensity'/>
236
236
  <field accessType='inputOutput' type='SFVec3f' name='direction'/>
237
+ <field accessType='initializeOnly' type='SFVec3f' name='upVector' value='0 1 0'/>
237
238
  <field accessType='inputOnly' type='SFRotation' name='set_rotation'/>
238
239
  <field accessType='inputOutput' type='SFFloat' name='beamWidth'/>
239
240
  <field accessType='inputOutput' type='SFFloat' name='cutOffAngle'/>
@@ -338,8 +339,8 @@ function set_direction (value)
338
339
 
339
340
  changing = true;
340
341
 
341
- transform .rotation = straightenHorizon (new SFRotation (new SFVec3f (0, 0, 1), value),
342
- new SFVec3f (0, 1, 0));
342
+ transform .rotation = new SFRotation (new SFVec3f (0, 0, 1), value)
343
+ .straighten (upVector);
343
344
  }
344
345
 
345
346
  function set_rotation (value)
@@ -353,25 +354,7 @@ function set_rotation (value)
353
354
  changing = true;
354
355
 
355
356
  direction = transform .rotation .multVec (new SFVec3f (0, 0, 1));
356
- }
357
-
358
- function straightenHorizon (orientation, upVector)
359
- {
360
- const
361
- localXAxis = orientation .multVec (new SFVec3f (-1, 0, 0)),
362
- localZAxis = orientation .multVec (new SFVec3f (0, 0, 1)),
363
- vector = localZAxis .cross (upVector);
364
-
365
- // If viewer looks along the up vector.
366
- if (Math .abs (localZAxis .dot (upVector)) >= 1)
367
- return orientation;
368
-
369
- if (Math .abs (vector .dot (localXAxis)) >= 1)
370
- return orientation;
371
-
372
- const rotation = new SFRotation (localXAxis, vector);
373
-
374
- return orientation .multiply (rotation);
357
+ upVector = transform .rotation .multVec (new SFVec3f (0, 1, 0));
375
358
  }
376
359
 
377
360
  function set_beamWidth ()
@@ -6,15 +6,22 @@
6
6
  <meta name='comment' content='Rise and Shine'/>
7
7
  <meta name='created' content='Sun, 03 Aug 2014 14:00:40 GMT'/>
8
8
  <meta name='creator' content='Holger Seelig'/>
9
- <meta name='generator' content='Sunrize X3D Editor V1.0.11, https://create3000.github.io/sunrize/'/>
9
+ <meta name='generator' content='Sunrize X3D Editor V1.5.13, https://create3000.github.io/sunrize/'/>
10
10
  <meta name='identifier' content='file:///Users/holger/Desktop/X_ITE/sunrize/src/sunrize/Tools/Shaders/TextureShader.x3d'/>
11
- <meta name='modified' content='Thu, 16 Mar 2023 12:32:57 GMT'/>
11
+ <meta name='modified' content='Tue, 27 Feb 2024 11:40:36 GMT'/>
12
12
  </head>
13
13
  <Scene>
14
14
  <ProtoDeclare name='TextureShader'>
15
+ <ProtoInterface>
16
+ <field accessType='inputOutput' type='SFBool' name='flipY'/>
17
+ </ProtoInterface>
15
18
  <ProtoBody>
16
19
  <ComposedShader DEF='TextureShader'
17
20
  language='GLSL'>
21
+ <field accessType='inputOutput' type='SFBool' name='flipY'/>
22
+ <IS>
23
+ <connect nodeField='flipY' protoField='flipY'/>
24
+ </IS>
18
25
  <ShaderPart DEF='TextureVertexShader'>
19
26
  <![CDATA[data:text/plain,#version 300 es
20
27
 
@@ -46,6 +53,7 @@ precision highp float;
46
53
 
47
54
  uniform x3d_UnlitMaterialParameters x3d_Material;
48
55
  uniform sampler2D x3d_Texture2D [1];
56
+ uniform bool flipY;
49
57
 
50
58
  in vec4 texCoord;
51
59
 
@@ -54,7 +62,12 @@ out vec4 x3d_FragColor;
54
62
  void
55
63
  main ()
56
64
  {
57
- x3d_FragColor = texture (x3d_Texture2D [0], texCoord .st / texCoord .q);
65
+ vec2 tc = texCoord .st / texCoord .q;
66
+
67
+ if (flipY)
68
+ tc .t = 1.0 - tc .t;
69
+
70
+ x3d_FragColor = texture (x3d_Texture2D [0], tc);
58
71
  x3d_FragColor .a *= 1.0 - x3d_Material .transparency;
59
72
  }
60
73
  ]]>
@@ -4,14 +4,9 @@ const
4
4
  X3DSnapNodeTool = require ("./X3DSnapNodeTool"),
5
5
  ActionKeys = require ("../../Application/ActionKeys");
6
6
 
7
- class SnapSourceTool extends X3DSnapNodeTool
7
+ class SnapSource extends X3DSnapNodeTool
8
8
  {
9
9
  toolModifiers = ActionKeys .Option;
10
-
11
- constructor (executionContext)
12
- {
13
- super (executionContext);
14
- }
15
10
 
16
11
  async initializeTool ()
17
12
  {
@@ -21,4 +16,4 @@ class SnapSourceTool extends X3DSnapNodeTool
21
16
  }
22
17
  }
23
18
 
24
- module .exports = SnapSourceTool;
19
+ module .exports = SnapSource;