<?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='SeaStateExtrusionPrototype.x3d' name='title'/>
    <meta content='Marcus V. da S. Simoes' name='creator'/>
    <meta content='11 January 2001' name='created'/>
    <meta content='20 October 2019' name='modified'/>
    <meta content='Sea state rendering of ocean wave motion: prototype for reproducing sea state surface in other scenes.' name='description'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/SeaStateExtrusionPrototype.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='SeaStateExtrusionPrototype.x3d'/>
    <ProtoDeclare name='SeaStateExtrusion'>
      <ProtoInterface>
        <field accessType='outputOnly' name='shipPitch' type='SFRotation'/>
        <field accessType='outputOnly' name='shipRoll' type='SFRotation'/>
      </ProtoInterface>
      <ProtoBody>
        <Group>
          <!-- AnimationClock -->
          <!-- ================================================= -->
          <Group DEF='TimeSensors'>
            <TimeSensor DEF='WaveClock' cycleInterval='15' loop='true'/>
            <TimeSensor DEF='PitchandRollClock' cycleInterval='10' loop='true'/>
          </Group>
          <!-- ================================================= -->
          <!-- Interpolators -->
          <!-- ================================================= -->
          <!-- MovingTheShip -->
          <Group DEF='OrientationInterpolators'>
            <OrientationInterpolator DEF='PitchInterpolator' key='0.0 0.5 1.0' keyValue='0 0 1 -0.05 0 0 1 0.0 0 0 1 -0.05'>
              <IS>
                <connect nodeField='value_changed' protoField='shipPitch'/>
              </IS>
            </OrientationInterpolator>
            <OrientationInterpolator DEF='RollInterpolator' key='0.0 0.5 1.0' keyValue='1 0 0 -0.05 1 0 0 0.0 1 0 0 -0.05'>
              <IS>
                <connect nodeField='value_changed' protoField='shipRoll'/>
              </IS>
            </OrientationInterpolator>
          </Group>
          <!-- ================================================= -->
          <!-- MovingTheSea -->
          <Group DEF='CoordinateInterpolator'>
            <CoordinateInterpolator DEF='Ondulation' key='0.0 0.25 0.50 0.75 1.0' keyValue='-4.100 0.0 0 -4.0 0.0 0 -3.529 0.674 0 -3.059 0.996 0 -2.588 0.798 0 -2.118 0.184 0 -1.647 -0.526 0 -1.176 -0.962 0 -0.706 -0.895 0 -0.235 -0.361 0 0.235 0.361 0 0.706 0.895 0 1.176 0.962 0 1.647 0.526 0 2.118 -0.184 0 2.588 -0.798 0 3.059 -0.996 0 3.529 -0.674 0 4.0 0.0 0 -4.100 -1.0 0 -4.0 -1.0 0 -3.529 -0.739 0 -3.059 -0.092 0 -2.588 0.603 0 -2.118 0.983 0 -1.647 0.850 0 -1.176 0.274 0 -0.706 -0.446 0 -0.235 -0.932 0 0.235 -0.932 0 0.706 -0.446 0 1.176 0.274 0 1.647 0.850 0 2.118 0.983 0 2.588 0.603 0 3.059 -0.092 0 3.529 -0.739 0 4.0 -1.0 0 -4.100 0.0 0 -4.0 0.0 0 -3.529 -0.674 0 -3.059 -0.996 0 -2.588 -0.798 0 -2.118 -0.184 0 -1.647 0.526 0 -1.176 0.962 0 -0.706 0.895 0 -0.235 0.361 0 0.235 -0.361 0 0.706 -0.895 0 1.176 -0.962 0 1.647 -0.526 0 2.118 0.184 0 2.588 0.798 0 3.059 0.996 0 3.529 0.674 0 4.0 0.0 0 -4.100 1.0 0 -4.0 1.0 0 -3.529 0.739 0 -3.059 0.092 0 -2.588 -0.603 0 -2.118 -0.983 0 -1.647 -0.850 0 -1.176 -0.274 0 -0.706 0.446 0 -0.235 0.932 0 0.235 0.932 0 0.706 0.446 0 1.176 -0.274 0 1.647 -0.850 0 2.118 -0.983 0 2.588 -0.603 0 3.059 0.092 0 3.529 0.739 0 4.0 1.0 0 -4.100 0.0 0 -4.0 0.0 0 -3.529 0.674 0 -3.059 0.996 0 -2.588 0.798 0 -2.118 0.184 0 -1.647 -0.526 0 -1.176 -0.962 0 -0.706 -0.895 0 -0.235 -0.361 0 0.235 0.361 0 0.706 0.895 0 1.176 0.962 0 1.647 0.526 0 2.118 -0.184 0 2.588 -0.798 0 3.059 -0.996 0 3.529 -0.674 0 4.0 0.0 0'/>
          </Group>
          <!-- ================================================= -->
          <!-- SeaLevelChoiceGroup -->
          <Switch DEF='SeaStateNumber' whichChoice='0'>
            <Group DEF='SeaState_1'>
              <Transform>
                <Transform DEF='TheSea'>
                  <!-- BasicWave -->
                  <Transform DEF='Basic' scale='250 1 10'>
                    <Shape DEF='BasicWave'>
                      <Appearance DEF='SeaColor'>
                        <ImageTexture url='"../../Environment/SeaState/pool.jpg" "https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/pool.jpg"'/>
                        <Material diffuseColor='0 0 0' transparency='0.3'/>
                      </Appearance>
                      <Extrusion DEF='BasicExtrusion' beginCap='false' convex='false' creaseAngle='0.01' crossSection='0 0 0 200 0 0' endCap='false' solid='false' spine='0.0 0.0 0.0000 1.0 0.0204 1.0000 2.0 0.0161 2.0000 3.0 -0.0218 3.0000 4.0 -0.0791 4.0000 5.0 -0.1237 5.0000 6.0 -0.1224 6.0000 7.0 -0.0598 7.0000 8.0 0.0503 8.0000 9.0 0.1661 9.0000 10.0 0.2348 10.0000 11.0 0.2163 11.0000 12.0 0.1041 12.0000 13.0 -0.0672 13.0000 14.0 -0.2326 14.0000 15.0 -0.3224 15.0000 16.0 -0.2920 16.0000 17.0 -0.1434 17.0000 18.0 0.0723 18.0000 19.0 0.2728 19.0000 20.0 0.3776 20.0000 21.0 0.3408 21.0000 22.0 0.1718 22.0000 23.0 -0.0670 23.0000 24.0 -0.2840 24.0000 25.0 -0.3951 25.0000 26.0 -0.3568 26.0000 27.0 -0.1846 27.0000 28.0 0.0541 28.0000 29.0 0.2668 29.0000 30.0 0.3734 30.0000 31.0 0.3373 31.0000 32.0 0.1782 32.0000 33.0 -0.0373 33.0000 34.0 -0.2246 34.0000 35.0 -0.3153 35.0000 36.0 -0.2831 36.0000 37.0 -0.1513 37.0000 38.0 0.0205 38.0000 39.0 0.1632 39.0000 40.0 0.2269 40.0000 41.0 0.1990 41.0000 42.0 0.1048 42.0000 43.0 -0.0074 43.0000 44.0 -0.0903 44.0000 45.0 -0.1177 45.0000 46.0 -0.0928 46.0000 47.0 -0.0423 47.0000 48.0 0.0006 48.0000 49.0 0.0142 49.0000 50.0 -0.0012 50.0000 51.0 -0.0251 51.0000 52.0 -0.0307 52.0000 53.0 -0.0015 53.0000 54.0 0.0571 54.0000 55.0 0.1175 55.0000 56.0 0.1429 56.0000 57.0 0.1069 57.0000 58.0 0.0098 58.0000 59.0 -0.1166 59.0000 60.0 -0.2197 60.0000 61.0 -0.2485 61.0000 62.0 -0.1780 62.0000 63.0 -0.0240 63.0000 64.0 0.1590 64.0000 65.0 0.2978 65.0000 66.0 0.3309 66.0000 67.0 0.2357 67.0000 68.0 0.0411 68.0000 69.0 -0.1814 69.0000 70.0 -0.3446 70.0000 71.0 -0.3815 71.0000 72.0 -0.2729 72.0000 73.0 -0.0574 73.0000 74.0 0.1834 74.0000 75.0 0.3563 75.0000 76.0 0.3946 76.0000 77.0 0.2841 77.0000 78.0 0.0689 78.0000 79.0 -0.1668 79.0000 80.0 -0.3327 80.0000 81.0 -0.3686 81.0000 82.0 -0.2664 82.0000 83.0 -0.0721 83.0000 84.0 0.1355 84.0000 85.0 0.2774 85.0000 86.0 0.3057 86.0000 87.0 0.2201 87.0000 88.0 0.0645 88.0000 89.0 -0.0946 89.0000 90.0 -0.1969 90.0000 91.0 -0.2121 91.0000 92.0 -0.1485 92.0000 93.0 -0.0450 93.0000 94.0 0.0499 94.0000 95.0 0.1004 95.0000 96.0 0.0972 96.0000 97.0 0.0580 97.0000 98.0 0.0142 98.0000 99.0 -0.0071 99.0000 100.0 0.0020 100.0'/>
                    </Shape>
                  </Transform>
                </Transform>
              </Transform>
            </Group>
            <Group DEF='SeaState_2'>
              <Transform scale='1 5 1'>
                <Group USE='SeaState_1'/>
              </Transform>
            </Group>
            <Group DEF='SeaState_3'>
              <Transform scale='1 8 1'>
                <Group USE='SeaState_1'/>
              </Transform>
            </Group>
            <Group DEF='SeaState_4'>
              <Transform scale='1 12 1'>
                <Group USE='SeaState_1'/>
              </Transform>
            </Group>
            <Group DEF='SeaState_5'>
              <Transform scale='1 15 1'>
                <Group USE='SeaState_1'/>
              </Transform>
            </Group>
            <Group DEF='SeaState_6'>
              <Transform scale='1 20 1'>
                <Group USE='SeaState_1'/>
              </Transform>
            </Group>
            <Group DEF='SeaState_7'>
              <Transform scale='1 25 1'>
                <Group USE='SeaState_1'/>
              </Transform>
            </Group>
            <Group DEF='SeaState_8'>
              <Transform scale='1 32 1'>
                <Group USE='SeaState_1'/>
              </Transform>
            </Group>
          </Switch>
          <!-- ================================================= -->
          <!-- Sea State Control Panel -->
          <Group DEF='SeaStateAndDirection'>
            <Transform translation='0 100 4000'>
              <Viewpoint description='Sea State Control Panel' position='-2 0 6'/>
              <Billboard>
                <Group DEF='SeaStateChoice'>
                  <Transform DEF='Option1' translation='0 -2.0 0'>
                    <Transform DEF='Box1' translation='0 .1 0'>
                      <Shape DEF='BoxSensor'>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='0 0 1' specularColor='0 0 1' transparency='.9'/>
                        </Appearance>
                      </Shape>
                      <TouchSensor DEF='TouchSensorSeaState1' description='click to select sea state'/>
                      <Transform DEF='Text1' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 1"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                    </Transform>
                  </Transform>
                  <Transform DEF='Option2' translation='0 -1.5 0'>
                    <Transform DEF='Box2' translation='0 .1 0'>
                      <Shape>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='0 0 .8' transparency='.7'/>
                        </Appearance>
                      </Shape>
                      <TouchSensor DEF='TouchSensorSeaState2' description='click to select sea state'/>
                      <Transform DEF='Text2' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 2"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                    </Transform>
                  </Transform>
                  <Transform DEF='Option3' translation='0 -1.0 0'>
                    <Transform DEF='Box3' translation='0 .1 0'>
                      <Shape>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='0 0 .8' transparency='.7'/>
                        </Appearance>
                      </Shape>
                      <TouchSensor DEF='TouchSensorSeaState3' description='click to select sea state'/>
                      <Transform DEF='Text3' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 3"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                    </Transform>
                  </Transform>
                  <Transform DEF='Option4' translation='0 -0.5 0'>
                    <Transform DEF='Box4' translation='0 .1 0'>
                      <Shape>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='0 0.8 0' transparency='0.8'/>
                        </Appearance>
                      </Shape>
                      <TouchSensor DEF='TouchSensorSeaState4' description='click to select sea state'/>
                      <Transform DEF='Text4' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 4"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                    </Transform>
                  </Transform>
                  <Transform DEF='Option5'>
                    <Transform DEF='Box5' translation='0 .1 0'>
                      <Shape>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='0 .5 0' transparency='.4'/>
                        </Appearance>
                      </Shape>
                      <Transform DEF='Text5' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 5"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                      <TouchSensor DEF='TouchSensorSeaState5' description='click to select sea state'/>
                    </Transform>
                  </Transform>
                  <Transform DEF='Option6' translation='0 .5 0'>
                    <Transform DEF='Box6' translation='0 .1 0'>
                      <Transform DEF='Text6' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 6"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                      <Shape>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='.2 0 0' transparency='0.8'/>
                        </Appearance>
                      </Shape>
                      <TouchSensor DEF='TouchSensorSeaState6' description='click to select sea state'/>
                    </Transform>
                  </Transform>
                  <Transform DEF='Option7' translation='0 1.0 0'>
                    <Transform DEF='Box7' translation='0 .1 0'>
                      <Transform DEF='Text7' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 7"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                      <Shape>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='.5 0 0' transparency='0.7'/>
                        </Appearance>
                      </Shape>
                      <TouchSensor DEF='TouchSensorSeaState7' description='click to select sea state'/>
                    </Transform>
                  </Transform>
                  <Transform DEF='Option8' translation='0 1.5 0'>
                    <Transform DEF='Box8' translation='0 .1 0'>
                      <Transform DEF='Text8' scale='.25 .25 .25' translation='0 0 .1'>
                        <Shape>
                          <Text string='"SST 8"'>
                            <FontStyle justify='"MIDDLE" "MIDDLE"'/>
                          </Text>
                          <Appearance>
                            <Material emissiveColor='.8 .8 .8'/>
                          </Appearance>
                        </Shape>
                      </Transform>
                      <Shape>
                        <Box size='1 .4 .1'/>
                        <Appearance>
                          <Material diffuseColor='1 0 0' transparency='0.5'/>
                        </Appearance>
                      </Shape>
                      <TouchSensor DEF='TouchSensorSeaState8' description='click to select sea state'/>
                    </Transform>
                  </Transform>
                  <Transform translation='0 0 -3'>
                    <Shape>
                      <Box size='2 6.5 0.2'/>
                      <Appearance>
                        <Material diffuseColor='.3 .3 .3'/>
                        <ImageTexture/>
                      </Appearance>
                    </Shape>
                  </Transform>
                </Group>
              </Billboard>
            </Transform>
          </Group>
          <Group DEF='ScriptsForWaveMovement'>
            <Script DEF='SeaStateChoiceToValue'>
              <field accessType='inputOnly' name='SeaStateChoice0' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice1' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice2' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice3' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice4' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice5' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice6' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice7' type='SFBool'/>
              <field accessType='inputOnly' name='SeaStateChoice8' type='SFBool'/>
              <field accessType='outputOnly' name='SeaStateValue' type='SFInt32'/>
              <![CDATA[
ecmascript:

// Return the numeric value of SST button clicked

function initialize ()
{
	SeaStateValue = 2;


}
function SeaStateChoice1 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 0;
}
function SeaStateChoice2 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 1;
}
function SeaStateChoice3 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 2;
}
function SeaStateChoice4 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 3;
}
function SeaStateChoice5 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 4;
}
function SeaStateChoice6 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 5;
}
function SeaStateChoice7 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 6;
}
function SeaStateChoice8 (inputBoolean, timestamp)
{
	if (inputBoolean) SeaStateValue = 7;
}
]]>
            </Script>
          </Group>
        </Group>
        <!-- ================================================= -->
        <!-- RoutesToChooseSST -->
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState1' toField='SeaStateChoice1' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState2' toField='SeaStateChoice2' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState3' toField='SeaStateChoice3' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState4' toField='SeaStateChoice4' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState5' toField='SeaStateChoice5' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState6' toField='SeaStateChoice6' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState7' toField='SeaStateChoice7' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='isActive' fromNode='TouchSensorSeaState8' toField='SeaStateChoice8' toNode='SeaStateChoiceToValue'/>
        <ROUTE fromField='SeaStateValue' fromNode='SeaStateChoiceToValue' toField='whichChoice' toNode='SeaStateNumber'/>
        <!-- ================================================= -->
        <!-- RoutesToMoveTheSea -->
        <ROUTE fromField='fraction_changed' fromNode='WaveClock' toField='set_fraction' toNode='Ondulation'/>
        <ROUTE fromField='fraction_changed' fromNode='PitchandRollClock' toField='set_fraction' toNode='PitchInterpolator'/>
        <ROUTE fromField='fraction_changed' fromNode='PitchandRollClock' toField='set_fraction' toNode='RollInterpolator'/>
        <ROUTE fromField='value_changed' fromNode='Ondulation' toField='set_spine' toNode='BasicExtrusion'/>
      </ProtoBody>
    </ProtoDeclare>
    <!-- ================================================= -->
    <NavigationInfo speed='100'/>
    <Background groundAngle='1.309 1.570796' groundColor='0.0 0.2 0.7 0.0 0.5 1.0 0.6 0.6 0.6' skyAngle='1.309 1.571' skyColor='0.0 0.2 0.7 0.0 0.5 1.0 0.6 0.6 0.6'/>
    <Anchor description='Sea State Extrusion Example' parameter='"target=_blank"' url='"SeaStateExtrusionExample.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/SeaStateExtrusionExample.x3d" "SeaStateExtrusionExample.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Environment/SeaState/SeaStateExtrusionExample.wrl"'>
      <Shape>
        <Text string='"SeaStateExtrusionPrototype" "is a prototype definition file" "" "To see an example scene" "click on this text and view" "SeaStateExtrusionExample"'>
          <FontStyle justify='"MIDDLE" "MIDDLE"'/>
        </Text>
        <Appearance>
          <Material diffuseColor='1 1 0'/>
        </Appearance>
      </Shape>
    </Anchor>
  </Scene>
</X3D>