#X3D V3.3 utf8 PROFILE Immersive # [X3D] version=3.3 # [X3D] noNamespaceSchemaLocation=https://www.web3d.org/specifications/x3d-3.3.xsd # X3D-to-ClassicVRML XSL translation autogenerated by X3dToClassicVrmlEncoding.xslt and X3dToVrml97.xslt # https://www.web3d.org/x3d/content/X3dToClassicVrmlEncoding.xslt # https://www.web3d.org/x3d/content/X3dToVrml97.xslt # Transformation using XSLT processor: Saxonica # head META "title" "SphericalMinePrototype.x3d" META "description" "Underwater mine prototype SphericalMine. Note level of detail (LOD) transitions when seen at transition ranges." META "creator" "Don Brutzman" META "created" "26 June 2000" META "modified" "2 September 2024" META "identifier" "https://savage.nps.edu/Savage/Weapons/UnderwaterMines/SphericalMinePrototype.x3d" META "generator" "X3D-Edit 4.0, https://savage.nps.edu/X3D-Edit" META "license" "../../license.html" # [Scene] ========== ========== ========== # SphericalMine is a simple notional mine WorldInfo { title "SphericalMinePrototype.x3d" } PROTO SphericalMine [ # [appinfo] Spherical floating mine moored to bottom initializeOnly SFString description "10 m: Spherical Mine" # [appinfo] Description for each mine contact. inputOutput SFColor color .8 .8 .8 # [appinfo] Mine color can be used to indicate status (found/unknown/disabled/) tactic etc. inputOutput SFVec3f translation 0 0 0 # [appinfo] Location of mine center in local world coordinates. inputOutput SFVec3f scale 1 1 1 # [appinfo] Scale factor to change spherical mine size default diameter = 1m. initializeOnly SFVec3f bboxCenter 0 0 0 # [appinfo] Bounding box for collision detection of mine. inputOutput MFVec3f tetherPoints [ 0 0 0 0 -10 0 ] # [appinfo] Top and bottom endpoints of line tether that anchors this mine to the bottom. outputOnly SFBool proximityIsActive # [appinfo] proximityIsActive can be used to activate information or interaction when the viewer nears the mine. inputOutput SFVec3f proximitySize 10 10 10 # [appinfo] proximitySize provides overall box dimensions for proximity; thus (10 10 10) yields approximate radius 5 to 7 meters. ] { DEF LOCATOR Transform { translation IS translation scale IS scale bboxCenter IS bboxCenter children [ LOD { range [ 100 500 5000 ] children [ ### children2 # High resolution Group { children [ DEF UW_MINE_VIEWPOINT Viewpoint { description IS description } ### Warning: Viewpoint behavior not guaranteed as child (or descendant) of LOD node DEF UW_MINE_PROXIMITY ProximitySensor { isActive IS proximityIsActive size IS proximitySize } DEF UW_MINE_SPHERE Shape { geometry Sphere { radius .5 } appearance DEF UW_MINE_APPEARANCE Appearance { material DEF UW_MINE_MATERIAL Material { shininess .5 diffuseColor IS color } } } Transform { translation 0 .49 0 children [ DEF SPIKE Transform { center 0 -.1 0 translation 0 .1 0 children [ Shape { geometry Cone { bottom FALSE bottomRadius .05 height .2 } appearance Appearance { material Material { diffuseColor .8 .8 .8 shininess .5 specularColor .2 .2 .2 } } } ] } ] } Transform { rotation 0 0 1 3.1416 translation 0 -.49 0 children [ USE SPIKE ] } Transform { rotation 0 0 1 -1.57079 translation .49 0 0 children [ USE SPIKE ] } Transform { rotation 0 0 1 1.57079 translation -.49 0 0 children [ USE SPIKE ] } Transform { rotation 1 0 0 1.57079 translation 0 0 .49 children [ USE SPIKE ] } Transform { rotation 1 0 0 -1.57079 translation 0 0 -.49 children [ USE SPIKE ] } Shape { geometry IndexedLineSet { coordIndex [ 0 1 -1 ] coord DEF UW_MINE_TETHER Coordinate { point IS tetherPoints } } } ] } # Medium resolution Group { children [ DEF UW_MINE_VIEWPOINT_MEDIUM Viewpoint { description IS description } ### Warning: Viewpoint behavior not guaranteed as child (or descendant) of LOD node USE UW_MINE_SPHERE ] } # Low resolution Shape { geometry Box { size 12 12 12 } appearance USE UW_MINE_APPEARANCE } # No resolution WorldInfo { info [ "null geometry" ] } ] } ] } } # Show default geometry, in case this Prototype library is viewed directly as a scene DEF ShowSphericalMines Group { children [ DEF BLUE_SPHERICAL_MINE SphericalMine { description "10 m: blue SphericalMine default viewpoint" color 0 0 .8 translation 0 -10 0 bboxCenter 1 1 1 tetherPoints [ 0 0 0 0 -10.0 0 ] } DEF GREEN_SPHERICAL_MINE SphericalMine { description "10 m: green SphericalMine default viewpoint" color 0 .8 0 translation 10 -10 0 bboxCenter 2 2 2 tetherPoints [ 0 0 0 0 -10.0 0 ] } Background { groundColor [ 0 .2 .2 ] skyColor [ 0 .3 .3 ] } Viewpoint { description "1 m: one closeup SphericalMine" position 10 -10 2 } Viewpoint { description "10 m: two pointy SphericalMines" position 5 -10 10 } Viewpoint { description "100+ m: two round SphericalMines" position 5 -10 105 } Viewpoint { description "500+ m: two boxy SphericalMines" position 5 -10 510 } Viewpoint { description "5000+ m: two invisible SphericalMines" position 5 -10 5010 } ] } # Proximity activation triggers switch in NavigationInfo mode between EXAMINE and WALK - pretty cool! DEF NAVIGATION NavigationInfo { speed 20 type [ "WALK" "EXAMINE" "ANY" ] } DEF NAVIGATION_MODE Script { inputOnly SFBool inProximity outputOnly MFString type url [ "ecmascript: // ### X3D Browser.print() not supported by all VRML97 viewers, instead simply using print() 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); } " ] } ROUTE BLUE_SPHERICAL_MINE.proximityIsActive TO NAVIGATION_MODE.inProximity ROUTE GREEN_SPHERICAL_MINE.proximityIsActive TO NAVIGATION_MODE.inProximity # TODO match field name in Script exactly ROUTE NAVIGATION_MODE.type TO NAVIGATION.set_type