1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
|
3 | <X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'> |
4 | <head> |
5 | <meta name='title' content=' GridXZ_20x20Movable.x3d '/> |
6 | <meta name='creator' content='MV4204 class'/> |
7 | <meta name='created' content='22 November 2000'/> |
8 | <meta name='modified' content='28 November 2019'/> |
9 | <meta name='description' content='Line grid authoring tool for precise measurement in 3D space: drag plane to move along Y axis, click numbers to hide grid. Oriented along XZ plane, size 20m by 20m, default block size 1m by 1m.'/> |
10 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Authoring/GridXZ_20x20Movable.x3d '/> |
11 | <meta name='generator' content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
12 | <meta name='license' content='../../license.html'/> |
13 | </head> |
14 | <Scene> |
15 | <!-- Viewpoint above X axis, rotated left and oriented down to face center --> |
16 | <WorldInfo title='GridXZ_20x20Movable.x3d'/> |
17 | <Viewpoint description='XZ grid (0 10 25 relative)' orientation='1 0 0 -0.4' position='0 10 25'/> |
18 | <Transform center='25 10 0' rotation='0 1 0 1.57079'> |
19 | <Viewpoint description='XZ grid (25 10 0 relative)' orientation='1 0 0 -0.4' position='25 10 0'/> |
20 | </Transform> |
21 |
<!-- ROUTE information for GridLocation node:
[from LineSensorAxisY.translation_changed to set_translation
]
-->
<Transform DEF='GridLocation'> |
22 | <Group> |
23 |
<!-- ROUTE information for TextLabelTouchSensor node:
[from isActive to SwitchTextOnOffScript.isTouched
]
-->
<TouchSensor DEF='TextLabelTouchSensor' description='select and hold to hide grid'/> |
24 | <Transform translation='0 -0.5 0'> |
25 | <Billboard> |
26 | <Shape> |
27 |
<!-- ROUTE information for CenterText node:
[from CenterTextScript.value to string
]
-->
<Text DEF='CenterText' string='"origin"'> |
28 | |
29 | </Text> |
30 |
<!-- Appearance
DefaultAppearance is a DEF node that has 4 USE nodes: USE_1, USE_2, USE_3, USE_4 -->
<Appearance DEF='DefaultAppearance'> |
31 | <Material/> |
32 | </Appearance> |
33 | </Shape> |
34 | </Billboard> |
35 | </Transform> |
36 | <Transform translation='10 -0.5 10'> |
37 | <Billboard> |
38 | <Shape> |
39 |
<!-- ROUTE information for SouthEastText node:
[from SouthEastTextScript.value to string
]
-->
<Text DEF='SouthEastText' string='"10 0 10"'> |
40 | <FontStyle USE='LABEL_FONT'/> |
41 | </Text> |
42 | <Appearance USE='DefaultAppearance'/> |
43 | </Shape> |
44 | </Billboard> |
45 | </Transform> |
46 | <Transform translation='10 -0.5 -10'> |
47 | <Billboard> |
48 | <Shape> |
49 |
<!-- ROUTE information for NorthEastText node:
[from NorthEastTextScript.value to string
]
-->
<Text DEF='NorthEastText' string='"10 0 -10"'> |
50 | <FontStyle USE='LABEL_FONT'/> |
51 | </Text> |
52 | <Appearance USE='DefaultAppearance'/> |
53 | </Shape> |
54 | </Billboard> |
55 | </Transform> |
56 | <Transform translation='-10 -0.5 -10'> |
57 | <Billboard> |
58 | <Shape> |
59 |
<!-- ROUTE information for NorthWestText node:
[from NorthWestTextScript.value to string
]
-->
<Text DEF='NorthWestText' string='"-10 0 -10"'> |
60 | <FontStyle USE='LABEL_FONT'/> |
61 | </Text> |
62 | <Appearance USE='DefaultAppearance'/> |
63 | </Shape> |
64 | </Billboard> |
65 | </Transform> |
66 | <Transform translation='-10 -0.5 10'> |
67 | <Billboard> |
68 | <Shape> |
69 |
<!-- ROUTE information for SouthWestText node:
[from SouthWestTextScript.value to string
]
-->
<Text DEF='SouthWestText' string='"-10 0 10"'> |
70 | <FontStyle USE='LABEL_FONT'/> |
71 | </Text> |
72 | <Appearance USE='DefaultAppearance'/> |
73 | </Shape> |
74 | </Billboard> |
75 | </Transform> |
76 | </Group> |
77 |
<!-- ROUTE information for GridOnOffSwitch node:
[from SwitchTextOnOffScript.touchChoice to whichChoice
]
-->
<Switch DEF='GridOnOffSwitch' whichChoice='0'> |
78 | <Group> |
79 |
<!-- ROUTE information for GridSensor node:
[from translation_changed to LineSensorAxisY.set_translation
]
-->
<PlaneSensor DEF='GridSensor' description='click and drag to move grid'/> |
80 |
<!-- ROUTE information for LineSensorAxisY node:
[from GridSensor.translation_changed to set_translation
]
[from translation_changed to GridLocation.set_translation
]
[from translation_changed to CenterTextScript.set_translation
]
[from translation_changed to SouthEastTextScript.set_translation
]
[from translation_changed to NorthEastTextScript.set_translation
]
[from translation_changed to NorthWestTextScript.set_translation
]
[from translation_changed to SouthWestTextScript.set_translation
]
-->
<Script DEF='LineSensorAxisY'> |
81 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
82 | <field name='translation_changed' type='SFVec3f' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function set_translation (location, timeStamp) { translation_changed [0] = 0; translation_changed [1] = location.y; translation_changed [2] = 0; // Browser.println ('location=' + location + ', translation_changed=' + translation_changed); }
]]>
|
|
84 | </Script> |
85 |
<!-- Shape
LinesAlignedAlongZ is a DEF node that has 1 USE node: USE_1 -->
<Shape DEF='LinesAlignedAlongZ'> |
86 | <IndexedLineSet colorPerVertex='false' colorIndex='1 0 0 0 0 2 0 0 0 0 1 0 0 0 0 2 0 0 0 0 1' coordIndex='1 22 -1 2 23 -1 3 24 -1 4 25 -1 5 26 -1 6 27 -1 7 28 -1 8 29 -1 9 30 -1 10 31 -1 11 32 -1 12 33 -1 13 34 -1 14 35 -1 15 36 -1 16 37 -1 17 38 -1 18 39 -1 19 40 -1 20 41 -1 21 42 -1'> |
87 | <Coordinate DEF='EndPoints' point='0 0 0 -10 0 10 -9 0 10 -8 0 10 -7 0 10 -6 0 10 -5 0 10 -4 0 10 -3 0 10 -2 0 10 -1 0 10 0 0 10 1 0 10 2 0 10 3 0 10 4 0 10 5 0 10 6 0 10 7 0 10 8 0 10 9 0 10 10 0 10 -10 0 -10 -9 0 -10 -8 0 -10 -7 0 -10 -6 0 -10 -5 0 -10 -4 0 -10 -3 0 -10 -2 0 -10 -1 0 -10 0 0 -10 1 0 -10 2 0 -10 3 0 -10 4 0 -10 5 0 -10 6 0 -10 7 0 -10 8 0 -10 9 0 -10 10 0 -10'/> |
88 | <Color color='0.4 0.4 0.4 0.8 0.2 0 0.4 0.1 0.05'/> |
89 | </IndexedLineSet> |
90 | </Shape> |
91 | <Transform DEF='LinesAlignedAlongX' rotation='0 1 0 1.57079'> |
92 | <Shape USE='LinesAlignedAlongZ'/> |
93 | </Transform> |
94 | <Transform translation='10.5 0 0'> |
95 | <Billboard> |
96 | <Shape> |
97 | <Text string='"X"'> |
98 | <FontStyle USE='LABEL_FONT'/> |
99 | </Text> |
100 |
<!-- Appearance
LABEL_APPEARANCE is a DEF node that has 1 USE node: USE_1 -->
<Appearance DEF='LABEL_APPEARANCE'> |
101 | <Material diffuseColor='1 1 .3' emissiveColor='.33 .33 .1'/> |
102 | </Appearance> |
103 | </Shape> |
104 | </Billboard> |
105 | </Transform> |
106 | <Transform translation='0 0 10.5'> |
107 | <Billboard> |
108 | <Shape> |
109 | <Text string='"Z"'> |
110 | <FontStyle USE='LABEL_FONT'/> |
111 | </Text> |
112 | <Appearance USE='LABEL_APPEARANCE'/> |
113 | </Shape> |
114 | </Billboard> |
115 | </Transform> |
116 | </Group> |
117 | </Switch> |
118 | </Transform> |
119 |
<!-- ROUTE information for CenterTextScript node:
[from LineSensorAxisY.translation_changed to set_translation
]
[from value to CenterText.string
]
-->
<Script DEF='CenterTextScript'> |
120 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
121 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript: // eventOut 'value' is an MFString array to match type of destination Text node string field function initialize ( ) { // Browser.println ('Grid script initialized, print function works'); // trace ('Grid script initialized, trace function works'); } function set_translation (location, timeStamp) { numberOfPlaces = 1000; value[0] = (Math.round (location.x * numberOfPlaces) / numberOfPlaces) + ' ' + (Math.round (location.y * numberOfPlaces) / numberOfPlaces) + ' ' + (Math.round (location.z * numberOfPlaces) / numberOfPlaces); // Browser.println ('location=' + location); }
]]>
|
|
123 | </Script> |
124 |
<!-- ROUTE information for SouthEastTextScript node:
[from LineSensorAxisY.translation_changed to set_translation
]
[from value to SouthEastText.string
]
-->
<Script DEF='SouthEastTextScript'> |
125 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
126 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function set_translation (location, timeStamp) { numberOfPlaces = 1000; value[0] = 10 + ' ' + (Math.round (location.y * numberOfPlaces) / numberOfPlaces) + ' ' + 10; }
]]>
|
|
128 | </Script> |
129 |
<!-- ROUTE information for NorthEastTextScript node:
[from LineSensorAxisY.translation_changed to set_translation
]
[from value to NorthEastText.string
]
-->
<Script DEF='NorthEastTextScript'> |
130 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
131 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function set_translation (location, timeStamp) { numberOfPlaces = 1000; value[0] = 10 + ' ' + (Math.round (location.y * numberOfPlaces) / numberOfPlaces) + ' ' + -10; }
]]>
|
|
133 | </Script> |
134 |
<!-- ROUTE information for NorthWestTextScript node:
[from LineSensorAxisY.translation_changed to set_translation
]
[from value to NorthWestText.string
]
-->
<Script DEF='NorthWestTextScript'> |
135 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
136 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function set_translation (location, timeStamp) { numberOfPlaces = 1000; value[0] = -10 + ' ' + (Math.round (location.y * numberOfPlaces) / numberOfPlaces) + ' ' + -10; }
]]>
|
|
138 | </Script> |
139 |
<!-- ROUTE information for SouthWestTextScript node:
[from LineSensorAxisY.translation_changed to set_translation
]
[from value to SouthWestText.string
]
-->
<Script DEF='SouthWestTextScript'> |
140 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
141 | <field name='value' type='MFString' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function set_translation (location, timeStamp) { numberOfPlaces = 1000; value[0] = -10 + ' ' + (Math.round (location.y * numberOfPlaces) / numberOfPlaces) + ' ' + 10; }
]]>
|
|
143 | </Script> |
144 |
<!-- ROUTE information for SwitchTextOnOffScript node:
[from TextLabelTouchSensor.isActive to isTouched
]
[from touchChoice to GridOnOffSwitch.whichChoice
]
-->
<Script DEF='SwitchTextOnOffScript'> |
145 | <field name='isTouched' type='SFBool' accessType='inputOnly'/> |
146 | <field name='touchChoice' type='SFInt32' accessType='outputOnly'/> |
<![CDATA[
ecmascript: function isTouched (value, timeStamp) { if (value == true) touchChoice = -1; else touchChoice = 0; }
]]>
|
|
148 | </Script> |
149 | < ROUTE fromNode='GridSensor' fromField='translation_changed' toNode='LineSensorAxisY' toField='set_translation'/> |
150 | <!-- Send changed position to text-construction scripts --> |
151 | < ROUTE fromNode='LineSensorAxisY' fromField='translation_changed' toNode='GridLocation' toField='set_translation'/> |
152 | < ROUTE fromNode='LineSensorAxisY' fromField='translation_changed' toNode='CenterTextScript' toField='set_translation'/> |
153 | < ROUTE fromNode='LineSensorAxisY' fromField='translation_changed' toNode='SouthEastTextScript' toField='set_translation'/> |
154 | < ROUTE fromNode='LineSensorAxisY' fromField='translation_changed' toNode='NorthEastTextScript' toField='set_translation'/> |
155 | < ROUTE fromNode='LineSensorAxisY' fromField='translation_changed' toNode='NorthWestTextScript' toField='set_translation'/> |
156 | < ROUTE fromNode='LineSensorAxisY' fromField='translation_changed' toNode='SouthWestTextScript' toField='set_translation'/> |
157 | <!-- Send text showing changed position to output Text nodes --> |
158 | < ROUTE fromNode='CenterTextScript' fromField='value' toNode='CenterText' toField='string'/> |
159 | < ROUTE fromNode='SouthEastTextScript' fromField='value' toNode='SouthEastText' toField='string'/> |
160 | < ROUTE fromNode='NorthEastTextScript' fromField='value' toNode='NorthEastText' toField='string'/> |
161 | < ROUTE fromNode='NorthWestTextScript' fromField='value' toNode='NorthWestText' toField='string'/> |
162 | < ROUTE fromNode='SouthWestTextScript' fromField='value' toNode='SouthWestText' toField='string'/> |
163 | <!-- Enable/disable grid visibility based on user touching coordinate labels --> |
164 | < ROUTE fromNode='TextLabelTouchSensor' fromField='isActive' toNode='SwitchTextOnOffScript' toField='isTouched'/> |
165 | < ROUTE fromNode='SwitchTextOnOffScript' fromField='touchChoice' toNode='GridOnOffSwitch' toField='whichChoice'/> |
166 | </Scene> |
167 | </X3D> |
Event Graph ROUTE Table entries with 14 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
TextLabelTouchSensor
TouchSensor isActive SFBool |
SwitchTextOnOffScript
Script isTouched SFBool |
then
|
SwitchTextOnOffScript
Script touchChoice SFInt32 |
GridOnOffSwitch
Switch whichChoice SFInt32 |
<!--
Color-coding legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->