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='ViewpointGroupPrototype.x3d'/> |
6 | <meta name='description' content='ViewpointGroup contains Viewpoint and ViewpointGroup nodes, allowing nested lists and viewpoint scoping in viewpoint lists. This is a developmental example for potential specification improvement. It is needed because (a) currently specified rules for X3D/VRML node binding state that behavior of child Viewpoints beneath Switch/LOD/etc. is undefined, and (b) browser viewpoint list display behavior is undefined.'/> |
7 | <meta name='creator' content='Don Brutzman'/> |
8 | <meta name='created' content='29 October 2003'/> |
9 | <meta name='modified' content='20 October 2019'/> |
10 | <meta name=' warning ' content=' this prototype is for development purposes only, do not override native player support for ViewpointGroup '/> |
11 | <meta name='reference' content='ViewpointListViewpointGroupProse.html'/> |
12 | <meta name='reference' content='ViewpointGroupExample.x3d'/> |
13 | <meta name='reference' content='https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/navigation.html#Viewpoint'/> |
14 | <meta name='reference' content='https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#Viewpoint'/> |
15 | <meta name='subject' content='ViewpointGroup Viewpoint'/> |
16 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupPrototype.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 | <WorldInfo title='ViewpointGroupPrototype.x3d'/> |
22 | <ProtoDeclare name='ViewpointGroup' appinfo='warning: developmental prototype for X3D v3.2 node do not override native support!'> |
23 | <ProtoInterface> |
24 |
<field name='children' type='MFNode' accessType='inputOutput'
appinfo='[Viewpoint | ViewpointGroup] only'> |
25 | <!-- initialized at runtime, default is empty array of Viewpoint/ViewpointGroup nodes. --> |
26 | </field> |
27 |
<field name='description' type='SFString' accessType='inputOutput'
appinfo='Text description or navigation hint to be displayed for this ViewpointGroup.'/> |
28 |
<field name='displayed' type='SFBool' value='true' accessType='inputOutput'
appinfo='Whether this ViewpointGroup description is displayed in current viewpoint list.'/> |
29 |
<field name='center' type='SFVec3f' value='0 0 0' accessType='inputOutput'
appinfo='Position offset from origin of local coordinate system.'/> |
30 |
<field name='radius' type='SFFloat' value='10' accessType='initializeOnly'
appinfo='[0..infinity) Radius in meters of Proximity box within which the ViewpointGroup is usable and displayed on the viewpoint list.'/> |
31 |
<field name='set_radius' type='SFFloat' accessType='inputOnly'
appinfo='[0..infinity) Radius in meters of Proximity box within which the ViewpointGroup is usable and displayed on the viewpoint list.'/> |
32 |
<field name='retainUserOffsets' type='SFBool' value='true' accessType='inputOutput'
appinfo='Whether viewpoint needs to retain (true) or rezero (false) any prior user navigation offsets from defined viewpoint position orientation.'/> |
33 | </ProtoInterface> |
34 | <ProtoBody> |
35 | <Group> |
36 |
<!-- ProximitySensor
ProximityZone is a DEF node that has 1 USE node: USE_1
<!-- ROUTE information for ProximityZone node: [from isActive to UnbindingControlScript.isActive ] --> <ProximitySensor DEF='ProximityZone' size='20 20 20'> |
37 | <IS> |
38 | <connect nodeField='center' protoField='center'/> |
39 | </IS> |
40 | </ProximitySensor> |
41 |
<!-- Switch
ViewpointsSwitch is a DEF node that has 1 USE node: USE_1 -->
<Switch DEF='ViewpointsSwitch' whichChoice='0'> |
42 | <Group> |
43 | <IS> |
44 | <connect nodeField='children' protoField='children'/> |
45 | </IS> |
46 | </Group> |
47 | </Switch> |
48 | <Switch DEF='HoldExposedFields' whichChoice='-1'> |
49 | <!-- WorldInfo not used because title field is accessType initializeOnly --> |
50 |
<!-- Anchor
DescriptionHolder is a DEF node that has 1 USE node: USE_1 -->
<Anchor DEF='DescriptionHolder'> |
51 | <IS> |
52 | <connect nodeField='description' protoField='description'/> |
53 | </IS> |
54 | </Anchor> |
55 |
<!-- ProximitySensor
DisplayedHolder is a DEF node that has 1 USE node: USE_1 -->
<ProximitySensor DEF='DisplayedHolder'> |
56 | <IS> |
57 | <connect nodeField='enabled' protoField='displayed'/> |
58 | </IS> |
59 | </ProximitySensor> |
60 | </Switch> |
61 |
<!-- ROUTE information for UnbindingControlScript node:
[from ProximityZone.isActive to isActive
]
-->
<Script DEF='UnbindingControlScript' directOutput='true'> |
62 | <field name='isActive' type='SFBool' accessType='inputOnly'/> |
63 | <field name='ProximityZone' type='SFNode' accessType='initializeOnly'> |
64 | <ProximitySensor USE='ProximityZone'/> |
65 | </field> |
66 |
<field name='radius' type='SFFloat' accessType='initializeOnly'
appinfo='[0..infinity) Radius in meters of Proximity box within which the ViewpointGroup is usable and displayed on the viewpoint list.'/> |
67 |
<field name='set_radius' type='SFFloat' accessType='inputOnly'
appinfo='[0..infinity) Radius in meters of Proximity box within which the ViewpointGroup is usable and displayed on the viewpoint list.'/> |
68 | <field name='viewpointsSwitch' type='SFNode' accessType='initializeOnly'> |
69 | <Switch USE='ViewpointsSwitch'/> |
70 | </field> |
71 | <!-- use node holders to work around VRML 97 Script exposedField restriction --> |
72 | <field name='descriptionHolder' type='SFNode' accessType='initializeOnly'> |
73 | <Anchor USE='DescriptionHolder'/> |
74 | </field> |
75 | <field name='displayedHolder' type='SFNode' accessType='initializeOnly'> |
76 | <ProximitySensor USE='DisplayedHolder'/> |
77 | </field> |
78 | <field name='description' type='SFString' accessType='initializeOnly'/> |
79 | <field name='displayed' type='SFBool' value='true' accessType='initializeOnly'/> |
80 | <field name='traceEnabled' type='SFBool' value='false' accessType='initializeOnly'/> |
81 | <IS> |
82 | <connect nodeField='radius' protoField='radius'/> |
83 | <connect nodeField='set_radius' protoField='set_radius'/> |
84 | </IS> |
<![CDATA[
ecmascript: function initialize () { // since Viewpoints remain on binding stack as before, // no initialization action is necessary when implemented natively. description = descriptionHolder.description; displayed = displayedHolder.enabled; tracePrint ('displayed=' + displayed); if (!displayed) viewpointsSwitch.whichChoice = -1; set_radius (radius); // typecheck valid children nodes: tracePrint ('viewpointsSwitch.choice.length=' + viewpointsSwitch.choice.length); if (viewpointsSwitch.choice.length >= 1) for (i=0; i >= viewpointsSwitch.choice.length; i) { // how to check type? // if (viewpointsSwitch.choice[i].____ etc.) // once type checked, warn if Viewpoint position outside proximity box size } tracePrint ('... initialize() complete'); } function isActive (activeValue) { // Most likely, viewpoint list actions will be controlled by browser. // If viewpoint list is exposed via SAI, could do things here // such as setting ViewpointGroup.description as browser label. // Current action: switch child Viewpoints in/out of scope. tracePrint ('activeValue=' + activeValue); tracePrint ('displayed=' + displayed); if (!displayed) return; if (activeValue) viewpointsSwitch.whichChoice = 0; else viewpointsSwitch.whichChoice = -1; tracePrint ('viewpointsSwitch.whichChoice=' + viewpointsSwitch.whichChoice); } function set_radius (value, timestamp) { radius = value; ProximityZone.size.x = 2 * radius; ProximityZone.size.y = 2 * radius; ProximityZone.size.z = 2 * radius; tracePrint ('set_radius (' + value + '), radius=' + radius + ', ProximityZone.size=' + ProximityZone.size); } function tracePrint(outputString) { if (traceEnabled) Browser.println ('[ViewpointGroup' + description + ']' + outputString); } function alwaysPrint(outputString) { Browser.println ('[ViewpointGroup' + description + ']' + outputString); }
]]>
|
|
86 | </Script> |
87 | < ROUTE fromNode='ProximityZone' fromField='isActive' toNode='UnbindingControlScript' toField='isActive'/> |
88 | </Group> |
89 | </ProtoBody> |
90 | </ProtoDeclare> |
91 | <!-- ===============Example============== --> |
92 | <NavigationInfo type='"FLY" "ANY"'/> |
93 | <Anchor description='ViewpointGroupExample' parameter='"target=_blank"' url=' "ViewpointGroupExample.x3d" "https://www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupExample.x3d" "ViewpointGroupExample.wrl" "https://www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupExample.wrl" '> |
94 | <Shape> |
95 | <Text string='"ViewpointGroupPrototype" "defines a prototype" "" "Click on this text to see" "ViewpointGroupExample scene"'> |
96 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.5'/> |
97 | </Text> |
98 | <Appearance> |
99 | <Material diffuseColor='1 1 0.2'/> |
100 | </Appearance> |
101 | </Shape> |
102 | </Anchor> |
103 | <Viewpoint description='inside scope: ViewpointGroup' position='0 0 5'/> |
104 | <Viewpoint description='outside scope: ViewpointGroup' position='0 0 12'/> |
105 | </Scene> |
106 | </X3D> |
Event Graph ROUTE Table with 1 ROUTE connection 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.
UnbindingControlScript
Script |
No ROUTE connection found for output events from this node. Contains SFNode fields with direct access to another node. |
ProximityZone
ProximitySensor isActive SFBool |
UnbindingControlScript
Script isActive SFBool |
Anchor |
description='ViewpointGroupExample' 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)
<ProtoDeclare
name='ProtoName'>
<field
name='fieldName'/> </ProtoDeclare>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->