X3D Model Documentation: Chopper.x3d

  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='titlecontent='Chopper.x3d'/>
  6            <meta name='descriptioncontent='Rotor node provides animation and serves as an ExternProtoDeclare example'/>
  7            <meta name='creatorcontent='Don Brutzman and Joe Williams'/>
  8            <meta name='createdcontent='1 June 2002'/>
  9            <meta name='modifiedcontent='28 October 2019'/>
 10            <meta name='specificationSectioncontent='X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.16 Chopper'/>
 11            <meta name='specificationUrlcontent='https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#Chopper'/>
 12            <meta name='identifiercontent='https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Chopper.x3d'/>
 13            <meta name='generatorcontent='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/>
 14            <meta name='licensecontent='../license.html'/>
 15       </head>
<!--

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

<!-- to top Index for DEF nodes: MikesChopper, RotorScript, Top, Touch

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: Rotor

Index for ProtoDeclare definition: Chopper
-->
 16       <Scene>
 17            <WorldInfo title='Chopper.x3d'/>
 18            <ExternProtoDeclare name='Rotor'   url=' "Rotor.x3d#Rotor" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Rotor.x3d#Rotor" "Rotor.wrl#Rotor" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Rotor.wrl#Rotor" '>
 19                 <field name='ratetype='SFTimeaccessType='initializeOnly'/>
 20                 <field name='childrentype='MFNodeaccessType='initializeOnly'/>
 21                 <field name='startTimetype='SFTimeaccessType='inputOutput'/>
 22                 <field name='stopTimetype='SFTimeaccessType='inputOutput'/>
 23            </ExternProtoDeclare>
 24            <ProtoDeclare name='Chopper'>
 25                 <ProtoInterface>
 26                      <field name='rotorSpeedtype='SFTimevalue='1accessType='initializeOnly'/>
 27                 </ProtoInterface>
 28                 <ProtoBody>
 29                      <Group>
 30 
                         <!-- ROUTE information for Touch node:  [from touchTime to RotorScript.startOrStopEngine ] -->
                         <TouchSensor DEF='Touchdescription='touch to toggle rotor rotation'/>
 31                           <Inline   url=' "ChopperBody.x3d" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperBody.x3d" "ChopperBody.wrl" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperBody.wrl" '/>
 32 
                         <!-- ROUTE information for Top node:  [from RotorScript.startEngine to startTime ] [from RotorScript.stopEngine to stopTime ] -->
                         <ProtoInstance name='RotorDEF='Top'>
 33                                <fieldValue name='stopTimevalue='1'/>
 34                                <fieldValue name='children'>
 35                                     <Inline   url=' "ChopperRotor.x3d" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperRotor.x3d" "ChopperRotor.wrl" "https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/ChopperRotor.wrl" '/>
 36                                </fieldValue>
 37                                <IS>
 38                                     <connect nodeField='rateprotoField='rotorSpeed'/>
 39                                </IS>
 40                           </ProtoInstance>
 41                      </Group>
 42                      <!-- after first node in ProtoDeclare, remainder of nodes do not render -->
 43 
                    <!-- ROUTE information for RotorScript node:  [from Touch.touchTime to startOrStopEngine ] [from startEngine to Top.startTime ] [from stopEngine to Top.stopTime ] -->
                    <Script DEF='RotorScript'>
 44                           <field name='startOrStopEnginetype='SFTimeaccessType='inputOnly'/>
 45                           <field name='startEnginetype='SFTimeaccessType='outputOnly'/>
 46                           <field name='stopEnginetype='SFTimeaccessType='outputOnly'/>
 47                           <field name='engineStartedtype='SFBoolvalue='falseaccessType='initializeOnly'/>
  <![CDATA[
          
ecmascript:

function startOrStopEngine(value)
{
	// start or stop engine:
	if (!engineStarted)
	{
		startEngine = value;
		engineStarted = true;
	}
	else
	{
		stopEngine = value;
		engineStarted = false;
	}
}

        
]]>
 49                      </Script>
 50                      < ROUTE  fromNode='Touch' fromField='touchTime' toNode='RotorScript' toField='startOrStopEngine'/>
 51                      < ROUTE  fromNode='RotorScript' fromField='startEngine' toNode='Top' toField='startTime'/>
 52                      < ROUTE  fromNode='RotorScript' fromField='stopEngine' toNode='Top' toField='stopTime'/>
 53                 </ProtoBody>
 54            </ProtoDeclare>
 55            <Viewpoint description='Example16position='0 0 5'/>
 56            <Group>
 57                 <ProtoInstance name='ChopperDEF='MikesChopper'/>
 58            </Group>
 59       </Scene>
 60  </X3D>
<!--

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

<!-- to top Index for DEF nodes: MikesChopper, RotorScript, Top, Touch

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: Rotor

Index for ProtoDeclare definition: Chopper
-->
X3D Tooltips element index: connect, ExternProtoDeclare, field, fieldValue, Group, head, Inline, IS, meta, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ROUTE, Scene, Script, TouchSensor, Viewpoint, WorldInfo, X3D, accessType and type, XML data types, 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.

Touch
TouchSensor
touchTime
SFTime

ROUTE
event to
(1)
RotorScript
Script
startOrStopEngine
SFTime
then
 
 
 
RotorScript
Script
startEngine
SFTime

ROUTE
event to
(2)
Top
ProtoInstance
startTime
SFTime
  then
 
 
 
RotorScript
Script
stopEngine
SFTime

ROUTE
event to
(2)
Top
ProtoInstance
stopTime
SFTime

MikesChopper
ProtoInstance
Chopper
No ROUTE connection found for output events 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/Basic/X3dSpecifications/ChopperIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/Chopper.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)
    <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. -->