X3D Model Documentation: SphericalMinePrototype.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='SphericalMinePrototype.x3d'/>
  6            <meta name='descriptioncontent='Underwater mine prototype SphericalMine. Note level of detail (LOD) transitions when seen at transition ranges.'/>
  7            <meta name='creatorcontent='Don Brutzman'/>
  8            <meta name='createdcontent='26 June 2000'/>
  9            <meta name='modifiedcontent='2 September 2024'/>
 10            <meta name='identifiercontent='https://savage.nps.edu/Savage/Weapons/UnderwaterMines/SphericalMinePrototype.x3d'/>
 11            <meta name='generatorcontent='X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit'/>
 12            <meta name='licensecontent='../../license.html'/>
 13       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: BLUE_SPHERICAL_MINE, GREEN_SPHERICAL_MINE, LOCATOR, NAVIGATION, NAVIGATION_MODE, ShowSphericalMines, SPIKE, UW_MINE_APPEARANCE, UW_MINE_MATERIAL, UW_MINE_PROXIMITY, UW_MINE_SPHERE, UW_MINE_TETHER, UW_MINE_VIEWPOINT, UW_MINE_VIEWPOINT_MEDIUM

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2, Viewpoint_3, Viewpoint_4, Viewpoint_5, UW_MINE_VIEWPOINT, UW_MINE_VIEWPOINT_MEDIUM

Index for ProtoDeclare definition: SphericalMine
-->
 14       <Scene>
 15            <!-- SphericalMine is a simple notional mine -->
 16            <WorldInfo title='SphericalMinePrototype.x3d'/>
 17            <ProtoDeclare name='SphericalMineappinfo='Spherical floating mine moored to bottom'>
 18                 <ProtoInterface>
 19                      <field name='descriptiontype='SFStringvalue='10 m: Spherical MineaccessType='initializeOnly'
                     appinfo='Description for each mine contact.'/>
 20                      <field name='colortype='SFColorvalue='.8 .8 .8accessType='inputOutput'
                     appinfo='Mine color can be used to indicate status (found/unknown/disabled/) tactic etc.'/>
 21                      <field name='translationtype='SFVec3fvalue='0 0 0accessType='inputOutput'
                     appinfo='Location of mine center in local world coordinates.'/>
 22                      <field name='scaletype='SFVec3fvalue='1 1 1accessType='inputOutput'
                     appinfo='Scale factor to change spherical mine size default diameter = 1m.'/>
 23                      <field name='bboxCentertype='SFVec3fvalue='0 0 0accessType='initializeOnly'
                     appinfo='Bounding box for collision detection of mine.'/>
 24                      <field name='tetherPointstype='MFVec3fvalue='0 0 0 0 -10 0accessType='inputOutput'
                     appinfo='Top and bottom endpoints of line tether that anchors this mine to the bottom.'/>
 25                      <field name='proximityIsActivetype='SFBoolaccessType='outputOnly'
                     appinfo='proximityIsActive can be used to activate information or interaction when the viewer nears the mine.'/>
 26                      <field name='proximitySizetype='SFVec3fvalue='10 10 10accessType='inputOutput'
                     appinfo='proximitySize provides overall box dimensions for proximity; thus (10 10 10) yields approximate radius 5 to 7 meters.'/>
 27                 </ProtoInterface>
 28                 <ProtoBody>
 29                      <Transform DEF='LOCATOR'>
 30                           <IS>
 31                                <connect nodeField='translationprotoField='translation'/>
 32                                <connect nodeField='scaleprotoField='scale'/>
 33                                <connect nodeField='bboxCenterprotoField='bboxCenter'/>
 34                           </IS>
 35                           <LOD range='100 500 5000'>
 36                                <!-- High resolution -->
 37                                <Group>
 38                                     <Viewpoint DEF='UW_MINE_VIEWPOINT'>
 39                                          <IS>
 40                                               <connect nodeField='descriptionprotoField='description'/>
 41                                          </IS>
 42                                     </Viewpoint>
 43                                     <ProximitySensor DEF='UW_MINE_PROXIMITY'>
 44                                          <IS>
 45                                               <connect nodeField='isActiveprotoField='proximityIsActive'/>
 46                                               <connect nodeField='sizeprotoField='proximitySize'/>
 47                                          </IS>
 48                                     </ProximitySensor>
 49 
                                   <!-- Shape UW_MINE_SPHERE is a DEF node that has 1 USE node: USE_1 -->
                                   <Shape DEF='UW_MINE_SPHERE'>
 50                                          <Sphere radius='.5'/>
 51 
                                        <!-- Appearance UW_MINE_APPEARANCE is a DEF node that has 1 USE node: USE_1 -->
                                        <Appearance DEF='UW_MINE_APPEARANCE'>
 52                                               <Material DEF='UW_MINE_MATERIALshininess='.5'>
 53                                                    <IS>
 54                                                         <connect nodeField='diffuseColorprotoField='color'/>
 55                                                    </IS>
 56                                               </Material>
 57                                          </Appearance>
 58                                     </Shape>
 59                                     <Transform translation='0 .49 0'>
 60 
                                        <!-- Transform SPIKE is a DEF node that has 5 USE nodes: USE_1, USE_2, USE_3, USE_4, USE_5 -->
                                        <Transform DEF='SPIKEcenter='0 -.1 0translation='0 .1 0'>
 61                                               <Shape>
 62                                                    <Cone bottom='falsebottomRadius='.05height='.2'/>
 63                                                    <Appearance>
 64                                                         <Material diffuseColor='.8 .8 .8shininess='.5specularColor='.2 .2 .2'/>
 65                                                    </Appearance>
 66                                               </Shape>
 67                                          </Transform>
 68                                     </Transform>
 69                                     <Transform rotation='0 0 1 3.1416translation='0 -.49 0'>
 70                                          <Transform USE='SPIKE'/>
 71                                     </Transform>
 72                                     <Transform rotation='0 0 1 -1.57079translation='.49 0 0'>
 73                                          <Transform USE='SPIKE'/>
 74                                     </Transform>
 75                                     <Transform rotation='0 0 1 1.57079translation='-.49 0 0'>
 76                                          <Transform USE='SPIKE'/>
 77                                     </Transform>
 78                                     <Transform rotation='1 0 0 1.57079translation='0 0 .49'>
 79                                          <Transform USE='SPIKE'/>
 80                                     </Transform>
 81                                     <Transform rotation='1 0 0 -1.57079translation='0 0 -.49'>
 82                                          <Transform USE='SPIKE'/>
 83                                     </Transform>
 84                                     <Shape>
 85                                          <IndexedLineSet coordIndex='0 1 -1'>
 86                                               <Coordinate DEF='UW_MINE_TETHER'>
 87                                                    <IS>
 88                                                         <connect nodeField='pointprotoField='tetherPoints'/>
 89                                                    </IS>
 90                                               </Coordinate>
 91                                          </IndexedLineSet>
 92                                     </Shape>
 93                                </Group>
 94                                <!-- Medium resolution -->
 95                                <Group>
 96                                     <Viewpoint DEF='UW_MINE_VIEWPOINT_MEDIUM'>
 97                                          <IS>
 98                                               <connect nodeField='descriptionprotoField='description'/>
 99                                          </IS>
100                                     </Viewpoint>
101                                     <Shape USE='UW_MINE_SPHERE'/>
102                                </Group>
103                                <!-- Low resolution -->
104                                <Shape>
105                                     <Box size='12 12 12'/>
106                                     <Appearance USE='UW_MINE_APPEARANCE'/>
107                                </Shape>
108                                <!-- No resolution -->
109                                <WorldInfo info='"null geometry"'/>
110                           </LOD>
111                      </Transform>
112                 </ProtoBody>
113            </ProtoDeclare>
114            <!-- Show default geometry, in case this Prototype library is viewed directly as a scene -->
115            <Group DEF='ShowSphericalMines'>
116 
               <!-- ROUTE information for BLUE_SPHERICAL_MINE node:  [from proximityIsActive to NAVIGATION_MODE.inProximity ] -->
               <ProtoInstance name='SphericalMineDEF='BLUE_SPHERICAL_MINE'>
117                      <fieldValue name='descriptionvalue='10 m: blue SphericalMine default viewpoint'/>
118                      <fieldValue name='colorvalue='0 0 .8'/>
119                      <fieldValue name='translationvalue='0 -10 0'/>
120                      <fieldValue name='bboxCentervalue='1 1 1'/>
121                      <fieldValue name='tetherPointsvalue='0 0 0 0 -10.0 0'/>
122                 </ProtoInstance>
123 
               <!-- ROUTE information for GREEN_SPHERICAL_MINE node:  [from proximityIsActive to NAVIGATION_MODE.inProximity ] -->
               <ProtoInstance name='SphericalMineDEF='GREEN_SPHERICAL_MINE'>
124                      <fieldValue name='descriptionvalue='10 m: green SphericalMine default viewpoint'/>
125                      <fieldValue name='colorvalue='0 .8 0'/>
126                      <fieldValue name='translationvalue='10 -10 0'/>
127                      <fieldValue name='bboxCentervalue='2 2 2'/>
128                      <fieldValue name='tetherPointsvalue='0 0 0 0 -10.0 0'/>
129                 </ProtoInstance>
130                 <Background groundColor='0 .2 .2skyColor='0 .3 .3'/>
131                 <Viewpoint description='1 m: one closeup SphericalMineposition='10 -10 2'/>
132                 <Viewpoint description='10 m: two pointy SphericalMinesposition='5 -10 10'/>
133                 <Viewpoint description='100+ m: two round SphericalMinesposition='5 -10 105'/>
134                 <Viewpoint description='500+ m: two boxy SphericalMinesposition='5 -10 510'/>
135                 <Viewpoint description='5000+ m: two invisible SphericalMinesposition='5 -10 5010'/>
136            </Group>
137            <!-- Proximity activation triggers switch in NavigationInfo mode between EXAMINE and WALK - pretty cool! -->
138 
          <!-- ROUTE information for NAVIGATION node:  [from NAVIGATION_MODE.type to set_type ] -->
          <NavigationInfo DEF='NAVIGATIONspeed='20type='"WALK" "EXAMINE" "ANY"'/>
139 
140                 <field name='inProximitytype='SFBoolaccessType='inputOnly'/>
141                 <field name='typetype='MFStringaccessType='outputOnly'/>
  <![CDATA[
      
ecmascript:

function inProximity ( value, eventTime )
{
 if ( value == true )
 {
	type[0] = 'EXAMINE';
	type[1] = 'WALK';
	type[2] = 'ANY';
 }
 else
 {
	type[0] = 'WALK';
	type[1] = 'EXAMINE';
	type[2] = 'ANY';
 }
 // Browser.println ('inProximity=' + value + ', type=' + type);
}

    
]]>
143            </Script>
144            < ROUTE  fromNode='BLUE_SPHERICAL_MINE' fromField='proximityIsActive' toNode='NAVIGATION_MODE' toField='inProximity'/>
145            < ROUTE  fromNode='GREEN_SPHERICAL_MINE' fromField='proximityIsActive' toNode='NAVIGATION_MODE' toField='inProximity'/>
146            <!-- TODO match field name in Script exactly -->
147            < ROUTE  fromNode='NAVIGATION_MODE' fromField='type' toNode='NAVIGATION' toField='set_type'/>
148       </Scene>
149  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top Index for DEF nodes: BLUE_SPHERICAL_MINE, GREEN_SPHERICAL_MINE, LOCATOR, NAVIGATION, NAVIGATION_MODE, ShowSphericalMines, SPIKE, UW_MINE_APPEARANCE, UW_MINE_MATERIAL, UW_MINE_PROXIMITY, UW_MINE_SPHERE, UW_MINE_TETHER, UW_MINE_VIEWPOINT, UW_MINE_VIEWPOINT_MEDIUM

Index for Viewpoint nodes: Viewpoint_1, Viewpoint_2, Viewpoint_3, Viewpoint_4, Viewpoint_5, UW_MINE_VIEWPOINT, UW_MINE_VIEWPOINT_MEDIUM

Index for ProtoDeclare definition: SphericalMine
-->
X3D Tooltips element index: Appearance, Background, Box, Cone, connect, Coordinate, field, fieldValue, Group, head, IndexedLineSet, IS, LOD, Material, meta, NavigationInfo, ProtoBody, ProtoDeclare, ProtoInstance, ProtoInterface, ProximitySensor, ROUTE, Scene, Script, Shape, Sphere, Transform, Viewpoint, 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.

BLUE_SPHERICAL_MINE
ProtoInstance
proximityIsActive
SFBool

ROUTE
event to
(1)
NAVIGATION_MODE
Script
inProximity
SFBool
then
 
 
 
NAVIGATION_MODE
Script
type
MFString

ROUTE
event to
(2)
NAVIGATION
NavigationInfo
set_type
SFString

GREEN_SPHERICAL_MINE
ProtoInstance
proximityIsActive
SFBool

ROUTE
event to
(1)
NAVIGATION_MODE
Script
inProximity
SFBool
then
 
 
 
NAVIGATION_MODE
Script
type
MFString

ROUTE
event to
(2)
NAVIGATION
NavigationInfo
set_type
SFString

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://savage.nps.edu/Savage/Weapons/UnderwaterMines/SphericalMinePrototypeIndex.html -->
<!-- Version control at
https://gitlab.nps.edu/Savage/Savage/Weapons/UnderwaterMines/SphericalMinePrototype.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. -->