<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<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'>
  <head>
    <meta content='Type209PrevezeDieselSubmarineAnimated.x3d' name='title'/>
    <meta content='Alper SINAV' name='creator'/>
    <meta content='1 August 2001' name='created'/>
    <meta content='28 November 2019' name='modified'/>
    <meta content='This is a Type 209 Preveze Class Submarine From Turkish Submarine Fleet. It consists of a cylindric pressure hull, hydroplanes, rudder, propeller and superstructure with tower.' name='description'/>
    <meta content='Alper SINAV' name='creator'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Savage/Submarines/Various/Type209PrevezeDieselSubmarineAnimated.x3d' name='identifier'/>
    <meta content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='Type209PrevezeDieselSubmarineAnimated.x3d'/>
    <Background groundAngle='1.309 1.570796' groundColor='0 0.4 0.4 0.25 0.6 0.6 0.1 0.4 0.4' skyAngle='1.309 1.571' skyColor='0.1 0.1 0.6 0.1 0.25 0.8 0.6 0.6 0.9'/>
    <Viewpoint description='Look away'/>
    <Viewpoint description='Listen Sonar' position='0 0 3'/>
    <!-- Following is construction of submarine -->
    <Transform scale='0.2 0.2 0.2'>
      <!-- original rotation 0 0 1 -0.8 -->
      <Transform DEF='ROT'>
        <Transform DEF='SUBTRANS'>
          <Transform DEF='SUBROTATE'>
            <Group DEF='SUBMARINE'>
              <!-- Main Pessure Hull and upper form super structure -->
              <Transform rotation='-1 0 0 1.57'>
                <Transform DEF='Z90' rotation='0 0 1 1.57'>
                  <Shape>
                    <Appearance DEF='SUBOUT'>
                      <Material DEF='Total' diffuseColor='0.0 0.0 0.1' emissiveColor='0.1 0.1 0.1' specularColor='0.6 0.5 0.5'/>
                    </Appearance>
                    <Extrusion ccw='false' creaseAngle='0.785' crossSection='0 2 0.2 1.95 0.4 1.92 0.6 1.9 0.8 1.8 1 1.7 1 2.19 0.9 2.28 0.8 2.37 0.7 2.4 -0.7 2.4 -0.8 2.37 -0.9 2.28 -1 2.19 -1 1.7 -0.8 1.8 -0.6 1.9 -0.4 1.92 -0.2 1.95 0 2' spine='0 -7 0 0 7 0'/>
                  </Shape>
                  <Shape>
                    <Appearance>
                      <Material USE='Total'/>
                    </Appearance>
                    <Cylinder height='14' radius='2'/>
                  </Shape>
                  <Transform scale='2 2 2'>
                    <Shape>
                      <Appearance>
                        <Material USE='Total'/>
                      </Appearance>
                      <Extrusion creaseAngle='0.785' crossSection='1.00 0.00 0.92 -0.38 0.71 -0.71 0.38 -0.92 0.00 -1.00 -0.38 -0.92 -0.71 -0.71 -0.92 -0.38 -1.00 -0.00 -0.92 0.38 -0.71 0.71 -0.38 0.92 0.00 1.00 0.38 0.92 0.71 0.71 0.92 0.38 1.00 0.00' scale='0.3 0.3 1 1' spine='0 7 0 0 3.5 0'/>
                    </Shape>
                  </Transform>
                  <Shape>
                    <Appearance>
                      <Material USE='Total'/>
                    </Appearance>
                    <Extrusion ccw='false' creaseAngle='0.785' crossSection='0 2 0.2 1.95 0.4 1.92 0.6 1.9 0.8 1.8 1 1.7 1 2.19 0.9 2.28 0.8 2.37 0.7 2.4 -0.7 2.4 -0.8 2.37 -0.9 2.28 -1 2.19 -1 1.7 -0.8 1.8 -0.6 1.9 -0.4 1.92 -0.2 1.95 0 2' scale='1 1 0.1 0.1' spine='0 -7 0 0 -9 0'/>
                  </Shape>
                </Transform>
              </Transform>
              <!-- Head section of submarine MAIN BALAST TANKS -->
              <Transform center='0 0 14' translation='7 0 0'>
                <Shape>
                  <Sphere radius='2'/>
                  <Appearance>
                    <Material USE='Total'/>
                  </Appearance>
                </Shape>
              </Transform>
              <!-- Propeller copyright LtJg Burcin KAYALI -->
              <Transform scale='0.2 0.15 0.15' translation='-14.2 0 0'>
                <Inline url='"Type209Propeller.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Submarines/Various/Type209Propeller.wrl"'/>
              </Transform>
              <!-- TOWER -->
              <Transform scale='4 0.5 1' translation='-2 3 0'>
                <Shape>
                  <Appearance>
                    <Material USE='Total'/>
                  </Appearance>
                  <Cylinder height='4' radius='0.6'/>
                </Shape>
              </Transform>
              <!-- Retractable Mast Group -->
              <Transform DEF='PERISCOPETRANS' translation='-2 3 0'>
                <Shape DEF='PERISCOPE'>
                  <Appearance>
                    <Material USE='Total'/>
                  </Appearance>
                  <Cylinder height='6' radius='0.1'/>
                </Shape>
              </Transform>
              <Transform DEF='UHFANTENNATRANS' translation='-4 3 0'>
                <Shape USE='PERISCOPE'/>
              </Transform>
              <!-- Rudder and Hydro planes -->
              <Group DEF='RUDDER'>
                <Transform translation='-13 1 0'>
                  <Transform DEF='LowRudderRot'>
                    <Transform scale='1 1 0.2'>
                      <Shape>
                        <Cylinder DEF='BOWHYDPLANE' height='1' radius='0.5'/>
                        <Appearance>
                          <Material USE='Total'/>
                        </Appearance>
                      </Shape>
                    </Transform>
                  </Transform>
                </Transform>
                <Transform translation='-13 -1 0'>
                  <Transform DEF='UpRudderRot'>
                    <Transform scale='1 1 0.2'>
                      <Shape>
                        <Cylinder USE='BOWHYDPLANE'/>
                        <Appearance>
                          <Material USE='Total'/>
                        </Appearance>
                      </Shape>
                    </Transform>
                  </Transform>
                </Transform>
              </Group>
              <Group DEF='BOWPLANE'>
                <Transform translation='-12.5 0 1'>
                  <Transform rotation='1 0 0 1.57'>
                    <Transform DEF='RBowPlaneRot'>
                      <Transform scale='1 1 0.2'>
                        <Shape>
                          <Cylinder USE='BOWHYDPLANE'/>
                          <Appearance>
                            <Material USE='Total'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                    </Transform>
                  </Transform>
                </Transform>
                <Transform translation='-12.5 0 -1'>
                  <Transform rotation='1 0 0 1.57'>
                    <Transform DEF='LBowPlaneRot' rotation='0 1 0 0.8'>
                      <Transform scale='1 1 0.2'>
                        <Shape>
                          <Cylinder USE='BOWHYDPLANE'/>
                          <Appearance>
                            <Material USE='Total'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                    </Transform>
                  </Transform>
                </Transform>
              </Group>
            </Group>
          </Transform>
          <Sound intensity='0.5' maxBack='70' maxFront='120' minBack='50' minFront='100'>
            <AudioClip description='sonar ping' loop='true' url='"sonar.wav" "https://www.web3d.org/x3d/content/examples/Savage/Submarines/Various/sonar.wav" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/tone1.wav"'/>
          </Sound>
        </Transform>
      </Transform>
    </Transform>
    <TimeSensor DEF='CLOCK' cycleInterval='40' loop='true'/>
    <PositionInterpolator DEF='PATH' key='0 0.5 1' keyValue='2 0 0 5 0 0 6 0 0'/>
    <OrientationInterpolator DEF='RUDDERANGLE' key='0 0.2 0.7' keyValue='0 1 0 0 0 1 0 0.8 0 1 0 1.1'/>
    <ROUTE fromField='fraction_changed' fromNode='CLOCK' toField='set_fraction' toNode='RUDDERANGLE'/>
    <ROUTE fromField='value_changed' fromNode='RUDDERANGLE' toField='set_rotation' toNode='RBowPlaneRot'/>
    <ROUTE fromField='value_changed' fromNode='RUDDERANGLE' toField='set_rotation' toNode='LBowPlaneRot'/>
    <Script DEF='MOVER'>
      <field accessType='inputOnly' name='set_fraction' type='SFFloat'/>
      <field accessType='outputOnly' name='value_changed' type='SFVec3f'/>
      <field accessType='initializeOnly' name='radius' type='SFFloat' value='10'/>
      <field accessType='initializeOnly' name='turns' type='SFFloat' value='1'/>
      <![CDATA[
ecmascript:

function set_fraction ( fraction, eventTime ) {
	value_changed = new SFVec3f (radius * Math.sin( turns * fraction * 6.28 ), 0, radius * Math.cos( turns * fraction * 6.28 ));
}
]]>
    </Script>
    <Script DEF='TURNER'>
      <field accessType='inputOnly' name='set_fraction' type='SFFloat'/>
      <field accessType='outputOnly' name='value_changed' type='SFRotation'/>
      <!-- <field accessType="initializeOnly" name="radius" type="SFFloat" value="1"/> <field accessType="initializeOnly" name="turns" type="SFFloat" value="1"/> -->
      <![CDATA[
ecmascript:

function set_fraction ( fraction, eventTime ) {
	value_changed = new SFRotation (0, 1, 0, fraction*6.28);
}
]]>
    </Script>
    <ROUTE fromField='fraction_changed' fromNode='CLOCK' toField='set_fraction' toNode='TURNER'/>
    <ROUTE fromField='value_changed' fromNode='TURNER' toField='set_rotation' toNode='SUBROTATE'/>
    <ROUTE fromField='fraction_changed' fromNode='CLOCK' toField='set_fraction' toNode='MOVER'/>
    <ROUTE fromField='value_changed' fromNode='MOVER' toField='set_translation' toNode='SUBTRANS'/>
  </Scene>
</X3D>