sunrize 1.2.7 → 1.3.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 (62) hide show
  1. package/package.json +12 -10
  2. package/src/Application/Dashboard.js +44 -47
  3. package/src/Application/Document.js +13 -1
  4. package/src/Application/Tabs.js +81 -80
  5. package/src/Editors/OutlineEditor.js +129 -21
  6. package/src/Editors/Primitives.js +13 -2
  7. package/src/Tools/CADGeometry/IndexedQuadSetTool.js +7 -0
  8. package/src/Tools/CADGeometry/QuadSetTool.js +7 -0
  9. package/src/Tools/Core/ToolColors.js +2 -2
  10. package/src/Tools/Core/X3DBaseTool.js +61 -0
  11. package/src/Tools/Core/X3DChildNodeTool.js +2 -176
  12. package/src/Tools/Core/X3DNodeTool.js +231 -53
  13. package/src/Tools/EnvironmentalSensor/X3DEnvironmentalSensorNodeTool.x3d +1 -1
  14. package/src/Tools/Geometry2D/Arc2DTool.js +105 -0
  15. package/src/Tools/Geometry2D/ArcClose2DTool.js +105 -0
  16. package/src/Tools/Geometry2D/Circle2DTool.js +105 -0
  17. package/src/Tools/Geometry2D/Disk2DTool.js +197 -0
  18. package/src/Tools/Geometry2D/Polyline2DTool.js +7 -0
  19. package/src/Tools/Geometry2D/Polypoint2DTool.js +7 -0
  20. package/src/Tools/Geometry2D/Rectangle2DTool.js +117 -0
  21. package/src/Tools/Geometry2D/TriangleSet2DTool.js +7 -0
  22. package/src/Tools/Geometry3D/BoxTool.js +117 -0
  23. package/src/Tools/Geometry3D/ConeTool.js +151 -0
  24. package/src/Tools/Geometry3D/CylinderTool.js +159 -0
  25. package/src/Tools/Geometry3D/ElevationGridTool.js +7 -0
  26. package/src/Tools/Geometry3D/ExtrusionTool.js +7 -0
  27. package/src/Tools/Geometry3D/IndexedFaceSetTool.js +7 -0
  28. package/src/Tools/Geometry3D/SphereTool.js +116 -0
  29. package/src/Tools/Geospatial/GeoElevationGridTool.js +15 -0
  30. package/src/Tools/Grouping/X3DBoundedObjectTool.x3d +5 -2
  31. package/src/Tools/Grouping/X3DTransformNodeTool.js +4 -2
  32. package/src/Tools/Grouping/X3DTransformNodeTool.x3d +42 -17
  33. package/src/Tools/Lighting/X3DLightNodeTool.x3d +1 -1
  34. package/src/Tools/NURBS/NurbsCurveTool.js +7 -0
  35. package/src/Tools/NURBS/NurbsPatchSurfaceTool.js +7 -0
  36. package/src/Tools/NURBS/NurbsSweptSurfaceTool.js +7 -0
  37. package/src/Tools/NURBS/NurbsSwungSurfaceTool.js +7 -0
  38. package/src/Tools/NURBS/NurbsTrimmedSurfaceTool.js +7 -0
  39. package/src/Tools/Navigation/X3DViewpointNodeTool.x3d +1 -1
  40. package/src/Tools/Rendering/IndexedLineSetTool.js +7 -0
  41. package/src/Tools/Rendering/IndexedTriangleFanSetTool.js +7 -0
  42. package/src/Tools/Rendering/IndexedTriangleSetTool.js +7 -0
  43. package/src/Tools/Rendering/IndexedTriangleStripSetTool.js +7 -0
  44. package/src/Tools/Rendering/LineSetTool.js +7 -0
  45. package/src/Tools/Rendering/PointSetTool.js +7 -0
  46. package/src/Tools/Rendering/TriangleFanSetTool.js +7 -0
  47. package/src/Tools/Rendering/TriangleSetTool.js +7 -0
  48. package/src/Tools/Rendering/TriangleStripSetTool.js +7 -0
  49. package/src/Tools/Rendering/X3DGeometryNodeTool.js +52 -0
  50. package/src/Tools/Rendering/X3DGeometryNodeTool.x3d +70 -0
  51. package/src/Tools/Rendering/X3DLineGeometryNodeTool.js +40 -0
  52. package/src/Tools/Rendering/X3DLineGeometryNodeTool.x3d +62 -0
  53. package/src/Tools/Rendering/X3DPointGeometryNodeTool.js +40 -0
  54. package/src/Tools/Rendering/X3DPointGeometryNodeTool.x3d +52 -0
  55. package/src/Tools/Sound/SoundTool.x3d +3 -3
  56. package/src/Tools/Text/TextTool.js +7 -0
  57. package/src/Tools/TextureProjection/X3DTextureProjectorNodeTool.x3d +1 -1
  58. package/src/Undo/Editor.js +1 -1
  59. package/src/assets/html/application.html +71 -0
  60. package/src/assets/html/window.html +37 -0
  61. package/src/assets/themes/default.css +1333 -0
  62. package/src/assets/themes/prompt.css +48 -0
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ const
4
+ X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool"),
5
+ ToolColors = require ("../Core/ToolColors"),
6
+ X3D = require ("../../X3D"),
7
+ _ = require ("../../Application/GetText");
8
+
9
+ class ConeTool extends X3DGeometryNodeTool
10
+ {
11
+ #transformNode = null;
12
+ #changing = [false, false];
13
+
14
+ async initializeTool ()
15
+ {
16
+ await super .initializeTool ("CUSTOM");
17
+
18
+ // Transform Tool
19
+
20
+ const
21
+ transformNode = this .getToolScene () .createNode ("Transform"),
22
+ transformTool = await transformNode .getValue () .addTool () .getToolInstance ();
23
+
24
+ this .#transformNode = transformNode;
25
+
26
+ transformNode .scale .addInterest ("set_scale", this);
27
+ transformNode .scale .addFieldInterest (this .tool .size);
28
+ transformTool .getField ("isActive") .addInterest ("handleUndo", this);
29
+
30
+ transformNode .bboxSize = new X3D .Vector3 (2, 2, 2);
31
+ transformTool .group = this .getTypeName ();
32
+ transformTool .undo = false;
33
+ transformTool .tools = ["SCALE"];
34
+ transformTool .keys = ["SHIFT"];
35
+ transformTool .connectedAxes = ["XZ", "ZX"];
36
+ transformTool .centerDisplay = false;
37
+ transformTool .centerTool = false;
38
+ transformTool .bboxColor = ToolColors .BLUE;
39
+
40
+ this .tool .group = this .getTypeName ();
41
+ this .tool .undo = true;
42
+ this .tool .addChildren = new X3D .MFNode (transformNode);
43
+
44
+ // Connections
45
+
46
+ this .node ._height .addInterest ("set_height", this);
47
+ this .node ._bottomRadius .addInterest ("set_bottomRadius", this);
48
+
49
+ this .node ._side .addInterest ("set_optionNode", this);
50
+ this .node ._bottom .addInterest ("set_optionNode", this);
51
+ this .getBrowser () .getConeOptions () .addInterest ("set_optionNode", this);
52
+
53
+ this .set_height_and_bottomRadius ();
54
+ this .set_optionNode ();
55
+ }
56
+
57
+ disposeTool ()
58
+ {
59
+ this .node ._height .removeInterest ("set_height", this);
60
+ this .node ._bottomRadius .removeInterest ("set_bottomRadius", this);
61
+
62
+ this .node ._side .removeInterest ("set_optionNode", this);
63
+ this .node ._bottom .removeInterest ("set_optionNode", this);
64
+ this .getBrowser () .getConeOptions () .removeInterest ("set_optionNode", this);
65
+
66
+ super .disposeTool ();
67
+ }
68
+
69
+ getTransformTool ()
70
+ {
71
+ return this .#transformNode .getValue () .getTool ();
72
+ }
73
+
74
+ set_scale (scale)
75
+ {
76
+ if (this .#changing .includes (true))
77
+ {
78
+ this .#changing .fill (false);
79
+ return;
80
+ }
81
+
82
+ this .#changing .fill (true);
83
+
84
+ this .node ._height = Math .abs (scale .y) * 2;
85
+ this .node ._bottomRadius = scale .abs () .dot (new X3D .SFVec3f (1, 0, 1)) / 2;
86
+ }
87
+
88
+ set_height ()
89
+ {
90
+ this .set_height_and_bottomRadius (0);
91
+ }
92
+
93
+ set_bottomRadius ()
94
+ {
95
+ this .set_height_and_bottomRadius (1);
96
+ }
97
+
98
+ set_height_and_bottomRadius (i)
99
+ {
100
+ if (this .#changing [i])
101
+ {
102
+ this .#changing [i] = false;
103
+ return;
104
+ }
105
+
106
+ this .#changing [i] = true;
107
+
108
+ const
109
+ y = Math .abs (this .node ._height .getValue () / 2),
110
+ r = Math .abs (this .node ._bottomRadius .getValue ());
111
+
112
+ this .#transformNode .scale = new X3D .Vector3 (r, y, r);
113
+ }
114
+
115
+ set_optionNode ()
116
+ {
117
+ const
118
+ optionNode = this .getBrowser () .getConeOptions (),
119
+ dimension = optionNode ._dimension .getValue (),
120
+ coordIndex = [ ];
121
+
122
+ if (this .node ._side .getValue ())
123
+ coordIndex .push (... optionNode .getSideGeometry () ._coordIndex);
124
+
125
+ if (this .node ._bottom .getValue ())
126
+ {
127
+ coordIndex .push (... optionNode .getBottomGeometry () ._coordIndex);
128
+ coordIndex .splice (-1, 0, coordIndex .at (-dimension - 1));
129
+ }
130
+
131
+ this .tool .set_linesCoordIndex = coordIndex;
132
+ this .tool .linesCoord = optionNode .getSideGeometry () ._coord;
133
+
134
+ this .addExternalNode (optionNode .getSideGeometry () ._coord);
135
+ }
136
+
137
+ beginUndo ()
138
+ {
139
+ this .undoSaveInitialValues (["height", "bottomRadius"]);
140
+ }
141
+
142
+ getUndoDescription (activeTool, name)
143
+ {
144
+ if (name)
145
+ return _ ("Resize Node %s »%s«");
146
+
147
+ return _ ("Resize Node %s");
148
+ }
149
+ }
150
+
151
+ module .exports = ConeTool;
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+
3
+ const
4
+ X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool"),
5
+ ToolColors = require ("../Core/ToolColors"),
6
+ X3D = require ("../../X3D"),
7
+ _ = require ("../../Application/GetText");
8
+
9
+ class CylinderTool extends X3DGeometryNodeTool
10
+ {
11
+ #transformNode = null;
12
+ #changing = [false, false];
13
+
14
+ async initializeTool ()
15
+ {
16
+ await super .initializeTool ("CUSTOM");
17
+
18
+ // Transform Tool
19
+
20
+ const
21
+ transformNode = this .getToolScene () .createNode ("Transform"),
22
+ transformTool = await transformNode .getValue () .addTool () .getToolInstance ();
23
+
24
+ this .#transformNode = transformNode;
25
+
26
+ transformNode .scale .addInterest ("set_scale", this);
27
+ transformNode .scale .addFieldInterest (this .tool .size);
28
+ transformTool .getField ("isActive") .addInterest ("handleUndo", this);
29
+
30
+ transformNode .bboxSize = new X3D .Vector3 (2, 2, 2);
31
+ transformTool .group = this .getTypeName ();
32
+ transformTool .undo = false;
33
+ transformTool .tools = ["SCALE"];
34
+ transformTool .keys = ["SHIFT"];
35
+ transformTool .connectedAxes = ["XZ", "ZX"];
36
+ transformTool .centerDisplay = false;
37
+ transformTool .centerTool = false;
38
+ transformTool .bboxColor = ToolColors .BLUE;
39
+
40
+ this .tool .group = this .getTypeName ();
41
+ this .tool .undo = true;
42
+ this .tool .addChildren = new X3D .MFNode (transformNode);
43
+
44
+ // Connections
45
+
46
+ this .node ._height .addInterest ("set_height", this);
47
+ this .node ._radius .addInterest ("set_radius", this);
48
+
49
+ this .node ._side .addInterest ("set_optionNode", this);
50
+ this .node ._bottom .addInterest ("set_optionNode", this);
51
+ this .node ._top .addInterest ("set_optionNode", this);
52
+ this .getBrowser () .getCylinderOptions () .addInterest ("set_optionNode", this);
53
+
54
+ this .set_height_and_radius ();
55
+ this .set_optionNode ();
56
+ }
57
+
58
+ disposeTool ()
59
+ {
60
+ this .node ._height .removeInterest ("set_height", this);
61
+ this .node ._radius .removeInterest ("set_radius", this);
62
+
63
+ this .node ._side .removeInterest ("set_optionNode", this);
64
+ this .node ._bottom .removeInterest ("set_optionNode", this);
65
+ this .node ._top .removeInterest ("set_optionNode", this);
66
+ this .getBrowser () .getCylinderOptions () .removeInterest ("set_optionNode", this);
67
+
68
+ super .disposeTool ();
69
+ }
70
+
71
+ getTransformTool ()
72
+ {
73
+ return this .#transformNode .getValue () .getTool ();
74
+ }
75
+
76
+ set_scale (scale)
77
+ {
78
+ if (this .#changing .includes (true))
79
+ {
80
+ this .#changing .fill (false);
81
+ return;
82
+ }
83
+
84
+ this .#changing .fill (true);
85
+
86
+ this .node ._height = Math .abs (scale .y) * 2;
87
+ this .node ._radius = scale .abs () .dot (new X3D .SFVec3f (1, 0, 1)) / 2;
88
+ }
89
+
90
+ set_height ()
91
+ {
92
+ this .set_height_and_radius (0);
93
+ }
94
+
95
+ set_radius ()
96
+ {
97
+ this .set_height_and_radius (1);
98
+ }
99
+
100
+ set_height_and_radius (i)
101
+ {
102
+ if (this .#changing [i])
103
+ {
104
+ this .#changing [i] = false;
105
+ return;
106
+ }
107
+
108
+ this .#changing [i] = true;
109
+
110
+ const
111
+ y = Math .abs (this .node ._height .getValue () / 2),
112
+ r = Math .abs (this .node ._radius .getValue ());
113
+
114
+ this .#transformNode .scale = new X3D .Vector3 (r, y, r);
115
+ }
116
+
117
+ set_optionNode ()
118
+ {
119
+ const
120
+ optionNode = this .getBrowser () .getCylinderOptions (),
121
+ dimension = optionNode ._dimension .getValue (),
122
+ coordIndex = [ ];
123
+
124
+ if (this .node ._side .getValue ())
125
+ coordIndex .push (... optionNode .getSideGeometry () ._coordIndex);
126
+
127
+ if (this .node ._bottom .getValue ())
128
+ {
129
+ coordIndex .push (... optionNode .getBottomGeometry () ._coordIndex);
130
+ coordIndex .splice (-1, 0, coordIndex .at (-dimension - 1));
131
+ }
132
+
133
+ if (this .node ._top .getValue ())
134
+ {
135
+ coordIndex .push (... optionNode .getTopGeometry () ._coordIndex);
136
+ coordIndex .splice (-1, 0, coordIndex .at (-dimension - 1));
137
+ }
138
+
139
+ this .tool .set_linesCoordIndex = coordIndex;
140
+ this .tool .linesCoord = optionNode .getSideGeometry () ._coord;
141
+
142
+ this .addExternalNode (optionNode .getSideGeometry () ._coord);
143
+ }
144
+
145
+ beginUndo ()
146
+ {
147
+ this .undoSaveInitialValues (["height", "radius"]);
148
+ }
149
+
150
+ getUndoDescription (activeTool, name)
151
+ {
152
+ if (name)
153
+ return _ ("Resize Node %s »%s«");
154
+
155
+ return _ ("Resize Node %s");
156
+ }
157
+ }
158
+
159
+ module .exports = CylinderTool;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ const X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool");
4
+
5
+ class ElevationGridTool extends X3DGeometryNodeTool { }
6
+
7
+ module .exports = ElevationGridTool;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ const X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool");
4
+
5
+ class ExtrusionTool extends X3DGeometryNodeTool { }
6
+
7
+ module .exports = ExtrusionTool;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ const X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool");
4
+
5
+ class IndexedFaceSetTool extends X3DGeometryNodeTool { }
6
+
7
+ module .exports = IndexedFaceSetTool;
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ const
4
+ X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool"),
5
+ ToolColors = require ("../Core/ToolColors"),
6
+ X3D = require ("../../X3D"),
7
+ _ = require ("../../Application/GetText");
8
+
9
+ class SphereTool extends X3DGeometryNodeTool
10
+ {
11
+ #transformNode = null;
12
+ #changing = false;
13
+
14
+ async initializeTool ()
15
+ {
16
+ await super .initializeTool ("CUSTOM");
17
+
18
+ // Transform Tool
19
+
20
+ const
21
+ transformNode = this .getToolScene () .createNode ("Transform"),
22
+ transformTool = await transformNode .getValue () .addTool () .getToolInstance ();
23
+
24
+ this .#transformNode = transformNode;
25
+
26
+ transformNode .scale .addInterest ("set_scale", this);
27
+ transformNode .scale .addFieldInterest (this .tool .size);
28
+ transformTool .getField ("isActive") .addInterest ("handleUndo", this);
29
+
30
+ transformNode .bboxSize = new X3D .Vector3 (2, 2, 2);
31
+ transformTool .group = this .getTypeName ();
32
+ transformTool .undo = false;
33
+ transformTool .tools = ["SCALE"];
34
+ transformTool .keys = [ ];
35
+ transformTool .connectedAxes = ["XY", "XZ", "YX", "YZ", "ZX", "ZY"];
36
+ transformTool .centerDisplay = false;
37
+ transformTool .centerTool = false;
38
+ transformTool .bboxColor = ToolColors .BLUE;
39
+
40
+ this .tool .group = this .getTypeName ();
41
+ this .tool .undo = true;
42
+ this .tool .addChildren = new X3D .MFNode (transformNode);
43
+
44
+ // Connections
45
+
46
+ this .node ._radius .addInterest ("set_radius", this);
47
+ this .getBrowser () .getSphereOptions () .addInterest ("set_optionNode", this);
48
+
49
+ this .set_radius (this .node ._radius);
50
+ this .set_optionNode (this .getBrowser () .getSphereOptions ());
51
+ }
52
+
53
+ disposeTool ()
54
+ {
55
+ this .node ._radius .removeInterest ("set_radius", this);
56
+ this .getBrowser () .getSphereOptions () .removeInterest ("set_optionNode", this);
57
+
58
+ super .disposeTool ();
59
+ }
60
+
61
+ getTransformTool ()
62
+ {
63
+ return this .#transformNode .getValue () .getTool ();
64
+ }
65
+
66
+ set_scale (scale)
67
+ {
68
+ if (this .#changing)
69
+ {
70
+ this .#changing = false;
71
+ return;
72
+ }
73
+
74
+ this .#changing = true;
75
+
76
+ this .node ._radius = scale .abs () .dot (new X3D .SFVec3f (1, 1, 1)) / 3;
77
+ }
78
+
79
+ set_radius (radius)
80
+ {
81
+ if (this .#changing)
82
+ {
83
+ this .#changing = false;
84
+ return;
85
+ }
86
+
87
+ this .#changing = true;
88
+
89
+ const r = Math .abs (radius .getValue ());
90
+
91
+ this .#transformNode .scale = new X3D .Vector3 (r, r, r);
92
+ }
93
+
94
+ set_optionNode (optionNode)
95
+ {
96
+ this .tool .set_linesCoordIndex = optionNode .getGeometry () ._coordIndex;
97
+ this .tool .linesCoord = optionNode .getGeometry () ._coord;
98
+
99
+ this .addExternalNode (optionNode .getGeometry () ._coord);
100
+ }
101
+
102
+ beginUndo ()
103
+ {
104
+ this .undoSaveInitialValues (["radius"]);
105
+ }
106
+
107
+ getUndoDescription (activeTool, name)
108
+ {
109
+ if (name)
110
+ return _ ("Resize Node %s »%s«");
111
+
112
+ return _ ("Resize Node %s");
113
+ }
114
+ }
115
+
116
+ module .exports = SphereTool;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ const X3DGeometryNodeTool = require ("../Rendering/X3DGeometryNodeTool");
4
+
5
+ class GeoElevationGridTool extends X3DGeometryNodeTool
6
+ {
7
+ async initializeTool ()
8
+ {
9
+ await super .initializeTool ();
10
+
11
+ this .tool .linewidthScaleFactor = 1;
12
+ }
13
+ }
14
+
15
+ module .exports = GeoElevationGridTool;
@@ -9,8 +9,8 @@
9
9
  <meta name='comment' content='Rise and Shine'/>
10
10
  <meta name='created' content='Fri, 29 Aug 2014 13:13:27 GMT'/>
11
11
  <meta name='creator' content='Holger Seelig'/>
12
- <meta name='generator' content='Sunrize X3D Editor V1.1.9, https://create3000.github.io/sunrize/'/>
13
- <meta name='modified' content='Tue, 21 Nov 2023 18:32:21 GMT'/>
12
+ <meta name='generator' content='Sunrize X3D Editor V1.2.7, https://create3000.github.io/sunrize/'/>
13
+ <meta name='modified' content='Tue, 28 Nov 2023 22:34:13 GMT'/>
14
14
  </head>
15
15
  <Scene>
16
16
  <ExternProtoDeclare name='ToolShader' url='"../Shaders/ToolShader.x3d"'>
@@ -54,6 +54,8 @@
54
54
  <connect nodeField='emissiveColor' protoField='bboxColor'/>
55
55
  </IS>
56
56
  </UnlitMaterial>
57
+ <DepthMode
58
+ polygonOffset='-1 -1'/>
57
59
  </Appearance>
58
60
  <IndexedLineSet
59
61
  coordIndex='0, 1, 2, 3, 0, -1, 4, 5, 6, 7, 4, -1, 0, 4, -1, 3, 7, -1, 1, 5, -1, 2, 6, -1'>
@@ -423,6 +425,7 @@ function eventsProcessed ()
423
425
  </ProtoBody>
424
426
  </ProtoDeclare>
425
427
  <ProtoInstance name='Tool'>
428
+ <fieldValue name='bboxDisplay' value='true'/>
426
429
  <fieldValue name='bboxSize' value='2 3 4'/>
427
430
  </ProtoInstance>
428
431
  </Scene>
@@ -4,7 +4,6 @@ const
4
4
  X3DChildNodeTool = require ("../Core/X3DChildNodeTool"),
5
5
  X3D = require ("../../X3D"),
6
6
  Editor = require ("../../Undo/Editor"),
7
- UndoManager = require ("../../Undo/UndoManager"),
8
7
  ActionKeys = require ("../../Application/ActionKeys"),
9
8
  _ = require ("../../Application/GetText");
10
9
 
@@ -50,7 +49,10 @@ class X3DTransformNodeTool extends X3DChildNodeTool
50
49
 
51
50
  set_keys__ (keys)
52
51
  {
53
- if (!this .tool .keys)
52
+ if ((keys & ActionKeys .Option) && !this .tool .keys .includes ("OPTION"))
53
+ return;
54
+
55
+ if ((keys & ActionKeys .Shift) && !this .tool .keys .includes ("SHIFT"))
54
56
  return;
55
57
 
56
58
  if (this .tool .tools .includes ("TRANSLATE"))