sunrize 2.1.21 → 2.2.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 (40) hide show
  1. package/package.json +6 -6
  2. package/src/Application/Application.js +14 -15
  3. package/src/Application/Document.js +113 -60
  4. package/src/Application/Interface.js +1 -1
  5. package/src/Application/Tabs.js +377 -48
  6. package/src/Controls/AddPrototypePopover.js +2 -1
  7. package/src/Controls/AnimationPropertiesPopover.js +3 -4
  8. package/src/Controls/EditNodePopover.js +4 -1
  9. package/src/Controls/EditUserDefinedFieldPopover.js +4 -1
  10. package/src/Controls/ExportNodePopover.js +3 -1
  11. package/src/Controls/ImportNodePopover.js +3 -1
  12. package/src/Editors/AnimationEditor.js +8 -3
  13. package/src/Editors/BrowserFrame.js +44 -30
  14. package/src/Editors/NodeList.js +2 -2
  15. package/src/Editors/SceneProperties.js +7 -3
  16. package/src/Editors/ScriptEditor.js +1 -0
  17. package/src/Tools/Core/X3DPrototypeInstanceTool.js +2 -0
  18. package/src/Tools/Grids/AxonometricGridTool.js +1 -1
  19. package/src/Tools/Grids/X3DGridNodeTool.js +7 -13
  20. package/src/Tools/Rendering/X3DGeometryNodeTool.x3d +6 -7
  21. package/src/Tools/Shaders/ToolShader.x3d +13 -6
  22. package/src/Undo/Editor.js +81 -79
  23. package/src/assets/html/application-template.html +95 -27
  24. package/src/assets/html/application.html +95 -27
  25. package/src/assets/images/seti/audio.svg +44 -0
  26. package/src/assets/images/seti/default.svg +36 -0
  27. package/src/assets/images/seti/html.svg +37 -0
  28. package/src/assets/images/seti/image.svg +37 -0
  29. package/src/assets/images/seti/json.svg +37 -0
  30. package/src/assets/images/seti/obj.svg +50 -0
  31. package/src/assets/images/seti/others.svg +50 -0
  32. package/src/assets/images/seti/ply.svg +50 -0
  33. package/src/assets/images/seti/sog.svg +57 -0
  34. package/src/assets/images/seti/spz.svg +57 -0
  35. package/src/assets/images/seti/stl.svg +50 -0
  36. package/src/assets/images/seti/svg.svg +41 -0
  37. package/src/assets/images/seti/video.svg +36 -0
  38. package/src/assets/images/seti/vrml.svg +34 -0
  39. package/src/assets/themes/default.css +12 -1
  40. package/src/assets/themes/system-colors.css +4 -9
@@ -66,6 +66,7 @@ $.fn.editUserDefinedFieldPopover = function (executionContext, node, field = -1)
66
66
 
67
67
  const nameInput = $("<input></input>")
68
68
  .attr ("placeholder", _("Enter a name"))
69
+ .attr ("spellcheck", "true")
69
70
  .appendTo (content);
70
71
 
71
72
  if (field instanceof X3D .X3DField)
@@ -89,6 +90,7 @@ $.fn.editUserDefinedFieldPopover = function (executionContext, node, field = -1)
89
90
  $("<input></input>")
90
91
  .addClass ("appinfo")
91
92
  .attr ("placeholder", _("Enter application information"))
93
+ .attr ("spellcheck", "true")
92
94
  .val (field .getAppInfo ())
93
95
  .appendTo (content);
94
96
 
@@ -99,6 +101,7 @@ $.fn.editUserDefinedFieldPopover = function (executionContext, node, field = -1)
99
101
  $("<input></input>")
100
102
  .addClass ("documentation")
101
103
  .attr ("placeholder", _("Enter documentation"))
104
+ .attr ("spellcheck", "true")
102
105
  .val (field .getDocumentation ())
103
106
  .appendTo (content);
104
107
  }
@@ -129,7 +132,7 @@ $.fn.editUserDefinedFieldPopover = function (executionContext, node, field = -1)
129
132
  wide: field instanceof X3D .X3DField,
130
133
  },
131
134
  events: {
132
- show (event, api)
135
+ show (/* event, api */)
133
136
  {
134
137
  nameInput .off () .validate (Editor .Id, () =>
135
138
  {
@@ -23,6 +23,7 @@ $.fn.exportNodePopover = function (node, oldExportedName, oldDescription = "")
23
23
 
24
24
  const nameInput = $("<input></input>")
25
25
  .attr ("placeholder", _("Enter exported name"))
26
+ .attr ("spellcheck", "true")
26
27
  .val (oldExportedName || scene .getUniqueExportName (node .getName ()))
27
28
  .appendTo (content);
28
29
 
@@ -32,12 +33,13 @@ $.fn.exportNodePopover = function (node, oldExportedName, oldDescription = "")
32
33
 
33
34
  const descriptionInput = $("<input></input>")
34
35
  .attr ("placeholder", _("Enter description"))
36
+ .attr ("spellcheck", "true")
35
37
  .val (oldDescription)
36
38
  .appendTo (content);
37
39
 
38
40
  // Create tooltip.
39
41
 
40
- const tooltip = this .popover ({
42
+ this .popover ({
41
43
  content: content,
42
44
  extension:
43
45
  {
@@ -23,6 +23,7 @@ $.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName, ol
23
23
 
24
24
  const nameInput = $("<input></input>")
25
25
  .attr ("placeholder", _("Enter imported name"))
26
+ .attr ("spellcheck", "true")
26
27
  .val (oldImportedName || executionContext .getUniqueImportName (exportedName))
27
28
  .appendTo (content);
28
29
 
@@ -32,12 +33,13 @@ $.fn.importNodePopover = function (inlineNode, exportedName, oldImportedName, ol
32
33
 
33
34
  const descriptionInput = $("<input></input>")
34
35
  .attr ("placeholder", _("Enter description"))
36
+ .attr ("spellcheck", "true")
35
37
  .val (oldDescription)
36
38
  .appendTo (content);
37
39
 
38
40
  // Create tooltip.
39
41
 
40
- const tooltip = this .popover ({
42
+ this .popover ({
41
43
  content: content,
42
44
  extension:
43
45
  {
@@ -229,6 +229,7 @@ module .exports = class AnimationEditor extends Interface
229
229
  .addClass ("node-name")
230
230
  .attr ("title", _("Rename animation."))
231
231
  .attr ("placeholder", _("Enter animation name."))
232
+ .attr ("spellcheck", "true")
232
233
  .appendTo (this .verticalSplitterLeft)
233
234
  .validate (Editor .Id, () =>
234
235
  {
@@ -279,7 +280,7 @@ module .exports = class AnimationEditor extends Interface
279
280
  this .keyTypeElement .val (this .config .file .keyType);
280
281
  }
281
282
 
282
- colorScheme (shouldUseDarkColors)
283
+ colorScheme (/* shouldUseDarkColors */)
283
284
  {
284
285
  this .requestDrawTimeline ();
285
286
  }
@@ -425,6 +426,10 @@ module .exports = class AnimationEditor extends Interface
425
426
  this .propertiesIcon,
426
427
  this .keyTypeElement,
427
428
  this .timeElement,
429
+ this .zoomOutIcon,
430
+ this .zoomInIcon,
431
+ this .zoomFitIcon,
432
+ this .zoom100Icon,
428
433
  ]
429
434
  .flatMap (object => [... object]))
430
435
  .removeClass (enabled ? "disabled" : [ ])
@@ -818,7 +823,7 @@ module .exports = class AnimationEditor extends Interface
818
823
  }
819
824
 
820
825
  const keyType = Object .entries (keyTypes)
821
- .find (([key, value]) => value === this .getSelectedKeyframes () .length);
826
+ .find (([, value]) => value === this .getSelectedKeyframes () .length);
822
827
 
823
828
  this .keyTypeElement .val (keyType ?.[0] ?? "MIXED");
824
829
  }
@@ -2737,7 +2742,7 @@ module .exports = class AnimationEditor extends Interface
2737
2742
  event .stopPropagation ();
2738
2743
  }
2739
2744
 
2740
- on_mouseup_scrollbar (event)
2745
+ on_mouseup_scrollbar ()
2741
2746
  {
2742
2747
  $(document) .off ("mouseup.AnimationEditorScrollbar");
2743
2748
 
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  const
4
- $ = require ("jquery"),
5
- Dialog = require ("../Controls/Dialog"),
6
- _ = require ("../Application/GetText");
4
+ $ = require ("jquery"),
5
+ X3D = require ("../X3D"),
6
+ Dialog = require ("../Controls/Dialog"),
7
+ Editor = require ("../Undo/Editor"),
8
+ UndoManager = require ("../Undo/UndoManager"),
9
+ _ = require ("../Application/GetText");
7
10
 
8
11
  module .exports = new class BrowserFrame extends Dialog
9
12
  {
@@ -37,7 +40,7 @@ module .exports = new class BrowserFrame extends Dialog
37
40
  .attr ("min", 1)
38
41
  .attr ("step", "1")
39
42
  .css ("width", "calc((100% - 20px) / 2)")
40
- .on ("change", () => this .onsize ());
43
+ .on ("input", () => this .onsize ());
41
44
 
42
45
  const x = $("<span></span>")
43
46
  .css ({ "display": "inline-block", "width": "20px", "text-align": "center" })
@@ -48,7 +51,7 @@ module .exports = new class BrowserFrame extends Dialog
48
51
  .attr ("min", 1)
49
52
  .attr ("step", "1")
50
53
  .css ("width", "calc((100% - 20px) / 2)")
51
- .on ("change", () => this .onsize ());
54
+ .on ("input", () => this .onsize ());
52
55
 
53
56
  $("<tr></tr>")
54
57
  .append ($("<th></th>")
@@ -78,7 +81,7 @@ module .exports = new class BrowserFrame extends Dialog
78
81
  .attr ("min", 1)
79
82
  .attr ("step", "1")
80
83
  .css ("width", "calc((100% - 20px) / 2)")
81
- .on ("change", () => this .onchange ());
84
+ .on ("input", () => this .onchange ());
82
85
 
83
86
  const slash = $("<span></span>")
84
87
  .css ({ "display": "inline-block", "width": "20px", "text-align": "center" })
@@ -89,7 +92,7 @@ module .exports = new class BrowserFrame extends Dialog
89
92
  .attr ("min", 1)
90
93
  .attr ("step", "1")
91
94
  .css ("width", "calc((100% - 20px) / 2)")
92
- .on ("change", () => this .onchange ());
95
+ .on ("input", () => this .onchange ());
93
96
 
94
97
  $("<tr></tr>")
95
98
  .append ($("<th></th>")
@@ -121,24 +124,25 @@ module .exports = new class BrowserFrame extends Dialog
121
124
  {
122
125
  super .configure ({ size: [388, 175] });
123
126
 
124
- this .config .file .setDefaultValues ({
125
- fixedSize: false,
126
- numerator: 1,
127
- denominator: 1,
128
- backgroundColor: "",
129
- });
130
-
127
+ this .connect (Editor .getConfigNode (this .browser .currentScene));
131
128
  this .updateInputs ();
132
129
  this .onresize ();
133
130
  }
134
131
 
132
+ connect (configNode)
133
+ {
134
+ configNode ?.addMetaDataCallback (this, "Sunrize/BrowserFrame/fixedSize", () => this .updateInputs ());
135
+ configNode ?.addMetaDataCallback (this, "Sunrize/BrowserFrame/aspectRatio", () => this .updateInputs ());
136
+ configNode ?.addMetaDataCallback (this, "Sunrize/BrowserFrame/backgroundColor", () => this .updateInputs ());
137
+ }
138
+
135
139
  updateInputs ()
136
140
  {
137
141
  const
138
- fixedSize = this .config .file .fixedSize,
139
- numerator = this .config .file .numerator,
140
- denominator = this .config .file .denominator,
141
- backgroundColor = this .config .file .backgroundColor;
142
+ configNode = Editor .getConfigNode (this .browser .currentScene),
143
+ [fixedSize = false] = configNode ?.getMetaData ("Sunrize/BrowserFrame/fixedSize") ?? [ ],
144
+ [numerator = 1, denominator = 1] = configNode ?.getMetaData ("Sunrize/BrowserFrame/aspectRatio") ?? [ ],
145
+ [backgroundColor = ""] = configNode ?.getMetaData ("Sunrize/BrowserFrame/backgroundColor") ?? [ ];
142
146
 
143
147
  this .updateSize ();
144
148
 
@@ -156,12 +160,22 @@ module .exports = new class BrowserFrame extends Dialog
156
160
 
157
161
  onchange ()
158
162
  {
159
- this .config .file .fixedSize = this .fixedSize .prop ("checked");
160
- this .config .file .numerator = this .numerator .val ();
161
- this .config .file .denominator = this .denominator .val ();
162
- this .config .file .backgroundColor = this .backgroundColor .val ();
163
+ const
164
+ configNode = Editor .getConfigNode (this .browser .currentScene, true),
165
+ fixedSize = new X3D .SFBool (this .fixedSize .prop ("checked")),
166
+ aspectRatio = new X3D .MFDouble (this .numerator .val (), this .denominator .val ()),
167
+ backgroundColor = new X3D .SFString (this .backgroundColor .val ());
163
168
 
164
- this .onresize ();
169
+ this .connect (configNode);
170
+
171
+ UndoManager .shared .beginUndo (_("Change Browser Frame"));
172
+
173
+ Editor .setNodeMetaData (configNode, "Sunrize/BrowserFrame/fixedSize", fixedSize);
174
+ Editor .setNodeMetaData (configNode, "Sunrize/BrowserFrame/aspectRatio", aspectRatio);
175
+ Editor .setNodeMetaData (configNode, "Sunrize/BrowserFrame/backgroundColor", backgroundColor);
176
+ Editor .deferFunction (() => this .onresize ());
177
+
178
+ UndoManager .shared .endUndo ();
165
179
  }
166
180
 
167
181
  /**
@@ -170,13 +184,13 @@ module .exports = new class BrowserFrame extends Dialog
170
184
  onresize ()
171
185
  {
172
186
  const
173
- fixedSize = this .config .file .fixedSize,
174
- numerator = this .config .file .numerator,
175
- denominator = this .config .file .denominator,
176
- backgroundColor = this .config .file .backgroundColor,
177
- aspectRatio = numerator / denominator,
178
- frameAspectRatio = $("#browser-frame") .width () / $("#browser-frame") .height (),
179
- element = $(this .browser .element);
187
+ configNode = Editor .getConfigNode (this .browser .currentScene),
188
+ [fixedSize = false] = configNode ?.getMetaData ("Sunrize/BrowserFrame/fixedSize") ?? [ ],
189
+ [numerator = 1, denominator = 1] = configNode ?.getMetaData ("Sunrize/BrowserFrame/aspectRatio") ?? [ ],
190
+ [backgroundColor = ""] = configNode ?.getMetaData ("Sunrize/BrowserFrame/backgroundColor") ?? [ ],
191
+ aspectRatio = numerator / denominator,
192
+ frameAspectRatio = $("#browser-frame") .width () / $("#browser-frame") .height (),
193
+ element = $(this .browser .element);
180
194
 
181
195
  if (fixedSize && aspectRatio)
182
196
  {
@@ -54,8 +54,8 @@ module .exports = class NodeList extends Interface
54
54
  .filter (this .filter);
55
55
 
56
56
  // this .nodes = this .nodes
57
- // .sort ((a, b) => Algorithm .cmp (this .getName (a), this .getName (b)))
58
- // .sort ((a, b) => Algorithm .cmp (a .getTypeName (), b .getTypeName ()))
57
+ // .sort ((a, b) => this .getName (a) .localeCompare (this .getName (b), "en"))
58
+ // .sort ((a, b) => a .getTypeName () .localeCompare (b .getTypeName (), "en"));
59
59
 
60
60
  for (const node of this .nodes)
61
61
  {
@@ -213,7 +213,7 @@ module .exports = new class SceneProperties extends Dialog
213
213
 
214
214
  return helper;
215
215
  },
216
- update: (event, ui) =>
216
+ update: (/* event, ui */) =>
217
217
  {
218
218
  this .changeMetaData ();
219
219
  },
@@ -248,8 +248,8 @@ module .exports = new class SceneProperties extends Dialog
248
248
  .attr ("type", "checkbox")
249
249
  .on ("click", () => this .toggleWorldInfo ());
250
250
 
251
- this .worldInfo .inputs .title = $("<input></input>");
252
- this .worldInfo .inputs .info = $("<textarea></textarea>") .height ("100%") .css ("resize", "none");
251
+ this .worldInfo .inputs .title = $("<input></input>") .attr ("spellcheck", "true");
252
+ this .worldInfo .inputs .info = $("<textarea></textarea>") .attr ("spellcheck", "true") .height ("100%") .css ("resize", "none");
253
253
 
254
254
  this .worldInfo .checkboxRow = $("<tr></tr>")
255
255
  .height ("19.5px")
@@ -494,12 +494,14 @@ module .exports = new class SceneProperties extends Dialog
494
494
  .append ($("<input></input>")
495
495
  .attr ("index", 0)
496
496
  .attr ("placeholder", _("Insert meta key here."))
497
+ .attr ("spellcheck", "true")
497
498
  .val (key) .on ("change", (event) => this .changeMetaData (event, key))))
498
499
  .append ($("<td></td>")
499
500
  .addClass ("meta-value")
500
501
  .append ($("<input></input>")
501
502
  .attr ("index", 1)
502
503
  .attr ("placeholder", _("Insert meta value here."))
504
+ .attr ("spellcheck", "true")
503
505
  .val (value)
504
506
  .on ("change", (event) => this .changeMetaData (event, key))))
505
507
  .append ($("<td></td>")
@@ -562,10 +564,12 @@ module .exports = new class SceneProperties extends Dialog
562
564
  .append ($("<td></td>")
563
565
  .append ($("<input></input>")
564
566
  .attr ("placeholder", _("Add new meta key."))
567
+ .attr ("spellcheck", "true")
565
568
  .on ("change", event => this .changeMetaData (event, ""))))
566
569
  .append ($("<td></td>")
567
570
  .append ($("<input></input>")
568
571
  .prop ("readonly", true)
572
+ .attr ("spellcheck", "true")
569
573
  .on ("change", event => this .changeMetaData (event, ""))))
570
574
  .append ($("<td></td>"))
571
575
  .appendTo (this .metaData .table .foot .empty ());
@@ -119,6 +119,7 @@ module .exports = class ScriptEditor extends Interface
119
119
  .addClass ("node-name")
120
120
  .attr ("title", _("Rename node."))
121
121
  .attr ("placeholder", _("Enter node name."))
122
+ .attr ("spellcheck", "true")
122
123
  .appendTo (this .horizontalSplitterTop)
123
124
  .renameNodeInput (null);
124
125
 
@@ -10,6 +10,7 @@ class X3DPrototypeInstanceTool extends X3DNodeTool
10
10
  {
11
11
  super (node);
12
12
 
13
+ node .getProtoNode () ._updateInstances .addInterest ("set_toolRootNodes", this);
13
14
  node .getBody () .rootNodes .addInterest ("set_toolRootNodes", this);
14
15
 
15
16
  this .set_toolRootNodes ();
@@ -33,6 +34,7 @@ class X3DPrototypeInstanceTool extends X3DNodeTool
33
34
  {
34
35
  try
35
36
  {
37
+ this .node .getProtoNode () ._updateInstances .removeInterest ("set_toolRootNodes", this);
36
38
  this .node .getBody () .rootNodes .removeInterest ("set_toolRootNodes", this);
37
39
 
38
40
  this .node .getInnerNode () .removeTool ();
@@ -93,7 +93,7 @@ class AxonometricGridTool extends X3DGridNodeTool
93
93
  return p;
94
94
  }
95
95
 
96
- getSnapPositionWithNormal (position, direction)
96
+ getSnapPositionWithNormal (position)
97
97
  {
98
98
  return position;
99
99
  }
@@ -62,7 +62,7 @@ class X3DGridNodeTool extends X3DActiveLayerNodeTool
62
62
  if (!this .toolLayerNode)
63
63
  return;
64
64
 
65
- const configNode = Editor .getConfigNode (this .getBrowser ());
65
+ const configNode = Editor .getLayerConfigNode (this .getBrowser ());
66
66
 
67
67
  for (const field of this .tool .getValue () .getFields ())
68
68
  {
@@ -91,15 +91,15 @@ class X3DGridNodeTool extends X3DActiveLayerNodeTool
91
91
 
92
92
  if (field .equals (this .tool .getFieldDefinition (field .getName ()) .getValue ()))
93
93
  {
94
- const configNode = Editor .getConfigNode (this .getBrowser ());
94
+ const configNode = Editor .getLayerConfigNode (this .getBrowser ());
95
95
 
96
96
  configNode ?.removeMetaData (path);
97
97
  }
98
98
  else
99
99
  {
100
- const configNode = Editor .getConfigNode (this .getBrowser (), true);
100
+ const configNode = Editor .getLayerConfigNode (this .getBrowser (), true);
101
101
 
102
- configNode .setMetaData (path, field);
102
+ configNode ?.setMetaData (path, field);
103
103
  }
104
104
  }
105
105
 
@@ -168,15 +168,9 @@ class X3DGridNodeTool extends X3DActiveLayerNodeTool
168
168
 
169
169
  const absoluteMatrix = transformTool .getCurrentMatrix () .multRight (transformTool .getModelMatrix ());
170
170
 
171
- if (transformTool .tool .keepCenter || !this .tool .snapToCenter)
172
- {
173
- // snapping to bbox center.
174
- var position = transformTool .getSubBBox (new X3D .Box3 ()) .multRight (absoluteMatrix) .center;
175
- }
176
- else
177
- {
178
- var position = absoluteMatrix .multVecMatrix (transformTool ._center .getValue () .copy ());
179
- }
171
+ const position = transformTool .tool .keepCenter || !this .tool .snapToCenter
172
+ ? transformTool .getSubBBox (new X3D .Box3 ()) .multRight (absoluteMatrix) .center
173
+ : absoluteMatrix .multVecMatrix (transformTool ._center .getValue () .copy ());
180
174
 
181
175
  // Calculate snapping position and apply absolute translation.
182
176
 
@@ -4,15 +4,15 @@
4
4
  <head>
5
5
  <component name='Core' level='2'/>
6
6
  <component name='Shaders' level='1'/>
7
- <component name='X_ITE' level='1'/>
8
7
  <meta name='created' content='Tue, 28 Nov 2023 21:59:27 GMT'/>
9
8
  <meta name='comment' content='Rise and Shine'/>
10
9
  <meta name='creator' content='Holger Seelig'/>
11
- <meta name='generator' content='Sunrize X3D Editor V2.0.7, https://create3000.github.io/sunrize/'/>
12
- <meta name='modified' content='Sun, 08 Mar 2026 19:34:05 GMT'/>
10
+ <meta name='generator' content='Sunrize X3D Editor V2.2.0, https://create3000.github.io/sunrize/'/>
11
+ <meta name='modified' content='Sun, 23 Aug 2026 07:25:05 GMT'/>
13
12
  </head>
14
13
  <Scene>
15
14
  <ExternProtoDeclare name='ToolShader' url='"../Shaders/ToolShader.x3d"'>
15
+ <field accessType='inputOutput' type='SFFloat' name='depthOffset'/>
16
16
  <field accessType='inputOutput' type='SFBool' name='instanced'/>
17
17
  </ExternProtoDeclare>
18
18
  <ProtoDeclare name='X3DGeometryNodeTool'>
@@ -60,9 +60,9 @@
60
60
  <connect nodeField='emissiveColor' protoField='linesColor'/>
61
61
  </IS>
62
62
  </Material>
63
- <ProtoInstance name='ToolShader' DEF='_1' containerField='shaders'/>
64
- <DepthMode DEF='_2'
65
- polygonOffset='-1 -1'/>
63
+ <ProtoInstance name='ToolShader' DEF='_1' containerField='shaders'>
64
+ <fieldValue name='depthOffset' value='1e-5'/>
65
+ </ProtoInstance>
66
66
  </Appearance>
67
67
  <IndexedLineSet>
68
68
  <IS>
@@ -91,7 +91,6 @@
91
91
  </IS>
92
92
  </Material>
93
93
  <ProtoInstance name='ToolShader' USE='_1' containerField='shaders'/>
94
- <DepthMode USE='_2'/>
95
94
  </Appearance>
96
95
  <PointSet>
97
96
  <IS>
@@ -1,29 +1,32 @@
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
5
  <component name='Shaders' level='1'/>
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.7.1, https://create3000.github.io/sunrize/'/>
9
+ <meta name='generator' content='Sunrize X3D Editor V2.2.0, https://create3000.github.io/sunrize/'/>
10
10
  <meta name='identifier' content='file:///Users/holger/Desktop/X_ITE/sunrize/src/sunrize/Tools/Shaders/ToolShader.x3d'/>
11
- <meta name='modified' content='Sat, 29 Jun 2024 11:30:31 GMT'/>
11
+ <meta name='modified' content='Sun, 23 Aug 2026 07:44:54 GMT'/>
12
12
  </head>
13
13
  <Scene>
14
14
  <ProtoDeclare name='ToolShader'>
15
15
  <ProtoInterface>
16
+ <field accessType='inputOutput' type='SFFloat' name='depthOffset' appinfo='depthOffset is in Normalized Device Coordinates (NDC)'/>
16
17
  <field accessType='inputOutput' type='SFBool' name='instanced'/>
17
18
  </ProtoInterface>
18
19
  <ProtoBody>
19
20
  <ComposedShader DEF='ToolShader'
20
21
  language='GLSL'>
22
+ <field accessType='inputOutput' type='SFFloat' name='depthOffset'/>
21
23
  <field accessType='inputOutput' type='SFBool' name='instanced'/>
22
24
  <IS>
25
+ <connect nodeField='depthOffset' protoField='depthOffset'/>
23
26
  <connect nodeField='instanced' protoField='instanced'/>
24
27
  </IS>
25
28
  <ShaderPart DEF='ToolVertexShader'>
26
- <![CDATA[data:text/plain,#version 300 es
29
+ <![CDATA[data:x-shader/x-fragment,#version 300 es
27
30
 
28
31
  precision highp float;
29
32
 
@@ -33,6 +36,8 @@ uniform mat3 x3d_NormalMatrix;
33
36
 
34
37
  uniform x3d_PointPropertiesParameters x3d_PointProperties;
35
38
 
39
+ // depthOffset is in Normalized Device Coordinates (NDC)
40
+ uniform float depthOffset;
36
41
  uniform bool instanced;
37
42
 
38
43
  in mat4 x3d_InstanceMatrix;
@@ -53,12 +58,14 @@ main ()
53
58
  normal = normalize (x3d_NormalMatrix * x3d_Normal);
54
59
 
55
60
  gl_Position = x3d_ProjectionMatrix * x3d_ModelViewMatrix * instancedMatrix * x3d_Vertex;
61
+
62
+ gl_Position .z -= depthOffset * gl_Position .w;
56
63
  }
57
64
  ]]>
58
65
  </ShaderPart>
59
66
  <ShaderPart DEF='ToolFragmentShader'
60
67
  type='FRAGMENT'>
61
- <![CDATA[data:text/plain,#version 300 es
68
+ <![CDATA[data:x-shader/x-vertex,#version 300 es
62
69
 
63
70
  precision highp float;
64
71