[x3d-public] X3DJSAIL updates

John Carlson yottzumm at gmail.com
Sun Dec 17 00:33:49 PST 2017


Generated XML (shows problem--search for \\"Immel did it) and build command:
        <java classname="HelloWorldProgramOutput" classpath="${java.classes.dir};${java.jars.dir}/${jsai.full.archive.jar.name}" fork="${fork}">
            <arg value="x3d"/>
            <arg value="nashorn/examples/HelloWorldProgramOutput.x3d"/>
        </java>

<?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>
        <!-- comment #1 -->
        <!-- comment #2 -->
        <!-- comment #3 -->
        <!-- comment #4 -->
        <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='17 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'/>
    </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"'>
                    <!-- escaped quotation marks example 3: He said, "Immel did it!" -->
                    <!-- escaped quotation marks example 4: He said, "Immel did it!" -->
                    <MetadataSet name='EscapedQuotationMarksMetadataSet'>
                        <MetadataString name='escapedQuotesTest1' containerField='value' value='"escaped quotation marks example 1: He said, \\"Immel did it!\\""'/>
                        <MetadataString name='escapedQuotesTest2' containerField='value' value='"escaped quotation marks example 2: He said, &quot;Immel did it!&quot;"'/>
                    </MetadataSet>
                    <FontStyle family='"SERIF"' justify='"MIDDLE" "MIDDLE"'/>
                </Text>
            </Shape>
            <Collision>
                <!-- test containerField='proxy' -->
                <Shape DEF='ProxyShape' containerField='proxy'>
                    <!-- 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 -->
                    <Text string='"One, Two, Three" "" "He said, \\"Immel did it!\\""'/>
                </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: ArtDeco01Material prototype is a Material node'>
            <ProtoInterface>
                <field name='description' accessType='inputOutput' appinfo='tooltip for descriptionField' type='SFString' value='ArtDeco01Material 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#ArtDeco02Material" "http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material"'>
            <!-- [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." -->
            <field name='description' accessType='inputOutput' appinfo='tooltip for descriptionField' type='SFString'/>
        </ExternProtoDeclare>
        <!-- Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place -->
        <Shape DEF='TestShape1'>
            <Appearance DEF='TestAppearance1'>
                <!-- ArtDeco01Material prototype goes here... -->
                <ProtoInstance name='ArtDeco01Material'>
                    <!-- [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()="Material" -->
                    <fieldValue name='description' value='ArtDeco01Material can substitute for a Material node'/>
                </ProtoInstance>
            </Appearance>
            <Sphere radius='0.001'/>
        </Shape>
        <Shape DEF='TestShape2'>
            <Appearance DEF='TestAppearance2'>
                <!-- ArtDeco02Material prototype goes here... -->
                <ProtoInstance DEF='ArtDeco02MaterialDEF' name='ArtDeco02Material'>
                    <!-- [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." -->
                    <fieldValue name='description' value='ArtDeco02Material can substitute for another Material node'/>
                </ProtoInstance>
            </Appearance>
            <Cone bottomRadius='0.001' height='0.001'/>
        </Shape>
        <Shape DEF='TestShape3'>
            <Appearance DEF='TestAppearance3'>
                <!-- ArtDeco02Material ProtoInstance USE goes here... -->
                <ProtoInstance USE='ArtDeco02MaterialDEF'/>
            </Appearance>
            <Cylinder height='0.001' radius='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'>
                    <!-- DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance -->
                    <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator'/>
                </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'> -->
        <!-- <!- - DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance - -> -->
        <!-- <ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/> -->
        <!-- </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 location='0 1.6 0'>
            <!-- set sound-ellipsoid location height at 1.6m to match typical avatar height -->
            <AudioClip description='chimes' 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 -->
            </AudioClip>
        </Sound>
        <Sound location='0 1.6 0'>
            <!-- set sound-ellipsoid location height at 1.6m to match typical avatar height -->
            <MovieTexture containerField='source' description='mpgsys.mpg from ConformanceNist suite' 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" -->
            </MovieTexture>
        </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'>
            <!-- 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]' -->
            <Appearance DEF='TransparentAppearance'>
                <Material transparency='1.0'/>
            </Appearance>
            <Extrusion DEF='ExampleExtrusion'/>
        </Shape>
    </Scene>
</X3D>

Sent from Mail for Windows 10

From: John Carlson
Sent: Sunday, December 17, 2017 3:28 AM
To: Don Brutzman
Cc: X3D Graphics public mailing list
Subject: RE: [x3d-public] X3DJSAIL updates

Here is the JSON generated from HelloWorldProgramOutput.java:

Note it has the same problem as the generated JavaScript.

Build command:

        <java classname="HelloWorldProgramOutput" classpath="${java.classes.dir};${java.jars.dir}/${jsai.full.archive.jar.name}" fork="${fork}">
            <arg value="json"/>
            <arg value="nashorn/examples/HelloWorldProgramOutput.json"/>
        </java>

{ "X3D": {
    "encoding":"UTF-8",
"@profile":"Immersive",
"@version":"3.3",
"@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json",
"head": {
"-children":[
{
"#comment":"comment #1"
},
{
"#comment":"comment #2"
},
{
"#comment":"comment #3"
},
{
"#comment":"comment #4"
}
],
"component": [
{
"@name":"Navigation",
"@level":3
},
{
"@name":"Layering",
"@level":1
}
],
"unit": [
{
"@name":"AngleUnitConversion",
"@category":"angle",
"@conversionFactor":1.0
},
{
"@name":"LengthUnitConversion",
"@category":"length",
"@conversionFactor":1.0
}
],
"meta": [
{
"@name":"title",
"@content":"HelloWorldProgramOutput.x3d"
},
{
"@name":"description",
"@content":"Example HelloWorldProgram creates an X3D model using the X3D Java Scene
Access Interface (SAI) Library"
},
{
"@name":"reference",
"@content":"http://www.web3d.org/specifications/java/X3DJSAIL.html"
},
{
"@name":"generator",
"@content":"HelloWorldProgramOutput.java"
},
{
"@name":"created",
"@content":"6 September 2016"
},
{
"@name":"modified",
"@content":"17 December 2017"
},
{
"@name":"generator",
"@content":"X3D Java Scene Access Interface Library (X3DJSAIL)"
},
{
"@name":"generator",
"@content":"http://www.web3d.org/specifications/java/examples/HelloWorldProgram.java"
},
{
"@name":"generator",
"@content":"Netbeans http://www.netbeans.org"
},
{
"@name":"creator",
"@content":"Don Brutzman"
},
{
"@name":"reference",
"@content":"https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d"
},
{
"@name":"reference",
"@content":"Console output, ClassicVRML encoding, VRML97 encoding and pretty-print
documentation:"
},
{
"@name":"reference",
"@content":"HelloWorldProgramOutput.txt"
},
{
"@name":"reference",
"@content":"HelloWorldProgramOutput.x3dv"
},
{
"@name":"reference",
"@content":"HelloWorldProgramOutput.wrl"
},
{
"@name":"reference",
"@content":"HelloWorldProgramOutput.html"
},
{
"@name":"X3dValidator",
"@content":"https://savage.nps.edu/X3dValidator?url=http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d"
},
{
"@name":"identifier",
"@content":"http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d"
},
{
"@name":"license",
"@content":"../license.html"
},
{
"@name":"SpecialTest",
"@content":"tested sat: name value cannot contain embedded space character"
},
{
"@name":"translated",
"@content":"17 December 2017"
},
{
"@name":"generator",
"@content":"X3dToJson.xslt, http://www.web3d.org/x3d/stylesheets/X3dToJson.html"
},
{
"@name":"reference",
"@content":"X3D JSON encoding: http://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
}
]
},
"Scene": {
"-children":[
{ "ViewpointGroup":
{
"@description":"Available viewpoints",
"-children":[
{ "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]
}
}
]
}
},
{ "WorldInfo":
{
"@DEF":"WorldInfoDEF",
"@title":"HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)"
}
},
{ "WorldInfo":
{
"@USE":"WorldInfoDEF"
}
},
{ "WorldInfo":
{
"@USE":"WorldInfoDEF"
}
},
{ "LayerSet":
{
"@DEF":"scene.addChildLayerSetObjectTest"
}
},
{ "Transform":
{
"@DEF":"LogoGeometryTransform",
"@translation":[0,1.5,0],
"-children":[
{ "Anchor":
{
"@description":"select for X3D Java SAI Library (X3DJSAIL) description",
"@url":["../X3DJSAIL.html","http://www.web3d.org/specifications/java/X3DJSAIL.html"],
"-children":[
{ "Shape":
{
"@DEF":"BoxShape",
"-appearance":
{ "Appearance":
{
"-material":
{ "Material":
{
"@DEF":"GreenMaterial",
"@diffuseColor":[0,1,1],
"@emissiveColor":[0.8,0,0],
"@transparency":0.1
}
},
"-texture":
{ "ImageTexture":
{
"@url":["images/X3dJavaSceneAccessInterfaceSaiLibrary.png","http://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png"]
}
}
}
},
"-geometry":
{ "Box":
{
"@DEF":"test-NMTOKEN_regex.0123456789",
"@class":"textured"
}
}
}
}
]
}
}
]
}
},
{ "Shape":
{
"@DEF":"LineShape",
"-appearance":
{ "Appearance":
{
"-material":
{ "Material":
{
"@emissiveColor":[0.6,0.19607843,0.8]
}
}
}
},
"-geometry":
{ "IndexedLineSet":
{
"@coordIndex":[0,1,2,3,4,0],
"-coord":
{ "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]
}
}
}
}
}
},
{ "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],
"-children":[
{ "Shape":
{
"-appearance":
{ "Appearance":
{
"-material":
{ "Material":
{
"@USE":"GreenMaterial"
}
}
}
},
"-geometry":
{ "Text":
{
"@string":["X3D Java","SAI Library","X3DJSAIL"],
"-children":[
{
"#comment":"escaped quotation marks example 3: He said, \"Immel did it!\""
},
{
"#comment":"escaped quotation marks example 4: He said, &quot;Immel did it!&quot;"
}
],
"-metadata":
{ "MetadataSet":
{
"@name":"EscapedQuotationMarksMetadataSet",
"-value":[
{ "MetadataString":
{
"@name":"escapedQuotesTest1",
"@value":["escaped quotation marks example 1: He said, \\"Immel did it!\\""]
}
},
{ "MetadataString":
{
"@name":"escapedQuotesTest2",
"@value":["escaped quotation marks example 2: He said, &quot;Immel did it!&quot;"]
}
}
]
}
},
"-fontStyle":
{ "FontStyle":
{
"@justify":["MIDDLE","MIDDLE"]
}
}
}
}
}
},
{ "Collision":
{
"-children":[
{
"#comment":"test containerField='proxy'"
}
],
"-proxy":
{ "Shape":
{
"@DEF":"ProxyShape",
"-children":[
{
"#comment":"alternative XML encoding: Text string='\"One, Two, Three\" \"\" \"He said,
\\&quot;Immel did it!\\&quot;\"'"
},
{
"#comment":"alternative Java source: .setString(new String [] {\"One, Two, Three\",
\"\", \"He said, \\\"Immel did it!\\\"\"})"
},
{
"#comment":"reference: http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html"
}
],
"-geometry":
{ "Text":
{
"@string":["One, Two, Three","","He said, \\"Immel did it!\\""]
}
}
}
}
}
},
{
"#comment":"It's a beautiful world"
},
{
"#comment":"... for you!"
},
{
"#comment":"https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song)"
}
]
}
},
{
"#comment":"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",
"-children":[
{ "Background":
{
"@DEF":"GradualBackground"
}
},
{ "Script":
{
"@DEF":"colorTypeConversionScript",
"field": [
{
"@name":"colorInput",
"@accessType":"inputOnly",
"@type":"SFColor"
},
{
"@name":"colorsOutput",
"@accessType":"outputOnly",
"@type":"MFColor"
}
],
"#sourceText":[
"ecmascript:",
"",
"function colorInput (eventValue) // Example source code",
"{",
"   colorsOutput = new MFColor(eventValue); // assigning value sends output event",
"// Browser.print('colorInput=' + eventValue + ', colorsOutput=' + colorsOutput +
'\n');",
"}"
]
}
},
{ "ColorInterpolator":
{
"@DEF":"ColorAnimator",
"@key":[0,0.5,1],
"@keyValue":[0.9411765,1,1,0.29411766,0,0.50980395,0.9411765,1,1],
"-children":[
{
"#comment":"AZURE to INDIGO and back again"
}
]
}
},
{ "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"
}
}
]
}
},
{ "ProtoDeclare":
{
"@name":"ArtDeco01Material",
"@appinfo":"tooltip: ArtDeco01Material prototype is a Material node",
"ProtoInterface": {
"field": [
{
"@name":"description",
"@accessType":"inputOutput",
"@appinfo":"tooltip for descriptionField",
"@type":"SFString",
"@value":"ArtDeco01Material prototype is a Material node"
},
{
"@name":"enabled",
"@accessType":"inputOutput",
"@type":"SFBool",
"@value":true
}
]
},
"ProtoBody": {
"-children":[
{
"#comment":"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]
}
},
{
"#comment":"[HelloWorldProgram diagnostic] should be connected to scene graph: ArtDeco01ProtoDeclare.getNodeType()=\"Material\""
},
{
"#comment":"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"
},
{
"@nodeField":"enabled",
"@protoField":"enabled"
}
]
}
}
}
]
}
}
},
{ "ExternProtoDeclare":
{
"@name":"ArtDeco02Material",
"@appinfo":"this is a different Material node",
"@url":["http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material","http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material"],
"-children":[
{
"#comment":"[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.\""
}
],
"field": [
{
"@name":"description",
"@accessType":"inputOutput",
"@appinfo":"tooltip for descriptionField",
"@type":"SFString"
}
]
}
},
{
"#comment":"Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node
type when ProtoInstance is added in wrong place"
},
{ "Shape":
{
"@DEF":"TestShape1",
"-appearance":
{ "Appearance":
{
"@DEF":"TestAppearance1",
"-children":[
{
"#comment":"ArtDeco01Material prototype goes here..."
},
{ "ProtoInstance":
{
"@name":"ArtDeco01Material",
"-children":[
{
"#comment":"[HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()=\"Material\""
}
],
"fieldValue": [
{
"@name":"description",
"@value":"ArtDeco01Material can substitute for a Material node"
}
]
}
}
]
}
},
"-geometry":
{ "Sphere":
{
"@radius":0.001
}
}
}
},
{ "Shape":
{
"@DEF":"TestShape2",
"-appearance":
{ "Appearance":
{
"@DEF":"TestAppearance2",
"-children":[
{
"#comment":"ArtDeco02Material prototype goes here..."
},
{ "ProtoInstance":
{
"@name":"ArtDeco02Material",
"@DEF":"ArtDeco02MaterialDEF",
"-children":[
{
"#comment":"[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.\""
}
],
"fieldValue": [
{
"@name":"description",
"@value":"ArtDeco02Material can substitute for another Material node"
}
]
}
}
]
}
},
"-geometry":
{ "Cone":
{
"@bottomRadius":0.001,
"@height":0.001
}
}
}
},
{ "Shape":
{
"@DEF":"TestShape3",
"-appearance":
{ "Appearance":
{
"@DEF":"TestAppearance3",
"-children":[
{
"#comment":"ArtDeco02Material ProtoInstance USE goes here..."
},
{ "ProtoInstance":
{
"@USE":"ArtDeco02MaterialDEF"
}
}
]
}
},
"-geometry":
{ "Cylinder":
{
"@height":0.001,
"@radius":0.001
}
}
}
},
{ "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
},
{
"@name":"diffuseColor",
"@accessType":"inputOutput",
"@type":"SFColor",
"@value":[0,0,0]
},
{
"@name":"emissiveColor",
"@accessType":"inputOutput",
"@type":"SFColor",
"@value":[0.05,0.05,0.5]
},
{
"@name":"specularColor",
"@accessType":"inputOutput",
"@type":"SFColor",
"@value":[0,0,0]
},
{
"@name":"transparency",
"@accessType":"inputOutput",
"@type":"SFFloat",
"@value":0.0
},
{
"@name":"shininess",
"@accessType":"inputOutput",
"@type":"SFFloat",
"@value":0.0
},
{
"@name":"ambientIntensity",
"@accessType":"inputOutput",
"@type":"SFFloat",
"@value":0.0
}
]
},
"ProtoBody": {
"-children":[
{ "Material":
{
"@DEF":"MaterialNode",
"IS": {
"connect": [
{
"@nodeField":"diffuseColor",
"@protoField":"diffuseColor"
},
{
"@nodeField":"emissiveColor",
"@protoField":"emissiveColor"
},
{
"@nodeField":"specularColor",
"@protoField":"specularColor"
},
{
"@nodeField":"transparency",
"@protoField":"transparency"
},
{
"@nodeField":"shininess",
"@protoField":"shininess"
},
{
"@nodeField":"ambientIntensity",
"@protoField":"ambientIntensity"
}
]
}
}
},
{
"#comment":"Only first node (the node type) is renderable, others are along for the
ride"
},
{ "Script":
{
"@DEF":"MaterialModulatorScript",
"field": [
{
"@name":"enabled",
"@accessType":"inputOutput",
"@type":"SFBool"
},
{
"@name":"diffuseColor",
"@accessType":"inputOutput",
"@type":"SFColor"
},
{
"@name":"newColor",
"@accessType":"outputOnly",
"@type":"SFColor"
},
{
"@name":"clockTrigger",
"@accessType":"inputOnly",
"@type":"SFTime"
}
],
"IS": {
"connect": [
{
"@nodeField":"enabled",
"@protoField":"enabled"
},
{
"@nodeField":"diffuseColor",
"@protoField":"diffuseColor"
}
]
},
"#sourceText":[
"ecmascript:",
"function initialize ()",
"{",
"    newColor = diffuseColor; // start with correct color",
"}",
"function set_enabled (newValue)",
"{",
"\tenabled = 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);",
"\tif (enabled)",
"\t{",
"\t\tBrowser.print ('diffuseColor=(' + red + ',' + green + ',' + blue + ') newColor='
+ newColor.toString() + '\n');",
"\t}",
"}"
]
}
}
]
}
}
},
{
"#comment":"Test success: declarative statement createDeclarativeShapeTests()"
},
{ "Group":
{
"@DEF":"DeclarativeGroupExample",
"-children":[
{ "Shape":
{
"-metadata":
{ "MetadataString":
{
"@name":"findThisNameValue",
"@DEF":"FindableMetadataStringTest",
"@value":["test case"]
}
},
"-appearance":
{ "Appearance":
{
"@DEF":"DeclarativeAppearanceExample",
"-children":[
{
"#comment":"DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator
ProtoInstance"
},
{ "ProtoInstance":
{
"@name":"MaterialModulator",
"@DEF":"MyMaterialModulator"
}
}
]
}
},
"-geometry":
{ "Cone":
{
"@bottom":false,
"@bottomRadius":0.05,
"@height":0.1
}
}
}
},
{
"#comment":"Test success: declarativeGroup.addChild() singleton pipeline method"
}
]
}
},
{
"#comment":"Test success: declarative statement addChild()"
},
{
"#comment":"Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = <Appearance
DEF='DeclarativeAppearanceExample'/> i.e."
},
{
"#comment":"<Appearance DEF='DeclarativeAppearanceExample'>"
},
{
"#comment":"<!- - DeclarativeMaterialExample gets overridden by subsequently added
MaterialModulator ProtoInstance - ->"
},
{
"#comment":"<ProtoInstance DEF='MyMaterialModulator' name='MaterialModulator' containerField='material'/>"
},
{
"#comment":"</Appearance>"
},
{
"#comment":"Test success: x3dModel.findElementByNameValue(findThisNameValue) = <MetadataString
DEF='FindableMetadataStringTest' name='findThisNameValue' value='\"test case\"'/>"
},
{
"#comment":"Test success: x3dModel.findElementByNameValue(\"ArtDeco01Material\", \"ProtoDeclare\")
found"
},
{
"#comment":"Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoDeclare\")
found"
},
{
"#comment":"Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoInstance\")
found"
},
{ "Group":
{
"@DEF":"TestFieldObjectsGroup",
"-children":[
{
"#comment":"testFieldObjects() results"
},
{
"#comment":"SFBool default=true, true=true, false=false, negate()=true"
},
{
"#comment":"MFBool default=, initial=true false true, negate()=false true false"
},
{
"#comment":"SFFloat default=0.0, initial=1.0, setValue(2)=2.0, setValue(3.0f)=3.0,
setValue(4.0)=4.0"
},
{
"#comment":"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"
},
{
"#comment":"... 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="
},
{
"#comment":"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"
}
]
}
},
{ "Sound":
{
"@location":[0,1.6,0],
"-children":[
{
"#comment":"set sound-ellipsoid location height at 1.6m to match typical avatar height"
}
],
"-source":
{ "AudioClip":
{
"@description":"chimes",
"@url":["chimes.wav","http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav"],
"-children":[
{
"#comment":"Scene example fragment from http://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d"
}
]
}
}
}
},
{ "Sound":
{
"@location":[0,1.6,0],
"-children":[
{
"#comment":"set sound-ellipsoid location height at 1.6m to match typical avatar height"
}
],
"-source":
{ "MovieTexture":
{
"@description":"mpgsys.mpg from ConformanceNist suite",
"@url":["mpgsys.mpg","http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg"],
"-children":[
{
"#comment":"Scene example fragment from http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpeg1-systems.x3d"
},
{
"#comment":"Expected containerField='source', allowed containerField values=\"texture\"
\"source\" \"back\" \"bottom\" \"front\" \"left\" \"right\" \"top\" \"backTexture\"
\"bottomTexture\" \"frontTexture\" \"leftTexture\" \"rightTexture\" \"topTexture\""
}
]
}
}
}
},
{
"#comment":"Test success: AnchorObject.isNode()=true, siteAnchor.isNode()=true"
},
{
"#comment":"Test success: AnchorObject.isStatement()=false, siteAnchor.isStatement()=false"
},
{
"#comment":"Test success: ROUTEObject.isNode()=false, orbitPositionROUTE.isNode()=false"
},
{
"#comment":"Test success: ROUTEObject.isStatement()=true, orbitPositionROUTE.isStatement()=true"
},
{
"#comment":"Test success: CommentsBlock.isNode()=false, testComments.isNode()=false"
},
{
"#comment":"Test success: CommentsBlock.isStatement()=false, testComments.isStatement()=false"
},
{ "Shape":
{
"@DEF":"ExtrusionShape",
"-children":[
{
"#comment":"ExampleExtrusion isCrossSectionClosed()=true, crossSection='[1.0, 1.0,
1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0]'"
},
{
"#comment":"ExampleExtrusion isSpineClosed()=false, spine='[0.0, 0.0, 0.0, 0.0, 1.0,
0.0]'"
}
],
"-appearance":
{ "Appearance":
{
"@DEF":"TransparentAppearance",
"-material":
{ "Material":
{
"@transparency":1.0
}
}
}
},
"-geometry":
{ "Extrusion":
{
"@DEF":"ExampleExtrusion"
}
}
}
}
]
}
  }
}
Sent from Mail for Windows 10

From: John Carlson
Sent: Sunday, December 17, 2017 3:22 AM
To: Don Brutzman
Cc: X3D Graphics public mailing list
Subject: RE: [x3d-public] X3DJSAIL updates

Here is the specific Immel error. You will need to run the test-nashorn build target to get it:

C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml:1587: javax.script.ScriptException: SyntaxError: nashorn/examples/HelloWorldProgramOutput.js.intermediate.js:333:96 Expected comma but found ident
                                      "@value":["escaped quotation marks example 1: He said, \\"Immel did it!\\""]
                                                                                                ^ in <eval> at line number 5
        at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:469)

If you edit the file and run with jjs, you can get farther.

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Sunday, December 17, 2017 3:16 AM
To: Don Brutzman
Cc: X3D Graphics public mailing list
Subject: RE: [x3d-public] X3DJSAIL updates

More investigation reveals HelloWorldProgramOutput.java is not up to date.  Please update and check in.  Thanks!

John

Sent from Mail for Windows 10

From: John Carlson
Sent: Sunday, December 17, 2017 3:12 AM
To: Don Brutzman
Cc: X3D Graphics public mailing list
Subject: RE: [x3d-public] X3DJSAIL updates

I think the file separator problem has been fixed by modifying my X3DJSAIL code.  Please apply patch.

X3dToJson.xslt is still a problem around “Immel” for the JSON output for JavaScript from X3DJSAIL (my version).  It shouldn’t hurt to patch your version at all, but review code if desired.  The java in java/examples is capable of producing the JSON output.

Once we fix the intermediate code output, we can then bring the evaluation of the JavaScript into X3DJSAIL and test it.  It’s currently commented out in my patch.

If you desire to implement an X3dToES5.xslt or X3dToES6.xslt let me know.   I can jumpstart that.

I’m still getting CDATA errors:

coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/www.web3d.org/x3d/stylesheets/java/classes
$ java -cp ../jars/X3DJSAIL.3.3.full.jar";." HelloWorldProgramOutput json foo
Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException: Illegal setSourceCode() invocation, String newSourceText is wrapped in <![CDATA[ ...(source)...  block which can be omitted
        at org.web3d.x3d.jsail.Scripting.ScriptObject.setSourceCode(ScriptObject.java:1455)
        at HelloWorldProgramOutput.initialize(HelloWorldProgramOutput.java:220)
        at HelloWorldProgramOutput.<init>(HelloWorldProgramOutput.java:131)
        at HelloWorldProgramOutput.main(HelloWorldProgramOutput.java:405)

Perhaps a stylesheet file was missed?

Test-nashorn also reveals the problem:

test-nashorn:
    [javac] Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes
     [java] Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException: Illegal setSourceCode() invocation, String newSourceText is wrapped in <![CDATA[ ...(source)...  block which can be omitted
     [java]     at org.web3d.x3d.jsail.Scripting.ScriptObject.setSourceCode(ScriptObject.java:1455)
     [java]     at HelloWorldProgramOutput.initialize(HelloWorldProgramOutput.java:220)
     [java]     at HelloWorldProgramOutput.<init>(HelloWorldProgramOutput.java:131)
     [java]     at HelloWorldProgramOutput.main(HelloWorldProgramOutput.java:405)
     [java] Java Result: 1

John

Sent from Mail for Windows 10

From: Don Brutzman
Sent: Saturday, December 16, 2017 11:44 PM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: [x3d-public] X3DJSAIL updates

Detoured today to fix some discovered problems:

- bug fixes for proper handling of ProtoInstance USE and containerField,
- do not wrap CDATA blocks around input script text to .setSourceCode(), fixed in several places,
- detailed debugging and additional tests when "smoke testing",
-comments precede children nodes in XML encoding for readability,
- rename level -> indentLevel,
- improved project description.

                X3D Java Scene Access Interface Library (X3DJSAIL)
                http://www.web3d.org/specifications/java/X3DJSAIL.html

Sorry not able to work on X3dToJson.xslt debugging yet... these fixes took all day.  Rather than working within big codebase, might we focus on stylesheet conversion of one or more prior example .x3d scenes?  That is how X3DJSAIL produces .json outputs.

Inspection of X3dToJson.xslt didn't reveal any use of backslashes for path separators.

Please identify one or two or three .x3d scenes that illustrate the general quoting and backslash issues that you've identified for JSON.  Focusing on those should help us resolve these gotchas. Thanks John.



On 12/10/2017 7:25 PM, John Carlson wrote:
> Issue 2 is the folder separator specification which becomes \ in the JavaScript, which isn’t acceptable JavaScript it appears.

On 12/9/2017 10:02 PM, Don Brutzman wrote:
> On 12/6/2017 5:38 AM, John Carlson wrote:
>> So I would like to port X3DJSAIL to the web.   To do this, I need to identify pain points in porting Java to the web, namely File, Properties, advanced stylesheet usage, and perhaps others not yet available on the web.  In those cases, I would like to create another version of X3DJSAIL which is more portable.   Then I would like to use Jsweet or J2TS to convert from Java to TypeScript and then JavaScript.
>>
>> Does anyone else want this eunucized X3DJSAIL and can help?
> 
> John thanks for asking and your persistent tracking of issues/improvements, am definitely interesting to keep progressing.  Thanks also for the discussion this morning.
> 
> Am back from 2 weeks travel, will be able to slowly get sorted out back at work.
> 
> Priorities for X3DJSAIL over the next week: finish EXI support (adding OpenEXI as alternative to already-working EXIficient) and integrating your recommended patches.
> 
> Today added fromZIP and fromGZIP load methods on X3DObject.
> 
> Topics for the upcoming meeting should include how X3DJSAIL, X3DJSONLD and X3D JSON/Java/Python development can continue to progress in a complementary, mutually beneficial fashion.  This work also helps SAI and X3D Unified Object Model efforts.
> 
> For anyone else interested, we have scheduled a meeting to follow up on John's suggested inquiry.
> 
>      X3DJSAIL review, issues, planning
>      Tuesday December 19, 1030-1200 pacific
>      Web3D teleconference line
>      http://www.web3d.org/member/teleconference-information
> 
> Community participants interested in joining us are welcome.  If so, then please advise and then can provide connection information... as well as an enthusiastic suggestion to
> 
>      Join the Web3D Consortium
>      http://www.web3d.org/join
> 
> Thanks for all interest and activity with X3DJSAIL.
> 
> =============================================================================
> X3D Java Scene Access Interface Library (X3DJSAIL)
> X3DJSAIL supports programmers with standards-based X3D Java interfaces and objects, all as open source.
> 
> X3DJSAIL, the X3D Java Scene Access Interface Library is a set of strongly typed Java application programming interfaces (APIs) providing programmer access to an X3D scene graph. Two open-source Java packages are included that contain X3D SAI interfaces and support the X3D Standards for Java programmers.
> 
>      org.web3d.x3d.jsail provides concrete implementation-oriented classes for building X3D scenes using standalone Java objects.
>      org.web3d.x3d.sai    contains standard X3D SAI interfaces to independently compile Script-node source for use in X3D players.
> 
> Available products include Javadoc, source code, build support, run-time jar archives, several thousand self-validating examples, and draft specification annexes for both node interfaces and abstract-node type interfaces.
> 
> Goals include making it easy to create an X3D scene graph using Java, while also making it hard to create an incorrect or invalid X3D model.  That design goal is successfully met with further progress continuing.
> 
> Multiple uses are intended for these libraries.
> 
>      Create high-performance standalone Java applications using a Plain Old Java Object (POJO) implementation for X3D.
>      Compiling Java source code used in X3D Script nodes.
>      Future: serve as a design template for planned autogeneration of similar codebases using ECMAScript, C++/C# and Python programming languages.
> =============================================================================
> 
> Have fun with X3D programming!  8)
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/20171217/e46f956f/attachment-0001.html>


More information about the x3d-public mailing list