1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
|
3 | <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'> |
4 | <head> |
5 | <meta name='title' content='TextureAngleViewer.x3d'/> |
6 | <meta name='description' content='View a given texture from different angles to judge readability, example use is a QR code.'/> |
7 | <meta name='creator' content='Don Brutzman'/> |
8 | <meta name='created' content='23 April 2013'/> |
9 | <meta name='modified' content='20 April 2020'/> |
10 | <meta name=' TODO ' content=' color mapper in scene for varying Background contrast '/> |
11 | <meta name=' TODO ' content=' second X-axis angle slider '/> |
12 | <meta name='Image' content='TextureAngleViewer36degrees.png'/> |
13 | <meta name='Image' content='images/QrNpsEduCode.png'/> |
14 | <meta name='reference' content='http://qr.nps.edu'/> |
15 | <meta name='reference' content='https://zxing.appspot.com/generator'/> |
16 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/TextureMapping/TextureAngleViewer.x3d'/> |
17 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
18 | <meta name='license' content='../license.html'/> |
19 | </head> |
20 | <Scene> |
21 | <!-- ================================ --> |
22 | <WorldInfo title='Texture Angle Viewer'/> |
23 | <Background skyColor='0.72549 1 0.721569'/> |
24 | <Viewpoint description='Texture angle viewer' position='0 0 11'/> |
25 | <NavigationInfo DEF='NavigationInfoFinal' type='"NONE"'/> |
26 | <!-- <NavigationInfo DEF='NavigationInfoDebug' type='"EXAMINE" "ANY"'/> --> |
27 | <!-- ================================ --> |
28 | <Transform translation='0 3.6 0'> |
29 | <Shape> |
30 |
<!-- ROUTE information for AngleOutputText node:
[from SliderScript.angleMFString_changed to string
]
-->
<Text DEF='AngleOutputText' string='"Texture angle viewer"'> |
31 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.7'/> |
32 | </Text> |
33 | <Appearance> |
34 | <Material diffuseColor='0.2 0.4 0.8'/> |
35 | </Appearance> |
36 | </Shape> |
37 | </Transform> |
38 | <!-- ================================ --> |
39 | <Anchor description='this QR code links to http://qr.nps.edu' url=' "http://qr.nps.edu" '> |
40 |
<!-- ROUTE information for ImageTransform node:
[from SliderScript.rotation_changed to rotation
]
-->
<Transform DEF='ImageTransform'> |
41 | <Shape> |
42 | <!-- TODO add a single geometry node here --> |
43 | <IndexedFaceSet coordIndex='1 0 2 3 0 -1'> |
44 | <Coordinate point='-3 -3 0 3 -3 0 3 3 0 -3 3 0 -3 -3 0'/> |
45 | </IndexedFaceSet> |
46 | <Appearance> |
47 | <Material/> |
48 | <ImageTexture url=' "images/QrNpsEduCode.png " "https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/TextureMapping/images/QrNpsEduCode.png " '/> |
49 | </Appearance> |
50 | </Shape> |
51 | </Transform> |
52 | </Anchor> |
53 | <!-- ================================ --> |
54 | <Transform DEF='SliderSituated' translation='0 -3.6 0'> |
55 |
<!-- ROUTE information for SliderKnobTransform node:
[from SliderScript.translation_changed to translation
]
-->
<Transform DEF='SliderKnobTransform'> |
56 |
<!-- ROUTE information for SliderPlaneSensor node:
[from translation_changed to SliderScript.set_translation
]
-->
<PlaneSensor DEF='SliderPlaneSensor' description='select and drag to change angle values' maxPosition='3 0' minPosition='-3 0'/> |
57 | <Transform rotation='0 0 1 1.570796'> |
58 | <Shape> |
59 | <Cylinder DEF='SliderKnob' height='0.2' radius='0.2'/> |
60 |
<!-- Appearance
Metals13Appearance is a DEF node that has 1 USE node: USE_1 -->
<Appearance DEF='Metals13Appearance'> |
61 | <Material ambientIntensity='0.25641' diffuseColor='0.222308 0.15428 0' specularColor='0.882653 0.860832 0.687861'> |
62 | <!-- Universal Media Library: Metals 13 --> |
63 | </Material> |
64 | </Appearance> |
65 | </Shape> |
66 | </Transform> |
67 | </Transform> |
68 | <!-- SliderBar does not rotate or drag with SliderKnob --> |
69 | <Transform DEF='SliderBar' rotation='0 0 1 1.570796'> |
70 | <Shape> |
71 | <Cylinder height='6' radius='0.05'/> |
72 | <Appearance USE='Metals13Appearance'/> |
73 | </Shape> |
74 | </Transform> |
75 | </Transform> |
76 | <!-- ================================ --> |
77 |
<!-- ROUTE information for SliderScript node:
[from SliderPlaneSensor.translation_changed to set_translation
]
[from translation_changed to SliderKnobTransform.translation
]
[from rotation_changed to ImageTransform.rotation
]
[from angleMFString_changed to AngleOutputText.string
]
-->
<Script DEF='SliderScript'> |
78 |
<field name='set_translation' type='SFVec3f' accessType='inputOnly'
appinfo='input provided by SliderKnobTransform PlaneSensor output'/> |
79 | <field name='angle' type='SFFloat' value='0.0' accessType='initializeOnly'/> |
80 | <field name='y' type='SFFloat' value='0.0' accessType='initializeOnly'/> |
81 |
<field name='rotation_changed' type='SFRotation' accessType='outputOnly'
appinfo='output provided for ImageTransform rotation'/> |
82 | <!-- Note that trackPoint_changed events represent unclamped intersection points on plane surface. Browsers can interpret drags off of the surface in various ways. Note that translation_changed events are clamped by minPosition/maxPosition and thus may be preferable. --> |
83 |
<field name='translation_changed' type='SFVec3f' accessType='outputOnly'
appinfo='output provided for SliderKnobTransform translation'/> |
84 |
<field name='angleMFString_changed' type='MFString' accessType='outputOnly'
appinfo='output provided for degrees of rotation in Text node'/> |
85 |
<field name='tracePrint' type='SFBool' value='true' accessType='initializeOnly'
appinfo='console output for debugging'/> |
<![CDATA[
ecmascript: function set_translation (eventValue) { x = eventValue.x; if (tracePrint) { Browser.println ("========================"); Browser.println (' x=' + x); } // clamp values to prevent overrun/underrun, in case minPosition/maxPosition fail if (x > 3.0) x = 3.0; if (x < -3.0) x = -3.0; translation_changed = eventValue; angle = Math.round(x * 90.0 / 3.0); rotation_changed = new SFRotation (0, 1, 0, angle * Math.PI / 180.0); var angleString = angle.toString() + ' degrees'; // JavaScript string // angleMFString_changed = new MFString (new SFString(angleString)); // only works in InstantReality angleMFString_changed = new MFString (angleString); // works in several players but not all // angleMFString_changed = [ angleString ]; // Use JavaScript string array instead of MFString doesn't work if (tracePrint) { Browser.println (' clamped x=' + x); Browser.println (" set_translation=" + eventValue); Browser.println ("translation_changed=" + translation_changed.toString() + ", rotation_changed=" + rotation_changed.toString()); Browser.println ("angle=" + angle + ", angleString=" + angleString + ", angleMFString_changed=" + angleMFString_changed.toString()); } /* example console excerpt: ======================== x=-0.05248255282640457 clamped x=-0.05248255282640457 set_translation=-0.05248255282640457 0 0 translation_changed=-0.05248255282640457 0 0, rotation_changed=0 1 0 -0.03490658503988659 angle=-2, angleString=-2 degrees, angleMFString_changed="-2 degrees" ======================== */ }
]]>
|
|
87 | </Script> |
88 | < ROUTE fromNode='SliderPlaneSensor' fromField='translation_changed' toNode='SliderScript' toField='set_translation'/> |
89 | < ROUTE fromNode='SliderScript' fromField='translation_changed' toNode='SliderKnobTransform' toField='translation'/> |
90 | < ROUTE fromNode='SliderScript' fromField='rotation_changed' toNode='ImageTransform' toField='rotation'/> |
91 | < ROUTE fromNode='SliderScript' fromField='angleMFString_changed' toNode='AngleOutputText' toField='string'/> |
92 | </Scene> |
93 | </X3D> |
Event Graph ROUTE Table entries with 4 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.
SliderPlaneSensor
PlaneSensor translation_changed SFVec3f |
SliderScript
Script set_translation SFVec3f |
then
|
SliderScript
Script angleMFString_changed MFString |
AngleOutputText
Text string MFString |
||
then
|
SliderScript
Script rotation_changed SFRotation |
ImageTransform
Transform rotation SFRotation |
||||
then
|
SliderScript
Script translation_changed SFVec3f |
SliderKnobTransform
Transform translation SFVec3f |
Anchor |
description='this QR code links to http://qr.nps.edu' User-interaction hint for this node. |
<!--
Color 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. -->