| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.1//EN" "https://www.web3d.org/specifications/x3d-3.1.dtd">
|
| 3 | <X3D profile='Immersive' version='3.1' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.1.xsd'> |
| 4 | <head> |
| 5 | <meta name='title' content=' BollardHydraulicSecurityPrototype.x3d '/> |
| 6 | <meta name='description' content='Rising/retractable security bollard'/> |
| 7 | <meta name='creator' content='Don Brutzman and MV4205 Advanced XML class'/> |
| 8 | <meta name='created' content='30 May 2007'/> |
| 9 | <meta name='modified' content='20 October 2019'/> |
| 10 | <meta name='reference' content='http://www.atgaccess.com'/> |
| 11 | <meta name=' warning ' content=' under development, initial functionality completed. TODO: add SMALL metadata. TODO: how to string together multiple bollards - add fields for spacing and count? '/> |
| 12 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Buildings/SecurityPerimeter/BollardHydraulicSecurityPrototype.x3d '/> |
| 13 | <meta name='generator' content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 14 | <meta name='license' content='../../license.html'/> |
| 15 | </head> |
| 16 | <Scene> |
| 17 | <WorldInfo title='BollardHydraulicSecurityPrototype.x3d'/> |
| 18 | <ProtoDeclare name='BollardHydraulicSecurity' appinfo='A security bollard can be raised or lowered to prevent vehicle access by blocking a road. Usually multiple bollards are installed side by side raised and lowered together.'> |
| 19 | <ProtoInterface> |
| 20 | <field name='radius' type='SFFloat' value='0.2' accessType='initializeOnly'/> |
| 21 | <field name='height' type='SFFloat' value='1' accessType='initializeOnly'/> |
| 22 | <field name='textureUrl' type='MFString' accessType='inputOutput'/> |
| 23 | <field name='diffuseColor' type='SFColor' value='1 1 0' accessType='inputOutput'/> |
| 24 |
<field name='raise' type='SFBool' accessType='inputOnly'
appinfo='Command to raise the bollard.'/> |
| 25 |
<field name='lower' type='SFBool' accessType='inputOnly'
appinfo='Command to lower the bollard.'/> |
| 26 | <!-- TODO: add TimeDelaySensor nodes to report completion by the following output fields --> |
| 27 |
<field name='isRaised' type='SFBool' accessType='outputOnly'
appinfo='Notification event sent when bollard is fully raised.'/> |
| 28 |
<field name='isLowered' type='SFBool' accessType='outputOnly'
appinfo='Notification event sent when bollard is fully lowered.'/> |
| 29 | </ProtoInterface> |
| 30 | <ProtoBody> |
| 31 |
<!-- ROUTE information for BollardTransform node:
[from HeightInterpolator.value_changed to set_translation
]
[from HeightTypeConversion.initialTranslation to set_translation
]
-->
<Transform DEF='BollardTransform'> |
| 32 | <!-- first Cylinder displays only the sides, with an optional texture applied --> |
| 33 | <Shape> |
| 34 | <Cylinder bottom='false' top='false'> |
| 35 | <IS> |
| 36 | <connect nodeField='radius' protoField='radius'/> |
| 37 | <connect nodeField='height' protoField='height'/> |
| 38 | </IS> |
| 39 | </Cylinder> |
| 40 | <Appearance> |
| 41 |
<!-- Material
CylinderMaterial is a DEF node that has 1 USE node: USE_1 -->
<Material DEF='CylinderMaterial'> |
| 42 | <IS> |
| 43 | <connect nodeField='diffuseColor' protoField='diffuseColor'/> |
| 44 | </IS> |
| 45 | </Material> |
| 46 | <ImageTexture> |
| 47 | <IS> |
| 48 | <connect nodeField='url' protoField='textureUrl'/> |
| 49 | </IS> |
| 50 | </ImageTexture> |
| 51 | </Appearance> |
| 52 | </Shape> |
| 53 | <!-- second Cylinder displays only the top and bottom, which do not have the optional texture applied --> |
| 54 | <Shape> |
| 55 | <Cylinder side='false'> |
| 56 | <IS> |
| 57 | <connect nodeField='radius' protoField='radius'/> |
| 58 | <connect nodeField='height' protoField='height'/> |
| 59 | </IS> |
| 60 | </Cylinder> |
| 61 | <Appearance> |
| 62 | <Material USE='CylinderMaterial'/> |
| 63 | </Appearance> |
| 64 | </Shape> |
| 65 | </Transform> |
| 66 | <!-- only the first node in a prototype body is rendered, the others are carried along for the ride --> |
| 67 |
<!-- PositionInterpolator
HeightInterpolator is a DEF node that has 1 USE node: USE_1
<!-- ROUTE information for HeightInterpolator node: [from RaiseBollardClock.fraction_changed to set_fraction ] [from FractionReverser.value_changed to set_fraction ] [from value_changed to BollardTransform.set_translation ] --> <PositionInterpolator DEF='HeightInterpolator' key='0 1' keyValue='0 -0.5 0 0 0.5 0'/> |
| 68 | < ROUTE fromNode='HeightInterpolator' fromField='value_changed' toNode='BollardTransform' toField='set_translation'/> |
| 69 | <!-- ========= setup =========== --> |
| 70 | <!-- this Script initializes our PositionInterpolator to proper start/stop heights. Also initializes BollardTransform translation to the correct height. --> |
| 71 |
<!-- ROUTE information for HeightTypeConversion node:
[from initialTranslation to BollardTransform.set_translation
]
-->
<Script DEF='HeightTypeConversion' directOutput='true'> |
| 72 | <field name='height' type='SFFloat' accessType='initializeOnly'/> |
| 73 | <field name='initialTranslation' type='SFVec3f' accessType='outputOnly'/> |
| 74 | <field name='PI' type='SFNode' accessType='initializeOnly'> |
| 75 | <PositionInterpolator USE='HeightInterpolator'/> |
| 76 | </field> |
| 77 | <IS> |
| 78 | <connect nodeField='height' protoField='height'/> |
| 79 | </IS> |
<![CDATA[
ecmascript:
function initialize ()
{
// set initial Transform translation value to the correct height
initialTranslation = new SFVec3f (0, -(height / 2), 0); // output event
finalTranslation = new SFVec3f (0, (height / 2), 0);
// Browser.println ('initialTranslation=' + initialTranslation);
// customize PositionInterpolator to move correct vertical distance
PI.keyValue = new MFVec3f (initialTranslation, finalTranslation);
// Browser.println ('PI.keyValue=' + PI.keyValue);
}
]]>
|
|
| 81 | </Script> |
| 82 | < ROUTE fromNode='HeightTypeConversion' fromField='initialTranslation' toNode='BollardTransform' toField='set_translation'/> |
| 83 | <!-- ========= raise =========== --> |
| 84 |
<!-- ROUTE information for RaiseBollardClock node:
[from ClockScript.startRaising to startTime
]
[from fraction_changed to HeightInterpolator.set_fraction
]
-->
<TimeSensor DEF='RaiseBollardClock' cycleInterval='5'/> |
| 85 | <!-- alternative approach (shown below) replaces this script with a BooleanFilter plus TimeTrigger (to convert SFBool to SFTime) --> |
| 86 |
<!-- ROUTE information for ClockScript node:
[from startRaising to RaiseBollardClock.startTime
]
-->
<Script DEF='ClockScript'> |
| 87 | <field name='raise' type='SFBool' accessType='inputOnly'/> |
| 88 | <field name='startRaising' type='SFTime' accessType='outputOnly'/> |
| 89 | <IS> |
| 90 | <connect nodeField='raise' protoField='raise'/> |
| 91 | </IS> |
<![CDATA[
ecmascript:
function raise (value, timestamp)
{
startRaising = timestamp;
}
]]>
|
|
| 93 | </Script> |
| 94 | < ROUTE fromNode='RaiseBollardClock' fromField='fraction_changed' toNode='HeightInterpolator' toField='set_fraction'/> |
| 95 | < ROUTE fromNode='ClockScript' fromField='startRaising' toNode='RaiseBollardClock' toField='startTime'/> |
| 96 | <!-- ========= lower =========== --> |
| 97 |
<!-- ROUTE information for FractionReverser node:
[from LowerBollardClock.fraction_changed to set_fraction
]
[from value_changed to HeightInterpolator.set_fraction
]
-->
<ScalarInterpolator DEF='FractionReverser' key='0 1' keyValue='1 0'/> |
| 98 |
<!-- ROUTE information for LowerBollardClock node:
[from LowerTimeTrigger.triggerTime to set_startTime
]
[from fraction_changed to FractionReverser.set_fraction
]
-->
<TimeSensor DEF='LowerBollardClock' cycleInterval='5'/> |
| 99 |
<!-- ROUTE information for LowerTimeTrigger node:
[from StartLoweringFilter.inputTrue to set_boolean
]
[from triggerTime to LowerBollardClock.set_startTime
]
-->
<TimeTrigger DEF='LowerTimeTrigger'/> |
| 100 |
<!-- ROUTE information for StartLoweringFilter node:
[from inputTrue to LowerTimeTrigger.set_boolean
]
-->
<BooleanFilter DEF='StartLoweringFilter'> |
| 101 | <IS> |
| 102 | <connect nodeField='set_boolean' protoField='lower'/> |
| 103 | </IS> |
| 104 | </BooleanFilter> |
| 105 | < ROUTE fromNode='FractionReverser' fromField='value_changed' toNode='HeightInterpolator' toField='set_fraction'/> |
| 106 | < ROUTE fromNode='LowerBollardClock' fromField='fraction_changed' toNode='FractionReverser' toField='set_fraction'/> |
| 107 | < ROUTE fromNode='LowerTimeTrigger' fromField='triggerTime' toNode='LowerBollardClock' toField='set_startTime'/> |
| 108 | < ROUTE fromNode='StartLoweringFilter' fromField='inputTrue' toNode='LowerTimeTrigger' toField='set_boolean'/> |
| 109 | </ProtoBody> |
| 110 | </ProtoDeclare> |
| 111 | <!-- ==================== --> |
| 112 | <Viewpoint description='Bollard view' position='0 0 6'/> |
| 113 | <!-- test locally during development, once complete we split this out into a separate Example scene. --> |
| 114 |
<!-- ROUTE information for Bollard node:
[from ClickToRaiseBollard.isActive to raise
]
[from ClickToLowerBollard.isActive to lower
]
-->
<ProtoInstance name='BollardHydraulicSecurity' DEF='Bollard'> |
| 115 | <fieldValue name='height' value='0.85'/> |
| 116 | <fieldValue name='radius' value='0.2'/> |
| 117 | <fieldValue name='textureUrl' value=' "fan.png" '/> |
| 118 | </ProtoInstance> |
| 119 | <Shape DEF='GroundLevel'> |
| 120 | <Box size='10 0.01 10'/> |
| 121 | </Shape> |
| 122 | <Transform DEF='RaiseInterface' translation='-2 -1 0'> |
| 123 | <Shape> |
| 124 | <Text string='"Click to" "raise"'> |
| 125 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.3'/> |
| 126 | </Text> |
| 127 | </Shape> |
| 128 | <Shape> |
| 129 | <Box size='3 2 0.01'/> |
| 130 | <Appearance> |
| 131 | <Material transparency='1'/> |
| 132 | </Appearance> |
| 133 | </Shape> |
| 134 |
<!-- ROUTE information for ClickToRaiseBollard node:
[from isActive to Bollard.raise
]
-->
<TouchSensor DEF='ClickToRaiseBollard' description='click to raise bollard'/> |
| 135 | < ROUTE fromNode='ClickToRaiseBollard' fromField='isActive' toNode='Bollard' toField='raise'/> |
| 136 | </Transform> |
| 137 | <Transform DEF='LowerInterface' translation='2 -1 0'> |
| 138 | <Shape> |
| 139 | <Text string='"Click to" "lower"'> |
| 140 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.3'/> |
| 141 | </Text> |
| 142 | </Shape> |
| 143 | <Shape> |
| 144 | <Box size='3 2 0.01'/> |
| 145 | <Appearance> |
| 146 | <Material transparency='1'/> |
| 147 | </Appearance> |
| 148 | </Shape> |
| 149 |
<!-- ROUTE information for ClickToLowerBollard node:
[from isActive to Bollard.lower
]
-->
<TouchSensor DEF='ClickToLowerBollard' description='click tolower bollard'/> |
| 150 | < ROUTE fromNode='ClickToLowerBollard' fromField='isActive' toNode='Bollard' toField='lower'/> |
| 151 | </Transform> |
| 152 | </Scene> |
| 153 | </X3D> |
Event Graph ROUTE Table entries with 10 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.
|
ClickToLowerBollard
TouchSensor isActive SFBool |
Bollard
ProtoInstance lower SFBool |
|
ClickToRaiseBollard
TouchSensor isActive SFBool |
Bollard
ProtoInstance raise SFBool |
|
ClockScript
Script startRaising SFTime |
RaiseBollardClock
TimeSensor startTime SFTime |
then
|
RaiseBollardClock
TimeSensor fraction_changed SFFloat |
HeightInterpolator
PositionInterpolator set_fraction SFFloat |
then
|
HeightInterpolator
PositionInterpolator value_changed SFVec3f |
BollardTransform
Transform set_translation SFVec3f |
|
HeightTypeConversion
Script initialTranslation SFVec3f |
BollardTransform
Transform set_translation SFVec3f |
|
Bollard
ProtoInstance BollardHydraulicSecurity |
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. |
<!--
Color-coding 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>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->