[x3d-public] This attached file causes all kinds ofhavoc:X3dToJson.xslt, X3dToJava.xslt, JSON schema,

John Carlson yottzumm at gmail.com
Mon Dec 11 15:33:49 PST 2017


The fact that the X3D does not contain many containerFields may indicate something, not sure.   Attached.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Monday, December 11, 2017 6:30 PM
To: Don Brutzman; x3d-public at web3d.org; Roy Walmsley
Subject: RE: This attached file causes all kinds ofhavoc:X3dToJson.xslt,X3dToJava.xslt, JSON schema,

Note differences between recent X3dToJson.xslt run in X3DJSONLD and java/examples JSON.   We really need to regenerate the java/examples for a real test.  I believe that is not currently being done in the regression test.

The difference is I am generating the JSON from the Java in one test, and from the X3D in another test (X3DJSONLD).

Unfortunately, the results are different.  I am suspecting the stylesheet engine, but not sure.

John

$ !diff
diff ../data/HelloWorldProgramOutput.json /c/x3d-code/www.web3d.org/x3d/stylesheets/java/examples/
315c315,321
<                                 "-metadata":
---
>                                 "-value":[
>                                   { "MetadataString":
>                                     {
>                                       "@name":"escapedQuotesTest1",
>                                       "@value":["escaped quotation marks example 1: He said, \"Immel did it!\""]
>                                     }
>                                   },
321a328
>                                 ]
347c354,356
<                       },
---
>                       }
>                     ],
>                     "-proxy":
370d378
<                     ]
590c598
<                     "-children":[
---
>                     "-material":
606a615
>                     "-children":[
628c637
<                     "-children":[
---
>                     "-material":
644a654
>                     "-children":[
857c867
<                           "-children":[
---
>                           "-material":
863a874
>                           "-children":[
Note leftover JSON schema issues:

File: ../data/HelloWorldProgramOutput.json

keyword: additionalProperties
dataPath: X3D > Scene > -children > 5 > Transform > -children > 0 > Anchor > -children > 0 > Shape > -geometry > Box
value: {"@DEF":"test-NMTOKEN_regex.0123456789","@class":"textured"}
message: should not have additional properties
params: {"additionalProperty":"@class"}
file: ../data/HelloWorldProgramOutput.json
version: 3.3


keyword: additionalProperties
dataPath: X3D > Scene > -children > 21 > Shape > -appearance > Appearance > -children > 0
value: {"ProtoInstance":"|omitted|"}
message: should not have additional properties
params: {"additionalProperty":"ProtoInstance"}
file: ../data/HelloWorldProgramOutput.json
version: 3.3


keyword: additionalProperties
dataPath: X3D > Scene > -children > 22 > Shape > -appearance > Appearance > -children > 0
value: {"ProtoInstance":"|omitted|"}
message: should not have additional properties
params: {"additionalProperty":"ProtoInstance"}
file: ../data/HelloWorldProgramOutput.json
version: 3.3


keyword: type
dataPath: X3D > Scene > -children > 24 > IMPORT
value: {"@AS":"WorldInfoDEF2","@importedDEF":"WorldInfoDEF","@inlineDEF":"inlineSceneDef"}
message: should be array
params: {"type":"array"}
file: ../data/HelloWorldProgramOutput.json
version: 3.3


keyword: type
dataPath: X3D > Scene > -children > 25 > EXPORT
value: {"@AS":"WorldInfoDEF3","@localDEF":"WorldInfoDEF"}
message: should be array
params: {"type":"array"}
file: ../data/HelloWorldProgramOutput.json
version: 3.3


keyword: additionalProperties
dataPath: X3D > Scene > -children > 28 > Group > -children > 0 > Shape > -appearance > Appearance > -children > 0
value: {"ProtoInstance":"|omitted|"}
message: should not have additional properties
params: {"additionalProperty":"ProtoInstance"}
file: ../data/HelloWorldProgramOutput.json
version: 3.3

Error:  Errors present


Sent from Mail for Windows 10

From: Don Brutzman
Sent: Monday, December 11, 2017 11:11 AM
To: John Carlson; x3d-public at web3d.org; Roy Walmsley
Subject: Re: This attached file causes all kinds of havoc:X3dToJson.xslt,X3dToJava.xslt, JSON schema,

Hi John, thanks for this trouble report.

Last night's build fixed several of the construction errors in the .java and .x3d scene, such as improperly referencing the prototype name (given should match the ProtoDeclare name of ArtDeco01Material vice ArtDeco01, etc.)

X3D Validator has confirmed that we've reduced the set of issues with this scene.  Most of the following are warnings.

http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d
https://savage.nps.edu/X3dValidator?url=http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d

Performing X3D Schematron check...
<X3D profile='Immersive'> is defined satisfactorily for this scene, but ensure that child Inline scenes do not exceed this profile/component combination since a parent scene must have an equal or higher profile/component combination [/X3D, info]
<LayerSet DEF='scene.addChildLayerSetObjectTest'/> not handled correctly by X3D schematron rule, or else node name has unrecognized spelling and may fail X3D DTD/Schema validation... [/X3D/Scene/LayerSet, error]
<MetadataSet DEF='' name='EscapedQuotationMarksMetadataSet'/> contains a Metadata* node with default containerField='metadata' where typically such nodes have containerField='value' [/X3D/Scene/Transform[2]/Shape/Text/MetadataSet, warning]
<Text DEF='' string='"One, Two, Three" "" "He said, \"Immel did it!\""'/> has 8 quote marks with at least one escaped quote mark \" so double-check to ensure paired "quote marks" for each line are matched [/X3D/Scene/Transform[2]/Collision/Shape/Text, warning]
<Inline DEF='inlineSceneDef'/> url array address(es) missing online http/https references (url='"someOtherScene.x3d"') [/X3D/Scene/Inline, info]
<Script DEF='MaterialModulatorScript'> <field name='diffuseColor' accessType='inputOutput'/> must define function set_diffuseColor (newValue) [/X3D/Scene/ProtoDeclare[2]/ProtoBody/Script/field[2], error]
<Script DEF='MaterialModulatorScript'> <field name='diffuseColor' accessType='inputOutput'/> does not send output event via assignment statement diffuseColor=___; [/X3D/Scene/ProtoDeclare[2]/ProtoBody/Script/field[2], warning]

--------- Validation checks complete for HelloWorldProgramOutput.x3d ---------

Other updates yesterday: warnings now provided when files are overwritten; added ConfigurationProperties.isOverwriteExistingFiles() and setOverwriteExistingFiles(newValue) to modify overwrite permissions.

On 12/10/2017 9:15 PM, John Carlson wrote:
> I believe this may be due to not generating the material containerField attribute properly in the X3D file, not sure. In any case, the generated Java does not contain setMaterial() like the original HelloWorldProgram.java, instead addChild() is used improperly.  Or setProtoInstance() in my serializer.
> 
> Attached is an X3D file which appears to work properly with a containerField=”material”
> 
> Please insure that the containerField is written to XML in the cases where setMaterial() is called, and setMaterial is written with X3dToJava.xslt instead of addChild().   There are other container fields that you’ll have to handle as well.
> 
> X3dToJava.xslt appears to be working with the containerField specified.
> 
> Good Luck and
> 
> Thanks,
> 
> John
> 
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 
> *From: *John Carlson <mailto:yottzumm at gmail.com>
> *Sent: *Sunday, December 10, 2017 1:10 PM
> *To: *x3d-public at web3d.org <mailto:x3d-public at web3d.org>; Don Brutzman <mailto:brutzman at nps.edu>; Roy Walmsley <mailto:roy.walmsley at ntlworld.com>
> *Subject: *This attached file causes all kinds of havoc: X3dToJson.xslt,X3dToJava.xslt, JSON schema,
> 
>  1. Generated JSON from X3dToJson.xslt does not pass schema
>  2. Generated Java from X3dToJava.xslt does not compile
>  3. Serialized XML from JSON does not match original XML (see below)
>  4. Nashorn doesn’t run
>  5. <MetadataString DEF='scene.addChildMetadataObject' name='test'/> doesn’t get transferred to JSON.
>  6. <LayerSet DEF='scene.addChildLayerSetObjectTest' order='0'/>  order=’0’ doesn’t get transferred to JSON (may be default)
> 
> I can report errors if necessary.
> 
> This is really strange, because this file comes from the Don’s X3DJSAIL test suite as output.   We should test all outputs.  Plus I thought that it already validated, yet it appears it has errors???
> 
> Please put this file in X3D Resources Examples as a unit test.
> 
> Thanks,
> 
> John
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd">
> 
> <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>
> 
>      <head>
> 
>          <component name='Navigation' level='3'/>
> 
>          <component name='Layering' level='1'/>
> 
>          <unit name='AngleUnitConversion' category='angle' conversionFactor='1.0'/>
> 
>          <unit name='LengthUnitConversion' category='length' conversionFactor='1.0'/>
> 
>          <meta name='title' content='HelloWorldProgramOutput.x3d'/>
> 
>          <meta name='description' content='Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface (SAI) Library'/>
> 
>          <meta name='reference' content='http://www.web3d.org/specifications/java/X3DJSAIL.html'/>
> 
>          <meta name='generator' content='HelloWorldProgramOutput.java'/>
> 
>          <meta name='created' content='6 September 2016'/>
> 
>          <meta name='modified' content='9 December 2017'/>
> 
>          <meta name='generator' content='X3D Java Scene Access Interface Library (X3DJSAIL)'/>
> 
>          <meta name='generator' content='http://www.web3d.org/specifications/java/examples/HelloWorldProgram.java'/>
> 
>          <meta name='generator' content='Netbeans http://www.netbeans.org'/>
> 
>          <meta name='creator' content='Don Brutzman'/>
> 
>          <meta name='reference' content='https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d'/>
> 
>          <meta name='reference' content='Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:'/>
> 
>          <meta name='reference' content='HelloWorldProgramOutput.txt'/>
> 
>          <meta name='reference' content='HelloWorldProgramOutput.x3dv'/>
> 
>          <meta name='reference' content='HelloWorldProgramOutput.wrl'/>
> 
>          <meta name='reference' content='HelloWorldProgramOutput.html'/>
> 
>          <meta name='X3dValidator' content='https://savage.nps.edu/X3dValidator?url=http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d'/>
> 
>          <meta name='identifier' content='http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d'/>
> 
>          <meta name='license' content='../license.html'/>
> 
>          <meta name='SpecialTest' content='tested sat: name value cannot contain embedded space character'/>
> 
>          <!-- comment #1 -->
> 
>          <!-- comment #2 -->
> 
>          <!-- comment #3 -->
> 
>          <!-- comment #4 -->
> 
>      </head>
> 
>      <Scene>
> 
>          <ViewpointGroup description='Available viewpoints'>
> 
>              <Viewpoint DEF='DefaultView' description='Hello X3DJSAIL'/>
> 
>              <Viewpoint DEF='TopDownView' description='top-down view from above' orientation='1 0 0 -1.570796' position='0 100 0'/>
> 
>          </ViewpointGroup>
> 
>         <WorldInfo DEF='WorldInfoDEF' title='HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)'/>
> 
>          <WorldInfo USE='WorldInfoDEF'/>
> 
>          <WorldInfo USE='WorldInfoDEF'/>
> 
>          <MetadataString DEF='scene.addChildMetadataObject' name='test'/>
> 
>          <LayerSet DEF='scene.addChildLayerSetObjectTest' order='0'/>
> 
>          <Transform DEF='LogoGeometryTransform' translation='0 1.5 0'>
> 
>              <Anchor description='select for X3D Java SAI Library (X3DJSAIL) description' url='"../X3DJSAIL.html" "http://www.web3d.org/specifications/java/X3DJSAIL.html"'>
> 
>                  <Shape DEF='BoxShape'>
> 
>                      <Appearance>
> 
>                          <Material DEF='GreenMaterial' diffuseColor='0 1 1' emissiveColor='0.8 0 0' transparency='0.1'/>
> 
>                          <ImageTexture url='"images/X3dJavaSceneAccessInterfaceSaiLibrary.png" "http://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png"'/>
> 
>                      </Appearance>
> 
>                      <Box DEF='test-NMTOKEN_regex.0123456789' class='textured'/>
> 
>                  </Shape>
> 
>              </Anchor>
> 
>          </Transform>
> 
>          <Shape DEF='LineShape'>
> 
>              <Appearance>
> 
>                  <Material emissiveColor='0.6 0.19607843 0.8'/>
> 
>              </Appearance>
> 
>              <IndexedLineSet coordIndex='0 1 2 3 4 0'>
> 
>                  <Coordinate 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'/>
> 
>              </IndexedLineSet>
> 
>          </Shape>
> 
>          <PositionInterpolator DEF='BoxPathAnimator' key='0 0.125 0.375 0.625 0.875 1' 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'/>
> 
>          <TimeSensor DEF='OrbitClock' cycleInterval='8.0' loop='true'/>
> 
>          <ROUTE fromField='fraction_changed' fromNode='OrbitClock' toField='set_fraction' toNode='BoxPathAnimator'/>
> 
>          <ROUTE fromField='value_changed' fromNode='BoxPathAnimator' toField='set_translation' toNode='LogoGeometryTransform'/>
> 
>          <Transform DEF='TextTransform' translation='0 -1.5 0'>
> 
>              <Shape>
> 
>                  <Appearance>
> 
>                      <Material USE='GreenMaterial'/>
> 
>                  </Appearance>
> 
>                  <Text string='"X3D Java" "SAI Library" "X3DJSAIL"'>
> 
>                      <MetadataSet name='EscapedQuotationMarksMetadataSet'>
> 
>                          <MetadataString name='escapedQuotesTest2' value='"escaped quotation marks example 2: He said, &quot;Immel did it!&quot;"'/>
> 
>                      </MetadataSet>
> 
>                      <FontStyle family='"SERIF"' justify='"MIDDLE" "MIDDLE"'/>
> 
>                      <!-- escaped quotation marks example 3: He said, "Immel did it!" -->
> 
>                      <!-- escaped quotation marks example 4: He said, "Immel did it!" -->
> 
>                  </Text>
> 
>              </Shape>
> 
>              <Collision>
> 
>                  <!-- test containerField='proxy' -->
> 
>                  <Shape DEF='ProxyShape'>
> 
>                      <Text string='"One, Two, Three" "" "He said, \"Immel did it!\""'/>
> 
>                      <!-- alternative XML encoding: Text string='"One, Two, Three" "" "He said, \"Immel did it!\""' -->
> 
>                      <!-- alternative Java source: .setString(new String [] {"One, Two, Three", "", "He said, \"Immel did it!\""}) -->
> 
>                      <!-- reference: http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html -->
> 
>                  </Shape>
> 
>              </Collision>
> 
>              <!-- It's a beautiful world -->
> 
>              <!-- ... for you! -->
> 
>              <!-- https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song) -->
> 
>          </Transform>
> 
>          <!-- repeatedly spin 180 degrees as a readable special effect -->
> 
>          <OrientationInterpolator DEF='SpinInterpolator' key='0 0.5 1' keyValue='0 1 0 4.712389 0 1 0 0 0 1 0 1.5707964'/>
> 
>          <TimeSensor DEF='SpinClock' cycleInterval='5.0' loop='true'/>
> 
>          <ROUTE fromField='fraction_changed' fromNode='SpinClock' toField='set_fraction' toNode='SpinInterpolator'/>
> 
>          <ROUTE fromField='value_changed' fromNode='SpinInterpolator' toField='rotation' toNode='TextTransform'/>
> 
>          <Group DEF='BackgroundGroup'>
> 
>              <Background DEF='GradualBackground'/>
> 
>              <Script DEF='colorTypeConversionScript'>
> 
>                  <field name='colorInput' accessType='inputOnly' type='SFColor'/>
> 
>                  <field name='colorsOutput' accessType='outputOnly' type='MFColor'/>
> 
> <![CDATA[
> 
> ecmascript:
> 
> function colorInput (eventValue) // Example source code
> 
> {
> 
>     colorsOutput = new MFColor(eventValue); // assigning value sends output event
> 
> // Browser.print('colorInput=' + eventValue + ', colorsOutput=' + colorsOutput + '\n');
> 
> }
> 
> ]]>
> 
>              </Script>
> 
>             <ColorInterpolator DEF='ColorAnimator' key='0 0.5 1' keyValue='0.9411765 1 1 0.29411766 0 0.50980395 0.9411765 1 1'>
> 
>                  <!-- AZURE to INDIGO and back again -->
> 
>              </ColorInterpolator>
> 
>              <TimeSensor DEF='ColorClock' cycleInterval='60.0' loop='true'/>
> 
>              <ROUTE fromField='colorsOutput' fromNode='colorTypeConversionScript' toField='skyColor' toNode='GradualBackground'/>
> 
>              <ROUTE fromField='value_changed' fromNode='ColorAnimator' toField='colorInput' toNode='colorTypeConversionScript'/>
> 
>              <ROUTE fromField='fraction_changed' fromNode='ColorClock' toField='set_fraction' toNode='ColorAnimator'/>
> 
>          </Group>
> 
>          <ProtoDeclare name='ArtDeco01Material' appinfo='tooltip: ArtDeco01 prototype is a Material node'>
> 
>              <ProtoInterface>
> 
>                  <field name='description' accessType='inputOutput' appinfo='tooltip for descriptionField' type='SFString' value='ArtDeco01 prototype is a Material node'/>
> 
>                  <field name='enabled' accessType='inputOutput' type='SFBool' value='true'/>
> 
>              </ProtoInterface>
> 
>              <ProtoBody>
> 
>                  <!-- Initial node of ProtoBody determines prototype node type -->
> 
>                  <Material ambientIntensity='0.25' diffuseColor='0.282435 0.085159 0.134462' shininess='0.127273' specularColor='0.276305 0.11431 0.139857'/>
> 
>                  <!-- [HelloWorldProgram diagnostic] should be connected to scene graph: ArtDeco01ProtoDeclare.getNodeType()="Material" -->
> 
>                  <!-- presence of follow-on TouchSensor shows that additional nodes are allowed in ProtoBody after initial node, regardless of node types -->
> 
>                  <TouchSensor description='within ProtoBody'>
> 
>                      <IS>
> 
>                          <connect nodeField='description' protoField='description'/>
> 
>                          <connect nodeField='enabled' protoField='enabled'/>
> 
>                      </IS>
> 
>                  </TouchSensor>
> 
>              </ProtoBody>
> 
>          </ProtoDeclare>
> 
>          <ExternProtoDeclare name='ArtDeco02Material' appinfo='this is a different Material node' url='"http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02" "http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02"'>
> 
>              <field name='description' accessType='inputOutput' appinfo='tooltip for descriptionField' type='SFString'/>
> 
>              <!-- [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." -->
> 
>          </ExternProtoDeclare>
> 
>          <!-- Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place -->
> 
>          <Shape DEF='TestShape1'>
> 
>              <Appearance DEF='TestAppearance1'>
> 
>                  <ProtoInstance name='ArtDeco01'>
> 
>                      <fieldValue name='description' value='ArtDeco01 can substitute for a Material node'/>
> 
>                      <!-- [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()="ERROR_UNKNOWN_PROTOINSTANCE_NODE_TYPE: ProtoInstance name='ArtDeco01' has no corresponding ProtoDeclareObject or ExternProtoDeclareObject to provide type." -->
> 
>                  </ProtoInstance>
> 
>                  <!-- ArtDeco01 Material prototype goes here... -->
> 
>              </Appearance>
> 
>              <Sphere radius='0.001'/>
> 
>          </Shape>
> 
>          <Shape DEF='TestShape2'>
> 
>              <Appearance DEF='TestAppearance2'>
> 
>                  <ProtoInstance name='ArtDeco02'>
> 
>                      <fieldValue name='description' value='ArtDeco02 can substitute for another Material node'/>
> 
>                      <!-- [HelloWorldProgram diagnostic] ArtDeco02ProtoInstance.getNodeType()="ERROR_UNKNOWN_PROTOINSTANCE_NODE_TYPE: ProtoInstance name='ArtDeco02' has no corresponding ProtoDeclareObject or ExternProtoDeclareObject to provide type." -->
> 
>                  </ProtoInstance>
> 
>                  <!-- ArtDeco02 Material prototype goes here... -->
> 
>              </Appearance>
> 
>              <Cone bottomRadius='0.001' height='0.001'/>
> 
>          </Shape>
> 
>          <Inline DEF='inlineSceneDef' url='"someOtherScene.x3d"'/>
> 
>          <IMPORT AS='WorldInfoDEF2' importedDEF='WorldInfoDEF' inlineDEF='inlineSceneDef'/>
> 
>          <EXPORT AS='WorldInfoDEF3' localDEF='WorldInfoDEF'/>
> 
>          <ProtoDeclare name='MaterialModulator' appinfo='mimic a Material node and modulate fields as an animation effect' documentation='http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html'>
> 
>              <ProtoInterface>
> 
>                  <field name='enabled' accessType='inputOutput' type='SFBool' value='true'/>
> 
>                  <field name='diffuseColor' accessType='inputOutput' type='SFColor' value='0 0 0'/>
> 
>                  <field name='emissiveColor' accessType='inputOutput' type='SFColor' value='0.05 0.05 0.5'/>
> 
>                  <field name='specularColor' accessType='inputOutput' type='SFColor' value='0 0 0'/>
> 
>                  <field name='transparency' accessType='inputOutput' type='SFFloat' value='0.0'/>
> 
>                  <field name='shininess' accessType='inputOutput' type='SFFloat' value='0.0'/>
> 
>                  <field name='ambientIntensity' accessType='inputOutput' type='SFFloat' value='0.0'/>
> 
>              </ProtoInterface>
> 
>              <ProtoBody>
> 
>                  <Material DEF='MaterialNode'>
> 
>                      <IS>
> 
>                          <connect nodeField='diffuseColor' protoField='diffuseColor'/>
> 
>                          <connect nodeField='emissiveColor' protoField='emissiveColor'/>
> 
>                          <connect nodeField='specularColor' protoField='specularColor'/>
> 
>                          <connect nodeField='transparency' protoField='transparency'/>
> 
>                          <connect nodeField='shininess' protoField='shininess'/>
> 
>                          <connect nodeField='ambientIntensity' protoField='ambientIntensity'/>
> 
>                      </IS>
> 
>                  </Material>
> 
>                  <!-- Only first node (the node type) is renderable, others are along for the ride -->
> 
>                  <Script DEF='MaterialModulatorScript'>
> 
>                      <field name='enabled' accessType='inputOutput' type='SFBool'/>
> 
>                      <field name='diffuseColor' accessType='inputOutput' type='SFColor'/>
> 
>                      <field name='newColor' accessType='outputOnly' type='SFColor'/>
> 
>                      <field name='clockTrigger' accessType='inputOnly' type='SFTime'/>
> 
>                      <IS>
> 
>                          <connect nodeField='enabled' protoField='enabled'/>
> 
>                          <connect nodeField='diffuseColor' protoField='diffuseColor'/>
> 
>                      </IS>
> 
> <![CDATA[
> 
> ecmascript:
> 
> function initialize ()
> 
> {
> 
>      newColor = diffuseColor; // start with correct color
> 
> }
> 
> function set_enabled (newValue)
> 
> {
> 
>                  enabled = newValue;
> 
> }
> 
> function clockTrigger (timeValue)
> 
> {
> 
>      if (!enabled) return;
> 
>      red   = newColor.r;
> 
>      green = newColor.g;
> 
>      blue  = newColor.b;
> 
>      // note different modulation rates for each color component, % is modulus operator
> 
>      newColor = new SFColor ((red + 0.02) % 1, (green + 0.03) % 1, (blue + 0.04) % 1);
> 
>                  if (enabled)
> 
>                  {
> 
>                                  Browser.print ('diffuseColor=(' + red + ',' + green + ',' + blue + ') newColor=' + newColor.toString() + '\n');
> 
>                  }
> 
> }
> 
> ]]>
> 
>                  </Script>
> 
>              </ProtoBody>
> 
>          </ProtoDeclare>
> 
>          <!-- Test success: declarative statement createDeclarativeShapeTests() -->
> 
>          <Group DEF='DeclarativeGroupExample'>
> 
>              <Shape>
> 
>                  <MetadataString DEF='FindableMetadataStringTest' name='findThisNameValue' value='"test case"'/>
> 
>                  <Appearance DEF='DeclarativeAppearanceExample'>
> 
>                      <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator'/>
> 
>                      <!-- DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance -->
> 
>                  </Appearance>
> 
>                  <Cone bottom='false' bottomRadius='0.05' height='0.1'/>
> 
>              </Shape>
> 
>              <!-- Test success: declarativeGroup.addChild() singleton pipeline method -->
> 
>          </Group>
> 
>          <!-- Test success: declarative statement addChild() -->
> 
>          <!-- Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance DEF='DeclarativeAppearanceExample'/> i.e.
> 
> <Appearance DEF='DeclarativeAppearanceExample'>
> 
>      <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/>
> 
>      <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - ->
> 
> </Appearance> -->
> 
>          <!-- Test success: x3dModel.findElementByNameValue(findThisNameValue) = <MetadataString DEF='FindableMetadataStringTest' name='findThisNameValue' value='"test case"'/> -->
> 
>          <!-- Test success: x3dModel.findElementByNameValue("ArtDeco01Material", "ProtoDeclare") found -->
> 
>          <!-- Test success: x3dModel.findElementByNameValue("MaterialModulator", "ProtoDeclare")  found -->
> 
>          <!-- Test success: x3dModel.findElementByNameValue("MaterialModulator", "ProtoInstance") found -->
> 
>          <Group DEF='TestFieldObjectsGroup'>
> 
>              <!-- testFieldObjects() results -->
> 
>              <!-- SFBool default=true, true=true, false=false, negate()=true -->
> 
>              <!-- MFBool default=, initial=true false true, negate()=false true false -->
> 
>              <!-- SFFloat default=0.0, initial=1.0, setValue(2)=2.0, setValue(3.0f)=3.0, setValue(4.0)=4.0 -->
> 
>              <!-- 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 -->
> 
>              <!-- ... 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= -->
> 
>              <!-- 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 -->
> 
>          </Group>
> 
>          <Sound>
> 
>              <AudioClip url='"chimes.wav" "http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav"'/>
> 
>              <!-- Scene example fragment from http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d -->
> 
>          </Sound>
> 
>          <Sound>
> 
>              <MovieTexture containerField='source' url='"mpgsys.mpg" "http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg"'/>
> 
>              <!-- Scene example fragment from http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpeg1-systems.x3d -->
> 
>              <!-- Expected containerField='source', allowed containerField values="texture" "source" "back" "bottom" "front" "left" "right" "top" "backTexture" "bottomTexture" "frontTexture" "leftTexture" "rightTexture" "topTexture" -->
> 
>          </Sound>
> 
>          <!-- Test success:  AnchorObject.isNode()=true,              siteAnchor.isNode()=true -->
> 
>          <!-- Test success:  AnchorObject.isStatement()=false,        siteAnchor.isStatement()=false -->
> 
>          <!-- Test success:   ROUTEObject.isNode()=false,     orbitPositionROUTE.isNode()=false -->
> 
>          <!-- Test success:   ROUTEObject.isStatement()=true, orbitPositionROUTE.isStatement()=true -->
> 
>          <!-- Test success: CommentsBlock.isNode()=false,           testComments.isNode()=false -->
> 
>          <!-- Test success: CommentsBlock.isStatement()=false,      testComments.isStatement()=false -->
> 
>          <Shape DEF='ExtrusionShape'>
> 
>              <Appearance DEF='TransparentAppearance'>
> 
>                  <Material transparency='1.0'/>
> 
>              </Appearance>
> 
>              <Extrusion DEF='ExampleExtrusion'/>
> 
>              <!-- ExampleExtrusion isCrossSectionClosed()=true, crossSection='[1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0]' -->
> 
>              <!-- ExampleExtrusion isSpineClosed()=false, spine='[0.0, 0.0, 0.0, 0.0, 1.0, 0.0]' -->
> 
>          </Shape>
> 
>      </Scene>
> 
> </X3D>
> 


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20171211/fe967aa1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HelloWorldProgramOutput.x3d
Type: application/octet-stream
Size: 19968 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20171211/fe967aa1/attachment-0001.obj>


More information about the x3d-public mailing list