X3D Model Documentation: ViewpointGroupPrototype.x3d

  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='titlecontent='ViewpointGroupPrototype.x3d'/>
  6            <meta name='descriptioncontent='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='creatorcontent='Don Brutzman'/>
  8            <meta name='createdcontent='29 October 2003'/>
  9            <meta name='modifiedcontent='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='referencecontent='ViewpointListViewpointGroupProse.html'/>
 12            <meta name='referencecontent='ViewpointGroupExample.x3d'/>
 13            <meta name='referencecontent='https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/navigation.html#Viewpoint'/>
 14            <meta name='referencecontent='https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#Viewpoint'/>
 15            <meta name='subjectcontent='ViewpointGroup Viewpoint'/>
 16            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupPrototype.x3d'/>
 17            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 18            <meta name='licensecontent='../license.html'/>
 19       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: DescriptionHolder, DisplayedHolder, HoldExposedFields, ProximityZone, UnbindingControlScript, ViewpointsSwitch

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ProtoDeclare definition: ViewpointGroup
-->
 20       <Scene>
 21            <WorldInfo title='ViewpointGroupPrototype.x3d'/>
 22            <ProtoDeclare name='ViewpointGroupappinfo='warning: developmental prototype for X3D v3.2 node do not override native support!'>
 23                 <ProtoInterface>
 24                      <field name='childrentype='MFNodeaccessType='inputOutput'
                     appinfo='[Viewpoint | ViewpointGroup] only'>
 25                           <!-- initialized at runtime, default is empty array of Viewpoint/ViewpointGroup nodes. -->
 26                      </field>
 27                      <field name='descriptiontype='SFStringaccessType='inputOutput'
                     appinfo='Text description or navigation hint to be displayed for this ViewpointGroup.'/>
 28                      <field name='displayedtype='SFBoolvalue='trueaccessType='inputOutput'
                     appinfo='Whether this ViewpointGroup description is displayed in current viewpoint list.'/>
 29                      <field name='centertype='SFVec3fvalue='0 0 0accessType='inputOutput'
                     appinfo='Position offset from origin of local coordinate system.'/>
 30                      <field name='radiustype='SFFloatvalue='10accessType='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_radiustype='SFFloataccessType='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='retainUserOffsetstype='SFBoolvalue='trueaccessType='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='ProximityZonesize='20 20 20'>
 37                                <IS>
 38                                     <connect nodeField='centerprotoField='center'/>
 39                                </IS>
 40                           </ProximitySensor>
 41 
                         <!-- Switch ViewpointsSwitch is a DEF node that has 1 USE node: USE_1 -->
                         <Switch DEF='ViewpointsSwitchwhichChoice='0'>
 42                                <Group>
 43                                     <IS>
 44                                          <connect nodeField='childrenprotoField='children'/>
 45                                     </IS>
 46                                </Group>
 47                           </Switch>
 48                           <Switch DEF='HoldExposedFieldswhichChoice='-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='descriptionprotoField='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='enabledprotoField='displayed'/>
 58                                     </IS>
 59                                </ProximitySensor>
 60                           </Switch>
 61 
                         <!-- ROUTE information for UnbindingControlScript node:  [from ProximityZone.isActive to isActive ] -->
                         <Script DEF='UnbindingControlScriptdirectOutput='true'>
 62                                <field name='isActivetype='SFBoolaccessType='inputOnly'/>
 63                                <field name='ProximityZonetype='SFNodeaccessType='initializeOnly'>
 64                                     <ProximitySensor USE='ProximityZone'/>
 65                                </field>
 66                                <field name='radiustype='SFFloataccessType='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_radiustype='SFFloataccessType='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='viewpointsSwitchtype='SFNodeaccessType='initializeOnly'>
 69                                     <Switch USE='ViewpointsSwitch'/>
 70                                </field>
 71                                <!-- use node holders to work around VRML 97 Script exposedField restriction -->
 72                                <field name='descriptionHoldertype='SFNodeaccessType='initializeOnly'>
 73                                     <Anchor USE='DescriptionHolder'/>
 74                                </field>
 75                                <field name='displayedHoldertype='SFNodeaccessType='initializeOnly'>
 76                                     <ProximitySensor USE='DisplayedHolder'/>
 77                                </field>
 78                                <field name='descriptiontype='SFStringaccessType='initializeOnly'/>
 79                                <field name='displayedtype='SFBoolvalue='trueaccessType='initializeOnly'/>
 80                                <field name='traceEnabledtype='SFBoolvalue='falseaccessType='initializeOnly'/>
 81                                <IS>
 82                                     <connect nodeField='radiusprotoField='radius'/>
 83                                     <connect nodeField='set_radiusprotoField='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='ViewpointGroupExampleparameter='"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: ViewpointGroupposition='0 0 5'/>
104            <Viewpoint description='outside scope: ViewpointGroupposition='0 0 12'/>
105       </Scene>
106  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->

<!-- to top Index for DEF nodes: DescriptionHolder, DisplayedHolder, HoldExposedFields, ProximityZone, UnbindingControlScript, ViewpointsSwitch

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2

Index for ProtoDeclare definition: ViewpointGroup
-->
X3D Tooltips element index: Anchor, Appearance, connect, field, FontStyle, Group, head, IS, Material, meta, NavigationInfo, ProtoBody, ProtoDeclare, ProtoInterface, ProximitySensor, ROUTE, Scene, Script, Shape, Switch, Text, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, field types

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

ROUTE
event to
(1)
UnbindingControlScript
Script
isActive
SFBool


Anchor
description='ViewpointGroupExample' 
User-interaction hint for this node. 
Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupPrototypeIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/development/ViewpointGroupPrototype.x3d -->

<!-- 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> -->

to top <!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->