<div dir="ltr">Online source of Hello World EcmaScript SAI example:  <a href="https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/node/examples/HelloWorldProgramOutput.js">https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/node/examples/HelloWorldProgramOutput.js</a>  <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 14, 2020 at 10:15 AM John Carlson <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">// fixed version around parent/child node setting/adding.  Needs heavier testing now.  Please provide environment (X_ITE, freewrl, CGE) script you run the below sample script in (or a derivative).<div><br></div><div>X3D0 = Browser.createNode("X3D");<br>X3D0.profile = "Immersive";<br>X3D0.version = "3.3";<br>// x3dVersionComparisonTest for this model: supportsX3dVersion(X3DObject.VERSION_3_0)=true <br>head1 = Browser.createNode("head");<br>// comment #1 <br>// comment #2 <br>// comment #3 <br>// comment #4 <br>component2 = Browser.createNode("component");<br><a href="http://component2.name" target="_blank">component2.name</a> = "Navigation";<br>component2.level = 3;<br>head1.addComponent(component2);<br><br>component3 = Browser.createNode("component");<br><a href="http://component3.name" target="_blank">component3.name</a> = "Shaders";<br>component3.level = 1;<br>head1.addComponent(component3);<br><br>component4 = Browser.createNode("component");<br><a href="http://component4.name" target="_blank">component4.name</a> = "CADGeometry";<br>component4.level = 2;<br>head1.addComponent(component4);<br><br>component5 = Browser.createNode("component");<br><a href="http://component5.name" target="_blank">component5.name</a> = "DIS";<br>component5.level = 2;<br>head1.addComponent(component5);<br><br>component6 = Browser.createNode("component");<br><a href="http://component6.name" target="_blank">component6.name</a> = "H-Anim";<br>component6.level = 1;<br>head1.addComponent(component6);<br><br>component7 = Browser.createNode("component");<br><a href="http://component7.name" target="_blank">component7.name</a> = "Grouping";<br>component7.level = 1;<br>head1.addComponent(component7);<br><br>component8 = Browser.createNode("component");<br><a href="http://component8.name" target="_blank">component8.name</a> = "Layering";<br>component8.level = 1;<br>head1.addComponent(component8);<br><br>unit9 = Browser.createNode("unit");<br><a href="http://unit9.name" target="_blank">unit9.name</a> = "AngleUnitConversion";<br>unit9.category = "angle";<br>unit9.conversionFactor = 1.0;<br>head1.addUnit(unit9);<br><br>unit10 = Browser.createNode("unit");<br><a href="http://unit10.name" target="_blank">unit10.name</a> = "LengthUnitConversion";<br>unit10.category = "length";<br>unit10.conversionFactor = 1.0;<br>head1.addUnit(unit10);<br><br>unit11 = Browser.createNode("unit");<br><a href="http://unit11.name" target="_blank">unit11.name</a> = "ForceFromPoundsToNewtons";<br>unit11.category = "force";<br>unit11.conversionFactor = 4.4482;<br>head1.addUnit(unit11);<br><br>meta12 = Browser.createNode("meta");<br>meta12.content = "HelloWorldProgramOutput.x3d";<br><a href="http://meta12.name" target="_blank">meta12.name</a> = "title";<br>head1.addMeta(meta12);<br><br>meta13 = Browser.createNode("meta");<br>meta13.content = "continued development and testing in progress";<br><a href="http://meta13.name" target="_blank">meta13.name</a> = "info";<br>head1.addMeta(meta13);<br><br>meta14 = Browser.createNode("meta");<br>meta14.content = "Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)";<br><a href="http://meta14.name" target="_blank">meta14.name</a> = "description";<br>head1.addMeta(meta14);<br><br>meta15 = Browser.createNode("meta");<br>meta15.content = "<a href="https://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank">https://www.web3d.org/specifications/java/X3DJSAIL.html</a>";<br><a href="http://meta15.name" target="_blank">meta15.name</a> = "reference";<br>head1.addMeta(meta15);<br><br>meta16 = Browser.createNode("meta");<br>meta16.content = "HelloWorldProgramOutput.java";<br><a href="http://meta16.name" target="_blank">meta16.name</a> = "generator";<br>head1.addMeta(meta16);<br><br>meta17 = Browser.createNode("meta");<br>meta17.content = "6 September 2016";<br><a href="http://meta17.name" target="_blank">meta17.name</a> = "created";<br>head1.addMeta(meta17);<br><br>meta18 = Browser.createNode("meta");<br>meta18.content = "12 January 2020";<br><a href="http://meta18.name" target="_blank">meta18.name</a> = "modified";<br>head1.addMeta(meta18);<br><br>meta19 = Browser.createNode("meta");<br>meta19.content = "X3D Java Scene Access Interface Library (X3DJSAIL)";<br><a href="http://meta19.name" target="_blank">meta19.name</a> = "generator";<br>head1.addMeta(meta19);<br><br>meta20 = Browser.createNode("meta");<br>meta20.content = "<a href="https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java" target="_blank">https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java</a>";<br><a href="http://meta20.name" target="_blank">meta20.name</a> = "generator";<br>head1.addMeta(meta20);<br><br>meta21 = Browser.createNode("meta");<br>meta21.content = "Netbeans <a href="http://www.netbeans.org" target="_blank">http://www.netbeans.org</a>";<br><a href="http://meta21.name" target="_blank">meta21.name</a> = "generator";<br>head1.addMeta(meta21);<br><br>meta22 = Browser.createNode("meta");<br>meta22.content = "Don Brutzman";<br><a href="http://meta22.name" target="_blank">meta22.name</a> = "creator";<br>head1.addMeta(meta22);<br><br>meta23 = Browser.createNode("meta");<br>meta23.content = "<a href="https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d" target="_blank">https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d</a>";<br><a href="http://meta23.name" target="_blank">meta23.name</a> = "reference";<br>head1.addMeta(meta23);<br><br>meta24 = Browser.createNode("meta");<br>meta24.content = "Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:";<br><a href="http://meta24.name" target="_blank">meta24.name</a> = "reference";<br>head1.addMeta(meta24);<br><br>meta25 = Browser.createNode("meta");<br>meta25.content = "HelloWorldProgramOutput.txt";<br><a href="http://meta25.name" target="_blank">meta25.name</a> = "reference";<br>head1.addMeta(meta25);<br><br>meta26 = Browser.createNode("meta");<br>meta26.content = "HelloWorldProgramOutput.x3dv";<br><a href="http://meta26.name" target="_blank">meta26.name</a> = "reference";<br>head1.addMeta(meta26);<br><br>meta27 = Browser.createNode("meta");<br>meta27.content = "HelloWorldProgramOutput.wrl";<br><a href="http://meta27.name" target="_blank">meta27.name</a> = "reference";<br>head1.addMeta(meta27);<br><br>meta28 = Browser.createNode("meta");<br>meta28.content = "HelloWorldProgramOutput.html";<br><a href="http://meta28.name" target="_blank">meta28.name</a> = "reference";<br>head1.addMeta(meta28);<br><br>meta29 = Browser.createNode("meta");<br>meta29.content = "<a href="https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" target="_blank">https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d</a>";<br><a href="http://meta29.name" target="_blank">meta29.name</a> = "reference";<br>head1.addMeta(meta29);<br><br>meta30 = Browser.createNode("meta");<br>meta30.content = "<a href="https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" target="_blank">https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d</a>";<br><a href="http://meta30.name" target="_blank">meta30.name</a> = "identifier";<br>head1.addMeta(meta30);<br><br>meta31 = Browser.createNode("meta");<br>meta31.content = "../license.html";<br><a href="http://meta31.name" target="_blank">meta31.name</a> = "license";<br>head1.addMeta(meta31);<br><br>X3D0.head = head1;<br><br>Scene32 = Browser.createNode("Scene");<br>ViewpointGroup33 = Browser.createNode("ViewpointGroup");<br>ViewpointGroup33.description = "Available viewpoints";<br>Viewpoint34 = Browser.createNode("Viewpoint");<br>Viewpoint34.DEF = "DefaultView";<br>Viewpoint34.description = "Hello X3DJSAIL";<br>ViewpointGroup33.addChildren(Viewpoint34);<br><br>Viewpoint35 = Browser.createNode("Viewpoint");<br>Viewpoint35.DEF = "TopDownView";<br>Viewpoint35.description = "top-down view from above";<br>Viewpoint35.orientation = [1,0,0,-1.570796];<br>Viewpoint35.position = [0,100,0];<br>ViewpointGroup33.addChildren(Viewpoint35);<br><br>Scene32.addChildren(ViewpointGroup33);<br><br>NavigationInfo36 = Browser.createNode("NavigationInfo");<br>NavigationInfo36.avatarSize = [0.25,1.6,0.75];<br>NavigationInfo36.transitionType = ["LINEAR"];<br>NavigationInfo36.type = ["EXAMINE","FLY","ANY"];<br>Scene32.addChildren(NavigationInfo36);<br><br>WorldInfo37 = Browser.createNode("WorldInfo");<br>WorldInfo37.DEF = "WorldInfoDEF";<br>WorldInfo37.title = "HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)";<br>Scene32.addChildren(WorldInfo37);<br><br>WorldInfo38 = Browser.createNode("WorldInfo");<br>WorldInfo38.USE = "WorldInfoDEF";<br>Scene32.addChildren(WorldInfo38);<br><br>WorldInfo39 = Browser.createNode("WorldInfo");<br>WorldInfo39.USE = "WorldInfoDEF";<br>Scene32.addChildren(WorldInfo39);<br><br>MetadataString40 = Browser.createNode("MetadataString");<br>MetadataString40.DEF = "scene.addChildMetadata";<br>MetadataString40.name = "test";<br>MetadataString40.value = ["Top-level root Metadata node beneath Scene needs to be one of '-children' in JSON encoding"];<br>Scene32.addMetadata(MetadataString40);<br><br>LayerSet41 = Browser.createNode("LayerSet");<br>LayerSet41.DEF = "scene.addChildLayerSetTest";<br>LayerSet41.order = [0];<br>Scene32.addLayerSet(LayerSet41);<br><br>Transform42 = Browser.createNode("Transform");<br>Transform42.DEF = "LogoGeometryTransform";<br>Transform42.translation = [0,1.5,0];<br>Anchor43 = Browser.createNode("Anchor");<br>Anchor43.description = "select for X3D Java SAI Library (X3DJSAIL) description";<br>Anchor43.url = ["../X3DJSAIL.html","<a href="https://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank">https://www.web3d.org/specifications/java/X3DJSAIL.html</a>"];<br>Shape44 = Browser.createNode("Shape");<br>Shape44.DEF = "BoxShape";<br>Appearance45 = Browser.createNode("Appearance");<br>Material46 = Browser.createNode("Material");<br>Material46.DEF = "GreenMaterial";<br>Material46.diffuseColor = [0,1,1];<br>Material46.emissiveColor = [0.8,0,0];<br>Material46.transparency = 0.1;<br>Appearance45.material = Material46;<br><br>ImageTexture47 = Browser.createNode("ImageTexture");<br>ImageTexture47.url = ["images/X3dJavaSceneAccessInterfaceSaiLibrary.png","<a href="https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png" target="_blank">https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png</a>"];<br>Appearance45.texture = ImageTexture47;<br><br>Shape44.appearance = Appearance45;<br><br>Box48 = Browser.createNode("Box");<br>Box48.DEF = "test-NMTOKEN_regex.0123456789";<br>Box48.CssClass = "untextured";<br>Shape44.geometry = Box48;<br><br>Anchor43.addChildren(Shape44);<br><br>Transform42.addChildren(Anchor43);<br><br>Scene32.addChildren(Transform42);<br><br>Shape49 = Browser.createNode("Shape");<br>Shape49.DEF = "LineShape";<br>Appearance50 = Browser.createNode("Appearance");<br>Material51 = Browser.createNode("Material");<br>Material51.emissiveColor = [0.6,0.19607843,0.8];<br>Appearance50.material = Material51;<br><br>Shape49.appearance = Appearance50;<br><br>IndexedLineSet52 = Browser.createNode("IndexedLineSet");<br>IndexedLineSet52.coordIndex = [0,1,2,3,4,0];<br>// Coordinate 3-tuple point count: 6 <br>Coordinate53 = Browser.createNode("Coordinate");<br>Coordinate53.point = [0,1.5,0,2,1.5,0,2,1.5,-2,-2,1.5,-2,-2,1.5,0,0,1.5,0];<br>IndexedLineSet52.coord = Coordinate53;<br><br>Shape49.geometry = IndexedLineSet52;<br><br>Scene32.addChildren(Shape49);<br><br>PositionInterpolator54 = Browser.createNode("PositionInterpolator");<br>PositionInterpolator54.DEF = "BoxPathAnimator";<br>PositionInterpolator54.key = [0,0.125,0.375,0.625,0.875,1];<br>PositionInterpolator54.keyValue = [0,1.5,0,2,1.5,0,2,1.5,-2,-2,1.5,-2,-2,1.5,0,0,1.5,0];<br>Scene32.addChildren(PositionInterpolator54);<br><br>TimeSensor55 = Browser.createNode("TimeSensor");<br>TimeSensor55.DEF = "OrbitClock";<br>TimeSensor55.cycleInterval = 8.0;<br>TimeSensor55.loop = True;<br>Scene32.addChildren(TimeSensor55);<br><br>ROUTE56 = Browser.createNode("ROUTE");<br>ROUTE56.fromField = "fraction_changed";<br>ROUTE56.fromNode = "OrbitClock";<br>ROUTE56.toField = "set_fraction";<br>ROUTE56.toNode = "BoxPathAnimator";<br>Scene32.addChildren(ROUTE56);<br><br>ROUTE57 = Browser.createNode("ROUTE");<br>ROUTE57.fromField = "value_changed";<br>ROUTE57.fromNode = "BoxPathAnimator";<br>ROUTE57.toField = "set_translation";<br>ROUTE57.toNode = "LogoGeometryTransform";<br>Scene32.addChildren(ROUTE57);<br><br>Transform58 = Browser.createNode("Transform");<br>Transform58.DEF = "TextTransform";<br>Transform58.translation = [0,-1.5,0];<br>Shape59 = Browser.createNode("Shape");<br>Appearance60 = Browser.createNode("Appearance");<br>Material61 = Browser.createNode("Material");<br>Material61.USE = "GreenMaterial";<br>Appearance60.material = Material61;<br><br>Shape59.appearance = Appearance60;<br><br>Text62 = Browser.createNode("Text");<br>Text62.string = ["X3D Java","SAI Library","X3DJSAIL"];<br>// Comment example A, plain quotation marks: He said, \"Immel did it!\" <br>// Comment example B, XML character entities: He said, &quot;Immel did it!&quot; <br>MetadataSet63 = Browser.createNode("MetadataSet");<br>MetadataSet63.name = "EscapedQuotationMarksMetadataSet";<br>MetadataString64 = Browser.createNode("MetadataString");<br>MetadataString64.name = "quotesTestC";<br>MetadataString64.value = ["MFString example C, backslash-escaped quotes: He said, \"Immel did it!\""];<br>MetadataSet63.addValue(MetadataString64);<br><br>MetadataString65 = Browser.createNode("MetadataString");<br>MetadataString65.name = "extraChildTest";<br>MetadataString65.value = ["checks MetadataSetObject addValue() method"];<br>MetadataSet63.addValue(MetadataString65);<br><br>Text62.metadata = MetadataSet63;<br><br>FontStyle66 = Browser.createNode("FontStyle");<br>FontStyle66.family = ["SERIF"];<br>FontStyle66.justify = ["MIDDLE","MIDDLE"];<br>Text62.fontStyle = FontStyle66;<br><br>Shape59.geometry = Text62;<br><br>Transform58.addChildren(Shape59);<br><br>Collision67 = Browser.createNode("Collision");<br>// test containerField='proxy' <br>Shape68 = Browser.createNode("Shape");<br>Shape68.DEF = "ProxyShape";<br>// alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\&quot;Immel did it!\\&quot;\"' <br>// alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\&quot;Immel did it!\\&quot;\" \"\"' <br>// alternative Java source: .setString(new String [] {\"One, Two, Comment\", \"\", \"He said, \\\"Immel did it!\\\"\"}) <br>// reference: <a href="https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html</a> <br>Text69 = Browser.createNode("Text");<br>Text69.string = ["One, Two, Text","","He said, \"Immel did it!\" \"\""];<br>Shape68.geometry = Text69;<br><br>Collision67.setProxy = Shape68;<br><br>Transform58.addChildren(Collision67);<br><br>// It's a beautiful world <br>// ... for you! <br>// <a href="https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song)" target="_blank">https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song)</a> <br>Scene32.addChildren(Transform58);<br><br>// repeatedly spin 180 degrees as a readable special effect <br>OrientationInterpolator70 = Browser.createNode("OrientationInterpolator");<br>OrientationInterpolator70.DEF = "SpinInterpolator";<br>OrientationInterpolator70.key = [0,0.5,1];<br>OrientationInterpolator70.keyValue = [0,1,0,4.712389,0,1,0,0,0,1,0,1.5707964];<br>Scene32.addChildren(OrientationInterpolator70);<br><br>TimeSensor71 = Browser.createNode("TimeSensor");<br>TimeSensor71.DEF = "SpinClock";<br>TimeSensor71.cycleInterval = 5.0;<br>TimeSensor71.loop = True;<br>Scene32.addChildren(TimeSensor71);<br><br>ROUTE72 = Browser.createNode("ROUTE");<br>ROUTE72.fromField = "fraction_changed";<br>ROUTE72.fromNode = "SpinClock";<br>ROUTE72.toField = "set_fraction";<br>ROUTE72.toNode = "SpinInterpolator";<br>Scene32.addChildren(ROUTE72);<br><br>ROUTE73 = Browser.createNode("ROUTE");<br>ROUTE73.fromField = "value_changed";<br>ROUTE73.fromNode = "SpinInterpolator";<br>ROUTE73.toField = "rotation";<br>ROUTE73.toNode = "TextTransform";<br>Scene32.addChildren(ROUTE73);<br><br>Group74 = Browser.createNode("Group");<br>Group74.DEF = "BackgroundGroup";<br>Background75 = Browser.createNode("Background");<br>Background75.DEF = "GradualBackground";<br>Group74.addChildren(Background75);<br><br>Script76 = Browser.createNode("Script");<br>Script76.DEF = "colorTypeConversionScript";<br>field77 = Browser.createNode("field");<br><a href="http://field77.name" target="_blank">field77.name</a> = "colorInput";<br>field77.accessType = "inputOnly";<br>field77.type = "SFColor";<br>Script76.addField(field77);<br><br>field78 = Browser.createNode("field");<br><a href="http://field78.name" target="_blank">field78.name</a> = "colorsOutput";<br>field78.accessType = "outputOnly";<br>field78.type = "MFColor";<br>Script76.addField(field78);<br><br><br>Script76.setSourceCode('''\n"+<br>"ecmascript:\n"+<br>"\n"+<br>"function colorInput (eventValue) // Example source code\n"+<br>"{\n"+<br>"   colorsOutput = new MFColor(eventValue); // assigning value sends output event\n"+<br>"// Browser.print('colorInput=' + eventValue + ', colorsOutput=' + colorsOutput + '\\n');\n"+<br>"}\n"+<br>"''')<br>Group74.addChildren(Script76);<br><br>ColorInterpolator79 = Browser.createNode("ColorInterpolator");<br>ColorInterpolator79.DEF = "ColorAnimator";<br>ColorInterpolator79.key = [0,0.5,1];<br>ColorInterpolator79.keyValue = [0.9411765,1,1,0.29411766,0,0.50980395,0.9411765,1,1];<br>// AZURE to INDIGO and back again <br>Group74.addChildren(ColorInterpolator79);<br><br>TimeSensor80 = Browser.createNode("TimeSensor");<br>TimeSensor80.DEF = "ColorClock";<br>TimeSensor80.cycleInterval = 60.0;<br>TimeSensor80.loop = True;<br>Group74.addChildren(TimeSensor80);<br><br>ROUTE81 = Browser.createNode("ROUTE");<br>ROUTE81.fromField = "colorsOutput";<br>ROUTE81.fromNode = "colorTypeConversionScript";<br>ROUTE81.toField = "skyColor";<br>ROUTE81.toNode = "GradualBackground";<br>Group74.addChildren(ROUTE81);<br><br>ROUTE82 = Browser.createNode("ROUTE");<br>ROUTE82.fromField = "value_changed";<br>ROUTE82.fromNode = "ColorAnimator";<br>ROUTE82.toField = "colorInput";<br>ROUTE82.toNode = "colorTypeConversionScript";<br>Group74.addChildren(ROUTE82);<br><br>ROUTE83 = Browser.createNode("ROUTE");<br>ROUTE83.fromField = "fraction_changed";<br>ROUTE83.fromNode = "ColorClock";<br>ROUTE83.toField = "set_fraction";<br>ROUTE83.toNode = "ColorAnimator";<br>Group74.addChildren(ROUTE83);<br><br>Scene32.addChildren(Group74);<br><br>ProtoDeclare84 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare84.name = "ArtDeco01Material";<br>ProtoDeclare84.appinfo = "tooltip: ArtDeco01Material prototype is a Material node";<br>ProtoInterface85 = Browser.createNode("ProtoInterface");<br>field86 = Browser.createNode("field");<br><a href="http://field86.name" target="_blank">field86.name</a> = "description";<br>field86.accessType = "inputOutput";<br>field86.appinfo = "tooltip for descriptionField";<br>field86.type = "SFString";<br>field86.value = "ArtDeco01Material prototype is a Material node";<br>ProtoInterface85.addField(field86);<br><br>field87 = Browser.createNode("field");<br><a href="http://field87.name" target="_blank">field87.name</a> = "enabled";<br>field87.accessType = "inputOutput";<br>field87.type = "SFBool";<br>field87.value = "true";<br>ProtoInterface85.addField(field87);<br><br>ProtoDeclare84.protoInterface = ProtoInterface85;<br><br>ProtoBody88 = Browser.createNode("ProtoBody");<br>// Initial node of ProtoBody determines prototype node type <br>Material89 = Browser.createNode("Material");<br>Material89.ambientIntensity = 0.25;<br>Material89.diffuseColor = [0.282435,0.085159,0.134462];<br>Material89.shininess = 0.127273;<br>Material89.specularColor = [0.276305,0.11431,0.139857];<br>ProtoBody88.addChildren(Material89);<br><br>// [HelloWorldProgram diagnostic] should be connected to scene graph: artDeco01ProtoDeclare.getNodeType()=\"Material\" <br>// presence of follow-on TouchSensor shows that additional nodes are allowed in ProtoBody after initial node, regardless of node types <br>TouchSensor90 = Browser.createNode("TouchSensor");<br>TouchSensor90.description = "within ProtoBody";<br>IS91 = Browser.createNode("IS");<br>connect92 = Browser.createNode("connect");<br>connect92.nodeField = "description";<br>connect92.protoField = "description";<br>IS91.addConnect(connect92);<br><br>connect93 = Browser.createNode("connect");<br>connect93.nodeField = "enabled";<br>connect93.protoField = "enabled";<br>IS91.addConnect(connect93);<br><br>TouchSensor90.iS = IS91;<br><br>ProtoBody88.addChildren(TouchSensor90);<br><br>ProtoDeclare84.protoBody = ProtoBody88;<br><br>Scene32.addChildren(ProtoDeclare84);<br><br>ExternProtoDeclare94 = Browser.createNode("ExternProtoDeclare");<br>ExternProtoDeclare94.name = "ArtDeco02Material";<br>ExternProtoDeclare94.appinfo = "this is a different Material node";<br>ExternProtoDeclare94.url = ["<a href="http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material" target="_blank">http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material</a>","<a href="http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material" target="_blank">http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material</a>"];<br>// [HelloWorldProgram diagnostic] artDeco02ExternProtoDeclare.getNodeType()=\"ERROR_UNKNOWN_EXTERNPROTODECLARE_NODE_TYPE: ExternProtoDeclare name='ArtDeco02Material' type cannot be remotely accessed at run time. TODO X3DJSAIL needs to add further capability that retrieves the ExternProtoDeclare file.\" <br>field95 = Browser.createNode("field");<br><a href="http://field95.name" target="_blank">field95.name</a> = "description";<br>field95.accessType = "inputOutput";<br>field95.appinfo = "tooltip for descriptionField";<br>field95.type = "SFString";<br>ExternProtoDeclare94.addField(field95);<br><br>Scene32.addChildren(ExternProtoDeclare94);<br><br>// Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place <br>Shape96 = Browser.createNode("Shape");<br>Shape96.DEF = "TestShape1";<br>Appearance97 = Browser.createNode("Appearance");<br>Appearance97.DEF = "TestAppearance1";<br>// ArtDeco01Material prototype goes here... TODO ensure setContainerField is handled in exported Java <br>ProtoInstance98 = Browser.createNode("ProtoInstance");<br>ProtoInstance98.name = "ArtDeco01Material";<br>// [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()=\"Material\" <br>fieldValue99 = Browser.createNode("fieldValue");<br>fieldValue99.name = "description";<br>fieldValue99.value = "ArtDeco01Material can substitute for a Material node";<br>ProtoInstance98.addFieldValue(fieldValue99);<br><br>Appearance97.setMaterial = ProtoInstance98;<br><br>Shape96.appearance = Appearance97;<br><br>Sphere100 = Browser.createNode("Sphere");<br>Sphere100.radius = 0.001;<br>Shape96.geometry = Sphere100;<br><br>Scene32.addChildren(Shape96);<br><br>Shape101 = Browser.createNode("Shape");<br>Shape101.DEF = "TestShape2";<br>Appearance102 = Browser.createNode("Appearance");<br>Appearance102.DEF = "TestAppearance2";<br>// ArtDeco02Material prototype goes here... TODO ensure setContainerField is handled in exported Java <br>ProtoInstance103 = Browser.createNode("ProtoInstance");<br>ProtoInstance103.DEF = "ArtDeco02MaterialDEF";<br>ProtoInstance103.name = "ArtDeco02Material";<br>// [HelloWorldProgram diagnostic] ArtDeco02ProtoInstance.getNodeType()=\"ERROR_UNKNOWN_EXTERNPROTODECLARE_NODE_TYPE: ExternProtoDeclare name='ArtDeco02Material' type cannot be remotely accessed at run time. TODO X3DJSAIL needs to add further capability that retrieves the ExternProtoDeclare file.\" <br>fieldValue104 = Browser.createNode("fieldValue");<br>fieldValue104.name = "description";<br>fieldValue104.value = "ArtDeco02Material can substitute for another Material node";<br>ProtoInstance103.addFieldValue(fieldValue104);<br><br>Appearance102.setMaterial = ProtoInstance103;<br><br>Shape101.appearance = Appearance102;<br><br>Cone105 = Browser.createNode("Cone");<br>Cone105.bottomRadius = 0.001;<br>Cone105.height = 0.001;<br>Shape101.geometry = Cone105;<br><br>Scene32.addChildren(Shape101);<br><br>Shape106 = Browser.createNode("Shape");<br>Shape106.DEF = "TestShape3";<br>Appearance107 = Browser.createNode("Appearance");<br>Appearance107.DEF = "TestAppearance3";<br>// ArtDeco02Material ProtoInstance USE goes here. Note that name field is NOT defined as part of ProtoInstance USE. <br>ProtoInstance108 = Browser.createNode("ProtoInstance");<br>ProtoInstance108.USE = "ArtDeco02MaterialDEF";<br>Appearance107.setMaterial = ProtoInstance108;<br><br>Shape106.appearance = Appearance107;<br><br>Cylinder109 = Browser.createNode("Cylinder");<br>Cylinder109.height = 0.001;<br>Cylinder109.radius = 0.001;<br>Shape106.geometry = Cylinder109;<br><br>Scene32.addChildren(Shape106);<br><br>Inline110 = Browser.createNode("Inline");<br>Inline110.DEF = "inlineSceneDef";<br>Inline110.url = ["someOtherScene.x3d","<a href="https://www.web3d.org/specifications/java/examples/someOtherScene.x3d" target="_blank">https://www.web3d.org/specifications/java/examples/someOtherScene.x3d</a>"];<br>Scene32.addChildren(Inline110);<br><br>IMPORT111 = Browser.createNode("IMPORT");<br><a href="http://IMPORT111.AS" target="_blank">IMPORT111.AS</a> = "WorldInfoDEF2";<br>IMPORT111.importedDEF = "WorldInfoDEF";<br>IMPORT111.inlineDEF = "inlineSceneDef";<br>Scene32.addChildren(IMPORT111);<br><br>EXPORT112 = Browser.createNode("EXPORT");<br><a href="http://EXPORT112.AS" target="_blank">EXPORT112.AS</a> = "WorldInfoDEF3";<br>EXPORT112.localDEF = "WorldInfoDEF";<br>Scene32.addChildren(EXPORT112);<br><br>ProtoDeclare113 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare113.name = "MaterialModulator";<br>ProtoDeclare113.appinfo = "mimic a Material node and modulate fields as an animation effect";<br>ProtoDeclare113.documentation = "<a href="http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html" target="_blank">http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html</a>";<br>ProtoInterface114 = Browser.createNode("ProtoInterface");<br>field115 = Browser.createNode("field");<br><a href="http://field115.name" target="_blank">field115.name</a> = "enabled";<br>field115.accessType = "inputOutput";<br>field115.type = "SFBool";<br>field115.value = "true";<br>ProtoInterface114.addField(field115);<br><br>field116 = Browser.createNode("field");<br><a href="http://field116.name" target="_blank">field116.name</a> = "diffuseColor";<br>field116.accessType = "inputOutput";<br>field116.type = "SFColor";<br>field116.value = "0 0 0";<br>ProtoInterface114.addField(field116);<br><br>field117 = Browser.createNode("field");<br><a href="http://field117.name" target="_blank">field117.name</a> = "emissiveColor";<br>field117.accessType = "inputOutput";<br>field117.type = "SFColor";<br>field117.value = "0.05 0.05 0.5";<br>ProtoInterface114.addField(field117);<br><br>field118 = Browser.createNode("field");<br><a href="http://field118.name" target="_blank">field118.name</a> = "specularColor";<br>field118.accessType = "inputOutput";<br>field118.type = "SFColor";<br>field118.value = "0 0 0";<br>ProtoInterface114.addField(field118);<br><br>field119 = Browser.createNode("field");<br><a href="http://field119.name" target="_blank">field119.name</a> = "transparency";<br>field119.accessType = "inputOutput";<br>field119.type = "SFFloat";<br>field119.value = "0.0";<br>ProtoInterface114.addField(field119);<br><br>field120 = Browser.createNode("field");<br><a href="http://field120.name" target="_blank">field120.name</a> = "shininess";<br>field120.accessType = "inputOutput";<br>field120.type = "SFFloat";<br>field120.value = "0.0";<br>ProtoInterface114.addField(field120);<br><br>field121 = Browser.createNode("field");<br><a href="http://field121.name" target="_blank">field121.name</a> = "ambientIntensity";<br>field121.accessType = "inputOutput";<br>field121.type = "SFFloat";<br>field121.value = "0.0";<br>ProtoInterface114.addField(field121);<br><br>ProtoDeclare113.protoInterface = ProtoInterface114;<br><br>ProtoBody122 = Browser.createNode("ProtoBody");<br>Material123 = Browser.createNode("Material");<br>Material123.DEF = "MaterialNode";<br>IS124 = Browser.createNode("IS");<br>connect125 = Browser.createNode("connect");<br>connect125.nodeField = "diffuseColor";<br>connect125.protoField = "diffuseColor";<br>IS124.addConnect(connect125);<br><br>connect126 = Browser.createNode("connect");<br>connect126.nodeField = "emissiveColor";<br>connect126.protoField = "emissiveColor";<br>IS124.addConnect(connect126);<br><br>connect127 = Browser.createNode("connect");<br>connect127.nodeField = "specularColor";<br>connect127.protoField = "specularColor";<br>IS124.addConnect(connect127);<br><br>connect128 = Browser.createNode("connect");<br>connect128.nodeField = "transparency";<br>connect128.protoField = "transparency";<br>IS124.addConnect(connect128);<br><br>connect129 = Browser.createNode("connect");<br>connect129.nodeField = "shininess";<br>connect129.protoField = "shininess";<br>IS124.addConnect(connect129);<br><br>connect130 = Browser.createNode("connect");<br>connect130.nodeField = "ambientIntensity";<br>connect130.protoField = "ambientIntensity";<br>IS124.addConnect(connect130);<br><br>Material123.iS = IS124;<br><br>ProtoBody122.addChildren(Material123);<br><br>// Only first node (the node type) is renderable, others are along for the ride <br>Script131 = Browser.createNode("Script");<br>Script131.DEF = "MaterialModulatorScript";<br>field132 = Browser.createNode("field");<br><a href="http://field132.name" target="_blank">field132.name</a> = "enabled";<br>field132.accessType = "inputOutput";<br>field132.type = "SFBool";<br>Script131.addField(field132);<br><br>field133 = Browser.createNode("field");<br><a href="http://field133.name" target="_blank">field133.name</a> = "diffuseColor";<br>field133.accessType = "inputOutput";<br>field133.type = "SFColor";<br>Script131.addField(field133);<br><br>field134 = Browser.createNode("field");<br><a href="http://field134.name" target="_blank">field134.name</a> = "newColor";<br>field134.accessType = "outputOnly";<br>field134.type = "SFColor";<br>Script131.addField(field134);<br><br>field135 = Browser.createNode("field");<br><a href="http://field135.name" target="_blank">field135.name</a> = "clockTrigger";<br>field135.accessType = "inputOnly";<br>field135.type = "SFTime";<br>Script131.addField(field135);<br><br>IS136 = Browser.createNode("IS");<br>connect137 = Browser.createNode("connect");<br>connect137.nodeField = "enabled";<br>connect137.protoField = "enabled";<br>IS136.addConnect(connect137);<br><br>connect138 = Browser.createNode("connect");<br>connect138.nodeField = "diffuseColor";<br>connect138.protoField = "diffuseColor";<br>IS136.addConnect(connect138);<br><br>Script131.iS = IS136;<br><br><br>Script131.setSourceCode('''\n"+<br>"ecmascript:\n"+<br>"function initialize ()\n"+<br>"{\n"+<br>"    newColor = diffuseColor; // start with correct color\n"+<br>"}\n"+<br>"function set_enabled (newValue)\n"+<br>"{\n"+<br>" enabled = newValue;\n"+<br>"}\n"+<br>"function clockTrigger (timeValue)\n"+<br>"{\n"+<br>"    if (!enabled) return;\n"+<br>"    red   = newColor.r;\n"+<br>"    green = newColor.g;\n"+<br>"    blue  = newColor.b;\n"+<br>"    \n"+<br>"    // note different modulation rates for each color component, % is modulus operator\n"+<br>"    newColor = new SFColor ((red + 0.02) % 1, (green + 0.03) % 1, (blue + 0.04) % 1);\n"+<br>"  if (enabled)\n"+<br>"   {\n"+<br>"              Browser.print ('diffuseColor=(' + red + ',' + green + ',' + blue + ') newColor=' + newColor.toString() + '\\n');\n"+<br>"       }\n"+<br>"}\n"+<br>"''')<br>ProtoBody122.addChildren(Script131);<br><br>ProtoDeclare113.protoBody = ProtoBody122;<br><br>Scene32.addChildren(ProtoDeclare113);<br><br>// Test success: declarative statement createDeclarativeShapeTests() <br>Group139 = Browser.createNode("Group");<br>Group139.DEF = "DeclarativeGroupExample";<br>Shape140 = Browser.createNode("Shape");<br>MetadataString141 = Browser.createNode("MetadataString");<br>MetadataString141.DEF = "FindableMetadataStringTest";<br>MetadataString141.name = "findThisNameValue";<br>MetadataString141.value = ["test case"];<br>Shape140.metadata = MetadataString141;<br><br>Appearance142 = Browser.createNode("Appearance");<br>Appearance142.DEF = "DeclarativeAppearanceExample";<br>// DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance <br>ProtoInstance143 = Browser.createNode("ProtoInstance");<br>ProtoInstance143.DEF = "MyMaterialModulator";<br>ProtoInstance143.name = "MaterialModulator";<br>Appearance142.setMaterial = ProtoInstance143;<br><br>Shape140.appearance = Appearance142;<br><br>Cone144 = Browser.createNode("Cone");<br>Cone144.bottom = False;<br>Cone144.bottomRadius = 0.05;<br>Cone144.height = 0.1;<br>Shape140.geometry = Cone144;<br><br>Group139.addChildren(Shape140);<br><br>// Test success: declarativeGroup.addChild() singleton pipeline method <br>Scene32.addChildren(Group139);<br><br>// Test success: declarative statement addChild() <br>// Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance DEF='DeclarativeAppearanceExample'/> i.e. <Appearance DEF='DeclarativeAppearanceExample'> <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - -> <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/> </Appearance> <br>// Test success: x3dModel.findElementByNameValue(findThisNameValue) = <MetadataString DEF='FindableMetadataStringTest' name='findThisNameValue' value='\"test case\"'/> <br>// Test success: x3dModel.findElementByNameValue(\"ArtDeco01Material\", \"ProtoDeclare\") found <br>// Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoDeclare\") found <br>// Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoInstance\") found <br>Group145 = Browser.createNode("Group");<br>Group145.DEF = "TestFieldObjectsGroup";<br>// testFieldObjects() results <br>// SFBool default=true, true=true, false=false, negate()=true <br>// MFBool default=, initial=true false true, negate()=false true false <br>// SFFloat default=0.0, initial=1.0, setValue(2)=2.0, setValue(3.0f)=3.0, setValue(4.0)=4.0 <br>// MFFloat default=, initial=1 2 3, append(5)=1 2 3 5, inserts(3,4)(0,0)=0 1 2 3 4 5, append(6)=0 1 2 3 4 5 6, size()=7 <br>// ... get1Value[3]=3.0, remove[1]=0 2 3 4 5 6, set1Value(0,10)=10 2 3 4 5 6, multiply(2)=20 4 6 8 10 12, clear= <br>// SFVec3f default=0 0 0, initial=1 2 3, setValue=4 5 6, multiply(2)=8 10 12, normalize()=0.45584232 0.5698029 0.68376344, regex matches()=true <br>// regex test SFVec3f().matches(\"1 2 3\")=true, regex test SFVec3f().matches(\"1 2 3 4\")=false, regex test (SFRotationObject.matches(\"0 0 0 0\")=true, failure detecting illegal (zero axis) rotation value <br>Scene32.addChildren(Group145);<br><br>Sound146 = Browser.createNode("Sound");<br>Sound146.location = [0,1.6,0];<br>// set sound-ellipsoid location height at 1.6m to match typical avatar height <br>AudioClip147 = Browser.createNode("AudioClip");<br>AudioClip147.description = "chimes";<br>AudioClip147.url = ["chimes.wav","<a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav</a>"];<br>// Scene example fragment from <a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d</a> <br>Sound146.source = AudioClip147;<br><br>Scene32.addChildren(Sound146);<br><br>Sound148 = Browser.createNode("Sound");<br>Sound148.location = [0,1.6,0];<br>// set sound-ellipsoid location height at 1.6m to match typical avatar height <br>MovieTexture149 = Browser.createNode("MovieTexture");<br>MovieTexture149.description = "mpgsys.mpg from ConformanceNist suite";<br>MovieTexture149.url = ["mpgsys.mpg","<a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg</a>"];<br>// Scene example fragment from <a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpeg1-systems.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpeg1-systems.x3d</a> <br>// Expected containerField='source', allowed containerField values=\"texture\" \"source\" \"back\" \"bottom\" \"front\" \"left\" \"right\" \"top\" \"backTexture\" \"bottomTexture\" \"frontTexture\" \"leftTexture\" \"rightTexture\" \"topTexture\" \"watchList\" <br>Sound148.setSource = MovieTexture149;<br><br>Scene32.addChildren(Sound148);<br><br>// Test success: AnchorObject.isNode()=true, siteAnchor.isNode()=true <br>// Test success: AnchorObject.isStatement()=false, siteAnchor.isStatement()=false <br>// Test success: ROUTEObject.isNode()=false, orbitPositionROUTE.isNode()=false <br>// Test success: ROUTEObject.isStatement()=true, orbitPositionROUTE.isStatement()=true <br>// Test success: CommentsBlock.isNode()=false, testComments.isNode()=false <br>// Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true <br>Shape150 = Browser.createNode("Shape");<br>Shape150.DEF = "ExtrusionShape";<br>// ExampleExtrusion isCrossSectionClosed()=true, crossSection='[1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0]' <br>// ExampleExtrusion isSpineClosed()=false, spine='[0.0, 0.0, 0.0, 0.0, 1.0, 0.0]' <br>Appearance151 = Browser.createNode("Appearance");<br>Appearance151.DEF = "TransparentAppearance";<br>Material152 = Browser.createNode("Material");<br>Material152.transparency = 1.0;<br>Appearance151.material = Material152;<br><br>Shape150.appearance = Appearance151;<br><br>Extrusion153 = Browser.createNode("Extrusion");<br>Extrusion153.DEF = "ExampleExtrusion";<br>Shape150.geometry = Extrusion153;<br><br>Scene32.addChildren(Shape150);<br><br>Group154 = Browser.createNode("Group");<br>// Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes <br>ProtoDeclare155 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare155.name = "NewWorldInfo";<br>ProtoInterface156 = Browser.createNode("ProtoInterface");<br>field157 = Browser.createNode("field");<br><a href="http://field157.name" target="_blank">field157.name</a> = "description";<br>field157.accessType = "initializeOnly";<br>field157.type = "SFString";<br>ProtoInterface156.addField(field157);<br><br>ProtoDeclare155.protoInterface = ProtoInterface156;<br><br>ProtoBody158 = Browser.createNode("ProtoBody");<br>WorldInfo159 = Browser.createNode("WorldInfo");<br>ProtoBody158.addChildren(WorldInfo159);<br><br>ProtoDeclare155.protoBody = ProtoBody158;<br><br>Group154.addChildren(ProtoDeclare155);<br><br>ProtoInstance160 = Browser.createNode("ProtoInstance");<br>ProtoInstance160.DEF = "Proto1";<br>ProtoInstance160.name = "NewWorldInfo";<br>fieldValue161 = Browser.createNode("fieldValue");<br>fieldValue161.name = "description";<br>fieldValue161.value = "testing 1 2 3";<br>ProtoInstance160.addFieldValue(fieldValue161);<br><br>Group154.addChildren(ProtoInstance160);<br><br>Group162 = Browser.createNode("Group");<br>Group162.DEF = "Node2";<br>// intentionally empty <br>Group154.addChildren(Group162);<br><br>ProtoInstance163 = Browser.createNode("ProtoInstance");<br>ProtoInstance163.DEF = "Proto3";<br>ProtoInstance163.name = "NewWorldInfo";<br>Group154.addChildren(ProtoInstance163);<br><br>Transform164 = Browser.createNode("Transform");<br>Transform164.DEF = "Node4";<br>// intentionally empty <br>Group154.addChildren(Transform164);<br><br>// Test satisfactorily creates MFNode children array as an ordered list with mixed content <br>Scene32.addChildren(Group154);<br><br>ProtoDeclare165 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare165.name = "ShaderProto";<br>ProtoBody166 = Browser.createNode("ProtoBody");<br>ProgramShader167 = Browser.createNode("ProgramShader");<br>ProtoBody166.addChild(ProgramShader167);<br><br>ProtoDeclare165.protoBody = ProtoBody166;<br><br>Scene32.addChildren(ProtoDeclare165);<br><br>Shape168 = Browser.createNode("Shape");<br>Appearance169 = Browser.createNode("Appearance");<br>// Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes <br>// Test satisfactorily creates MFNode shaders array as an ordered list with mixed content <br>ProgramShader170 = Browser.createNode("ProgramShader");<br>ProgramShader170.DEF = "TestShader1";<br>ShaderProgram171 = Browser.createNode("ShaderProgram");<br>ShaderProgram171.DEF = "TestShader2";<br>ProgramShader170.addPrograms(ShaderProgram171);<br><br>Appearance169.addShaders(ProgramShader170);<br><br>ProtoInstance172 = Browser.createNode("ProtoInstance");<br>ProtoInstance172.DEF = "TestShader3";<br>ProtoInstance172.name = "ShaderProto";<br>Appearance169.setMaterial = ProtoInstance172;<br><br>ComposedShader173 = Browser.createNode("ComposedShader");<br>ComposedShader173.DEF = "TestShader4";<br>ShaderPart174 = Browser.createNode("ShaderPart");<br>ShaderPart174.DEF = "TestShader5";<br>ComposedShader173.addParts(ShaderPart174);<br><br>Appearance169.addShaders(ComposedShader173);<br><br>Shape168.appearance = Appearance169;<br><br>Scene32.addChildren(Shape168);<br><br>Transform175 = Browser.createNode("Transform");<br>Transform175.DEF = "SpecialtyNodes";<br>CADLayer176 = Browser.createNode("CADLayer");<br>CADAssembly177 = Browser.createNode("CADAssembly");<br>CADPart178 = Browser.createNode("CADPart");<br>CADFace179 = Browser.createNode("CADFace");<br>CADPart178.addChildren(CADFace179);<br><br>CADAssembly177.addChildren(CADPart178);<br><br>CADLayer176.addChildren(CADAssembly177);<br><br>Transform175.addChildren(CADLayer176);<br><br>EspduTransform180 = Browser.createNode("EspduTransform");<br>EspduTransform180.geoSystem = ["GD","WE"];<br>Transform175.addChildren(EspduTransform180);<br><br>ReceiverPdu181 = Browser.createNode("ReceiverPdu");<br>ReceiverPdu181.geoSystem = ["GD","WE"];<br>Transform175.addChildren(ReceiverPdu181);<br><br>SignalPdu182 = Browser.createNode("SignalPdu");<br>SignalPdu182.geoSystem = ["GD","WE"];<br>Transform175.addChildren(SignalPdu182);<br><br>TransmitterPdu183 = Browser.createNode("TransmitterPdu");<br>TransmitterPdu183.geoSystem = ["GD","WE"];<br>Transform175.addChildren(TransmitterPdu183);<br><br>DISEntityManager184 = Browser.createNode("DISEntityManager");<br>DISEntityTypeMapping185 = Browser.createNode("DISEntityTypeMapping");<br>DISEntityManager184.addMapping(DISEntityTypeMapping185);<br><br>Transform175.addChildren(DISEntityManager184);<br><br>Scene32.addChildren(Transform175);<br><br>X3D0.scene = Scene32;<br><br>X3D0.toFileX3D("examples/HelloWorldProgramOutput_RoundTrip.x3d")<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 14, 2020 at 8:52 AM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Here's a translation from the X3DJSAIL Hello World program to JavaScript. I will check in source soon. I have gone away from the chaining scenario since the JavaScript SAI examples do not use chaining.<div>Please check for errors (I already know there are *many*). This is a check so that I know someone actually looked at this code...</div><div><br></div><div>John</div><div>X3D0 = Browser.createNode("X3D");<br>X3D0.profile = "Immersive";<br>X3D0.version = "3.3";<br>// x3dVersionComparisonTest for this model: supportsX3dVersion(X3DObject.VERSION_3_0)=true <br>head1 = Browser.createNode("head");<br>// comment #1 <br>// comment #2 <br>// comment #3 <br>// comment #4 <br>component2 = Browser.createNode("component");<br><a href="http://component2.name" target="_blank">component2.name</a> = "Navigation";<br>component2.level = 3;<br>head1.addComponent(component2);<br><br>component3 = Browser.createNode("component");<br><a href="http://component3.name" target="_blank">component3.name</a> = "Shaders";<br>component3.level = 1;<br>head1.addComponent(component3);<br><br>component4 = Browser.createNode("component");<br><a href="http://component4.name" target="_blank">component4.name</a> = "CADGeometry";<br>component4.level = 2;<br>head1.addComponent(component4);<br><br>component5 = Browser.createNode("component");<br><a href="http://component5.name" target="_blank">component5.name</a> = "DIS";<br>component5.level = 2;<br>head1.addComponent(component5);<br><br>component6 = Browser.createNode("component");<br><a href="http://component6.name" target="_blank">component6.name</a> = "H-Anim";<br>component6.level = 1;<br>head1.addComponent(component6);<br><br>component7 = Browser.createNode("component");<br><a href="http://component7.name" target="_blank">component7.name</a> = "Grouping";<br>component7.level = 1;<br>head1.addComponent(component7);<br><br>component8 = Browser.createNode("component");<br><a href="http://component8.name" target="_blank">component8.name</a> = "Layering";<br>component8.level = 1;<br>head1.addComponent(component8);<br><br>unit9 = Browser.createNode("unit");<br><a href="http://unit9.name" target="_blank">unit9.name</a> = "AngleUnitConversion";<br>unit9.category = "angle";<br>unit9.conversionFactor = 1.0;<br>head1.addUnit(unit9);<br><br>unit10 = Browser.createNode("unit");<br><a href="http://unit10.name" target="_blank">unit10.name</a> = "LengthUnitConversion";<br>unit10.category = "length";<br>unit10.conversionFactor = 1.0;<br>head1.addUnit(unit10);<br><br>unit11 = Browser.createNode("unit");<br><a href="http://unit11.name" target="_blank">unit11.name</a> = "ForceFromPoundsToNewtons";<br>unit11.category = "force";<br>unit11.conversionFactor = 4.4482;<br>head1.addUnit(unit11);<br><br>meta12 = Browser.createNode("meta");<br>meta12.content = "HelloWorldProgramOutput.x3d";<br><a href="http://meta12.name" target="_blank">meta12.name</a> = "title";<br>head1.addMeta(meta12);<br><br>meta13 = Browser.createNode("meta");<br>meta13.content = "continued development and testing in progress";<br><a href="http://meta13.name" target="_blank">meta13.name</a> = "info";<br>head1.addMeta(meta13);<br><br>meta14 = Browser.createNode("meta");<br>meta14.content = "Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)";<br><a href="http://meta14.name" target="_blank">meta14.name</a> = "description";<br>head1.addMeta(meta14);<br><br>meta15 = Browser.createNode("meta");<br>meta15.content = "<a href="https://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank">https://www.web3d.org/specifications/java/X3DJSAIL.html</a>";<br><a href="http://meta15.name" target="_blank">meta15.name</a> = "reference";<br>head1.addMeta(meta15);<br><br>meta16 = Browser.createNode("meta");<br>meta16.content = "HelloWorldProgramOutput.java";<br><a href="http://meta16.name" target="_blank">meta16.name</a> = "generator";<br>head1.addMeta(meta16);<br><br>meta17 = Browser.createNode("meta");<br>meta17.content = "6 September 2016";<br><a href="http://meta17.name" target="_blank">meta17.name</a> = "created";<br>head1.addMeta(meta17);<br><br>meta18 = Browser.createNode("meta");<br>meta18.content = "12 January 2020";<br><a href="http://meta18.name" target="_blank">meta18.name</a> = "modified";<br>head1.addMeta(meta18);<br><br>meta19 = Browser.createNode("meta");<br>meta19.content = "X3D Java Scene Access Interface Library (X3DJSAIL)";<br><a href="http://meta19.name" target="_blank">meta19.name</a> = "generator";<br>head1.addMeta(meta19);<br><br>meta20 = Browser.createNode("meta");<br>meta20.content = "<a href="https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java" target="_blank">https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java</a>";<br><a href="http://meta20.name" target="_blank">meta20.name</a> = "generator";<br>head1.addMeta(meta20);<br><br>meta21 = Browser.createNode("meta");<br>meta21.content = "Netbeans <a href="http://www.netbeans.org" target="_blank">http://www.netbeans.org</a>";<br><a href="http://meta21.name" target="_blank">meta21.name</a> = "generator";<br>head1.addMeta(meta21);<br><br>meta22 = Browser.createNode("meta");<br>meta22.content = "Don Brutzman";<br><a href="http://meta22.name" target="_blank">meta22.name</a> = "creator";<br>head1.addMeta(meta22);<br><br>meta23 = Browser.createNode("meta");<br>meta23.content = "<a href="https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d" target="_blank">https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d</a>";<br><a href="http://meta23.name" target="_blank">meta23.name</a> = "reference";<br>head1.addMeta(meta23);<br><br>meta24 = Browser.createNode("meta");<br>meta24.content = "Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:";<br><a href="http://meta24.name" target="_blank">meta24.name</a> = "reference";<br>head1.addMeta(meta24);<br><br>meta25 = Browser.createNode("meta");<br>meta25.content = "HelloWorldProgramOutput.txt";<br><a href="http://meta25.name" target="_blank">meta25.name</a> = "reference";<br>head1.addMeta(meta25);<br><br>meta26 = Browser.createNode("meta");<br>meta26.content = "HelloWorldProgramOutput.x3dv";<br><a href="http://meta26.name" target="_blank">meta26.name</a> = "reference";<br>head1.addMeta(meta26);<br><br>meta27 = Browser.createNode("meta");<br>meta27.content = "HelloWorldProgramOutput.wrl";<br><a href="http://meta27.name" target="_blank">meta27.name</a> = "reference";<br>head1.addMeta(meta27);<br><br>meta28 = Browser.createNode("meta");<br>meta28.content = "HelloWorldProgramOutput.html";<br><a href="http://meta28.name" target="_blank">meta28.name</a> = "reference";<br>head1.addMeta(meta28);<br><br>meta29 = Browser.createNode("meta");<br>meta29.content = "<a href="https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" target="_blank">https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d</a>";<br><a href="http://meta29.name" target="_blank">meta29.name</a> = "reference";<br>head1.addMeta(meta29);<br><br>meta30 = Browser.createNode("meta");<br>meta30.content = "<a href="https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" target="_blank">https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d</a>";<br><a href="http://meta30.name" target="_blank">meta30.name</a> = "identifier";<br>head1.addMeta(meta30);<br><br>meta31 = Browser.createNode("meta");<br>meta31.content = "../license.html";<br><a href="http://meta31.name" target="_blank">meta31.name</a> = "license";<br>head1.addMeta(meta31);<br><br>X3D0.addHead(head1);<br><br>Scene32 = Browser.createNode("Scene");<br>ViewpointGroup33 = Browser.createNode("ViewpointGroup");<br>ViewpointGroup33.description = "Available viewpoints";<br>Viewpoint34 = Browser.createNode("Viewpoint");<br>Viewpoint34.DEF = "DefaultView";<br>Viewpoint34.description = "Hello X3DJSAIL";<br>ViewpointGroup33.addChildren(Viewpoint34);<br><br>Viewpoint35 = Browser.createNode("Viewpoint");<br>Viewpoint35.DEF = "TopDownView";<br>Viewpoint35.description = "top-down view from above";<br>Viewpoint35.orientation = [1,0,0,-1.570796];<br>Viewpoint35.position = [0,100,0];<br>ViewpointGroup33.addChildren(Viewpoint35);<br><br>Scene32.addChildren(ViewpointGroup33);<br><br>NavigationInfo36 = Browser.createNode("NavigationInfo");<br>NavigationInfo36.avatarSize = [0.25,1.6,0.75];<br>NavigationInfo36.transitionType = ["LINEAR"];<br>NavigationInfo36.type = ["EXAMINE","FLY","ANY"];<br>Scene32.addChildren(NavigationInfo36);<br><br>WorldInfo37 = Browser.createNode("WorldInfo");<br>WorldInfo37.DEF = "WorldInfoDEF";<br>WorldInfo37.title = "HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)";<br>Scene32.addChildren(WorldInfo37);<br><br>WorldInfo38 = Browser.createNode("WorldInfo");<br>WorldInfo38.USE = "WorldInfoDEF";<br>Scene32.addChildren(WorldInfo38);<br><br>WorldInfo39 = Browser.createNode("WorldInfo");<br>WorldInfo39.USE = "WorldInfoDEF";<br>Scene32.addChildren(WorldInfo39);<br><br>MetadataString40 = Browser.createNode("MetadataString");<br>MetadataString40.DEF = "scene.addChildMetadata";<br>MetadataString40.name = "test";<br>MetadataString40.value = ["Top-level root Metadata node beneath Scene needs to be one of '-children' in JSON encoding"];<br>Scene32.addMetadata(MetadataString40);<br><br>LayerSet41 = Browser.createNode("LayerSet");<br>LayerSet41.DEF = "scene.addChildLayerSetTest";<br>LayerSet41.order = [0];<br>Scene32.addLayerSet(LayerSet41);<br><br>Transform42 = Browser.createNode("Transform");<br>Transform42.DEF = "LogoGeometryTransform";<br>Transform42.translation = [0,1.5,0];<br>Anchor43 = Browser.createNode("Anchor");<br>Anchor43.description = "select for X3D Java SAI Library (X3DJSAIL) description";<br>Anchor43.url = ["../X3DJSAIL.html","<a href="https://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank">https://www.web3d.org/specifications/java/X3DJSAIL.html</a>"];<br>Shape44 = Browser.createNode("Shape");<br>Shape44.DEF = "BoxShape";<br>Appearance45 = Browser.createNode("Appearance");<br>Material46 = Browser.createNode("Material");<br>Material46.DEF = "GreenMaterial";<br>Material46.diffuseColor = [0,1,1];<br>Material46.emissiveColor = [0.8,0,0];<br>Material46.transparency = 0.1;<br>Appearance45.addMaterial(Material46);<br><br>ImageTexture47 = Browser.createNode("ImageTexture");<br>ImageTexture47.url = ["images/X3dJavaSceneAccessInterfaceSaiLibrary.png","<a href="https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png" target="_blank">https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png</a>"];<br>Appearance45.addTexture(ImageTexture47);<br><br>Shape44.addAppearance(Appearance45);<br><br>Box48 = Browser.createNode("Box");<br>Box48.DEF = "test-NMTOKEN_regex.0123456789";<br>Box48.CssClass = "untextured";<br>Shape44.addGeometry(Box48);<br><br>Anchor43.addChildren(Shape44);<br><br>Transform42.addChildren(Anchor43);<br><br>Scene32.addChildren(Transform42);<br><br>Shape49 = Browser.createNode("Shape");<br>Shape49.DEF = "LineShape";<br>Appearance50 = Browser.createNode("Appearance");<br>Material51 = Browser.createNode("Material");<br>Material51.emissiveColor = [0.6,0.19607843,0.8];<br>Appearance50.addMaterial(Material51);<br><br>Shape49.addAppearance(Appearance50);<br><br>IndexedLineSet52 = Browser.createNode("IndexedLineSet");<br>IndexedLineSet52.coordIndex = [0,1,2,3,4,0];<br>// Coordinate 3-tuple point count: 6 <br>Coordinate53 = Browser.createNode("Coordinate");<br>Coordinate53.point = [0,1.5,0,2,1.5,0,2,1.5,-2,-2,1.5,-2,-2,1.5,0,0,1.5,0];<br>IndexedLineSet52.addCoord(Coordinate53);<br><br>Shape49.addGeometry(IndexedLineSet52);<br><br>Scene32.addChildren(Shape49);<br><br>PositionInterpolator54 = Browser.createNode("PositionInterpolator");<br>PositionInterpolator54.DEF = "BoxPathAnimator";<br>PositionInterpolator54.key = [0,0.125,0.375,0.625,0.875,1];<br>PositionInterpolator54.keyValue = [0,1.5,0,2,1.5,0,2,1.5,-2,-2,1.5,-2,-2,1.5,0,0,1.5,0];<br>Scene32.addChildren(PositionInterpolator54);<br><br>TimeSensor55 = Browser.createNode("TimeSensor");<br>TimeSensor55.DEF = "OrbitClock";<br>TimeSensor55.cycleInterval = 8.0;<br>TimeSensor55.loop = True;<br>Scene32.addChildren(TimeSensor55);<br><br>ROUTE56 = Browser.createNode("ROUTE");<br>ROUTE56.fromField = "fraction_changed";<br>ROUTE56.fromNode = "OrbitClock";<br>ROUTE56.toField = "set_fraction";<br>ROUTE56.toNode = "BoxPathAnimator";<br>Scene32.addChildren(ROUTE56);<br><br>ROUTE57 = Browser.createNode("ROUTE");<br>ROUTE57.fromField = "value_changed";<br>ROUTE57.fromNode = "BoxPathAnimator";<br>ROUTE57.toField = "set_translation";<br>ROUTE57.toNode = "LogoGeometryTransform";<br>Scene32.addChildren(ROUTE57);<br><br>Transform58 = Browser.createNode("Transform");<br>Transform58.DEF = "TextTransform";<br>Transform58.translation = [0,-1.5,0];<br>Shape59 = Browser.createNode("Shape");<br>Appearance60 = Browser.createNode("Appearance");<br>Material61 = Browser.createNode("Material");<br>Material61.USE = "GreenMaterial";<br>Appearance60.addMaterial(Material61);<br><br>Shape59.addAppearance(Appearance60);<br><br>Text62 = Browser.createNode("Text");<br>Text62.string = ["X3D Java","SAI Library","X3DJSAIL"];<br>// Comment example A, plain quotation marks: He said, \"Immel did it!\" <br>// Comment example B, XML character entities: He said, &quot;Immel did it!&quot; <br>MetadataSet63 = Browser.createNode("MetadataSet");<br>MetadataSet63.name = "EscapedQuotationMarksMetadataSet";<br>MetadataString64 = Browser.createNode("MetadataString");<br>MetadataString64.name = "quotesTestC";<br>MetadataString64.value = ["MFString example C, backslash-escaped quotes: He said, \"Immel did it!\""];<br>MetadataSet63.addaddValue(MetadataString64);<br><br>MetadataString65 = Browser.createNode("MetadataString");<br>MetadataString65.name = "extraChildTest";<br>MetadataString65.value = ["checks MetadataSetObject addValue() method"];<br>MetadataSet63.addaddValue(MetadataString65);<br><br>Text62.addMetadata(MetadataSet63);<br><br>FontStyle66 = Browser.createNode("FontStyle");<br>FontStyle66.family = ["SERIF"];<br>FontStyle66.justify = ["MIDDLE","MIDDLE"];<br>Text62.addFontStyle(FontStyle66);<br><br>Shape59.addGeometry(Text62);<br><br>Transform58.addChildren(Shape59);<br><br>Collision67 = Browser.createNode("Collision");<br>// test containerField='proxy' <br>Shape68 = Browser.createNode("Shape");<br>Shape68.DEF = "ProxyShape";<br>// alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\&quot;Immel did it!\\&quot;\"' <br>// alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\&quot;Immel did it!\\&quot;\" \"\"' <br>// alternative Java source: .setString(new String [] {\"One, Two, Comment\", \"\", \"He said, \\\"Immel did it!\\\"\"}) <br>// reference: <a href="https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html</a> <br>Text69 = Browser.createNode("Text");<br>Text69.string = ["One, Two, Text","","He said, \"Immel did it!\" \"\""];<br>Shape68.addGeometry(Text69);<br><br>Collision67.addsetProxy(Shape68);<br><br>Transform58.addChildren(Collision67);<br><br>// It's a beautiful world <br>// ... for you! <br>// <a href="https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song)" target="_blank">https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song)</a> <br>Scene32.addChildren(Transform58);<br><br>// repeatedly spin 180 degrees as a readable special effect <br>OrientationInterpolator70 = Browser.createNode("OrientationInterpolator");<br>OrientationInterpolator70.DEF = "SpinInterpolator";<br>OrientationInterpolator70.key = [0,0.5,1];<br>OrientationInterpolator70.keyValue = [0,1,0,4.712389,0,1,0,0,0,1,0,1.5707964];<br>Scene32.addChildren(OrientationInterpolator70);<br><br>TimeSensor71 = Browser.createNode("TimeSensor");<br>TimeSensor71.DEF = "SpinClock";<br>TimeSensor71.cycleInterval = 5.0;<br>TimeSensor71.loop = True;<br>Scene32.addChildren(TimeSensor71);<br><br>ROUTE72 = Browser.createNode("ROUTE");<br>ROUTE72.fromField = "fraction_changed";<br>ROUTE72.fromNode = "SpinClock";<br>ROUTE72.toField = "set_fraction";<br>ROUTE72.toNode = "SpinInterpolator";<br>Scene32.addChildren(ROUTE72);<br><br>ROUTE73 = Browser.createNode("ROUTE");<br>ROUTE73.fromField = "value_changed";<br>ROUTE73.fromNode = "SpinInterpolator";<br>ROUTE73.toField = "rotation";<br>ROUTE73.toNode = "TextTransform";<br>Scene32.addChildren(ROUTE73);<br><br>Group74 = Browser.createNode("Group");<br>Group74.DEF = "BackgroundGroup";<br>Background75 = Browser.createNode("Background");<br>Background75.DEF = "GradualBackground";<br>Group74.addChildren(Background75);<br><br>Script76 = Browser.createNode("Script");<br>Script76.DEF = "colorTypeConversionScript";<br>field77 = Browser.createNode("field");<br><a href="http://field77.name" target="_blank">field77.name</a> = "colorInput";<br>field77.accessType = "inputOnly";<br>field77.type = "SFColor";<br>Script76.addField(field77);<br><br>field78 = Browser.createNode("field");<br><a href="http://field78.name" target="_blank">field78.name</a> = "colorsOutput";<br>field78.accessType = "outputOnly";<br>field78.type = "MFColor";<br>Script76.addField(field78);<br><br><br>Script76.setSourceCode('''\n"+<br>"ecmascript:\n"+<br>"\n"+<br>"function colorInput (eventValue) // Example source code\n"+<br>"{\n"+<br>"   colorsOutput = new MFColor(eventValue); // assigning value sends output event\n"+<br>"// Browser.print('colorInput=' + eventValue + ', colorsOutput=' + colorsOutput + '\\n');\n"+<br>"}\n"+<br>"''')<br>Group74.addChildren(Script76);<br><br>ColorInterpolator79 = Browser.createNode("ColorInterpolator");<br>ColorInterpolator79.DEF = "ColorAnimator";<br>ColorInterpolator79.key = [0,0.5,1];<br>ColorInterpolator79.keyValue = [0.9411765,1,1,0.29411766,0,0.50980395,0.9411765,1,1];<br>// AZURE to INDIGO and back again <br>Group74.addChildren(ColorInterpolator79);<br><br>TimeSensor80 = Browser.createNode("TimeSensor");<br>TimeSensor80.DEF = "ColorClock";<br>TimeSensor80.cycleInterval = 60.0;<br>TimeSensor80.loop = True;<br>Group74.addChildren(TimeSensor80);<br><br>ROUTE81 = Browser.createNode("ROUTE");<br>ROUTE81.fromField = "colorsOutput";<br>ROUTE81.fromNode = "colorTypeConversionScript";<br>ROUTE81.toField = "skyColor";<br>ROUTE81.toNode = "GradualBackground";<br>Group74.addChildren(ROUTE81);<br><br>ROUTE82 = Browser.createNode("ROUTE");<br>ROUTE82.fromField = "value_changed";<br>ROUTE82.fromNode = "ColorAnimator";<br>ROUTE82.toField = "colorInput";<br>ROUTE82.toNode = "colorTypeConversionScript";<br>Group74.addChildren(ROUTE82);<br><br>ROUTE83 = Browser.createNode("ROUTE");<br>ROUTE83.fromField = "fraction_changed";<br>ROUTE83.fromNode = "ColorClock";<br>ROUTE83.toField = "set_fraction";<br>ROUTE83.toNode = "ColorAnimator";<br>Group74.addChildren(ROUTE83);<br><br>Scene32.addChildren(Group74);<br><br>ProtoDeclare84 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare84.name = "ArtDeco01Material";<br>ProtoDeclare84.appinfo = "tooltip: ArtDeco01Material prototype is a Material node";<br>ProtoInterface85 = Browser.createNode("ProtoInterface");<br>field86 = Browser.createNode("field");<br><a href="http://field86.name" target="_blank">field86.name</a> = "description";<br>field86.accessType = "inputOutput";<br>field86.appinfo = "tooltip for descriptionField";<br>field86.type = "SFString";<br>field86.value = "ArtDeco01Material prototype is a Material node";<br>ProtoInterface85.addField(field86);<br><br>field87 = Browser.createNode("field");<br><a href="http://field87.name" target="_blank">field87.name</a> = "enabled";<br>field87.accessType = "inputOutput";<br>field87.type = "SFBool";<br>field87.value = "true";<br>ProtoInterface85.addField(field87);<br><br>ProtoDeclare84.addProtoInterface(ProtoInterface85);<br><br>ProtoBody88 = Browser.createNode("ProtoBody");<br>// Initial node of ProtoBody determines prototype node type <br>Material89 = Browser.createNode("Material");<br>Material89.ambientIntensity = 0.25;<br>Material89.diffuseColor = [0.282435,0.085159,0.134462];<br>Material89.shininess = 0.127273;<br>Material89.specularColor = [0.276305,0.11431,0.139857];<br>ProtoBody88.addChildren(Material89);<br><br>// [HelloWorldProgram diagnostic] should be connected to scene graph: artDeco01ProtoDeclare.getNodeType()=\"Material\" <br>// presence of follow-on TouchSensor shows that additional nodes are allowed in ProtoBody after initial node, regardless of node types <br>TouchSensor90 = Browser.createNode("TouchSensor");<br>TouchSensor90.description = "within ProtoBody";<br>IS91 = Browser.createNode("IS");<br>connect92 = Browser.createNode("connect");<br>connect92.nodeField = "description";<br>connect92.protoField = "description";<br>IS91.addConnect(connect92);<br><br>connect93 = Browser.createNode("connect");<br>connect93.nodeField = "enabled";<br>connect93.protoField = "enabled";<br>IS91.addConnect(connect93);<br><br>TouchSensor90.addIS(IS91);<br><br>ProtoBody88.addChildren(TouchSensor90);<br><br>ProtoDeclare84.addProtoBody(ProtoBody88);<br><br>Scene32.addChildren(ProtoDeclare84);<br><br>ExternProtoDeclare94 = Browser.createNode("ExternProtoDeclare");<br>ExternProtoDeclare94.name = "ArtDeco02Material";<br>ExternProtoDeclare94.appinfo = "this is a different Material node";<br>ExternProtoDeclare94.url = ["<a href="http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material" target="_blank">http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material</a>","<a href="http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material" target="_blank">http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material</a>"];<br>// [HelloWorldProgram diagnostic] artDeco02ExternProtoDeclare.getNodeType()=\"ERROR_UNKNOWN_EXTERNPROTODECLARE_NODE_TYPE: ExternProtoDeclare name='ArtDeco02Material' type cannot be remotely accessed at run time. TODO X3DJSAIL needs to add further capability that retrieves the ExternProtoDeclare file.\" <br>field95 = Browser.createNode("field");<br><a href="http://field95.name" target="_blank">field95.name</a> = "description";<br>field95.accessType = "inputOutput";<br>field95.appinfo = "tooltip for descriptionField";<br>field95.type = "SFString";<br>ExternProtoDeclare94.addField(field95);<br><br>Scene32.addChildren(ExternProtoDeclare94);<br><br>// Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place <br>Shape96 = Browser.createNode("Shape");<br>Shape96.DEF = "TestShape1";<br>Appearance97 = Browser.createNode("Appearance");<br>Appearance97.DEF = "TestAppearance1";<br>// ArtDeco01Material prototype goes here... TODO ensure setContainerField is handled in exported Java <br>ProtoInstance98 = Browser.createNode("ProtoInstance");<br>ProtoInstance98.name = "ArtDeco01Material";<br>// [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()=\"Material\" <br>fieldValue99 = Browser.createNode("fieldValue");<br>fieldValue99.name = "description";<br>fieldValue99.value = "ArtDeco01Material can substitute for a Material node";<br>ProtoInstance98.addFieldValue(fieldValue99);<br><br>Appearance97.addsetMaterial(ProtoInstance98);<br><br>Shape96.addAppearance(Appearance97);<br><br>Sphere100 = Browser.createNode("Sphere");<br>Sphere100.radius = 0.001;<br>Shape96.addGeometry(Sphere100);<br><br>Scene32.addChildren(Shape96);<br><br>Shape101 = Browser.createNode("Shape");<br>Shape101.DEF = "TestShape2";<br>Appearance102 = Browser.createNode("Appearance");<br>Appearance102.DEF = "TestAppearance2";<br>// ArtDeco02Material prototype goes here... TODO ensure setContainerField is handled in exported Java <br>ProtoInstance103 = Browser.createNode("ProtoInstance");<br>ProtoInstance103.DEF = "ArtDeco02MaterialDEF";<br>ProtoInstance103.name = "ArtDeco02Material";<br>// [HelloWorldProgram diagnostic] ArtDeco02ProtoInstance.getNodeType()=\"ERROR_UNKNOWN_EXTERNPROTODECLARE_NODE_TYPE: ExternProtoDeclare name='ArtDeco02Material' type cannot be remotely accessed at run time. TODO X3DJSAIL needs to add further capability that retrieves the ExternProtoDeclare file.\" <br>fieldValue104 = Browser.createNode("fieldValue");<br>fieldValue104.name = "description";<br>fieldValue104.value = "ArtDeco02Material can substitute for another Material node";<br>ProtoInstance103.addFieldValue(fieldValue104);<br><br>Appearance102.addsetMaterial(ProtoInstance103);<br><br>Shape101.addAppearance(Appearance102);<br><br>Cone105 = Browser.createNode("Cone");<br>Cone105.bottomRadius = 0.001;<br>Cone105.height = 0.001;<br>Shape101.addGeometry(Cone105);<br><br>Scene32.addChildren(Shape101);<br><br>Shape106 = Browser.createNode("Shape");<br>Shape106.DEF = "TestShape3";<br>Appearance107 = Browser.createNode("Appearance");<br>Appearance107.DEF = "TestAppearance3";<br>// ArtDeco02Material ProtoInstance USE goes here. Note that name field is NOT defined as part of ProtoInstance USE. <br>ProtoInstance108 = Browser.createNode("ProtoInstance");<br>ProtoInstance108.USE = "ArtDeco02MaterialDEF";<br>Appearance107.addsetMaterial(ProtoInstance108);<br><br>Shape106.addAppearance(Appearance107);<br><br>Cylinder109 = Browser.createNode("Cylinder");<br>Cylinder109.height = 0.001;<br>Cylinder109.radius = 0.001;<br>Shape106.addGeometry(Cylinder109);<br><br>Scene32.addChildren(Shape106);<br><br>Inline110 = Browser.createNode("Inline");<br>Inline110.DEF = "inlineSceneDef";<br>Inline110.url = ["someOtherScene.x3d","<a href="https://www.web3d.org/specifications/java/examples/someOtherScene.x3d" target="_blank">https://www.web3d.org/specifications/java/examples/someOtherScene.x3d</a>"];<br>Scene32.addChildren(Inline110);<br><br>IMPORT111 = Browser.createNode("IMPORT");<br><a href="http://IMPORT111.AS" target="_blank">IMPORT111.AS</a> = "WorldInfoDEF2";<br>IMPORT111.importedDEF = "WorldInfoDEF";<br>IMPORT111.inlineDEF = "inlineSceneDef";<br>Scene32.addChildren(IMPORT111);<br><br>EXPORT112 = Browser.createNode("EXPORT");<br><a href="http://EXPORT112.AS" target="_blank">EXPORT112.AS</a> = "WorldInfoDEF3";<br>EXPORT112.localDEF = "WorldInfoDEF";<br>Scene32.addChildren(EXPORT112);<br><br>ProtoDeclare113 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare113.name = "MaterialModulator";<br>ProtoDeclare113.appinfo = "mimic a Material node and modulate fields as an animation effect";<br>ProtoDeclare113.documentation = "<a href="http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html" target="_blank">http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html</a>";<br>ProtoInterface114 = Browser.createNode("ProtoInterface");<br>field115 = Browser.createNode("field");<br><a href="http://field115.name" target="_blank">field115.name</a> = "enabled";<br>field115.accessType = "inputOutput";<br>field115.type = "SFBool";<br>field115.value = "true";<br>ProtoInterface114.addField(field115);<br><br>field116 = Browser.createNode("field");<br><a href="http://field116.name" target="_blank">field116.name</a> = "diffuseColor";<br>field116.accessType = "inputOutput";<br>field116.type = "SFColor";<br>field116.value = "0 0 0";<br>ProtoInterface114.addField(field116);<br><br>field117 = Browser.createNode("field");<br><a href="http://field117.name" target="_blank">field117.name</a> = "emissiveColor";<br>field117.accessType = "inputOutput";<br>field117.type = "SFColor";<br>field117.value = "0.05 0.05 0.5";<br>ProtoInterface114.addField(field117);<br><br>field118 = Browser.createNode("field");<br><a href="http://field118.name" target="_blank">field118.name</a> = "specularColor";<br>field118.accessType = "inputOutput";<br>field118.type = "SFColor";<br>field118.value = "0 0 0";<br>ProtoInterface114.addField(field118);<br><br>field119 = Browser.createNode("field");<br><a href="http://field119.name" target="_blank">field119.name</a> = "transparency";<br>field119.accessType = "inputOutput";<br>field119.type = "SFFloat";<br>field119.value = "0.0";<br>ProtoInterface114.addField(field119);<br><br>field120 = Browser.createNode("field");<br><a href="http://field120.name" target="_blank">field120.name</a> = "shininess";<br>field120.accessType = "inputOutput";<br>field120.type = "SFFloat";<br>field120.value = "0.0";<br>ProtoInterface114.addField(field120);<br><br>field121 = Browser.createNode("field");<br><a href="http://field121.name" target="_blank">field121.name</a> = "ambientIntensity";<br>field121.accessType = "inputOutput";<br>field121.type = "SFFloat";<br>field121.value = "0.0";<br>ProtoInterface114.addField(field121);<br><br>ProtoDeclare113.addProtoInterface(ProtoInterface114);<br><br>ProtoBody122 = Browser.createNode("ProtoBody");<br>Material123 = Browser.createNode("Material");<br>Material123.DEF = "MaterialNode";<br>IS124 = Browser.createNode("IS");<br>connect125 = Browser.createNode("connect");<br>connect125.nodeField = "diffuseColor";<br>connect125.protoField = "diffuseColor";<br>IS124.addConnect(connect125);<br><br>connect126 = Browser.createNode("connect");<br>connect126.nodeField = "emissiveColor";<br>connect126.protoField = "emissiveColor";<br>IS124.addConnect(connect126);<br><br>connect127 = Browser.createNode("connect");<br>connect127.nodeField = "specularColor";<br>connect127.protoField = "specularColor";<br>IS124.addConnect(connect127);<br><br>connect128 = Browser.createNode("connect");<br>connect128.nodeField = "transparency";<br>connect128.protoField = "transparency";<br>IS124.addConnect(connect128);<br><br>connect129 = Browser.createNode("connect");<br>connect129.nodeField = "shininess";<br>connect129.protoField = "shininess";<br>IS124.addConnect(connect129);<br><br>connect130 = Browser.createNode("connect");<br>connect130.nodeField = "ambientIntensity";<br>connect130.protoField = "ambientIntensity";<br>IS124.addConnect(connect130);<br><br>Material123.addIS(IS124);<br><br>ProtoBody122.addChildren(Material123);<br><br>// Only first node (the node type) is renderable, others are along for the ride <br>Script131 = Browser.createNode("Script");<br>Script131.DEF = "MaterialModulatorScript";<br>field132 = Browser.createNode("field");<br><a href="http://field132.name" target="_blank">field132.name</a> = "enabled";<br>field132.accessType = "inputOutput";<br>field132.type = "SFBool";<br>Script131.addField(field132);<br><br>field133 = Browser.createNode("field");<br><a href="http://field133.name" target="_blank">field133.name</a> = "diffuseColor";<br>field133.accessType = "inputOutput";<br>field133.type = "SFColor";<br>Script131.addField(field133);<br><br>field134 = Browser.createNode("field");<br><a href="http://field134.name" target="_blank">field134.name</a> = "newColor";<br>field134.accessType = "outputOnly";<br>field134.type = "SFColor";<br>Script131.addField(field134);<br><br>field135 = Browser.createNode("field");<br><a href="http://field135.name" target="_blank">field135.name</a> = "clockTrigger";<br>field135.accessType = "inputOnly";<br>field135.type = "SFTime";<br>Script131.addField(field135);<br><br>IS136 = Browser.createNode("IS");<br>connect137 = Browser.createNode("connect");<br>connect137.nodeField = "enabled";<br>connect137.protoField = "enabled";<br>IS136.addConnect(connect137);<br><br>connect138 = Browser.createNode("connect");<br>connect138.nodeField = "diffuseColor";<br>connect138.protoField = "diffuseColor";<br>IS136.addConnect(connect138);<br><br>Script131.addIS(IS136);<br><br><br>Script131.setSourceCode('''\n"+<br>"ecmascript:\n"+<br>"function initialize ()\n"+<br>"{\n"+<br>"    newColor = diffuseColor; // start with correct color\n"+<br>"}\n"+<br>"function set_enabled (newValue)\n"+<br>"{\n"+<br>"  enabled = newValue;\n"+<br>"}\n"+<br>"function clockTrigger (timeValue)\n"+<br>"{\n"+<br>"    if (!enabled) return;\n"+<br>"    red   = newColor.r;\n"+<br>"    green = newColor.g;\n"+<br>"    blue  = newColor.b;\n"+<br>"    \n"+<br>"    // note different modulation rates for each color component, % is modulus operator\n"+<br>"    newColor = new SFColor ((red + 0.02) % 1, (green + 0.03) % 1, (blue + 0.04) % 1);\n"+<br>"  if (enabled)\n"+<br>"   {\n"+<br>"              Browser.print ('diffuseColor=(' + red + ',' + green + ',' + blue + ') newColor=' + newColor.toString() + '\\n');\n"+<br>"       }\n"+<br>"}\n"+<br>"''')<br>ProtoBody122.addChildren(Script131);<br><br>ProtoDeclare113.addProtoBody(ProtoBody122);<br><br>Scene32.addChildren(ProtoDeclare113);<br><br>// Test success: declarative statement createDeclarativeShapeTests() <br>Group139 = Browser.createNode("Group");<br>Group139.DEF = "DeclarativeGroupExample";<br>Shape140 = Browser.createNode("Shape");<br>MetadataString141 = Browser.createNode("MetadataString");<br>MetadataString141.DEF = "FindableMetadataStringTest";<br>MetadataString141.name = "findThisNameValue";<br>MetadataString141.value = ["test case"];<br>Shape140.addMetadata(MetadataString141);<br><br>Appearance142 = Browser.createNode("Appearance");<br>Appearance142.DEF = "DeclarativeAppearanceExample";<br>// DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance <br>ProtoInstance143 = Browser.createNode("ProtoInstance");<br>ProtoInstance143.DEF = "MyMaterialModulator";<br>ProtoInstance143.name = "MaterialModulator";<br>Appearance142.addsetMaterial(ProtoInstance143);<br><br>Shape140.addAppearance(Appearance142);<br><br>Cone144 = Browser.createNode("Cone");<br>Cone144.bottom = False;<br>Cone144.bottomRadius = 0.05;<br>Cone144.height = 0.1;<br>Shape140.addGeometry(Cone144);<br><br>Group139.addChildren(Shape140);<br><br>// Test success: declarativeGroup.addChild() singleton pipeline method <br>Scene32.addChildren(Group139);<br><br>// Test success: declarative statement addChild() <br>// Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance DEF='DeclarativeAppearanceExample'/> i.e. <Appearance DEF='DeclarativeAppearanceExample'> <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - -> <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/> </Appearance> <br>// Test success: x3dModel.findElementByNameValue(findThisNameValue) = <MetadataString DEF='FindableMetadataStringTest' name='findThisNameValue' value='\"test case\"'/> <br>// Test success: x3dModel.findElementByNameValue(\"ArtDeco01Material\", \"ProtoDeclare\") found <br>// Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoDeclare\") found <br>// Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoInstance\") found <br>Group145 = Browser.createNode("Group");<br>Group145.DEF = "TestFieldObjectsGroup";<br>// testFieldObjects() results <br>// SFBool default=true, true=true, false=false, negate()=true <br>// MFBool default=, initial=true false true, negate()=false true false <br>// SFFloat default=0.0, initial=1.0, setValue(2)=2.0, setValue(3.0f)=3.0, setValue(4.0)=4.0 <br>// MFFloat default=, initial=1 2 3, append(5)=1 2 3 5, inserts(3,4)(0,0)=0 1 2 3 4 5, append(6)=0 1 2 3 4 5 6, size()=7 <br>// ... get1Value[3]=3.0, remove[1]=0 2 3 4 5 6, set1Value(0,10)=10 2 3 4 5 6, multiply(2)=20 4 6 8 10 12, clear= <br>// SFVec3f default=0 0 0, initial=1 2 3, setValue=4 5 6, multiply(2)=8 10 12, normalize()=0.45584232 0.5698029 0.68376344, regex matches()=true <br>// regex test SFVec3f().matches(\"1 2 3\")=true, regex test SFVec3f().matches(\"1 2 3 4\")=false, regex test (SFRotationObject.matches(\"0 0 0 0\")=true, failure detecting illegal (zero axis) rotation value <br>Scene32.addChildren(Group145);<br><br>Sound146 = Browser.createNode("Sound");<br>Sound146.location = [0,1.6,0];<br>// set sound-ellipsoid location height at 1.6m to match typical avatar height <br>AudioClip147 = Browser.createNode("AudioClip");<br>AudioClip147.description = "chimes";<br>AudioClip147.url = ["chimes.wav","<a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav</a>"];<br>// Scene example fragment from <a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d</a> <br>Sound146.addSource(AudioClip147);<br><br>Scene32.addChildren(Sound146);<br><br>Sound148 = Browser.createNode("Sound");<br>Sound148.location = [0,1.6,0];<br>// set sound-ellipsoid location height at 1.6m to match typical avatar height <br>MovieTexture149 = Browser.createNode("MovieTexture");<br>MovieTexture149.description = "mpgsys.mpg from ConformanceNist suite";<br>MovieTexture149.url = ["mpgsys.mpg","<a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg</a>"];<br>// Scene example fragment from <a href="https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpeg1-systems.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpeg1-systems.x3d</a> <br>// Expected containerField='source', allowed containerField values=\"texture\" \"source\" \"back\" \"bottom\" \"front\" \"left\" \"right\" \"top\" \"backTexture\" \"bottomTexture\" \"frontTexture\" \"leftTexture\" \"rightTexture\" \"topTexture\" \"watchList\" <br>Sound148.addsetSource(MovieTexture149);<br><br>Scene32.addChildren(Sound148);<br><br>// Test success: AnchorObject.isNode()=true, siteAnchor.isNode()=true <br>// Test success: AnchorObject.isStatement()=false, siteAnchor.isStatement()=false <br>// Test success: ROUTEObject.isNode()=false, orbitPositionROUTE.isNode()=false <br>// Test success: ROUTEObject.isStatement()=true, orbitPositionROUTE.isStatement()=true <br>// Test success: CommentsBlock.isNode()=false, testComments.isNode()=false <br>// Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true <br>Shape150 = Browser.createNode("Shape");<br>Shape150.DEF = "ExtrusionShape";<br>// ExampleExtrusion isCrossSectionClosed()=true, crossSection='[1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0]' <br>// ExampleExtrusion isSpineClosed()=false, spine='[0.0, 0.0, 0.0, 0.0, 1.0, 0.0]' <br>Appearance151 = Browser.createNode("Appearance");<br>Appearance151.DEF = "TransparentAppearance";<br>Material152 = Browser.createNode("Material");<br>Material152.transparency = 1.0;<br>Appearance151.addMaterial(Material152);<br><br>Shape150.addAppearance(Appearance151);<br><br>Extrusion153 = Browser.createNode("Extrusion");<br>Extrusion153.DEF = "ExampleExtrusion";<br>Shape150.addGeometry(Extrusion153);<br><br>Scene32.addChildren(Shape150);<br><br>Group154 = Browser.createNode("Group");<br>// Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes <br>ProtoDeclare155 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare155.name = "NewWorldInfo";<br>ProtoInterface156 = Browser.createNode("ProtoInterface");<br>field157 = Browser.createNode("field");<br><a href="http://field157.name" target="_blank">field157.name</a> = "description";<br>field157.accessType = "initializeOnly";<br>field157.type = "SFString";<br>ProtoInterface156.addField(field157);<br><br>ProtoDeclare155.addProtoInterface(ProtoInterface156);<br><br>ProtoBody158 = Browser.createNode("ProtoBody");<br>WorldInfo159 = Browser.createNode("WorldInfo");<br>ProtoBody158.addChildren(WorldInfo159);<br><br>ProtoDeclare155.addProtoBody(ProtoBody158);<br><br>Group154.addChildren(ProtoDeclare155);<br><br>ProtoInstance160 = Browser.createNode("ProtoInstance");<br>ProtoInstance160.DEF = "Proto1";<br>ProtoInstance160.name = "NewWorldInfo";<br>fieldValue161 = Browser.createNode("fieldValue");<br>fieldValue161.name = "description";<br>fieldValue161.value = "testing 1 2 3";<br>ProtoInstance160.addFieldValue(fieldValue161);<br><br>Group154.addChildren(ProtoInstance160);<br><br>Group162 = Browser.createNode("Group");<br>Group162.DEF = "Node2";<br>// intentionally empty <br>Group154.addChildren(Group162);<br><br>ProtoInstance163 = Browser.createNode("ProtoInstance");<br>ProtoInstance163.DEF = "Proto3";<br>ProtoInstance163.name = "NewWorldInfo";<br>Group154.addChildren(ProtoInstance163);<br><br>Transform164 = Browser.createNode("Transform");<br>Transform164.DEF = "Node4";<br>// intentionally empty <br>Group154.addChildren(Transform164);<br><br>// Test satisfactorily creates MFNode children array as an ordered list with mixed content <br>Scene32.addChildren(Group154);<br><br>ProtoDeclare165 = Browser.createNode("ProtoDeclare");<br>ProtoDeclare165.name = "ShaderProto";<br>ProtoBody166 = Browser.createNode("ProtoBody");<br>ProgramShader167 = Browser.createNode("ProgramShader");<br>ProtoBody166.addChild(ProgramShader167);<br><br>ProtoDeclare165.addProtoBody(ProtoBody166);<br><br>Scene32.addChildren(ProtoDeclare165);<br><br>Shape168 = Browser.createNode("Shape");<br>Appearance169 = Browser.createNode("Appearance");<br>// Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes <br>// Test satisfactorily creates MFNode shaders array as an ordered list with mixed content <br>ProgramShader170 = Browser.createNode("ProgramShader");<br>ProgramShader170.DEF = "TestShader1";<br>ShaderProgram171 = Browser.createNode("ShaderProgram");<br>ShaderProgram171.DEF = "TestShader2";<br>ProgramShader170.addPrograms(ShaderProgram171);<br><br>Appearance169.addShaders(ProgramShader170);<br><br>ProtoInstance172 = Browser.createNode("ProtoInstance");<br>ProtoInstance172.DEF = "TestShader3";<br>ProtoInstance172.name = "ShaderProto";<br>Appearance169.addsetMaterial(ProtoInstance172);<br><br>ComposedShader173 = Browser.createNode("ComposedShader");<br>ComposedShader173.DEF = "TestShader4";<br>ShaderPart174 = Browser.createNode("ShaderPart");<br>ShaderPart174.DEF = "TestShader5";<br>ComposedShader173.addParts(ShaderPart174);<br><br>Appearance169.addShaders(ComposedShader173);<br><br>Shape168.addAppearance(Appearance169);<br><br>Scene32.addChildren(Shape168);<br><br>Transform175 = Browser.createNode("Transform");<br>Transform175.DEF = "SpecialtyNodes";<br>CADLayer176 = Browser.createNode("CADLayer");<br>CADAssembly177 = Browser.createNode("CADAssembly");<br>CADPart178 = Browser.createNode("CADPart");<br>CADFace179 = Browser.createNode("CADFace");<br>CADPart178.addChildren(CADFace179);<br><br>CADAssembly177.addChildren(CADPart178);<br><br>CADLayer176.addChildren(CADAssembly177);<br><br>Transform175.addChildren(CADLayer176);<br><br>EspduTransform180 = Browser.createNode("EspduTransform");<br>EspduTransform180.geoSystem = ["GD","WE"];<br>Transform175.addChildren(EspduTransform180);<br><br>ReceiverPdu181 = Browser.createNode("ReceiverPdu");<br>ReceiverPdu181.geoSystem = ["GD","WE"];<br>Transform175.addChildren(ReceiverPdu181);<br><br>SignalPdu182 = Browser.createNode("SignalPdu");<br>SignalPdu182.geoSystem = ["GD","WE"];<br>Transform175.addChildren(SignalPdu182);<br><br>TransmitterPdu183 = Browser.createNode("TransmitterPdu");<br>TransmitterPdu183.geoSystem = ["GD","WE"];<br>Transform175.addChildren(TransmitterPdu183);<br><br>DISEntityManager184 = Browser.createNode("DISEntityManager");<br>DISEntityTypeMapping185 = Browser.createNode("DISEntityTypeMapping");<br>DISEntityManager184.addMapping(DISEntityTypeMapping185);<br><br>Transform175.addChildren(DISEntityManager184);<br><br>Scene32.addChildren(Transform175);<br><br>X3D0.addScene(Scene32);<br><br>X3D0.toFileX3D("examples/HelloWorldProgramOutput_RoundTrip.x3d")<br></div></div>
</blockquote></div>
</blockquote></div>