@prefix :        <https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/ElevationGridSimpleWaveAnimation.ttl#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema:  <http://schema.org/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix x3d:     <https://www.web3d.org/specifications/x3d-4.0.xsd#> .
@prefix x3do:    <https://www.web3d.org/specifications/X3dOntology4.0#> .

:X3D a owl:NamedIndividual, x3do:X3D ;
  x3do:hasHead :head ;
  x3do:hasScene :Scene ;
  x3do:profile 'Immersive' ;
  x3do:version '3.3' ;
  x3do:noNamespaceSchemaLocation 'https://www.web3d.org/specifications/x3d-3.3.xsd' .
:head a owl:NamedIndividual, x3do:head ;
  x3do:hasParent :X3D ;
  x3do:hasMeta :meta_1_1, :meta_1_2, :meta_1_3, :meta_1_4, :meta_1_5, :meta_1_6, :meta_1_7, :meta_1_8, :meta_1_9 .
:meta_1_1 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'ElevationGridSimpleWaveAnimation.x3d' ;
  x3do:name 'title' .
:meta_1_2 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Simple Javascript animation of ElevationGrid' ;
  x3do:name 'description' .
:meta_1_3 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'Don Brutzman' ;
  x3do:name 'creator' .
:meta_1_4 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '2 December 2012' ;
  x3do:name 'created' .
:meta_1_5 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '20 October 2019' ;
  x3do:name 'modified' .
:meta_1_6 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'ElevationGridSimpleWaveAnimation.png' ;
  x3do:name 'Image' .
:meta_1_7 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/ElevationGridSimpleWaveAnimation.x3d' ;
  x3do:name 'identifier' .
:meta_1_8 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content 'X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit' ;
  x3do:name 'generator' .
:meta_1_9 a owl:NamedIndividual, x3do:meta ;
  x3do:hasParent :head ;
  x3do:content '../license.html' ;
  x3do:name 'license' .
:meta dcterms:title "ElevationGridSimpleWaveAnimation.x3d" .
:meta dcterms:description "Simple Javascript animation of ElevationGrid" .
:meta dcterms:creator "Don Brutzman" .
:meta dcterms:created "2 December 2012" .
:meta dcterms:modified "20 October 2019" .
:meta dcterms:Image "ElevationGridSimpleWaveAnimation.png" .
:meta dcterms:identifier "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/ElevationGridSimpleWaveAnimation.x3d" .
:meta dcterms:generator "X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit" .
:meta dcterms:license "../license.html" .
:Scene a owl:NamedIndividual, x3do:Scene ;
  x3do:hasParent :X3D ;
  x3do:hasChildren :WorldInfo_2_1, :Viewpoint_2_2, :Background_2_3, :Transform_2_4, :Clock, :WaveGenerationScript ;
  x3do:hasROUTE :ROUTE_2_7, :ROUTE_2_8 .
:WorldInfo_2_1 a owl:NamedIndividual, x3do:WorldInfo ;
  x3do:hasParent :Scene ;
  x3do:title 'ElevationGridSimpleWaveAnimation.x3d' .
:Viewpoint_2_2 a owl:NamedIndividual, x3do:Viewpoint ;
  x3do:hasParent :Scene ;
  x3do:description 'Wave view' ;
  x3do:orientation ( 1 0 0 -0.358771 ) ;
  x3do:position ( 0 3 8 ) .
:Background_2_3 a owl:NamedIndividual, x3do:Background ;
  x3do:hasParent :Scene ;
  x3do:groundColor ( 1 1 1 ) ;
  x3do:skyColor ( 1 1 1 ) .
:Transform_2_4 a owl:NamedIndividual, x3do:Transform ;
  x3do:hasParent :Scene ;
  x3do:hasChildren :Shape_2_4_1 ;
  x3do:translation ( -4 0 0 ) .
:Shape_2_4_1 a owl:NamedIndividual, x3do:Shape ;
  x3do:hasParent :Transform_2_4 ;
  x3do:hasGeometry :GridSurface ;
  x3do:hasAppearance :Appearance_2_4_1_2 .
:GridSurface a owl:NamedIndividual, x3do:ElevationGrid ;
  x3do:hasParent :Shape_2_4_1 ;
  x3do:DEF 'GridSurface' ;
  x3do:height ( 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) ;
  x3do:solid false ;
  x3do:xDimension 9 ;
  x3do:zDimension 3 .
:Appearance_2_4_1_2 a owl:NamedIndividual, x3do:Appearance ;
  x3do:hasParent :Shape_2_4_1 ;
  x3do:hasMaterial :Material_2_4_1_2_1 .
:Material_2_4_1_2_1 a owl:NamedIndividual, x3do:Material ;
  x3do:hasParent :Appearance_2_4_1_2 ;
  x3do:diffuseColor ( 0 0.5 1 ) .
:Clock a owl:NamedIndividual, x3do:TimeSensor ;
  x3do:hasParent :Scene ;
  x3do:DEF 'Clock' ;
  x3do:cycleInterval '5' ;
  x3do:loop true .
:WaveGenerationScript a owl:NamedIndividual, x3do:Script ;
  x3do:hasParent :Scene ;
  x3do:hasField :field_2_6_1, :field_2_6_2, :field_2_6_3 ;
  x3do:DEF 'WaveGenerationScript' ;
  x3do:sourceCode """
ecmascript:

function newInputValue (eventValue)
{
   fraction = eventValue; // connected by ROUTE, receives values from TimeSensor Clock fraction_changed
   
   value0 = 0.2 * Math.sin (2 * Math.PI * (fraction - 4*waveStep));
   value1 = 0.2 * Math.sin (2 * Math.PI * (fraction - 3*waveStep));
   value2 = 0.2 * Math.sin (2 * Math.PI * (fraction - 2*waveStep));
   value3 = 0.2 * Math.sin (2 * Math.PI * (fraction -   waveStep));
   value4 = 0.2 * Math.sin (2 * Math.PI * (fraction             ));
   value5 = 0.2 * Math.sin (2 * Math.PI * (fraction +   waveStep));
   value6 = 0.2 * Math.sin (2 * Math.PI * (fraction + 2*waveStep));
   value7 = 0.2 * Math.sin (2 * Math.PI * (fraction + 3*waveStep));
   value8 = 0.2 * Math.sin (2 * Math.PI * (fraction + 4*waveStep));
   
   // setting the gridOutput value creates an output event that is connected via ROUTE to the ElevationGrid set_height field.
   // note that types match (MFFloat) and accessTypes also match (output_only connects to inputOnly).
   gridOutput = new MFFloat (
		value0, value1, value2, value3, value4, value5, value6, value7, value8,
		value0, value1, value2, value3, value4, value5, value6, value7, value8,
		value0, value1, value2, value3, value4, value5, value6, value7, value8 );
}
""" .
:field_2_6_1 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :WaveGenerationScript ;
  x3do:accessType 'inputOnly' ;
  x3do:appinfo 'provide value and trigger new computation' ;
  x3do:name 'newInputValue' ;
  x3do:type 'SFFloat' .
:field_2_6_2 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :WaveGenerationScript ;
  x3do:accessType 'outputOnly' ;
  x3do:appinfo 'provide values to ElevationGrid' ;
  x3do:name 'gridOutput' ;
  x3do:type 'MFFloat' .
:field_2_6_3 a owl:NamedIndividual, x3do:field ;
  x3do:hasParent :WaveGenerationScript ;
  x3do:accessType 'initializeOnly' ;
  x3do:appinfo 'wave variation' ;
  x3do:name 'waveStep' ;
  x3do:type 'SFTime' ;
  x3do:value '0.1' .
:ROUTE_2_7 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'fraction_changed' ;
  x3do:fromNode 'Clock' ;
  x3do:toField 'newInputValue' ;
  x3do:toNode 'WaveGenerationScript' .
:ROUTE_2_8 a owl:NamedIndividual, x3do:ROUTE ;
  x3do:hasParent :Scene ;
  x3do:fromField 'gridOutput' ;
  x3do:fromNode 'WaveGenerationScript' ;
  x3do:toField 'set_height' ;
  x3do:toNode 'GridSurface' .
