X3D Model Documentation: CanopyExample.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=' CanopyExample.x3d '/>
  6            <meta name='descriptioncontent='Animation example from Canopy Prototype. Clicking canopy triggers animation for open and close performance.'/>
  7            <meta name='creatorcontent='Etsuko Lippi'/>
  8            <meta name='createdcontent='18 October 2001'/>
  9            <meta name='modifiedcontent='28 November 2019'/>
 10            <meta name='generatorcontent='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 11            <meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyExample.x3d '/>
 12            <meta name='subjectcontent='cockpit canopy animation example'/>
 13            <meta name='licensecontent='../../license.html'/>
 14       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: Canopy, CanopyTouchSensor, CP, ExampleSelectionScript

Index for ExternProtoDeclare definition: Canopy
-->
 15       <Scene>
 16            <WorldInfo title='CanopyExample.x3d'/>
 17            <ExternProtoDeclare name='Canopy'   url=' "CanopyPrototype.wrl#Canopy" "../../AircraftFixedWing/F18BlueAngelUnitedStates/CanopyPrototype.wrl#Canopy" "https://www.web3d.org/x3d/content/examples/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyPrototype.wrl#Canopy" "CanopyPrototype.x3d#Canopy" "../../AircraftFixedWing/F18BlueAngelUnitedStates/CanopyPrototype.x3d#Canopy" "https://www.web3d.org/x3d/content/examples/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyPrototype.x3d#Canopy" '>
 18                 <field name='canopyOpentype='SFBoolaccessType='inputOnly'/>
 19                 <field name='canopyOuttype='SFBoolaccessType='outputOnly'/>
 20                 <field name='animationStartTimetype='SFTimeaccessType='inputOnly'/>
 21                 <field name='traceEnabledtype='SFBoolaccessType='initializeOnly'/>
 22            </ExternProtoDeclare>
 23            <Background skyColor='0.7 0.7 0.7'/>
 24            <Group>
 25 
               <!-- ROUTE information for CanopyTouchSensor node:  [from touchTime to CP.animationStartTime ] [from isActive to ExampleSelectionScript.enabled ] -->
               <TouchSensor DEF='CanopyTouchSensordescription='canopy open/close'/>
 26                 <Transform DEF='Canopy'>
 27 
                    <!-- ROUTE information for ExampleSelectionScript node:  [from CanopyTouchSensor.isActive to enabled ] [from status to CP.canopyOpen ] -->
                    <Script DEF='ExampleSelectionScript'>
 28                           <field name='landedtype='SFInt32value='-1accessType='initializeOnly'/>
 29                           <field name='enabledtype='SFBoolaccessType='inputOnly'/>
 30                           <field name='statustype='SFBoolaccessType='outputOnly'/>
  <![CDATA[
          
ecmascript:

function tracePrint (outputString)
{
	if (traceEnabled) Browser.println ('[trace] ' + outputString);
}

function enabled(value, timeStamp)
{
	tracePrint('enabled = ' + value);
	if (value == true)
	{
		if (landed == -1)
		{			
                        status = false;
                        landed = 0;			
		}
		if (landed == 0)
		{
			if (status)
			{
				status = false;                             
			}
			else
			{
				status = true;                               			
			}
		}
                else
                {
         		landed = 0;
     			return;
                }
	}
}

        
]]>
 32                      </Script>
 33                 </Transform>
 34 
               <!-- ROUTE information for CP node:  [from CanopyTouchSensor.touchTime to animationStartTime ] [from ExampleSelectionScript.status to canopyOpen ] -->
               <ProtoInstance name='CanopyDEF='CP'>
 35                      <fieldValue name='traceEnabledvalue='true'/>
 36                 </ProtoInstance>
 37            </Group>
 38            < ROUTE  fromNode='CanopyTouchSensor' fromField='touchTime' toNode='CP' toField='animationStartTime'/>
 39            < ROUTE  fromNode='CanopyTouchSensor' fromField='isActive' toNode='ExampleSelectionScript' toField='enabled'/>
 40            < ROUTE  fromNode='ExampleSelectionScript' fromField='status' toNode='CP' toField='canopyOpen'/>
 41       </Scene>
 42  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: Canopy, CanopyTouchSensor, CP, ExampleSelectionScript

Index for ExternProtoDeclare definition: Canopy
-->
X3D Tooltips element index: Background, ExternProtoDeclare, field, fieldValue, Group, head, meta, ProtoInstance, ROUTE, Scene, Script, TouchSensor, Transform, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table entries with 3 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.

CanopyTouchSensor
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
CP
ProtoInstance
animationStartTime
SFTime
CanopyTouchSensor
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
ExampleSelectionScript
Script
enabled
SFBool
then
 
 
 
ExampleSelectionScript
Script
status
SFBool

ROUTE
event to
(2)
CP
ProtoInstance
canopyOpen
SFBool

      CP
ProtoInstance
Canopy
No direct ROUTE connection found for events to/from this node.
This ProtoInstance contains SFNode/MFNode fieldValue declarations with
direct access to other nodes, and thus has potential to produce run-time animation. 

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/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyExampleIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyExample.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idNamefield='value'/> matches XML terminology <XmlElement  DEF='idNameattribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
    <ProtoInstance name='ProtoName'> <field name='fieldName'/> </ProtoInstance> -->

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