ant -f C:\\x3d-code\\www.web3d.org\\x3d\\stylesheets test.X3DJSAIL versions: ANT_HOME=C:\apache-ant-1.10.14 JAVA_HOME=C:\Program Files\Java\openjdk\jdk-22.0.1 PYTHONHOME=C:\Program Files\Python312 PYTHONPATH=C:\x3d-code\www.web3d.org\x3d\stylesheets\python; Check CLASSPATH for X3DJSAIL X3DJSAIL.4.0.full.jar or X3DJSAIL.4.0.classes.jar CLASSPATH=C:\x3d-code\www.web3d.org\x3d\stylesheets\java\jars\X3DJSAIL.4.0.full.jar; javac source/target $java.source=17 $java.target=17 Java/JVM version $ant.java.version=22 Java/JVM detail version $java.version=22.0.1 Saxon directory $saxon.dir=C:\x3d-code\www.web3d.org\x3d\stylesheets\java\lib Saxon jar $saxon.jar=saxon-he-12.4.jar Ant version $ant.version=Apache Ant(TM) version 1.10.14 compiled on August 16 2023 ant -version Apache Ant(TM) version 1.10.14 compiled on August 16 2023 java -version openjdk version "22.0.1" 2024-04-16 OpenJDK Runtime Environment (build 22.0.1+8-16) OpenJDK 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing) python -version Python 3.12.0 saxon -? help SaxonJ-HE 12.4 from Saxonica Usage: see http://www.saxonica.com/documentation/index.html#!using-xsl/commandline Format: net.sf.saxon.Transform options params Options available: -? -a -catalog -config -cr -diag -dtd -ea -expand -explain -export -ext -im -init -it -jit -json -l -lib -license -nogo -now -ns -o -opt -or -outval -p -quit -r -relocate -repeat -s -sa -scmin -strip -t -T -target -threads -TJ -Tlevel -Tout -TP -TPxsl -traceout -tree -u -val -versionmsg -warnings -x -xi -xmlversion -xsd -xsdversion -xsiloc -xsl -y --? Use -XYZ:? for details of option XYZ Params: param=value Set stylesheet string parameter +param=filename Set stylesheet document parameter ?param=expression Set stylesheet parameter using XPath !param=value Set serialization parameter Check for node.js installation from https://nodejs.org v21.7.1 X3DJSAIL.4.0.full.jar -version X3DJSAIL version date: 29 April 2024 Configuration settings: https://savage.nps.edu/Savage/developers.html =========================================== test.X3DJSAIL.clean: =========================================== Preliminary cleanups Could not find file C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\CleatClamp_MeshLabLauncher.MeshLab.log.txt to delete. Could not find file C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\CleatClamp_MeshLabLauncher.stl to delete. Could not find file C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\CleatClamp_MeshLabLauncher.x3d to delete. Could not find file C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\CleatClamp_MeshLabRoundTrip.log.txt to delete. Could not find file C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\CleatClamp_RoundTrip.stl to delete. Could not find file C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\CleatClamp_RoundTrip.MeshLab.log.txt to delete. Deleting C:\x3d-code\www.web3d.org\x3d\stylesheets\test\CameraExamples.java Deleting C:\x3d-code\www.web3d.org\x3d\stylesheets\test\HelloWorld.java Deleting C:\x3d-code\www.web3d.org\x3d\stylesheets\test\arc.java Deleting C:\x3d-code\www.web3d.org\x3d\stylesheets\test\flowers4.java test.mkdir: compile.examples.java: delete *.class bytecode... compile HelloWorldProgram.java source... Compiling 1 source file to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples Note: Annotation processing is enabled because one or more processors were found on the class path. A future release of javac may disable annotation processing unless at least one processor is specified by name (-processor), or a search path is specified (--processor-path, --processor-module-path), or annotation processing is enabled explicitly (-proc:only, -proc:full). Use -Xlint:-options to suppress this message. Use -proc:none to disable annotation processing. test.X3DJSAIL: =========================================== helpful invocations for CommandLine debugging org.web3d.x3d.jsail.CommandLine -version -help Usage: java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.CommandLine [-help | -version | -home | -javadoc | -resources | -hints | -regexes | -tooltips | -X3DUOM] [-properties [propertiesFile]] [sourceModel.x3d | sourceModel.exi [-fromEXI] | sourceModel.gz [-fromGZIP] | sourceModel.zip [-fromZIP]] [-canonical] [-validate] [-EXIFICIENT | -OpenEXI] [-Tidy | -toX3D | -toXML | -toClassicVrml | -toJava | -toJSON | -toPython | -toVRML97] [-toHTML | -toX3DOM | -toX_ITE | -toMarkdown | -toEXI | -toGZIP | -toZIP] [-tofile [resultFile.*]] [-toImage [snapshotName.*]] -classpath X3DJSAIL.*.jar # optional classpath, can be set as environment variable org.web3d.x3d.jsail.CommandLine # invoke CommandLine application ==================================#====== informational ====================== -help # provide this help message -version # version date when this X3DJSAIL build was autogenerated -home # launch X3DJSAIL home page -javadoc # launch X3DJSAIL javadoc page -resources # launch X3D Resources page -hints # launch X3D Scene Authoring Hints page -regex # launch X3D Regular Expressions page -tooltips # launch X3D Tooltips page -X3DUOM # launch X3D Unified Object Model (X3DUOM) page =================================#====== properties, inputs ================= -properties [propertiesFile] # override X3DJSAIL properties (default file: X3DJSAIL.properties) -EXIFICIENT # use Exificient (default) as EXI_ENGINE -OpenEXI # use OpenEXI (Nagasena) as EXI_ENGINE (testing in progress) sourceModel.x3d # source model file name, X3D format sourceModel.exi [-fromEXI] # source model file name, EXI format sourceModel.gz [-fromGZIP] # source model file name, GZIP format sourceModel.zip [-fromZIP] # source model file name, ZIP format ==================================#====== operations ========================= -canonical # canonical XML output using X3D Canonicalization (c14n) -validate # validate correctness of loaded model -Tidy # X3D-Tidy cleanup in .x3d (XML) format -toX3D # output in .x3d (XML) format -toXML # output in .xml (X3D) format -toClassicVrml # output in .x3dv (ClassicVrml) X3D format -toJava # output in .java source code using X3DJSAIL -toJSON # output in .json (JavaScript Object Notation) format -toPython # output in .py Python source code -toVRML97 # output in .wrl (VRML97) format -toHTML # output in .html pretty-print documentation -toX3DOM # output in .xhtml page with X3DOM display of X3D model -toX_ITE # output in .html page with X_ITE display of X3D model -toMarkdown # output document metadata (meta tags) in .md (Markdown) format -toEXI # output in .exi (Efficient XML Interchange) compressed-XML format -toGZIP # output in .gz (X3D XML) format, with gzip compression -toZIP # output in .zip (X3D XML) format, with zip compression ==================================#====== outputs ============================ -tofile [resultFile.*] # specify output filename (otherwise original name with extension) -toImage [snapshotName.*] # create output images for each Viewpoint using Blender =========================================== org.web3d.x3d.jsail.CommandLine -properties C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples/X3DJSAIL.properties CommandLine parameter: "-properties" "C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples/X3DJSAIL.properties" for properties file name root C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples/X3DJSAIL C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples/X3DJSAIL.properties includes 13 properties: -- listing properties -- deleteIntermediateFiles=true BLENDER_PATH= XSLT_ENGINE=SAXON overwriteExistingFiles=true EXI_ENGINE=EXIFICIENT SFImagePixelOutputHexadecimal=true stripTrailingZeroes=true normalizeCommentWhitespace=true indentCharacter=SPACE MESHLAB_PATH= indentIncrement=2 validationExceptionAllowed=false stripDefaultAttributes=true ------------------------ C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples/X3DJSAIL.properties loading complete. =========================================== compile.X3DJSAIL.tests: Compiling java/tests classes test.X3DJSAIL.FieldObjectTests: Unit testing org.web3d.x3d.tests.FieldObjectTests FieldObjectTests start... FieldObjectTests.fieldObjectInitializationsTest() start... Preliminary tests... SFBoolTests... MFBoolTests... SFImageTests... MFImageTests... SFInt32Tests... MFInt32Tests... SFFloatTests... SFDoubleTests... SFTimeTests... MFFloatTests... MFDoubleTests... MFTimeTests... SFVec2fTests... SFVec2dTests... MFVec2fTests... MFVec2dTests... SFVec3fTests... SFVec3fBboxSizeTests for bounding box (bbox) constraints... SFVec3dTests... MFVec3fTests... MFVec3dTests... SFVec4fTests... SFVec4dTests... MFVec4fTests... MFVec4dTests... SFColorTests... MFColorTests... SFColorRGBATests... MFColorRGBATests... SFRotationTests... MFRotationTests... SFMatrix3fTests... SFMatrix3dTests... MFMatrix3fTests... MFMatrix3dTests... SFMatrix4fTests... SFMatrix4dTests... MFMatrix4fTests... MFMatrix4dTests... FieldObjectTests.fieldObjectInitializationsTest() complete FieldObjectTests complete =========================================== compile.examples.java: delete *.class bytecode... Deleting C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgram.class compile HelloWorldProgram.java source... Compiling 1 source file to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples Note: Annotation processing is enabled because one or more processors were found on the class path. A future release of javac may disable annotation processing unless at least one processor is specified by name (-processor), or a search path is specified (--processor-path, --processor-module-path), or annotation processing is enabled explicitly (-proc:only, -proc:full). Use -Xlint:-options to suppress this message. Use -proc:none to disable annotation processing. =========================================== test execution and self-validation of HelloWorldProgram and other examples: compile.examples.java: delete *.class bytecode... Deleting C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgram.class compile HelloWorldProgram.java source... Compiling 1 source file to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples Note: Annotation processing is enabled because one or more processors were found on the class path. A future release of javac may disable annotation processing unless at least one processor is specified by name (-processor), or a search path is specified (--processor-path, --processor-module-path), or annotation processing is enabled explicitly (-proc:only, -proc:full). Use -Xlint:-options to suppress this message. Use -proc:none to disable annotation processing. test.HelloWorldProgram.java: =========================================== SpecialTest section: fontStyle1 getStyle()=BOLD getCssStyle()=CSS Style; screenFontStyle3 getStyle()=BOLD getCssStyle()=CSS Style; fontStyle1 justify="BEGIN" "MIDDLE" fontStyle2 justify="END" "MIDDLE" justify field independence test #1 pass = true justify field independence test #2 pass = true pixelTexture.getImage=[0, 0, 0], getWidth=0, getHeight=0, getNumberComponents=0, getPixelsString()= pixelTexture.getImage=[1, 3, 4, -16777080, 16711816, 65416], getWidth=1, getHeight=3, getNumberComponents=4, getPixelsString()=0xFF000088 0x00FF0088 0x0000FF88, isValid()=true, validate() diagnostic='' =========================================== ConfigurationProperties.getClassPath()=C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples;C:\x3d-code\www.web3d.org\x3d\stylesheets\java\jars\X3DJSAIL.4.0.full.jar =========================================== X3DUnifiedObjectModelJaxbTests.x3duomInspectionsTest() start... X3DUnifiedObjectModelJaxbTests.x3duomInspectionsTest() complete =========================================== X3DJSAIL version date: 29 April 2024 =========================================== HelloWorldProgram() Constructor =========================================== buildModelSceneGraph(); // construct this model, testing many variations =========================================== showSceneResults(); // test all serializer outputs ConfigurationProperties.getPropertiesFileName()=X3DJSAIL.properties X3DJSAIL.properties includes 13 properties: -- listing properties -- deleteIntermediateFiles=true BLENDER_PATH= XSLT_ENGINE=SAXON overwriteExistingFiles=true EXI_ENGINE=EXIFICIENT SFImagePixelOutputHexadecimal=true stripTrailingZeroes=true normalizeCommentWhitespace=true indentCharacter=SPACE MESHLAB_PATH= indentIncrement=2 validationExceptionAllowed=false stripDefaultAttributes=true ------------------------ X3DJSAIL.properties loading complete. HelloWorldProgramOutput.java console output =========================================== HelloWorldProgram validation results for resulting scene graph: no errors detected. =========================================== x3dModel.toStringX3D() =========================================== x3dModel.toStringXML() =========================================== x3dModel.toStringClassicVRML() #X3D V4.0 utf8 PROFILE Full # Scene children [ MetadataSet { name "topLevelSceneMetadata" } ViewpointGroup { description "Available viewpoints" children [ DEF DefaultView Viewpoint { description "Hello X3DJSAIL" } DEF TopDownView Viewpoint { description "top-down view from above" orientation 1 0 0 -1.570796 position 0 100 0 } ] } NavigationInfo { avatarSize [ 0.25 1.6 0.75 ] transitionType [ "LINEAR" ] type [ "EXAMINE" "FLY" "ANY" ] } DEF WorldInfoDEF WorldInfo { # class "worldInfoNode.class" # id "worldInfoNode.id" # style "worldInfoNode.style" title "HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)" } USE WorldInfoDEF USE WorldInfoDEF DEF scene.addChildMetadata MetadataString { name "test" value [ "Top-level root Metadata node beneath Scene needs to be one of '-children' in JSON encoding" ] } DEF scene.addChildLayerSetTest LayerSet { order [ 0 ] } DEF LogoGeometryTransform Transform { translation 0 1.5 0 children [ DEF siteAnchor Anchor { description "select for X3D Java SAI Library (X3DJSAIL) description" url [ "../X3DJSAIL.html" "https://www.web3d.org/specifications/java/X3DJSAIL.html" ] children [ DEF BoxShape Shape { # id "BoxShapeID" appearance Appearance { material DEF GreenMaterial Material { diffuseColor 0 1 1 emissiveColor 0.8 0 0 transparency 0.1 } texture ImageTexture { url [ "images/X3dJavaSceneAccessInterfaceSaiLibrary.png" "https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png" ] } } geometry DEF test-NMTOKEN_regex.0123456789 Box { # class "untextured" } } ] } ] } DEF LineShape Shape { 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 ] } # Coordinate 3-tuple point count: 6 } } DEF BoxPathAnimator PositionInterpolator { 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 ] } DEF OrbitClock TimeSensor { cycleInterval 8.0 loop true } ROUTE OrbitClock.fraction_changed TO BoxPathAnimator.set_fraction ROUTE BoxPathAnimator.value_changed TO LogoGeometryTransform.set_translation DEF TextTransform Transform { translation 0 -1.5 0 children [ Shape { appearance Appearance { material USE GreenMaterial } geometry Text { string [ "X3D Java" "SAI Library" "X3DJSAIL" ] metadata MetadataSet { name "EscapedQuotationMarksMetadataSet" value [ MetadataString { name "quotesTestC" value [ "MFString example C, backslash-escaped quotes: He said, \"Immel did it!\"" ] } MetadataString { name "extraChildTest" value [ "checks MetadataSet addValue() method" ] } ] } fontStyle FontStyle { family [ "SERIF" ] justify [ "MIDDLE" "MIDDLE" ] } # Comment example A, plain quotation marks: He said, "Immel did it!" # Comment example B, XML character entities: He said, "Immel did it!" } } Collision { children [ # test containerField='proxy' ] proxy DEF ProxyShape Shape { geometry Text { string [ "One, Two, Text" "" "He said, \"Immel did it!\" \"\"" ] } # alternative XML encoding: Text string='"One, Two, Comment" "" "He said, \"Immel did it!\""' # alternative XML encoding: Text string='"One, Two, Comment" "" "He said, \"Immel did it!\"" ""' # alternative Java source: .setString(new String [] {"One, Two, Comment", "", "He said, \"Immel did it!\""}) # reference: https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html } } # It's a beautiful world # ... for you! # https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song) ] } # repeatedly spin 180 degrees as a readable special effect DEF SpinInterpolator OrientationInterpolator { key [ 0 0.5 1 ] keyValue [ 0 1 0 4.712389 0 1 0 0 0 1 0 1.5707964 ] } DEF SpinClock TimeSensor { cycleInterval 5.0 loop true } ROUTE SpinClock.fraction_changed TO SpinInterpolator.set_fraction ROUTE SpinInterpolator.value_changed TO TextTransform.rotation DEF BackgroundGroup Group { children [ DEF GradualBackground Background { } DEF colorTypeConversionScript Script { inputOnly SFColor colorInput outputOnly MFColor colorsOutput url [ "ecmascript: function colorInput (eventValue) // Example source code { colorsOutput = new MFColor(eventValue); // assigning value sends output event // Browser.print('colorInput=' + eventValue + ', colorsOutput=' + colorsOutput + '\n'); } " ] } DEF ColorAnimator ColorInterpolator { 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 } DEF ColorClock TimeSensor { cycleInterval 60.0 loop true } ROUTE colorTypeConversionScript.colorsOutput TO GradualBackground.skyColor ROUTE ColorAnimator.value_changed TO colorTypeConversionScript.colorInput ROUTE ColorClock.fraction_changed TO ColorAnimator.set_fraction ] } PROTO ArtDeco01Material [ # [appinfo] "tooltip: ArtDeco01Material prototype is a Material node" # ProtoInterface inputOutput SFString description "ArtDeco01Material prototype is a Material node" # [appinfo] "tooltip for descriptionField" inputOutput SFBool enabled true] { # 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 IS description enabled IS enabled nodeField "description" protoField "description" nodeField "enabled" protoField "enabled" } } EXTERNPROTO ArtDeco02Material [ # [appinfo] "this is a different Material node" url [ "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material" "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material" ] inputOutput SFString description # [appinfo] "tooltip for descriptionField" # [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." ] # Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place DEF TestShape1 Shape { appearance DEF TestAppearance1 Appearance { material ArtDeco01Material { name "ArtDeco01Material" description "ArtDeco01Material can substitute for a Material node"# [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()="Material" } # ArtDeco01Material prototype goes here... TODO ensure setContainerField is handled in exported Java } geometry Sphere { radius 0.001 } } DEF TestShape2 Shape { appearance DEF TestAppearance2 Appearance { material DEF ArtDeco02MaterialDEF ArtDeco02Material { name "ArtDeco02Material" description "ArtDeco02Material can substitute for another Material node"# [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." } # ArtDeco02Material prototype goes here... TODO ensure setContainerField is handled in exported Java } geometry Cone { bottomRadius 0.001 height 0.001 } } DEF TestShape3 Shape { appearance DEF TestAppearance3 Appearance { material USE ArtDeco02MaterialDEF } # ArtDeco02Material ProtoInstance USE goes here. Note that name field is NOT defined as part of ProtoInstance USE. } geometry Cylinder { height 0.001 radius 0.001 } } DEF inlineScene Inline { url [ "someOtherScene.x3d" "https://www.web3d.org/specifications/java/examples/someOtherScene.x3d" ] } IMPORT inlineScene.WorldInfoDEF AS WorldInfoDEF2 EXPORT WorldInfoDEF AS WorldInfoDEF3 PROTO MaterialModulator [ # [appinfo] "mimic a Material node and modulate fields as an animation effect" # [documentation] "https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html" # ProtoInterface inputOutput SFBool enabled true inputOutput SFColor diffuseColor 0 0 0 inputOutput SFColor emissiveColor 0.05 0.05 0.5 inputOutput SFColor specularColor 0 0 0 inputOutput SFFloat transparency 0.0 inputOutput SFFloat shininess 0.0 inputOutput SFFloat ambientIntensity 0.0] { # ProtoBody DEF MaterialNode Material { ambientIntensity IS ambientIntensity diffuseColor IS diffuseColor emissiveColor IS emissiveColor shininess IS shininess specularColor IS specularColor transparency IS transparency nodeField "diffuseColor" protoField "diffuseColor" nodeField "emissiveColor" protoField "emissiveColor" nodeField "specularColor" protoField "specularColor" nodeField "transparency" protoField "transparency" nodeField "shininess" protoField "shininess" nodeField "ambientIntensity" protoField "ambientIntensity" } # Only first node (the node type) is renderable, others are along for the ride DEF MaterialModulatorScript Script { inputOutput SFBool enabled inputOutput SFColor diffuseColor outputOnly SFColor newColor inputOnly SFTime clockTriggernodeField "enabled" protoField "enabled" nodeField "diffuseColor" protoField "diffuseColor" url [ "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'); } } " ] } } # Test success: declarative statement createDeclarativeShapeTests() DEF DeclarativeGroupExample Group { children [ Shape { metadata DEF FindableMetadataStringTest MetadataString { name "findThisNameValue" value [ "test case" ] } appearance DEF DeclarativeAppearanceExample Appearance { material DEF MyMaterialModulator MaterialModulator { name "MaterialModulator" } # DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance } geometry Cone { bottom false bottomRadius 0.05 height 0.1 } } # Test success: declarativeGroup.addChild() singleton pipeline method ] } # Test success: declarative statement addChild() # Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = i.e. # Test success: x3dModel.findElementByNameValue(findThisNameValue) = # Test success: x3dModel.findElementByNameValue("ArtDeco01Material", "ProtoDeclare") found # Test success: x3dModel.findElementByNameValue("MaterialModulator", "ProtoDeclare") found # Test success: x3dModel.findElementByNameValue("MaterialModulator", "ProtoInstance") found DEF TestFieldObjectsGroup Group { children [ # testFieldObjects() results # SFBool default=false, 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, regex matches()=true # regex test SFVec3f().matches("1 2 3")=true, regex test SFVec3f().matches("1 2 3 4")=false, regex test (SFRotation.matches("0 0 0 0")=true, failure detecting illegal (zero axis) rotation value ] } Sound { location 0 1.6 0 source AudioClip { description "chimes" url [ "chimes.wav" "https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav" ] # Scene example fragment from https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d } # set sound-ellipsoid location height at 1.6m to match typical avatar height } Sound { location 0 1.6 0 source MovieTexture { description "mpgsys.mpg from ConformanceNist suite" url [ "mpgsys.mpg" "https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg" ] # Scene example fragment from https://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" "children" } # set sound-ellipsoid location height at 1.6m to match typical avatar height } # Test success: Anchor.isNode()=true, siteAnchor.isNode()=true # Test success: Anchor.isStatement()=false, siteAnchor.isStatement()=false # Test success: ROUTE.isNode()=false, orbitPositionROUTE.isNode()=false # Test success: ROUTE.isStatement()=true, orbitPositionROUTE.isStatement()=true # Test success: CommentsBlock.isNode()=false, testComments.isNode()=false # Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true DEF ExtrusionShape Shape { appearance DEF TransparentAppearance Appearance { material Material { transparency 1.0 } } geometry DEF ExampleExtrusion Extrusion { } # 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]' } Group { children [ # Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes PROTO NewWorldInfo [ # ProtoInterface initializeOnly SFString description] { # ProtoBody WorldInfo { } } DEF Proto1 NewWorldInfo { name "NewWorldInfo" description "testing 1 2 3" } DEF Node2 Group { children [ # intentionally empty ] } DEF Proto3 NewWorldInfo { name "NewWorldInfo" } DEF Node4 Transform { children [ # intentionally empty ] } # Test satisfactorily creates MFNode children array as an ordered list with mixed content ] } PROTO ShaderProto [ ] { # ProtoBody ProgramShader { } } Shape { appearance Appearance { shaders [ DEF TestShader1 ProgramShader { programs [ DEF TestShader2 ShaderProgram { } ] } DEF TestShader3 ShaderProto { name "ShaderProto" } DEF TestShader4 ComposedShader { parts [ DEF TestShader5 ShaderPart { } ] } ] # Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes # Test satisfactorily creates MFNode shaders array as an ordered list with mixed content } } DEF SpecialtyNodes Transform { children [ CADLayer { children [ CADAssembly { children [ CADPart { children [ CADFace { } ] } ] } ] } EspduTransform { geoSystem [ "GD" "WE" ] } ReceiverPdu { geoSystem [ "GD" "WE" ] } SignalPdu { geoSystem [ "GD" "WE" ] } TransmitterPdu { geoSystem [ "GD" "WE" ] } DISEntityManager { children [ DISEntityTypeMapping { } ] } ] } EspduTransform { geoSystem [ "GD" "WE" ] children [ WorldInfo { } ] } ReceiverPdu { geoSystem [ "GD" "WE" ] } SignalPdu { geoSystem [ "GD" "WE" ] } TransmitterPdu { geoSystem [ "GD" "WE" ] } DISEntityManager { children [ DISEntityTypeMapping { } ] } LoadSensor { children [ # Contained nodes typically must be USE references for nodes previously DEFined in the scene # The following nodes are test cases for all X3DUrlObject nodes USE siteAnchor USE inlineScene DISEntityTypeMapping { } GeoMetadata { } AudioClip { } ImageCubeMapTexture { } ImageTexture3D { } ImageTexture { } MovieTexture { } DEF DummyScript Script { url [ "ecmascript: /* dummy test source code */ " ] } PackagedShader { } ShaderPart { } ShaderProgram { } ] } ] # head COMPONENT Navigation:3 COMPONENT Shaders:1 COMPONENT CADGeometry:2 COMPONENT DIS:2 COMPONENT HAnim:1 COMPONENT Grouping:1 COMPONENT Layering:1 UNIT angle AngleUnitConversion 1.0 UNIT length LengthUnitConversion 1.0 UNIT force ForceFromPoundsToNewtons 4.4482 META "title" "HelloWorldProgramOutput.x3d" META "info" "continued development and testing in progress" META "description" "Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)" META "reference" "https://www.web3d.org/specifications/java/X3DJSAIL.html" META "generator" "HelloWorldProgramOutput.java" META "created" "6 September 2016" META "modified" "29 April 2024" META "generator" "X3D Java Scene Access Interface Library (X3DJSAIL)" META "generator" "https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java" META "generator" "Netbeans https://www.netbeans.org" META "creator" "Don Brutzman" META "reference" "https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d" META "reference" "Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:" META "reference" "HelloWorldProgramOutput.txt" META "reference" "HelloWorldProgramOutput.x3dv" META "reference" "HelloWorldProgramOutput.wrl" META "reference" "HelloWorldProgramOutput.html" META "reference" "https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" META "identifier" "https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" META "license" "../license.html" # comment #1 # comment #2 # comment #3 # comment #4 # x3dVersionComparisonTest for this model: supportsX3dVersion(X3D.VERSION_3_0)=true =========================================== x3dModel.toStringVRML97() #VRML V2.0 utf8 #PROFILE Full # Scene children [ MetadataSet { name "topLevelSceneMetadata" } ViewpointGroup { description "Available viewpoints" children [ DEF DefaultView Viewpoint { description "Hello X3DJSAIL" } DEF TopDownView Viewpoint { description "top-down view from above" orientation 1 0 0 -1.570796 position 0 100 0 } ] } NavigationInfo { avatarSize [ 0.25 1.6 0.75 ] transitionType [ "LINEAR" ] type [ "EXAMINE" "FLY" "ANY" ] } DEF WorldInfoDEF WorldInfo { # class "worldInfoNode.class" # id "worldInfoNode.id" # style "worldInfoNode.style" title "HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)" } USE WorldInfoDEF USE WorldInfoDEF DEF scene.addChildMetadata MetadataString { name "test" value [ "Top-level root Metadata node beneath Scene needs to be one of '-children' in JSON encoding" ] } DEF scene.addChildLayerSetTest LayerSet { order [ 0 ] } DEF LogoGeometryTransform Transform { translation 0 1.5 0 children [ DEF siteAnchor Anchor { description "select for X3D Java SAI Library (X3DJSAIL) description" url [ "../X3DJSAIL.html" "https://www.web3d.org/specifications/java/X3DJSAIL.html" ] children [ DEF BoxShape Shape { # id "BoxShapeID" appearance Appearance { material DEF GreenMaterial Material { diffuseColor 0 1 1 emissiveColor 0.8 0 0 transparency 0.1 } texture ImageTexture { url [ "images/X3dJavaSceneAccessInterfaceSaiLibrary.png" "https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png" ] } } geometry DEF test-NMTOKEN_regex.0123456789 Box { # class "untextured" } } ] } ] } DEF LineShape Shape { 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 ] } # Coordinate 3-tuple point count: 6 } } DEF BoxPathAnimator PositionInterpolator { 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 ] } DEF OrbitClock TimeSensor { cycleInterval 8.0 loop true } ROUTE OrbitClock.fraction_changed TO BoxPathAnimator.set_fraction ROUTE BoxPathAnimator.value_changed TO LogoGeometryTransform.set_translation DEF TextTransform Transform { translation 0 -1.5 0 children [ Shape { appearance Appearance { material USE GreenMaterial } geometry Text { string [ "X3D Java" "SAI Library" "X3DJSAIL" ] metadata MetadataSet { name "EscapedQuotationMarksMetadataSet" value [ MetadataString { name "quotesTestC" value [ "MFString example C, backslash-escaped quotes: He said, \"Immel did it!\"" ] } MetadataString { name "extraChildTest" value [ "checks MetadataSet addValue() method" ] } ] } fontStyle FontStyle { family [ "SERIF" ] justify [ "MIDDLE" "MIDDLE" ] } # Comment example A, plain quotation marks: He said, "Immel did it!" # Comment example B, XML character entities: He said, "Immel did it!" } } Collision { children [ # test containerField='proxy' ] proxy DEF ProxyShape Shape { geometry Text { string [ "One, Two, Text" "" "He said, \"Immel did it!\" \"\"" ] } # alternative XML encoding: Text string='"One, Two, Comment" "" "He said, \"Immel did it!\""' # alternative XML encoding: Text string='"One, Two, Comment" "" "He said, \"Immel did it!\"" ""' # alternative Java source: .setString(new String [] {"One, Two, Comment", "", "He said, \"Immel did it!\""}) # reference: https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html } } # It's a beautiful world # ... for you! # https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song) ] } # repeatedly spin 180 degrees as a readable special effect DEF SpinInterpolator OrientationInterpolator { key [ 0 0.5 1 ] keyValue [ 0 1 0 4.712389 0 1 0 0 0 1 0 1.5707964 ] } DEF SpinClock TimeSensor { cycleInterval 5.0 loop true } ROUTE SpinClock.fraction_changed TO SpinInterpolator.set_fraction ROUTE SpinInterpolator.value_changed TO TextTransform.rotation DEF BackgroundGroup Group { children [ DEF GradualBackground Background { } DEF colorTypeConversionScript Script { inputOnly SFColor colorInput outputOnly MFColor colorsOutput url [ "ecmascript: function colorInput (eventValue) // Example source code { colorsOutput = new MFColor(eventValue); // assigning value sends output event // Browser.print('colorInput=' + eventValue + ', colorsOutput=' + colorsOutput + '\n'); } " ] } DEF ColorAnimator ColorInterpolator { 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 } DEF ColorClock TimeSensor { cycleInterval 60.0 loop true } ROUTE colorTypeConversionScript.colorsOutput TO GradualBackground.skyColor ROUTE ColorAnimator.value_changed TO colorTypeConversionScript.colorInput ROUTE ColorClock.fraction_changed TO ColorAnimator.set_fraction ] } PROTO ArtDeco01Material [ # [appinfo] "tooltip: ArtDeco01Material prototype is a Material node" # ProtoInterface inputOutput SFString description "ArtDeco01Material prototype is a Material node" # [appinfo] "tooltip for descriptionField" inputOutput SFBool enabled true] { # 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 IS description enabled IS enabled nodeField "description" protoField "description" nodeField "enabled" protoField "enabled" } } EXTERNPROTO ArtDeco02Material [ # [appinfo] "this is a different Material node" url [ "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material" "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material" ] inputOutput SFString description # [appinfo] "tooltip for descriptionField" # [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." ] # Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place DEF TestShape1 Shape { appearance DEF TestAppearance1 Appearance { material ArtDeco01Material { name "ArtDeco01Material" description "ArtDeco01Material can substitute for a Material node"# [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()="Material" } # ArtDeco01Material prototype goes here... TODO ensure setContainerField is handled in exported Java } geometry Sphere { radius 0.001 } } DEF TestShape2 Shape { appearance DEF TestAppearance2 Appearance { material DEF ArtDeco02MaterialDEF ArtDeco02Material { name "ArtDeco02Material" description "ArtDeco02Material can substitute for another Material node"# [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." } # ArtDeco02Material prototype goes here... TODO ensure setContainerField is handled in exported Java } geometry Cone { bottomRadius 0.001 height 0.001 } } DEF TestShape3 Shape { appearance DEF TestAppearance3 Appearance { material USE ArtDeco02MaterialDEF } # ArtDeco02Material ProtoInstance USE goes here. Note that name field is NOT defined as part of ProtoInstance USE. } geometry Cylinder { height 0.001 radius 0.001 } } DEF inlineScene Inline { url [ "someOtherScene.x3d" "https://www.web3d.org/specifications/java/examples/someOtherScene.x3d" ] } IMPORT inlineScene.WorldInfoDEF AS WorldInfoDEF2 EXPORT WorldInfoDEF AS WorldInfoDEF3 PROTO MaterialModulator [ # [appinfo] "mimic a Material node and modulate fields as an animation effect" # [documentation] "https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html" # ProtoInterface inputOutput SFBool enabled true inputOutput SFColor diffuseColor 0 0 0 inputOutput SFColor emissiveColor 0.05 0.05 0.5 inputOutput SFColor specularColor 0 0 0 inputOutput SFFloat transparency 0.0 inputOutput SFFloat shininess 0.0 inputOutput SFFloat ambientIntensity 0.0] { # ProtoBody DEF MaterialNode Material { ambientIntensity IS ambientIntensity diffuseColor IS diffuseColor emissiveColor IS emissiveColor shininess IS shininess specularColor IS specularColor transparency IS transparency nodeField "diffuseColor" protoField "diffuseColor" nodeField "emissiveColor" protoField "emissiveColor" nodeField "specularColor" protoField "specularColor" nodeField "transparency" protoField "transparency" nodeField "shininess" protoField "shininess" nodeField "ambientIntensity" protoField "ambientIntensity" } # Only first node (the node type) is renderable, others are along for the ride DEF MaterialModulatorScript Script { inputOutput SFBool enabled inputOutput SFColor diffuseColor outputOnly SFColor newColor inputOnly SFTime clockTriggernodeField "enabled" protoField "enabled" nodeField "diffuseColor" protoField "diffuseColor" url [ "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'); } } " ] } } # Test success: declarative statement createDeclarativeShapeTests() DEF DeclarativeGroupExample Group { children [ Shape { metadata DEF FindableMetadataStringTest MetadataString { name "findThisNameValue" value [ "test case" ] } appearance DEF DeclarativeAppearanceExample Appearance { material DEF MyMaterialModulator MaterialModulator { name "MaterialModulator" } # DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance } geometry Cone { bottom false bottomRadius 0.05 height 0.1 } } # Test success: declarativeGroup.addChild() singleton pipeline method ] } # Test success: declarative statement addChild() # Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = i.e. # Test success: x3dModel.findElementByNameValue(findThisNameValue) = # Test success: x3dModel.findElementByNameValue("ArtDeco01Material", "ProtoDeclare") found # Test success: x3dModel.findElementByNameValue("MaterialModulator", "ProtoDeclare") found # Test success: x3dModel.findElementByNameValue("MaterialModulator", "ProtoInstance") found DEF TestFieldObjectsGroup Group { children [ # testFieldObjects() results # SFBool default=false, 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, regex matches()=true # regex test SFVec3f().matches("1 2 3")=true, regex test SFVec3f().matches("1 2 3 4")=false, regex test (SFRotation.matches("0 0 0 0")=true, failure detecting illegal (zero axis) rotation value ] } Sound { location 0 1.6 0 source AudioClip { description "chimes" url [ "chimes.wav" "https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav" ] # Scene example fragment from https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d } # set sound-ellipsoid location height at 1.6m to match typical avatar height } Sound { location 0 1.6 0 source MovieTexture { description "mpgsys.mpg from ConformanceNist suite" url [ "mpgsys.mpg" "https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg" ] # Scene example fragment from https://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" "children" } # set sound-ellipsoid location height at 1.6m to match typical avatar height } # Test success: Anchor.isNode()=true, siteAnchor.isNode()=true # Test success: Anchor.isStatement()=false, siteAnchor.isStatement()=false # Test success: ROUTE.isNode()=false, orbitPositionROUTE.isNode()=false # Test success: ROUTE.isStatement()=true, orbitPositionROUTE.isStatement()=true # Test success: CommentsBlock.isNode()=false, testComments.isNode()=false # Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true DEF ExtrusionShape Shape { appearance DEF TransparentAppearance Appearance { material Material { transparency 1.0 } } geometry DEF ExampleExtrusion Extrusion { } # 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]' } Group { children [ # Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes PROTO NewWorldInfo [ # ProtoInterface initializeOnly SFString description] { # ProtoBody WorldInfo { } } DEF Proto1 NewWorldInfo { name "NewWorldInfo" description "testing 1 2 3" } DEF Node2 Group { children [ # intentionally empty ] } DEF Proto3 NewWorldInfo { name "NewWorldInfo" } DEF Node4 Transform { children [ # intentionally empty ] } # Test satisfactorily creates MFNode children array as an ordered list with mixed content ] } PROTO ShaderProto [ ] { # ProtoBody ProgramShader { } } Shape { appearance Appearance { shaders [ DEF TestShader1 ProgramShader { programs [ DEF TestShader2 ShaderProgram { } ] } DEF TestShader3 ShaderProto { name "ShaderProto" } DEF TestShader4 ComposedShader { parts [ DEF TestShader5 ShaderPart { } ] } ] # Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes # Test satisfactorily creates MFNode shaders array as an ordered list with mixed content } } DEF SpecialtyNodes Transform { children [ CADLayer { children [ CADAssembly { children [ CADPart { children [ CADFace { } ] } ] } ] } EspduTransform { geoSystem [ "GD" "WE" ] } ReceiverPdu { geoSystem [ "GD" "WE" ] } SignalPdu { geoSystem [ "GD" "WE" ] } TransmitterPdu { geoSystem [ "GD" "WE" ] } DISEntityManager { children [ DISEntityTypeMapping { } ] } ] } EspduTransform { geoSystem [ "GD" "WE" ] children [ WorldInfo { } ] } ReceiverPdu { geoSystem [ "GD" "WE" ] } SignalPdu { geoSystem [ "GD" "WE" ] } TransmitterPdu { geoSystem [ "GD" "WE" ] } DISEntityManager { children [ DISEntityTypeMapping { } ] } LoadSensor { children [ # Contained nodes typically must be USE references for nodes previously DEFined in the scene # The following nodes are test cases for all X3DUrlObject nodes USE siteAnchor USE inlineScene DISEntityTypeMapping { } GeoMetadata { } AudioClip { } ImageCubeMapTexture { } ImageTexture3D { } ImageTexture { } MovieTexture { } DEF DummyScript Script { url [ "ecmascript: /* dummy test source code */ " ] } PackagedShader { } ShaderPart { } ShaderProgram { } ] } ] # head #COMPONENT Navigation:3 #COMPONENT Shaders:1 #COMPONENT CADGeometry:2 #COMPONENT DIS:2 #COMPONENT HAnim:1 #COMPONENT Grouping:1 #COMPONENT Layering:1 #UNIT angle AngleUnitConversion 1.0 #UNIT length LengthUnitConversion 1.0 #UNIT force ForceFromPoundsToNewtons 4.4482 #META "title" "HelloWorldProgramOutput.x3d" #META "info" "continued development and testing in progress" #META "description" "Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)" #META "reference" "https://www.web3d.org/specifications/java/X3DJSAIL.html" #META "generator" "HelloWorldProgramOutput.java" #META "created" "6 September 2016" #META "modified" "29 April 2024" #META "generator" "X3D Java Scene Access Interface Library (X3DJSAIL)" #META "generator" "https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java" #META "generator" "Netbeans https://www.netbeans.org" #META "creator" "Don Brutzman" #META "reference" "https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d" #META "reference" "Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:" #META "reference" "HelloWorldProgramOutput.txt" #META "reference" "HelloWorldProgramOutput.x3dv" #META "reference" "HelloWorldProgramOutput.wrl" #META "reference" "HelloWorldProgramOutput.html" #META "reference" "https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" #META "identifier" "https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" #META "license" "../license.html" # comment #1 # comment #2 # comment #3 # comment #4 # x3dVersionComparisonTest for this model: supportsX3dVersion(X3D.VERSION_3_0)=true =========================================== Create .x3d (X3D XML Encoding) version of model Note: toFileX3D() is overwriting prior file HelloWorldProgramOutput.x3d helloWorld.toFileX3D("HelloWorldProgramOutput.x3d") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.x3d =========================================== Create .xml (X3D XML Encoding) version of model Note: toFileX3D() is overwriting prior file HelloWorldProgramOutput.xml helloWorld.toFileXML("HelloWorldProgramOutput.xml") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.xml =========================================== Create pretty-print .html documentation of model Note: toFileStylesheetConversion(X3dExtrusionCrossSectionToSvg.xslt) is overwriting prior file HelloWorldProgramOutput.svg Note: toFileStylesheetConversion(X3dToXhtml.xslt) is overwriting prior file HelloWorldProgramOutput.html helloWorld.toFileHtmlDocumentation("HelloWorldProgramOutput.html") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.html =========================================== Create .x3d (X3D XML Encoding) cleaned-up version of model using X3D Tidy Note: toFileStylesheetConversion(X3dTidy.xslt) is overwriting prior file HelloWorldProgramOutputTidy.x3d helloWorld.toFileX3dTidy("HelloWorldProgramOutputTidy.x3d") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutputTidy.x3d =========================================== Create .md (Markdown) file for model meta information using X3dModelMetaToMarkdown.xslt Note: toFileStylesheetConversion(X3dModelMetaToMarkdown.xslt) is overwriting prior file HelloWorldProgramOutput.md helloWorld.toFileModelMetaMarkdown("HelloWorldProgramOutput.md") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.md =========================================== Create X3D ClassicVRML Encoding of model Note: toFileClassicVRML() is overwriting prior file HelloWorldProgramOutput.x3dv helloWorld.toFileClassicVRML("HelloWorldProgramOutput.x3dv") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.x3dv =========================================== Create VRML97 Encoding of model helloWorld.toFileVRML97("HelloWorldProgramOutput.wrl") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.wrl =========================================== Create pretty-print HTML documentation of model using ConfigurationProperties.getXsltEngine()=SAXON9HE and stylesheet X3dToXhtml.xslt Note: toFileStylesheetConversion(X3dExtrusionCrossSectionToSvg.xslt) is overwriting prior file HelloWorldProgramOutput.svg Note: toFileStylesheetConversion(X3dToXhtml.xslt) is overwriting prior file HelloWorldProgramOutput.html helloWorld.toFileHtmlDocumentation("HelloWorldProgramOutput.html") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.html =========================================== Create concise Java source of model using stylesheet X3dToJava.xslt [meta] name='info' content='continued development and testing in progress' helloWorld.toFileJava("HelloWorldProgramOutput.java") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.java Test toStringJava() [meta] name='info' content='continued development and testing in progress' import org.web3d.x3d.jsail.Core.*; import org.web3d.x3d.jsail.CADGeometry.*; import org.web3d.x3d.jsail.CubeMapTexturing.*; import org.web3d.x3d.jsail.DIS.*; import org.web3d.x3d.jsail.EnvironmentalEffects.*; import org.web3d.x3d.jsail.fields.*; import org.web3d.x3d.jsail.Geometry3D.*; import org.web3d.x3d.jsail.Geospatial.*; import org.web3d.x3d.jsail.Grouping.*; import org.web3d.x3d.jsail.Interpolation.*; import org.web3d.x3d.jsail.Layering.*; import org.web3d.x3d.jsail.Navigation.*; import org.web3d.x3d.jsail.Networking.*; import org.web3d.x3d.jsail.PointingDeviceSensor.*; import org.web3d.x3d.jsail.Rendering.*; import org.web3d.x3d.jsail.Scripting.*; import org.web3d.x3d.jsail.Shaders.*; import org.web3d.x3d.jsail.Shape.*; import org.web3d.x3d.jsail.Sound.*; import org.web3d.x3d.jsail.Text.*; import org.web3d.x3d.jsail.Texturing.*; import org.web3d.x3d.jsail.Texturing3D.*; import org.web3d.x3d.jsail.Time.*; // Javadoc metadata annotations follow, see below for X3DJSAIL Java source code. /** *

Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL).

Related links: source temporaryJavaOutputFile.java, X3D Resources, X3D Scene Authoring Hints, and X3D Tooltips.

Scene Meta Information
meta tags temporaryJavaOutputFile  Document Metadata
title HelloWorldProgramOutput.x3d
info continued development and testing in progress
description Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)
reference https://www.web3d.org/specifications/java/X3DJSAIL.html
generator HelloWorldProgramOutput.java
created 6 September 2016
modified 29 April 2024
generator X3D Java Scene Access Interface Library (X3DJSAIL)
generator https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java
generator Netbeans https://www.netbeans.org
creator Don Brutzman
reference https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d
reference Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:
reference HelloWorldProgramOutput.txt
reference HelloWorldProgramOutput.x3dv
reference HelloWorldProgramOutput.wrl
reference HelloWorldProgramOutput.html
reference https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d
identifier https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d
license ../license.html
 

This program uses the X3D Java Scene Access Interface Library (X3DJSAIL). It has been produced using the X3dToJava.xslt stylesheet (version control) which is used to create Java source code from an original .x3d model.

* @author Don Brutzman */ public class temporaryJavaOutputFile { /** Default constructor to create this object. */ public temporaryJavaOutputFile () { initialize(); } /** Create and initialize the X3D model for this object. */ public final void initialize() { try { // catch-all x3dModel = new X3D().setProfile(X3D.PROFILE_FULL).setVersion(X3D.VERSION_4_0).setCssClass("x3dModel.class").setHtmlID("x3dModel.id").setCssStyle("x3dModel.style") .addComments(" x3dVersionComparisonTest for this model: supportsX3dVersion(X3D.VERSION_3_0)=true ") .setHead(new head() .addComments(" comment #1 ") .addComments(" comment #2 ") .addComments(" comment #3 ") .addComments(" comment #4 ") .addComponent(new component().setName("Navigation").setLevel(3)) .addComponent(new component().setName("Shaders").setLevel(1)) .addComponent(new component().setName("CADGeometry").setLevel(2)) .addComponent(new component().setName("DIS").setLevel(2)) .addComponent(new component().setName("HAnim").setLevel(1)) .addComponent(new component().setName("Grouping").setLevel(1)) .addComponent(new component().setName("Layering").setLevel(1)) .addUnit(new unit().setName("AngleUnitConversion").setCategory("angle").setConversionFactor(1.0)) .addUnit(new unit().setName("LengthUnitConversion").setCategory("length").setConversionFactor(1.0)) .addUnit(new unit().setName("ForceFromPoundsToNewtons").setCategory("force").setConversionFactor(4.4482)) .addMeta(new meta().setName(meta.NAME_TITLE ).setContent("HelloWorldProgramOutput.x3d")) .addMeta(new meta().setName(meta.NAME_INFO ).setContent("continued development and testing in progress")) .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("https://www.web3d.org/specifications/java/X3DJSAIL.html")) .addMeta(new meta().setName(meta.NAME_GENERATOR ).setContent("HelloWorldProgramOutput.java")) .addMeta(new meta().setName(meta.NAME_CREATED ).setContent("6 September 2016")) .addMeta(new meta().setName(meta.NAME_MODIFIED ).setContent("29 April 2024")) .addMeta(new meta().setName(meta.NAME_GENERATOR ).setContent("X3D Java Scene Access Interface Library (X3DJSAIL)")) .addMeta(new meta().setName(meta.NAME_GENERATOR ).setContent("https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java")) .addMeta(new meta().setName(meta.NAME_GENERATOR ).setContent("Netbeans https://www.netbeans.org")) .addMeta(new meta().setName(meta.NAME_CREATOR ).setContent("Don Brutzman")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("HelloWorldProgramOutput.txt")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("HelloWorldProgramOutput.x3dv")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("HelloWorldProgramOutput.wrl")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("HelloWorldProgramOutput.html")) .addMeta(new meta().setName(meta.NAME_REFERENCE ).setContent("https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d")) .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d")) .addMeta(new meta().setName(meta.NAME_LICENSE ).setContent("../license.html"))) .setScene(new Scene() .addMetadata(new MetadataSet().setName("topLevelSceneMetadata")) .addChild(new ViewpointGroup().setDescription("Available viewpoints") .addChild(new Viewpoint("DefaultView").setDescription("Hello X3DJSAIL")) .addChild(new Viewpoint("TopDownView").setDescription("top-down view from above").setOrientation(1.0,0.0,0.0,-1.570796).setPosition(0.0,100.0,0.0))) .addChild(new NavigationInfo().setType("\"EXAMINE\" \"FLY\" \"ANY\"")) .addChild(new WorldInfo("WorldInfoDEF").setCssClass("worldInfoNode.class").setHtmlID("worldInfoNode.id").setCssStyle("worldInfoNode.style").setTitle("HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)")) .addChild(new WorldInfo().setUSE("WorldInfoDEF")) .addChild(new WorldInfo().setUSE("WorldInfoDEF")) .addMetadata(new MetadataString("scene.addChildMetadata").setName("test").setValue(new String[] {"Top-level root Metadata node beneath Scene needs to be one of '-children' in JSON encoding"})) .addLayerSet(new LayerSet("scene.addChildLayerSetTest")) .addChild(new Transform("LogoGeometryTransform").setTranslation(0.0,1.5,0.0) .addChild(new Anchor("siteAnchor").setDescription("select for X3D Java SAI Library (X3DJSAIL) description").setUrl(new String[] {"../X3DJSAIL.html","https://www.web3d.org/specifications/java/X3DJSAIL.html"}) .addChild(new Shape("BoxShape").setHtmlID("BoxShapeID") .setAppearance(new Appearance() .setMaterial(new Material("GreenMaterial").setDiffuseColor(0.0,1.0,1.0).setEmissiveColor(0.8,0.0,0.0).setTransparency(0.1)) .setTexture(new ImageTexture().setUrl(new String[] {"images/X3dJavaSceneAccessInterfaceSaiLibrary.png","https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png"}))) .setGeometry(new Box("test-NMTOKEN_regex.0123456789").setCssClass("untextured"))))) .addChild(new Shape("LineShape") .setAppearance(new Appearance() .setMaterial(new Material().setEmissiveColor(0.6,0.19607843,0.8))) .setGeometry(new IndexedLineSet().setCoordIndex(new int[] {0,1,2,3,4,0}) .addComments(" Coordinate 3-tuple point count: 6 ") .setCoord(new Coordinate().setPoint(new MFVec3f(new double[] {0.0,1.5,0.0,2.0,1.5,0.0,2.0,1.5,-2.0,-2.0,1.5,-2.0,-2.0,1.5,0.0,0.0,1.5,0.0}))))) .addChild(new PositionInterpolator("BoxPathAnimator").setKey(new double[] {0.0,0.125,0.375,0.625,0.875,1.0}).setKeyValue(new MFVec3f(new double[] {0.0,1.5,0.0,2.0,1.5,0.0,2.0,1.5,-2.0,-2.0,1.5,-2.0,-2.0,1.5,0.0,0.0,1.5,0.0}))) .addChild(new TimeSensor("OrbitClock").setCycleInterval(8.0).setLoop(true)) .addChild(new ROUTE().setFromNode("OrbitClock").setFromField("fraction_changed").setToNode("BoxPathAnimator").setToField("set_fraction")) .addChild(new ROUTE().setFromNode("BoxPathAnimator").setFromField("value_changed").setToNode("LogoGeometryTransform").setToField("set_translation")) .addChild(new Transform("TextTransform").setTranslation(0.0,-1.5,0.0) .addChild(new Shape() .setAppearance(new Appearance() .setMaterial(new Material().setUSE("GreenMaterial"))) .setGeometry(new Text().setString(new String[] {"X3D Java","SAI Library","X3DJSAIL"}) .addComments(" Comment example A, plain quotation marks: He said, \"Immel did it!\" ") .addComments(" Comment example B, XML character entities: He said, "Immel did it!" ") .setMetadata(new MetadataSet().setName("EscapedQuotationMarksMetadataSet") .setMetadata(new MetadataString().setName("quotesTestC").setValue(new String[] {"MFString example C, backslash-escaped quotes: He said, \"Immel did it!\""})) .setMetadata(new MetadataString().setName("extraChildTest").setValue(new String[] {"checks MetadataSet addValue() method"}))) .setFontStyle(new FontStyle().setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE)))) .addChild(new Collision() .addComments(" test containerField='proxy' ") .setProxy(new Shape("ProxyShape") .addComments(" alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\"Immel did it!\\"\"' ") .addComments(" alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\"Immel did it!\\"\" \"\"' ") .addComments(" alternative Java source: .setString(new String [] {\"One, Two, Comment\", \"\", \"He said, \\\"Immel did it!\\\"\"}) ") .addComments(" reference: https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html ") .setGeometry(new Text().setString(new String[] {"One, Two, Text","","He said, \"Immel did it!\" \"\""})))) .addComments(" It's a beautiful world ") .addComments(" ... for you! ") .addComments(" https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song) ")) .addComments(" repeatedly spin 180 degrees as a readable special effect ") .addChild(new OrientationInterpolator("SpinInterpolator").setKey(new double[] {0.0,0.5,1.0}).setKeyValue(new MFRotation(new double[] {0.0,1.0,0.0,4.712389,0.0,1.0,0.0,0.0,0.0,1.0,0.0,1.5707964}))) .addChild(new TimeSensor("SpinClock").setCycleInterval(5.0).setLoop(true)) .addChild(new ROUTE().setFromNode("SpinClock").setFromField("fraction_changed").setToNode("SpinInterpolator").setToField("set_fraction")) .addChild(new ROUTE().setFromNode("SpinInterpolator").setFromField("value_changed").setToNode("TextTransform").setToField("rotation")) .addChild(new Group("BackgroundGroup") .addChild(new Background("GradualBackground")) .addChild(new Script("colorTypeConversionScript").setSourceCode(""" ecmascript: function colorInput (eventValue) // Example source code { colorsOutput = new MFColor(eventValue); // assigning value sends output event // Browser.print('colorInput=' + eventValue + ', colorsOutput=' + colorsOutput + '\n'); } """) .addField(new field().setName("colorInput").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTONLY)) .addField(new field().setName("colorsOutput").setType(field.TYPE_MFCOLOR).setAccessType(field.ACCESSTYPE_OUTPUTONLY))) .addChild(new ColorInterpolator("ColorAnimator").setKey(new double[] {0.0,0.5,1.0}).setKeyValue(new MFColor(new double[] {0.9411765,1.0,1.0,0.29411766,0.0,0.50980395,0.9411765,1.0,1.0})) .addComments(" AZURE to INDIGO and back again ")) .addChild(new TimeSensor("ColorClock").setCycleInterval(60.0).setLoop(true)) .addChild(new ROUTE().setFromNode("colorTypeConversionScript").setFromField("colorsOutput").setToNode("GradualBackground").setToField("skyColor")) .addChild(new ROUTE().setFromNode("ColorAnimator").setFromField("value_changed").setToNode("colorTypeConversionScript").setToField("colorInput")) .addChild(new ROUTE().setFromNode("ColorClock").setFromField("fraction_changed").setToNode("ColorAnimator").setToField("set_fraction"))) .addChild(new ProtoDeclare("ArtDeco01Material").setName("ArtDeco01Material").setAppinfo("tooltip: ArtDeco01Material prototype is a Material node") .setProtoInterface(new ProtoInterface() .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue("ArtDeco01Material prototype is a Material node").setAppinfo("tooltip for descriptionField")) .addField(new field().setName("enabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(true))) .setProtoBody(new ProtoBody() .addComments(" Initial node of ProtoBody determines prototype node type ") .addChild(new Material().setAmbientIntensity(0.25).setDiffuseColor(0.282435,0.085159,0.134462).setShininess(0.127273).setSpecularColor(0.276305,0.11431,0.139857)) .addComments(" [HelloWorldProgram diagnostic] should be connected to scene graph: artDeco01ProtoDeclare.getNodeType()=\"Material\" ") .addComments(" presence of follow-on TouchSensor shows that additional nodes are allowed in ProtoBody after initial node, regardless of node types ") .addChild(new TouchSensor().setDescription("within ProtoBody") .setIS(new IS() .addConnect(new connect().setNodeField("description").setProtoField("description")) .addConnect(new connect().setNodeField("enabled").setProtoField("enabled")))))) .addChild(new ExternProtoDeclare("ArtDeco02Material").setName("ArtDeco02Material").setAppinfo("this is a different Material node").setUrl(new String[] {"https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material","https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3dv#ArtDeco02Material"}) .addComments(" [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.\" ") .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setAppinfo("tooltip for descriptionField"))) .addComments(" Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place ") .addChild(new Shape("TestShape1") .setAppearance(new Appearance("TestAppearance1") .addComments(" ArtDeco01Material prototype goes here... TODO ensure setContainerField is handled in exported Java ") .setMaterial(new ProtoInstance("ArtDeco01Material").setContainerField("material") .addComments(" [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()=\"Material\" ") .addFieldValue(new fieldValue().setName("description").setValue("ArtDeco01Material can substitute for a Material node")))) .setGeometry(new Sphere().setRadius(0.001))) .addChild(new Shape("TestShape2") .setAppearance(new Appearance("TestAppearance2") .addComments(" ArtDeco02Material prototype goes here... TODO ensure setContainerField is handled in exported Java ") .setMaterial(new ProtoInstance("ArtDeco02Material", "ArtDeco02MaterialDEF").setContainerField("material") .addComments(" [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.\" ") .addFieldValue(new fieldValue().setName("description").setValue("ArtDeco02Material can substitute for another Material node")))) .setGeometry(new Cone().setBottomRadius(0.001).setHeight(0.001))) .addChild(new Shape("TestShape3") .setAppearance(new Appearance("TestAppearance3") .addComments(" ArtDeco02Material ProtoInstance USE goes here. Note that name field is NOT defined as part of ProtoInstance USE. ") .setMaterial(new ProtoInstance().setUSE("ArtDeco02MaterialDEF").setContainerField("material"))) .setGeometry(new Cylinder().setHeight(0.001).setRadius(0.001))) .addChild(new Inline("inlineScene").setUrl(new String[] {"someOtherScene.x3d","https://www.web3d.org/specifications/java/examples/someOtherScene.x3d"})) .addChild(new IMPORT().setImportedDEF("WorldInfoDEF").setInlineDEF("inlineScene").setAS("WorldInfoDEF2")) .addChild(new EXPORT().setLocalDEF("WorldInfoDEF").setAS("WorldInfoDEF3")) .addChild(new ProtoDeclare("MaterialModulator").setName("MaterialModulator").setAppinfo("mimic a Material node and modulate fields as an animation effect").setDocumentation("https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html") .setProtoInterface(new ProtoInterface() .addField(new field().setName("enabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(true)) .addField(new field().setName("diffuseColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(new SFColor(0.0,0.0,0.0))) .addField(new field().setName("emissiveColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(new SFColor(0.05,0.05,0.5))) .addField(new field().setName("specularColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(new SFColor(0.0,0.0,0.0))) .addField(new field().setName("transparency").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(0.0)) .addField(new field().setName("shininess").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(0.0)) .addField(new field().setName("ambientIntensity").setType(field.TYPE_SFFLOAT).setAccessType(field.ACCESSTYPE_INPUTOUTPUT).setValue(0.0))) .setProtoBody(new ProtoBody() .addChild(new Material("MaterialNode") .setIS(new IS() .addConnect(new connect().setNodeField("diffuseColor").setProtoField("diffuseColor")) .addConnect(new connect().setNodeField("emissiveColor").setProtoField("emissiveColor")) .addConnect(new connect().setNodeField("specularColor").setProtoField("specularColor")) .addConnect(new connect().setNodeField("transparency").setProtoField("transparency")) .addConnect(new connect().setNodeField("shininess").setProtoField("shininess")) .addConnect(new connect().setNodeField("ambientIntensity").setProtoField("ambientIntensity")))) .addComments(" Only first node (the node type) is renderable, others are along for the ride ") .addChild(new Script("MaterialModulatorScript").setSourceCode(""" 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'); } } """) .addField(new field().setName("enabled").setType(field.TYPE_SFBOOL).setAccessType(field.ACCESSTYPE_INPUTOUTPUT)) .addField(new field().setName("diffuseColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_INPUTOUTPUT)) .addField(new field().setName("newColor").setType(field.TYPE_SFCOLOR).setAccessType(field.ACCESSTYPE_OUTPUTONLY)) .addField(new field().setName("clockTrigger").setType(field.TYPE_SFTIME).setAccessType(field.ACCESSTYPE_INPUTONLY)) .setIS(new IS() .addConnect(new connect().setNodeField("enabled").setProtoField("enabled")) .addConnect(new connect().setNodeField("diffuseColor").setProtoField("diffuseColor")))))) .addComments(" Test success: declarative statement createDeclarativeShapeTests() ") .addChild(new Group("DeclarativeGroupExample") .addChild(new Shape() .setMetadata(new MetadataString("FindableMetadataStringTest").setName("findThisNameValue").setValue(new String[] {"test case"})) .setAppearance(new Appearance("DeclarativeAppearanceExample") .addComments(" DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance ") .setMaterial(new ProtoInstance("MaterialModulator", "MyMaterialModulator").setContainerField("material"))) .setGeometry(new Cone().setBottom(false).setBottomRadius(0.05).setHeight(0.1))) .addComments(" Test success: declarativeGroup.addChild() singleton pipeline method ")) .addComments(" Test success: declarative statement addChild() ") .addComments(" Test success: x3dModel.findNodeByDEF(DeclarativeAppearanceExample) = i.e. ") .addComments(" Test success: x3dModel.findElementByNameValue(findThisNameValue) = ") .addComments(" Test success: x3dModel.findElementByNameValue(\"ArtDeco01Material\", \"ProtoDeclare\") found ") .addComments(" Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoDeclare\") found ") .addComments(" Test success: x3dModel.findElementByNameValue(\"MaterialModulator\", \"ProtoInstance\") found ") .addChild(new Group("TestFieldObjectsGroup") .addComments(" testFieldObjects() results ") .addComments(" SFBool default=false, true=true, false=false, negate()=true ") .addComments(" MFBool default=, initial=true false true, negate()=false true false ") .addComments(" SFFloat default=0.0, initial=1.0, setValue(2)=2.0, setValue(3.0f)=3.0, setValue(4.0)=4.0 ") .addComments(" 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 ") .addComments(" ... 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= ") .addComments(" 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 ") .addComments(" regex test SFVec3f().matches(\"1 2 3\")=true, regex test SFVec3f().matches(\"1 2 3 4\")=false, regex test (SFRotation.matches(\"0 0 0 0\")=true, failure detecting illegal (zero axis) rotation value ")) .addChild(new Sound().setLocation(0.0,1.6,0.0) .addComments(" set sound-ellipsoid location height at 1.6m to match typical avatar height ") .setSource(new AudioClip().setDescription("chimes").setUrl(new String[] {"chimes.wav","https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav"}) .addComments(" Scene example fragment from https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d "))) .addChild(new Sound().setLocation(0.0,1.6,0.0) .addComments(" set sound-ellipsoid location height at 1.6m to match typical avatar height ") .setSource(new MovieTexture().setDescription("mpgsys.mpg from ConformanceNist suite").setUrl(new String[] {"mpgsys.mpg","https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg"}) .addComments(" Scene example fragment from https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpeg1-systems.x3d ") .addComments(" Expected containerField='source', allowed containerField values=\"texture\" \"source\" \"back\" \"bottom\" \"front\" \"left\" \"right\" \"top\" \"backTexture\" \"bottomTexture\" \"frontTexture\" \"leftTexture\" \"rightTexture\" \"topTexture\" \"children\" "))) .addComments(" Test success: Anchor.isNode()=true, siteAnchor.isNode()=true ") .addComments(" Test success: Anchor.isStatement()=false, siteAnchor.isStatement()=false ") .addComments(" Test success: ROUTE.isNode()=false, orbitPositionROUTE.isNode()=false ") .addComments(" Test success: ROUTE.isStatement()=true, orbitPositionROUTE.isStatement()=true ") .addComments(" Test success: CommentsBlock.isNode()=false, testComments.isNode()=false ") .addComments(" Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true ") .addChild(new Shape("ExtrusionShape") .addComments(" ExampleExtrusion isCrossSectionClosed()=true, crossSection='[1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0]' ") .addComments(" ExampleExtrusion isSpineClosed()=false, spine='[0.0, 0.0, 0.0, 0.0, 1.0, 0.0]' ") .setAppearance(new Appearance("TransparentAppearance") .setMaterial(new Material().setTransparency(1.0))) .setGeometry(new Extrusion("ExampleExtrusion"))) .addChild(new Group() .addComments(" Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes ") .addChild(new ProtoDeclare("NewWorldInfo").setName("NewWorldInfo") .setProtoInterface(new ProtoInterface() .addField(new field().setName("description").setType(field.TYPE_SFSTRING).setAccessType(field.ACCESSTYPE_INITIALIZEONLY))) .setProtoBody(new ProtoBody() .addChild(new WorldInfo()))) .addChild(new ProtoInstance("NewWorldInfo", "Proto1").setContainerField("children") .addFieldValue(new fieldValue().setName("description").setValue("testing 1 2 3"))) .addChild(new Group("Node2") .addComments(" intentionally empty ")) .addChild(new ProtoInstance("NewWorldInfo", "Proto3").setContainerField("children")) .addChild(new Transform("Node4") .addComments(" intentionally empty ")) .addComments(" Test satisfactorily creates MFNode children array as an ordered list with mixed content ")) .addChild(new ProtoDeclare("ShaderProto").setName("ShaderProto") .setProtoBody(new ProtoBody() .addChild(new ProgramShader()))) .addChild(new Shape() .setAppearance(new Appearance() .addComments(" Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes ") .addComments(" Test satisfactorily creates MFNode shaders array as an ordered list with mixed content ") .addShaders(new ProgramShader("TestShader1") .addPrograms(new ShaderProgram("TestShader2"))) .addShaders(new ProtoInstance("ShaderProto", "TestShader3").setContainerField("shaders")) .addShaders(new ComposedShader("TestShader4") .addParts(new ShaderPart("TestShader5"))))) .addChild(new Transform("SpecialtyNodes") .addChild(new CADLayer() .addChild(new CADAssembly() .addChild(new CADPart() .addChild(new CADFace())))) .addChild(new EspduTransform()) .addChild(new ReceiverPdu().setReceivedPower(0.0)) .addChild(new SignalPdu()) .addChild(new TransmitterPdu().setRelativeAntennaLocation(0.0,0.0,0.0).setTransmitFrequencyBandwidth(0.0)) .addChild(new DISEntityManager() .addChild(new DISEntityTypeMapping()))) .addChild(new EspduTransform() .addChild(new WorldInfo())) .addChild(new ReceiverPdu().setReceivedPower(0.0)) .addChild(new SignalPdu()) .addChild(new TransmitterPdu().setRelativeAntennaLocation(0.0,0.0,0.0).setTransmitFrequencyBandwidth(0.0)) .addChild(new DISEntityManager() .addChild(new DISEntityTypeMapping())) .addChild(new LoadSensor() .addComments(" Contained nodes typically must be USE references for nodes previously DEFined in the scene ") .addComments(" The following nodes are test cases for all X3DUrlObject nodes ") .addChild(new Anchor().setUSE("siteAnchor")) .addChild(new Inline().setUSE("inlineScene")) .addChild(new DISEntityTypeMapping()) .addChild(new GeoMetadata()) .addChild(new AudioClip()) .addChild(new ImageCubeMapTexture()) .addChild(new ImageTexture3D()) .addChild(new ImageTexture()) .addChild(new MovieTexture()) .addChild(new Script("DummyScript").setSourceCode(""" ecmascript: /* dummy test source code */ """)) .addChild(new PackagedShader()) .addChild(new ShaderPart()) .addChild(new ShaderProgram()))); } catch (Exception ex) { System.err.println ("*** Further hints on X3DJSAIL errors and exceptions at"); System.err.println ("*** https://www.web3d.org/specifications/java/X3DJSAIL.html"); throw (ex); } } // end of initialize() method /** The initialized model object, created within initialize() method. */ private X3D x3dModel; /** * Provide a * shallow copy * of the X3D model. * @see X3D * @return temporaryJavaOutputFile model */ public X3D getX3dModel() { return x3dModel; } /** * Default main() method provided for test purposes, uses CommandLine to set global ConfigurationProperties for this object. * @param args array of input parameters, provided as arguments * @see X3D.handleArguments(args) * @see X3D.validationReport() * @see CommandLine * @see CommandLine.USAGE * @see ConfigurationProperties */ public static void main(String args[]) { System.out.println("Build this X3D model, showing validation diagnostics..."); X3D thisExampleX3dModel = new temporaryJavaOutputFile().getX3dModel(); // System.out.println("X3D model construction complete."); // next handle command line arguments boolean hasArguments = (args != null) && (args.length > 0); boolean validate = true; // default boolean argumentsLoadNewModel = false; String fileName = new String(); if (args != null) { for (String arg : args) { if (arg.toLowerCase().startsWith("-v") || arg.toLowerCase().contains("validate")) { validate = true; // making sure } if (arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_X3D) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_CLASSICVRML) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_X3DB) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_VRML97) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_EXI) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_GZIP) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_ZIP) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_HTML) || arg.toLowerCase().endsWith(X3D.FILE_EXTENSION_XHTML)) { argumentsLoadNewModel = true; fileName = arg; } } } if (argumentsLoadNewModel) System.out.println("WARNING: \"temporaryJavaOutputFile\" model invocation is attempting to load file \"" + fileName + "\" instead of simply validating itself... file loading ignored."); else if (hasArguments) // if no arguments provided, this method produces usage warning thisExampleX3dModel.handleArguments(args); if (validate) { // System.out.println("--- TODO fix duplicated outputs ---"); // omit when duplicated outputs problem is solved/refactored String validationResults = thisExampleX3dModel.validationReport(); // System.out.println("-----------------------------------"); // omit when duplicated outputs problem is solved/refactored System.out.print("temporaryJavaOutputFile self-validation test results: "); if (!validationResults.equals("success")) System.out.println(); System.out.println(validationResults.trim()); } } } =========================================== Create JSON Encoding of model using stylesheet X3dToJson.xslt Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=DummyScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=DummyScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode helloWorld.toFileJSON("HelloWorldProgramOutput.json") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.json Test toStringJSON() Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=DummyScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode Script DEF=DummyScript contains CDATA source-code text, copied as "#sourceCode" using "strings" mode { "X3D": { "encoding":"UTF-8", "@class":"x3dModel.class", "@profile":"Full", "@style":"x3dModel.style", "@version":"4.0", "@xsd:noNamespaceSchemaLocation":"https://www.web3d.org/specifications/x3d-4.0.xsd", "JSON schema":"https://www.web3d.org/specifications/x3d-4.0-JSONSchema.autogenerated.json", "-children":[ { "#comment":"x3dVersionComparisonTest for this model: supportsX3dVersion(X3D.VERSION_3_0)=true" } ], "head": { "-children":[ { "#comment":"comment #1" }, { "#comment":"comment #2" }, { "#comment":"comment #3" }, { "#comment":"comment #4" } ], "component": [ { "@name":"Navigation", "@level":3 }, { "@name":"Shaders", "@level":1 }, { "@name":"CADGeometry", "@level":2 }, { "@name":"DIS", "@level":2 }, { "@name":"HAnim", "@level":1 }, { "@name":"Grouping", "@level":1 }, { "@name":"Layering", "@level":1 } ], "unit": [ { "@name":"AngleUnitConversion", "@category":"angle", "@conversionFactor":1.0 }, { "@name":"LengthUnitConversion", "@category":"length", "@conversionFactor":1.0 }, { "@name":"ForceFromPoundsToNewtons", "@category":"force", "@conversionFactor":4.4482 } ], "meta": [ { "@name":"title", "@content":"HelloWorldProgramOutput.x3d" }, { "@name":"info", "@content":"continued development and testing in progress" }, { "@name":"description", "@content":"Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)" }, { "@name":"reference", "@content":"https://www.web3d.org/specifications/java/X3DJSAIL.html" }, { "@name":"generator", "@content":"HelloWorldProgramOutput.java" }, { "@name":"created", "@content":"6 September 2016" }, { "@name":"modified", "@content":"29 April 2024" }, { "@name":"generator", "@content":"X3D Java Scene Access Interface Library (X3DJSAIL)" }, { "@name":"generator", "@content":"https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java" }, { "@name":"generator", "@content":"Netbeans https://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":"reference", "@content":"https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" }, { "@name":"identifier", "@content":"https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d" }, { "@name":"license", "@content":"../license.html" }, { "@name":"translated", "@content":"29 April 2024" }, { "@name":"generator", "@content":"X3dToJson.xslt, https://www.web3d.org/x3d/stylesheets/X3dToJson.html" }, { "@name":"reference", "@content":"X3D JSON encoding: https://www.web3d.org/wiki/index.php/X3D_JSON_Encoding" } ] }, "Scene": { "-children":[ { "MetadataSet": { "@name":"topLevelSceneMetadata" } }, { "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] } } ] } }, { "NavigationInfo": { "@type":"\"EXAMINE\" \"FLY\" \"ANY\"" } }, { "WorldInfo": { "@DEF":"WorldInfoDEF", "@class":"worldInfoNode.class", "@style":"worldInfoNode.style", "@title":"HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)" } }, { "WorldInfo": { "@USE":"WorldInfoDEF" } }, { "WorldInfo": { "@USE":"WorldInfoDEF" } }, { "MetadataString": { "@name":"test", "@DEF":"scene.addChildMetadata", "@value":["Top-level root Metadata node beneath Scene needs to be one of '-children' in JSON encoding"] } }, { "LayerSet": { "@DEF":"scene.addChildLayerSetTest" } }, { "Transform": { "@DEF":"LogoGeometryTransform", "@translation":[0,1.5,0], "-children":[ { "Anchor": { "@DEF":"siteAnchor", "@description":"select for X3D Java SAI Library (X3DJSAIL) description", "@url":["../X3DJSAIL.html","https://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","https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png"] } } } }, "-geometry": { "Box": { "@DEF":"test-NMTOKEN_regex.0123456789", "@class":"untextured" } } } } ] } } ] } }, { "Shape": { "@DEF":"LineShape", "-appearance": { "Appearance": { "-material": { "Material": { "@emissiveColor":[0.6,0.19607843,0.8] } } } }, "-geometry": { "IndexedLineSet": { "@coordIndex":[0,1,2,3,4,0], "-children":[ { "#comment":"Coordinate 3-tuple point count: 6" } ], "-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":"Comment example A, plain quotation marks: He said, \"Immel did it!\"" }, { "#comment":"Comment example B, XML character entities: He said, "Immel did it!"" } ], "-metadata": { "MetadataSet": { "@name":"EscapedQuotationMarksMetadataSet", "-value":[ { "MetadataString": { "@name":"quotesTestC", "@value":["MFString example C, backslash-escaped quotes: He said, \"Immel did it!\""] } }, { "MetadataString": { "@name":"extraChildTest", "@value":["checks MetadataSet addValue() method"] } } ] } }, "-fontStyle": { "FontStyle": { "@justify":["MIDDLE","MIDDLE"] } } } } } }, { "Collision": { "-children":[ { "#comment":"test containerField='proxy'" } ], "-proxy": { "Shape": { "@DEF":"ProxyShape", "-children":[ { "#comment":"alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\"Immel did it!\\"\"'" }, { "#comment":"alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\"Immel did it!\\"\" \"\"'" }, { "#comment":"alternative Java source: .setString(new String [] {\"One, Two, Comment\", \"\", \"He said, \\\"\"Immel did it!\\\"\"\"})" }, { "#comment":"reference: https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html" } ], "-geometry": { "Text": { "@string":["One, Two, Text","","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" } ], "#sourceCode":[ "", "", "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":["https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material","https://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 that retrieves the ExternProtoDeclare file.\"" } ], "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... TODO ensure setContainerField is handled in exported Java" } ], "-material": { "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... TODO ensure setContainerField is handled in exported Java" } ], "-material": { "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 that retrieves the ExternProtoDeclare file.\"" } ], "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. Note that name field is NOT defined as part of ProtoInstance USE." } ], "-material": { "ProtoInstance": { "@USE":"ArtDeco02MaterialDEF" } } } }, "-geometry": { "Cylinder": { "@height":0.001, "@radius":0.001 } } } }, { "Inline": { "@DEF":"inlineScene", "@url":["someOtherScene.x3d","https://www.web3d.org/specifications/java/examples/someOtherScene.x3d"] } }, { "IMPORT": { "@AS":"WorldInfoDEF2", "@importedDEF":"WorldInfoDEF", "@inlineDEF":"inlineScene" } }, { "EXPORT": { "@AS":"WorldInfoDEF3", "@localDEF":"WorldInfoDEF" } }, { "ProtoDeclare": { "@name":"MaterialModulator", "@appinfo":"mimic a Material node and modulate fields as an animation effect", "@documentation":"https://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" } ] }, "#sourceCode":[ "", "", "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": { "-value":[ { "MetadataString": { "@name":"findThisNameValue", "@DEF":"FindableMetadataStringTest", "@value":["test case"] } } ], "-appearance": { "Appearance": { "@DEF":"DeclarativeAppearanceExample", "-children":[ { "#comment":"DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance" } ], "-material": { "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) = i.e. " }, { "#comment":"Test success: x3dModel.findElementByNameValue(findThisNameValue) = " }, { "#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=false, 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, regex matches()=true" }, { "#comment":"regex test SFVec3f().matches(\"1 2 3\")=true, regex test SFVec3f().matches(\"1 2 3 4\")=false, regex test (SFRotation.matches(\"0 0 0 0\")=true, failure detecting illegal (zero axis) rotation value" } ] } }, { "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","https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav"], "-children":[ { "#comment":"Scene example fragment from https://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","https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg"], "-children":[ { "#comment":"Scene example fragment from https://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\" \"children\"" } ] } } } }, { "#comment":"Test success: Anchor.isNode()=true, siteAnchor.isNode()=true" }, { "#comment":"Test success: Anchor.isStatement()=false, siteAnchor.isStatement()=false" }, { "#comment":"Test success: ROUTE.isNode()=false, orbitPositionROUTE.isNode()=false" }, { "#comment":"Test success: ROUTE.isStatement()=true, orbitPositionROUTE.isStatement()=true" }, { "#comment":"Test success: CommentsBlock.isNode()=false, testComments.isNode()=false" }, { "#comment":"Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true" }, { "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" } } } }, { "Group": { "-children":[ { "#comment":"Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes" }, { "ProtoDeclare": { "@name":"NewWorldInfo", "ProtoInterface": { "field": [ { "@name":"description", "@accessType":"initializeOnly", "@type":"SFString" } ] }, "ProtoBody": { "-children":[ { "WorldInfo": { } } ] } } }, { "ProtoInstance": { "@name":"NewWorldInfo", "@DEF":"Proto1", "fieldValue": [ { "@name":"description", "@value":"testing 1 2 3" } ] } }, { "Group": { "@DEF":"Node2", "-children":[ { "#comment":"intentionally empty" } ] } }, { "ProtoInstance": { "@name":"NewWorldInfo", "@DEF":"Proto3" } }, { "Transform": { "@DEF":"Node4", "-children":[ { "#comment":"intentionally empty" } ] } }, { "#comment":"Test satisfactorily creates MFNode children array as an ordered list with mixed content" } ] } }, { "ProtoDeclare": { "@name":"ShaderProto", "ProtoBody": { "-children":[ { "ProgramShader": { } } ] } } }, { "Shape": { "-appearance": { "Appearance": { "-children":[ { "#comment":"Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes" }, { "#comment":"Test satisfactorily creates MFNode shaders array as an ordered list with mixed content" } ], "-shaders":[ { "ProgramShader": { "@DEF":"TestShader1", "-programs":[ { "ShaderProgram": { "@DEF":"TestShader2", "@type":"VERTEX" } } ] } }, { "ProtoInstance": { "@name":"ShaderProto", "@DEF":"TestShader3" } }, { "ComposedShader": { "@DEF":"TestShader4", "-parts":[ { "ShaderPart": { "@DEF":"TestShader5", "@type":"VERTEX" } } ] } } ] } } } }, { "Transform": { "@DEF":"SpecialtyNodes", "-children":[ { "CADLayer": { "-children":[ { "CADAssembly": { "-children":[ { "CADPart": { "-children":[ { "CADFace": { } } ] } } ] } } ] } }, { "EspduTransform": { } }, { "ReceiverPdu": { } }, { "SignalPdu": { } }, { "TransmitterPdu": { } }, { "DISEntityManager": { "-children":[ { "DISEntityTypeMapping": { } } ] } } ] } }, { "EspduTransform": { "-children":[ { "WorldInfo": { } } ] } }, { "ReceiverPdu": { } }, { "SignalPdu": { } }, { "TransmitterPdu": { } }, { "DISEntityManager": { "-children":[ { "DISEntityTypeMapping": { } } ] } }, { "LoadSensor": { "-children":[ { "#comment":"Contained nodes typically must be USE references for nodes previously DEFined in the scene" }, { "#comment":"The following nodes are test cases for all X3DUrlObject nodes" }, { "Anchor": { "@USE":"siteAnchor" } }, { "Inline": { "@USE":"inlineScene" } }, { "DISEntityTypeMapping": { } }, { "GeoMetadata": { } }, { "AudioClip": { } }, { "ImageCubeMapTexture": { } }, { "ImageTexture3D": { } }, { "ImageTexture": { } }, { "MovieTexture": { } }, { "Script": { "@DEF":"DummyScript", "#sourceCode":[ "", "", "ecmascript:", "/* dummy test source code */", "", "" ] } }, { "PackagedShader": { } }, { "ShaderPart": { "@type":"VERTEX" } }, { "ShaderProgram": { "@type":"VERTEX" } } ] } } ], "-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] } } ] } }, { "NavigationInfo": { "@type":"\"EXAMINE\" \"FLY\" \"ANY\"" } }, { "WorldInfo": { "@DEF":"WorldInfoDEF", "@class":"worldInfoNode.class", "@style":"worldInfoNode.style", "@title":"HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)" } }, { "WorldInfo": { "@USE":"WorldInfoDEF" } }, { "WorldInfo": { "@USE":"WorldInfoDEF" } }, { "MetadataString": { "@name":"test", "@DEF":"scene.addChildMetadata", "@value":["Top-level root Metadata node beneath Scene needs to be one of '-children' in JSON encoding"] } }, { "LayerSet": { "@DEF":"scene.addChildLayerSetTest" } }, { "Transform": { "@DEF":"LogoGeometryTransform", "@translation":[0,1.5,0], "-children":[ { "Anchor": { "@DEF":"siteAnchor", "@description":"select for X3D Java SAI Library (X3DJSAIL) description", "@url":["../X3DJSAIL.html","https://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","https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png"] } } } }, "-geometry": { "Box": { "@DEF":"test-NMTOKEN_regex.0123456789", "@class":"untextured" } } } } ] } } ] } }, { "Shape": { "@DEF":"LineShape", "-appearance": { "Appearance": { "-material": { "Material": { "@emissiveColor":[0.6,0.19607843,0.8] } } } }, "-geometry": { "IndexedLineSet": { "@coordIndex":[0,1,2,3,4,0], "-children":[ { "#comment":"Coordinate 3-tuple point count: 6" } ], "-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":"Comment example A, plain quotation marks: He said, \"Immel did it!\"" }, { "#comment":"Comment example B, XML character entities: He said, "Immel did it!"" } ], "-metadata": { "MetadataSet": { "@name":"EscapedQuotationMarksMetadataSet", "-value":[ { "MetadataString": { "@name":"quotesTestC", "@value":["MFString example C, backslash-escaped quotes: He said, \"Immel did it!\""] } }, { "MetadataString": { "@name":"extraChildTest", "@value":["checks MetadataSet addValue() method"] } } ] } }, "-fontStyle": { "FontStyle": { "@justify":["MIDDLE","MIDDLE"] } } } } } }, { "Collision": { "-children":[ { "#comment":"test containerField='proxy'" } ], "-proxy": { "Shape": { "@DEF":"ProxyShape", "-children":[ { "#comment":"alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\"Immel did it!\\"\"'" }, { "#comment":"alternative XML encoding: Text string='\"One, Two, Comment\" \"\" \"He said, \\"Immel did it!\\"\" \"\"'" }, { "#comment":"alternative Java source: .setString(new String [] {\"One, Two, Comment\", \"\", \"He said, \\\"\"Immel did it!\\\"\"\"})" }, { "#comment":"reference: https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html" } ], "-geometry": { "Text": { "@string":["One, Two, Text","","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" } ], "#sourceCode":[ "", "", "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":["https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material","https://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 that retrieves the ExternProtoDeclare file.\"" } ], "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... TODO ensure setContainerField is handled in exported Java" } ], "-material": { "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... TODO ensure setContainerField is handled in exported Java" } ], "-material": { "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 that retrieves the ExternProtoDeclare file.\"" } ], "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. Note that name field is NOT defined as part of ProtoInstance USE." } ], "-material": { "ProtoInstance": { "@USE":"ArtDeco02MaterialDEF" } } } }, "-geometry": { "Cylinder": { "@height":0.001, "@radius":0.001 } } } }, { "Inline": { "@DEF":"inlineScene", "@url":["someOtherScene.x3d","https://www.web3d.org/specifications/java/examples/someOtherScene.x3d"] } }, { "IMPORT": { "@AS":"WorldInfoDEF2", "@importedDEF":"WorldInfoDEF", "@inlineDEF":"inlineScene" } }, { "EXPORT": { "@AS":"WorldInfoDEF3", "@localDEF":"WorldInfoDEF" } }, { "ProtoDeclare": { "@name":"MaterialModulator", "@appinfo":"mimic a Material node and modulate fields as an animation effect", "@documentation":"https://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" } ] }, "#sourceCode":[ "", "", "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": { "-value":[ { "MetadataString": { "@name":"findThisNameValue", "@DEF":"FindableMetadataStringTest", "@value":["test case"] } } ], "-appearance": { "Appearance": { "@DEF":"DeclarativeAppearanceExample", "-children":[ { "#comment":"DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance" } ], "-material": { "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) = i.e. " }, { "#comment":"Test success: x3dModel.findElementByNameValue(findThisNameValue) = " }, { "#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=false, 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, regex matches()=true" }, { "#comment":"regex test SFVec3f().matches(\"1 2 3\")=true, regex test SFVec3f().matches(\"1 2 3 4\")=false, regex test (SFRotation.matches(\"0 0 0 0\")=true, failure detecting illegal (zero axis) rotation value" } ] } }, { "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","https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav"], "-children":[ { "#comment":"Scene example fragment from https://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","https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg"], "-children":[ { "#comment":"Scene example fragment from https://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\" \"children\"" } ] } } } }, { "#comment":"Test success: Anchor.isNode()=true, siteAnchor.isNode()=true" }, { "#comment":"Test success: Anchor.isStatement()=false, siteAnchor.isStatement()=false" }, { "#comment":"Test success: ROUTE.isNode()=false, orbitPositionROUTE.isNode()=false" }, { "#comment":"Test success: ROUTE.isStatement()=true, orbitPositionROUTE.isStatement()=true" }, { "#comment":"Test success: CommentsBlock.isNode()=false, testComments.isNode()=false" }, { "#comment":"Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true" }, { "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" } } } }, { "Group": { "-children":[ { "#comment":"Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes" }, { "ProtoDeclare": { "@name":"NewWorldInfo", "ProtoInterface": { "field": [ { "@name":"description", "@accessType":"initializeOnly", "@type":"SFString" } ] }, "ProtoBody": { "-children":[ { "WorldInfo": { } } ] } } }, { "ProtoInstance": { "@name":"NewWorldInfo", "@DEF":"Proto1", "fieldValue": [ { "@name":"description", "@value":"testing 1 2 3" } ] } }, { "Group": { "@DEF":"Node2", "-children":[ { "#comment":"intentionally empty" } ] } }, { "ProtoInstance": { "@name":"NewWorldInfo", "@DEF":"Proto3" } }, { "Transform": { "@DEF":"Node4", "-children":[ { "#comment":"intentionally empty" } ] } }, { "#comment":"Test satisfactorily creates MFNode children array as an ordered list with mixed content" } ] } }, { "ProtoDeclare": { "@name":"ShaderProto", "ProtoBody": { "-children":[ { "ProgramShader": { } } ] } } }, { "Shape": { "-appearance": { "Appearance": { "-children":[ { "#comment":"Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes" }, { "#comment":"Test satisfactorily creates MFNode shaders array as an ordered list with mixed content" } ], "-shaders":[ { "ProgramShader": { "@DEF":"TestShader1", "-programs":[ { "ShaderProgram": { "@DEF":"TestShader2", "@type":"VERTEX" } } ] } }, { "ProtoInstance": { "@name":"ShaderProto", "@DEF":"TestShader3" } }, { "ComposedShader": { "@DEF":"TestShader4", "-parts":[ { "ShaderPart": { "@DEF":"TestShader5", "@type":"VERTEX" } } ] } } ] } } } }, { "Transform": { "@DEF":"SpecialtyNodes", "-children":[ { "CADLayer": { "-children":[ { "CADAssembly": { "-children":[ { "CADPart": { "-children":[ { "CADFace": { } } ] } } ] } } ] } }, { "EspduTransform": { } }, { "ReceiverPdu": { } }, { "SignalPdu": { } }, { "TransmitterPdu": { } }, { "DISEntityManager": { "-children":[ { "DISEntityTypeMapping": { } } ] } } ] } }, { "EspduTransform": { "-children":[ { "WorldInfo": { } } ] } }, { "ReceiverPdu": { } }, { "SignalPdu": { } }, { "TransmitterPdu": { } }, { "DISEntityManager": { "-children":[ { "DISEntityTypeMapping": { } } ] } }, { "LoadSensor": { "-children":[ { "#comment":"Contained nodes typically must be USE references for nodes previously DEFined in the scene" }, { "#comment":"The following nodes are test cases for all X3DUrlObject nodes" }, { "Anchor": { "@USE":"siteAnchor" } }, { "Inline": { "@USE":"inlineScene" } }, { "DISEntityTypeMapping": { } }, { "GeoMetadata": { } }, { "AudioClip": { } }, { "ImageCubeMapTexture": { } }, { "ImageTexture3D": { } }, { "ImageTexture": { } }, { "MovieTexture": { } }, { "Script": { "@DEF":"DummyScript", "#sourceCode":[ "", "", "ecmascript:", "/* dummy test source code */", "", "" ] } }, { "PackagedShader": { } }, { "ShaderPart": { "@type":"VERTEX" } }, { "ShaderProgram": { "@type":"VERTEX" } } ] } } ] } } } =========================================== Create Python source of model using stylesheet X3dToPython.xslt *** error in X3D4 model, overriding MetadataString DEF='FindableMetadataStringTest' having containerField='value' with corrected containerField='metadata' since parent node is Shape ... please fix original X3D model helloWorld.toFilePython("HelloWorldProgramOutput.py") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.py Test toStringPython() *** error in X3D4 model, overriding MetadataString DEF='FindableMetadataStringTest' having containerField='value' with corrected containerField='metadata' since parent node is Shape ... please fix original X3D model #################################################################################################### # # Invoking X3D model self-test: # # $ python HelloWorldProgramOutput.py # # Python package x3d.py package is available on PyPI for import. # This approach simplifies Python X3D deployment and use. # https://pypi.org/project/x3d # # Installation: # pip install x3d # or # python -m pip install x3d # # Developer options for loading x3d package in other Python programs: # # from x3d import * # preferred approach, terser source that avoids x3d.* class prefixes # # or # import x3d # traditional way to subclass x3d package, all classes require x3d.* prefix, # # but python source is very verbose, for example x3d.Material x3d.Shape etc. # # X3dToPython.xslt stylesheet insertPackagePrefix=true supports this option. # #################################################################################################### from x3d import * newModel=X3D(class_='x3dModel.class',id_='x3dModel.id',profile='Full',style_='x3dModel.style',version='4.0', # x3dVersionComparisonTest for this model: supportsX3dVersion(X3D.VERSION_3_0)=true head=head( children=[ # comment #1 # comment #2 # comment #3 # comment #4 component(name='Navigation',level=3), component(name='Shaders',level=1), component(name='CADGeometry',level=2), component(name='DIS',level=2), component(name='HAnim',level=1), component(name='Grouping',level=1), component(name='Layering',level=1), unit(name='AngleUnitConversion',category='angle',conversionFactor=1.0), unit(name='LengthUnitConversion',category='length',conversionFactor=1.0), unit(name='ForceFromPoundsToNewtons',category='force',conversionFactor=4.4482), meta(content='HelloWorldProgramOutput.x3d',name='title'), meta(content='continued development and testing in progress',name='info'), meta(content='Example HelloWorldProgram creates an X3D model using the X3D Java Scene Access Interface Library (X3DJSAIL)',name='description'), meta(content='https://www.web3d.org/specifications/java/X3DJSAIL.html',name='reference'), meta(content='HelloWorldProgramOutput.java',name='generator'), meta(content='6 September 2016',name='created'), meta(content='29 April 2024',name='modified'), meta(content='X3D Java Scene Access Interface Library (X3DJSAIL)',name='generator'), meta(content='https://www.web3d.org/specifications/java/examples/HelloWorldProgram.java',name='generator'), meta(content='Netbeans https://www.netbeans.org',name='generator'), meta(content='Don Brutzman',name='creator'), meta(content='https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples/HelloWorldProgramOutput.x3d',name='reference'), meta(content='Console output, ClassicVRML encoding, VRML97 encoding and pretty-print documentation:',name='reference'), meta(content='HelloWorldProgramOutput.txt',name='reference'), meta(content='HelloWorldProgramOutput.x3dv',name='reference'), meta(content='HelloWorldProgramOutput.wrl',name='reference'), meta(content='HelloWorldProgramOutput.html',name='reference'), meta(content='https://savage.nps.edu/X3dValidator?url=https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d',name='reference'), meta(content='https://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d',name='identifier'), meta(content='../license.html',name='license')]), Scene=Scene( children=[ MetadataSet(name='topLevelSceneMetadata'), 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))]), NavigationInfo(type='"EXAMINE" "FLY" "ANY"'), WorldInfo(DEF='WorldInfoDEF',class_='worldInfoNode.class',id_='worldInfoNode.id',style_='worldInfoNode.style',title='HelloWorldProgram produced by X3D Java SAI Library (X3DJSAIL)'), WorldInfo(USE='WorldInfoDEF'), WorldInfo(USE='WorldInfoDEF'), MetadataString(DEF='scene.addChildMetadata',name='test',value=["Top-level root Metadata node beneath Scene needs to be one of \'-children\' in JSON encoding"]), LayerSet(DEF='scene.addChildLayerSetTest'), Transform(DEF='LogoGeometryTransform',translation=(0,1.5,0), children=[ Anchor(DEF='siteAnchor',description='select for X3D Java SAI Library (X3DJSAIL) description',url=["../X3DJSAIL.html","https://www.web3d.org/specifications/java/X3DJSAIL.html"], children=[ Shape(DEF='BoxShape',id_='BoxShapeID', appearance=Appearance( material=Material(DEF='GreenMaterial',diffuseColor=(0,1,1),emissiveColor=(0.8,0,0),transparency=0.1), texture=ImageTexture(url=["images/X3dJavaSceneAccessInterfaceSaiLibrary.png","https://www.web3d.org/specifications/java/examples/images/X3dJavaSceneAccessInterfaceSaiLibrary.png"])), geometry=Box(DEF='test-NMTOKEN_regex.0123456789',class_='untextured'))])]), Shape(DEF='LineShape', appearance=Appearance( material=Material(emissiveColor=(0.6,0.19607843,0.8))), geometry=IndexedLineSet(coordIndex=[0,1,2,3,4,0], # Coordinate 3-tuple point count: 6 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"], # Comment example A, plain quotation marks: He said, "Immel did it!" # Comment example B, XML character entities: He said, &quot;Immel did it!&quot; metadata=MetadataSet(name='EscapedQuotationMarksMetadataSet', value=[ MetadataString(name='quotesTestC',value=["MFString example C, backslash-escaped quotes: He said, \"Immel did it!\""]), MetadataString(name='extraChildTest',value=["checks MetadataSet addValue() method"])]), fontStyle=FontStyle(justify=["MIDDLE","MIDDLE"]))), Collision( # test containerField='proxy' proxy=Shape(DEF='ProxyShape', # alternative XML encoding: Text string='"One, Two, Comment" "" "He said, \&quot;Immel did it!\&quot;"' # alternative XML encoding: Text string='"One, Two, Comment" "" "He said, \&quot;Immel did it!\&quot;" ""' # alternative Java source: .setString(new String [] {"One, Two, Comment", "", "He said, \"Immel did it!\""}) # reference: https://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/StringArrayEncodingExamplesIndex.html geometry=Text(string=["One, Two, Text","","He said, \"Immel did it!\" \"\""])))] # It's a beautiful world # ... for you! # https://en.wikipedia.org/wiki/Beautiful_World_(Devo_song) ), # 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=[ field(name='colorInput',accessType='inputOnly',type='SFColor'), field(name='colorsOutput',accessType='outputOnly',type='MFColor')], sourceCode=""" 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)], # 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=ProtoInterface( field=[ 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)]), ProtoBody=ProtoBody( # Initial node of ProtoBody determines prototype node type children=[ 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=IS( connect=[ connect(nodeField='description',protoField='description'), connect(nodeField='enabled',protoField='enabled')]))])), ExternProtoDeclare(name='ArtDeco02Material',appinfo='this is a different Material node',url=["https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/ArtDecoPrototypesExcerpt.x3d#ArtDeco02Material","https://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 that retrieves the ExternProtoDeclare file." field=[ field(name='description',accessType='inputOutput',appinfo='tooltip for descriptionField',type='SFString')]), # Tested ArtDeco01ProtoInstance, ArtDeco02ProtoInstance for improper node type when ProtoInstance is added in wrong place Shape(DEF='TestShape1', appearance=Appearance(DEF='TestAppearance1', # ArtDeco01Material prototype goes here... TODO ensure setContainerField is handled in exported Java material=ProtoInstance(name='ArtDeco01Material', # [HelloWorldProgram diagnostic] ArtDeco01ProtoInstance.getNodeType()="Material" fieldValue=[ fieldValue(name='description',value='ArtDeco01Material can substitute for a Material node')])), geometry=Sphere(radius=0.001)), Shape(DEF='TestShape2', appearance=Appearance(DEF='TestAppearance2', # ArtDeco02Material prototype goes here... TODO ensure setContainerField is handled in exported Java material=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 that retrieves the ExternProtoDeclare file." fieldValue=[ 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', # ArtDeco02Material ProtoInstance USE goes here. Note that name field is NOT defined as part of ProtoInstance USE. material=ProtoInstance(USE='ArtDeco02MaterialDEF')), geometry=Cylinder(height=0.001,radius=0.001)), Inline(DEF='inlineScene',url=["someOtherScene.x3d","https://www.web3d.org/specifications/java/examples/someOtherScene.x3d"]), IMPORT(AS='WorldInfoDEF2',importedDEF='WorldInfoDEF',inlineDEF='inlineScene'), EXPORT(AS='WorldInfoDEF3',localDEF='WorldInfoDEF'), ProtoDeclare(name='MaterialModulator',appinfo='mimic a Material node and modulate fields as an animation effect',documentation='https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulatorIndex.html', ProtoInterface=ProtoInterface( field=[ 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)]), ProtoBody=ProtoBody( children=[ Material(DEF='MaterialNode', IS=IS( connect=[ 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')])), # Only first node (the node type) is renderable, others are along for the ride Script(DEF='MaterialModulatorScript', field=[ 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=IS( connect=[ connect(nodeField='enabled',protoField='enabled'), connect(nodeField='diffuseColor',protoField='diffuseColor')]), sourceCode=""" 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'); } } """)])), # Test success: declarative statement createDeclarativeShapeTests() Group(DEF='DeclarativeGroupExample', children=[ Shape( metadata=MetadataString(DEF='FindableMetadataStringTest',name='findThisNameValue',value=["test case"]), appearance=Appearance(DEF='DeclarativeAppearanceExample', # DeclarativeMaterialExample gets overridden by subsequently added MaterialModulator ProtoInstance material=ProtoInstance(DEF='MyMaterialModulator',name='MaterialModulator')), geometry=Cone(bottom=False,bottomRadius=0.05,height=0.1))] # Test success: declarativeGroup.addChild() singleton pipeline method ), # 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=false, 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, regex matches()=true # regex test SFVec3f().matches("1 2 3")=true, regex test SFVec3f().matches("1 2 3 4")=false, regex test (SFRotation.matches("0 0 0 0")=true, failure detecting illegal (zero axis) rotation value ), Sound(location=(0,1.6,0), # set sound-ellipsoid location height at 1.6m to match typical avatar height source=AudioClip(description='chimes',url=["chimes.wav","https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/chimes.wav"], # Scene example fragment from https://www.web3d.org/x3d/content/examples/ConformanceNist/Sounds/AudioClip/default.x3d )), Sound(location=(0,1.6,0), # set sound-ellipsoid location height at 1.6m to match typical avatar height source=MovieTexture(description='mpgsys.mpg from ConformanceNist suite',url=["mpgsys.mpg","https://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/MovieTexture/mpgsys.mpg"], # Scene example fragment from https://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" "children" )), # Test success: Anchor.isNode()=true, siteAnchor.isNode()=true # Test success: Anchor.isStatement()=false, siteAnchor.isStatement()=false # Test success: ROUTE.isNode()=false, orbitPositionROUTE.isNode()=false # Test success: ROUTE.isStatement()=true, orbitPositionROUTE.isStatement()=true # Test success: CommentsBlock.isNode()=false, testComments.isNode()=false # Test failure: CommentsBlock.isStatement()=true, testComments.isStatement()=true 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=Appearance(DEF='TransparentAppearance', material=Material(transparency=1.0)), geometry=Extrusion(DEF='ExampleExtrusion')), Group( # Test MFNode children array as an ordered list consisting of comments, statements, ProtoInstance and nodes children=[ ProtoDeclare(name='NewWorldInfo', ProtoInterface=ProtoInterface( field=[ field(name='description',accessType='initializeOnly',type='SFString')]), ProtoBody=ProtoBody( children=[ WorldInfo(),])), ProtoInstance(DEF='Proto1',name='NewWorldInfo', fieldValue=[ fieldValue(name='description',value='testing 1 2 3')]), Group(DEF='Node2', # intentionally empty ), ProtoInstance(DEF='Proto3',name='NewWorldInfo'), Transform(DEF='Node4', # intentionally empty )] # Test satisfactorily creates MFNode children array as an ordered list with mixed content ), ProtoDeclare(name='ShaderProto', ProtoBody=ProtoBody( children=[ ProgramShader(),])), Shape( appearance=Appearance( # Test MFNode shaders array as an ordered list consisting of comments, ProtoInstance and nodes # Test satisfactorily creates MFNode shaders array as an ordered list with mixed content shaders=[ ProgramShader(DEF='TestShader1', programs=[ ShaderProgram(DEF='TestShader2')]), ProtoInstance(DEF='TestShader3',name='ShaderProto'), ComposedShader(DEF='TestShader4', parts=[ ShaderPart(DEF='TestShader5')])])), Transform(DEF='SpecialtyNodes', children=[ CADLayer( children=[ CADAssembly( children=[ CADPart( children=[ CADFace(),])])]), EspduTransform(), ReceiverPdu(receivedPower=0.0), SignalPdu(), TransmitterPdu(relativeAntennaLocation=(0,0,0),transmitFrequencyBandwidth=0.0), DISEntityManager( children=[ DISEntityTypeMapping(),])]), EspduTransform( children=[ WorldInfo(),]), ReceiverPdu(receivedPower=0.0), SignalPdu(), TransmitterPdu(relativeAntennaLocation=(0,0,0),transmitFrequencyBandwidth=0.0), DISEntityManager( children=[ DISEntityTypeMapping(),]), LoadSensor( # Contained nodes typically must be USE references for nodes previously DEFined in the scene # The following nodes are test cases for all X3DUrlObject nodes children=[ Anchor(USE='siteAnchor'), Inline(USE='inlineScene'), DISEntityTypeMapping(), GeoMetadata(), AudioClip(), ImageCubeMapTexture(), ImageTexture3D(), ImageTexture(), MovieTexture(), Script(DEF='DummyScript'), PackagedShader(), ShaderPart(), ShaderProgram(),])]) ) # X3D model complete #################################################################################################### # Self-test diagnostics #################################################################################################### print('Self-test diagnostics for HelloWorldProgramOutput.py:') if metaDiagnostics(newModel): # built-in utility method in X3D class print(metaDiagnostics(newModel)) # display meta info, hint, warning, error, TODO values in this model # print('check newModel.XML() serialization...') newModelXML= newModel.XML() # test export method XML() for exceptions during export newModel.XMLvalidate() # print(newModelXML) # diagnostic try: # print('check newModel.VRML() serialization...') newModelVRML=newModel.VRML() # test export method VRML() for exceptions during export # print(prependLineNumbers(newModelVRML)) # debug print("Python-to-VRML export of VRML output successful", flush=True) except Exception as err: # usually BaseException # https://stackoverflow.com/questions/18176602/how-to-get-the-name-of-an-exception-that-was-caught-in-python print("*** Python-to-VRML export of VRML output failed:", type(err).__name__, err) if newModelVRML: # may have failed to generate print(prependLineNumbers(newModelVRML, err.lineno)) try: # print('check newModel.JSON() serialization...') newModelJSON=newModel.JSON() # test export method JSON() for exceptions during export # print(prependLineNumbers(newModelJSON)) # debug print("Python-to-JSON export of JSON output successful (under development)") except Exception as err: # usually SyntaxError print("*** Python-to-JSON export of JSON output failed:", type(err).__name__, err) if newModelJSON: # may have failed to generate print(prependLineNumbers(newModelJSON,err.lineno)) print("python HelloWorldProgramOutput.py load and self-test diagnostics complete.") =========================================== Create displayable scene page rendered with X3DOM using stylesheet X3dToX3domX_ITE.xslt Note: toFileStylesheetConversion(X3dToX3domX_ITE.xslt) is overwriting prior file HelloWorldProgramOutputX3dom.xhtml helloWorld.toFileX3DOM("HelloWorldProgramOutputX3dom.xhtml") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutputX3dom.xhtml =========================================== Create displayable scene page rendered with X_ITE (formerly Cobweb) using stylesheet X3dToX3domX_ITE.xslt Note: toFileStylesheetConversion(X3dToX3domX_ITE.xslt) is overwriting prior file HelloWorldProgramOutputX_ITE.html helloWorld.toFileX3DOM("HelloWorldProgramOutputX_ITE.html") success: true C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutputX_ITE.html =========================================== Reload and provide text output using Java DOM, which includes default attribute values [X3DLoaderDOM] =========================================== Test success: x3dLoader.loadX3DfromXML(HelloWorldProgramOutput.x3d), x3dLoader.getX3dObjectTree() =========================================== =========================================== Test success: x3dLoader.getDomDocument() and x3dLoader.toStringX3D(domDocument) Now test x3dLoader.toX3dModelInstance(domDocument) [X3DLoaderDOM] Note: toFileX3D() is overwriting prior file HelloWorldProgramOutput_ReloadedDOM.x3d Test success: x3dLoader.toX3dModelInstance(domDocument), save HelloWorldProgramOutput_ReloadedDOM.x3d x3dLoader validation result: no issues reported. =========================================== Test loadModelFromFileX3D(String) and loadModelFromFileX3D(File) checking .x3d encoding HelloWorldProgramOutput.x3d [X3DLoaderDOM] newX3DModel HelloWorldProgramOutput.x3d loadSuccess=true, isEmpty()=false, validate()=success checking .xml encoding HelloWorldProgramOutput.xml [X3DLoaderDOM] newX3DModel HelloWorldProgramOutput.xml loadSuccess=true, isEmpty()=false, validate()=success =========================================== =========================================== Check file sizes for various forms of compression Source file HelloWorldProgramOutput.x3d 23585 bytes =========================================== Test toFileEXI() with EXIficient HelloWorldProgramOutput_EXIFICIENT.exi filesize 3689 bytes, compression 15.64% of original =========================================== Test fromFileEXI() with EXIficient Note: fromFileEXI() is overwriting prior file HelloWorldProgramOutput_EXIFICIENT.exi EXI decompressed examples\temp.exiInputTransformed.x3d size=30849 bytes [X3DLoaderDOM] fromFileEXIsuccess=true for HelloWorldProgramOutput_EXIFICIENT.exi exiModel.validate() results: success =========================================== Test toFileEXI() with OpenEXI: testing in progress HelloWorldProgramOutputOPENEXI.exi filesize 3689 bytes, compression 15.64% of original =========================================== Test fromFileEXI() with OpenEXI: TODO testing in progress, not fully implemented yet =========================================== Test toFileGZIP() HelloWorldProgramOutput.gz filesize 6265 bytes, compression 26.56% of original =========================================== Test toFileZip() HelloWorldProgramOutput.zip filesize 6525 bytes, compression 27.67% of original =========================================== =========================================== Test CommandLine invocations CommandLine [-help] Usage: java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.CommandLine [-help | -version | -home | -javadoc | -resources | -hints | -regexes | -tooltips | -X3DUOM] [-properties [propertiesFile]] [sourceModel.x3d | sourceModel.exi [-fromEXI] | sourceModel.gz [-fromGZIP] | sourceModel.zip [-fromZIP]] [-canonical] [-validate] [-EXIFICIENT | -OpenEXI] [-Tidy | -toX3D | -toXML | -toClassicVrml | -toJava | -toJSON | -toPython | -toVRML97] [-toHTML | -toX3DOM | -toX_ITE | -toMarkdown | -toEXI | -toGZIP | -toZIP] [-tofile [resultFile.*]] [-toImage [snapshotName.*]] -classpath X3DJSAIL.*.jar # optional classpath, can be set as environment variable org.web3d.x3d.jsail.CommandLine # invoke CommandLine application ==================================#====== informational ====================== -help # provide this help message -version # version date when this X3DJSAIL build was autogenerated -home # launch X3DJSAIL home page -javadoc # launch X3DJSAIL javadoc page -resources # launch X3D Resources page -hints # launch X3D Scene Authoring Hints page -regex # launch X3D Regular Expressions page -tooltips # launch X3D Tooltips page -X3DUOM # launch X3D Unified Object Model (X3DUOM) page =================================#====== properties, inputs ================= -properties [propertiesFile] # override X3DJSAIL properties (default file: X3DJSAIL.properties) -EXIFICIENT # use Exificient (default) as EXI_ENGINE -OpenEXI # use OpenEXI (Nagasena) as EXI_ENGINE (testing in progress) sourceModel.x3d # source model file name, X3D format sourceModel.exi [-fromEXI] # source model file name, EXI format sourceModel.gz [-fromGZIP] # source model file name, GZIP format sourceModel.zip [-fromZIP] # source model file name, ZIP format ==================================#====== operations ========================= -canonical # canonical XML output using X3D Canonicalization (c14n) -validate # validate correctness of loaded model -Tidy # X3D-Tidy cleanup in .x3d (XML) format -toX3D # output in .x3d (XML) format -toXML # output in .xml (X3D) format -toClassicVrml # output in .x3dv (ClassicVrml) X3D format -toJava # output in .java source code using X3DJSAIL -toJSON # output in .json (JavaScript Object Notation) format -toPython # output in .py Python source code -toVRML97 # output in .wrl (VRML97) format -toHTML # output in .html pretty-print documentation -toX3DOM # output in .xhtml page with X3DOM display of X3D model -toX_ITE # output in .html page with X_ITE display of X3D model -toMarkdown # output document metadata (meta tags) in .md (Markdown) format -toEXI # output in .exi (Efficient XML Interchange) compressed-XML format -toGZIP # output in .gz (X3D XML) format, with gzip compression -toZIP # output in .zip (X3D XML) format, with zip compression ==================================#====== outputs ============================ -tofile [resultFile.*] # specify output filename (otherwise original name with extension) -toImage [snapshotName.*] # create output images for each Viewpoint using Blender =========================================== CommandLine [HelloWorldProgramOutput.x3d, -canonicalize, -toFile, HelloWorldProgramOutputCanonical.xml] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-canonicalize" for X3D and XML canonicalization (C14N) CommandLine parameter: "-toFile" "HelloWorldProgramOutputCanonical.xml" for result file name root HelloWorldProgramOutputCanonical CommandLine invocation: new X3dCanonicalizer(C:\x3d-code\www.web3d.org\x3d\stylesheets\java\examples\HelloWorldProgramOutput.x3d,HelloWorldProgramOutputCanonical.xml) ...x3dCanonicalizer.isCanonical()=false Note: x3dCanonicalizer is overwriting prior file HelloWorldProgramOutputCanonical.xml now check result... CommandLine [HelloWorldProgramOutputCanonical.xml, -validate] parameter: source file HelloWorldProgramOutputCanonical.xml filesize 23454 bytes CommandLine parameter: "-validate" for model validation Parsing using Document Object Model (DOM) based X3DLoaderDOM... [X3DLoaderDOM] validate results: success, no problems noted =========================================== CommandLine [HelloWorldProgramOutput.x3d, -toX3D, -toFile, HelloWorldProgramOutput_CommandLine.x3d] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-toX3D" for conversion to X3D encoding CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine.x3d" for result file name root HelloWorldProgramOutput_CommandLine Parsing using Document Object Model (DOM) based X3DLoaderDOM... [X3DLoaderDOM] convert to X3D: Note: toFileX3D() is overwriting prior file HelloWorldProgramOutput_CommandLine.x3d file conversion successful: HelloWorldProgramOutput_CommandLine.x3d (23585 bytes) =========================================== CommandLine [HelloWorldProgramOutput.x3d, -toVRML97, -toFile, HelloWorldProgramOutput_CommandLine.wrl] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-toVRML97" for conversion to VRML97 encoding CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine.wrl" for result file name root HelloWorldProgramOutput_CommandLine convert to VRML97: [info] <meta name='info' content='continued development and testing in progress'/> [warning] Metadata nodes are not supported as a child of Text node in VRML97 encoding. The child MetadataSet node has been moved to immediately follow the parent Text. Additional Metadata* leaf node(s) follow that are similarly adjusted. [check X3D source or VRML output to find questionable <Text/> with parent Shape] [warning] IS/connect ignored for nodeField='description' since not a supported field in VRML97 for parent TouchSensor [check X3D source or VRML output to find questionable TouchSensor] [warning] Script field 'enabled' has accessType 'inputOutput' (exposedField), which is only allowed in X3D Script node, not VRML97 Script node. Using exposedField anyway, may cause errors. [field 'enabled' parent DEF='MaterialModulatorScript'] [warning] Script field 'diffuseColor' has accessType 'inputOutput' (exposedField), which is only allowed in X3D Script node, not VRML97 Script node. Using exposedField anyway, may cause errors. [field 'diffuseColor' parent DEF='MaterialModulatorScript'] [warning] ProtoInterface <field name='description'/> is unreferenced in ProtoBody with no corresponding IS/connect/@protoField [check X3D source or VRML output to find questionable field 'description' parent ProtoDeclare NewWorldInfo] [warning] no ROUTE found for LoadSensor output [check X3D source or VRML output to find questionable LoadSensor] =========================================== CommandLine [HelloWorldProgramOutput.x3d, -toX3DV, -toFile, HelloWorldProgramOutput_CommandLine.x3dv] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-toX3DV" for conversion to ClassicVRML encoding CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine.x3dv" for result file name root HelloWorldProgramOutput_CommandLine convert to ClassicVRML: Note: fileStylesheetConversion() is overwriting prior file HelloWorldProgramOutput_CommandLine.x3dv =========================================== CommandLine [HelloWorldProgramOutput.x3d, -toMarkdown, -toFile, HelloWorldProgramOutputCatalog.md] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-toMarkdown" for producing .md model meta information markdown CommandLine parameter: "-toFile" "HelloWorldProgramOutputCatalog.md" for result file name root HelloWorldProgramOutputCatalog convert to .md model meta information markdown, include subdirectories in meta links: true Note: fileStylesheetConversion() is overwriting prior file HelloWorldProgramOutputCatalog.md =========================================== CommandLine [HelloWorldProgramOutput.x3d, -toMarkdown, -toFile, HelloWorldProgramOutput.md] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-toMarkdown" for producing .md model meta information markdown CommandLine parameter: "-toFile" "HelloWorldProgramOutput.md" for result file name root HelloWorldProgramOutput convert to .md model meta information markdown, include subdirectories in meta links: true Note: fileStylesheetConversion() is overwriting prior file HelloWorldProgramOutput.md =========================================== CommandLine [HelloWorldProgramOutput.x3d, -EXIFICIENT, -toEXI, -toFile, HelloWorldProgramOutput_CommandLine_EXIFICIENT.exi] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-EXIFICIENT" invoked ConfigurationProperties.setExiEngine(EXIFICIENT); CommandLine parameter: "-toEXI" for conversion to compressed EXI containing model CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine_EXIFICIENT.exi" for result file name root HelloWorldProgramOutput_CommandLine_EXIFICIENT Parsing using Document Object Model (DOM) based X3DLoaderDOM... [X3DLoaderDOM] convert to EXI using EXIFICIENT: source: HelloWorldProgramOutput.x3d filesize 23585 bytes result: HelloWorldProgramOutput_CommandLine_EXIFICIENT.exi filesize 3689 bytes, compression 15.64% of original =========================================== CommandLine [HelloWorldProgramOutput_CommandLine_EXIFICIENT.exi, -EXIFICIENT, -fromEXI, -toFile, HelloWorldProgramOutput_CommandLine_EXIFICIENT.RoundTrip.x3d] parameter: source file HelloWorldProgramOutput_CommandLine_EXIFICIENT.exi filesize 3689 bytes CommandLine parameter: "-EXIFICIENT" invoked ConfigurationProperties.setExiEngine(EXIFICIENT); CommandLine parameter: "-fromEXI" for conversion from compressed EXI containing model CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine_EXIFICIENT.RoundTrip.x3d" for result file name root HelloWorldProgramOutput_CommandLine_EXIFICIENT.RoundTrip Note: fromFileEXI() is overwriting prior file HelloWorldProgramOutput_CommandLine_EXIFICIENT.exi EXI decompressed examples\temp.exiInputTransformed.x3d size=30849 bytes [X3DLoaderDOM] load result: true =========================================== CommandLine [HelloWorldProgramOutput.x3d, -OpenEXI, -toEXI, -toFile, HelloWorldProgramOutput_CommandLine.OPENEXI.exi] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-OpenEXI" invoked ConfigurationProperties.setExiEngine(OPENEXI); [warning] "OPENEXI" testing in progress, can also use EXIFICIENT instead. CommandLine parameter: "-toEXI" for conversion to compressed EXI containing model CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine.OPENEXI.exi" for result file name root HelloWorldProgramOutput_CommandLine.OPENEXI Parsing using Document Object Model (DOM) based X3DLoaderDOM... [X3DLoaderDOM] convert to EXI using OPENEXI: source: HelloWorldProgramOutput.x3d filesize 23585 bytes result: HelloWorldProgramOutput_CommandLine.OPENEXI.exi filesize 3753 bytes, compression 15.91% of original =========================================== CommandLine [HelloWorldProgramOutput_CommandLine.OPENEXI.exi, -OpenEXI, -fromEXI, -toFile, HelloWorldProgramOutput_CommandLine.OPENEXI.RoundTrip.x3d] parameter: source file HelloWorldProgramOutput_CommandLine.OPENEXI.exi filesize 3753 bytes CommandLine parameter: "-OpenEXI" invoked ConfigurationProperties.setExiEngine(OPENEXI); [warning] "OPENEXI" testing in progress, can also use EXIFICIENT instead. CommandLine parameter: "-fromEXI" for conversion from compressed EXI containing model CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine.OPENEXI.RoundTrip.x3d" for result file name root HelloWorldProgramOutput_CommandLine.OPENEXI.RoundTrip Note: fromFileEXI() is overwriting prior file HelloWorldProgramOutput_CommandLine.OPENEXI.exi EXI decompressed examples\temp.exiInputTransformed.x3d size=31028 bytes [X3DLoaderDOM] load result: true =========================================== CommandLine [HelloWorldProgramOutput.x3d, -toGZIP, -toFile, HelloWorldProgramOutput_CommandLine.x3d.gz] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-toGZIP" for conversion to compressed GZIP containing model CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine.x3d.gz" for result file name root HelloWorldProgramOutput_CommandLine.x3d Parsing using Document Object Model (DOM) based X3DLoaderDOM... [X3DLoaderDOM] convert to GZIP: source: HelloWorldProgramOutput.x3d filesize 23585 bytes result: HelloWorldProgramOutput_CommandLine.x3d.gz filesize 6265 bytes, compression 26.56% of original =========================================== CommandLine [HelloWorldProgramOutput_CommandLine.x3d.gz, -fromGZIP] parameter: source file HelloWorldProgramOutput_CommandLine.x3d.gz filesize 6265 bytes CommandLine parameter: "-fromGZIP" for conversion from compressed GZIP containing model fromFileGZIP() output modelFileName HelloWorldProgramOutput_CommandLine.x3d Note: fromFileGZIP() is overwriting prior file HelloWorldProgramOutput_CommandLine.x3d gunzipped HelloWorldProgramOutput_CommandLine.x3d size=23585 bytes [X3DLoaderDOM] load result: true =========================================== CommandLine [HelloWorldProgramOutput.x3d, -toZIP, -toFile, HelloWorldProgramOutput_CommandLine.x3d.zip] parameter: source file HelloWorldProgramOutput.x3d filesize 23585 bytes CommandLine parameter: "-toZIP" for conversion to compressed ZIP containing model CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLine.x3d.zip" for result file name root HelloWorldProgramOutput_CommandLine.x3d Parsing using Document Object Model (DOM) based X3DLoaderDOM... [X3DLoaderDOM] convert to ZIP: source: HelloWorldProgramOutput.x3d filesize 23585 bytes result: HelloWorldProgramOutput_CommandLine.x3d.zip filesize 6525 bytes, compression 27.67% of original =========================================== CommandLine [HelloWorldProgramOutput_CommandLine.x3d.zip, -fromZIP, -toFile, HelloWorldProgramOutput_CommandLineUnzipped.x3d] parameter: source file HelloWorldProgramOutput_CommandLine.x3d.zip filesize 6525 bytes CommandLine parameter: "-fromZIP" for conversion from compressed ZIP containing model CommandLine parameter: "-toFile" "HelloWorldProgramOutput_CommandLineUnzipped.x3d" for result file name root HelloWorldProgramOutput_CommandLineUnzipped [warning] fromFileZIP() modelFileName was empty, unzipping found initial X3D file to load: HelloWorldProgramOutput.x3d Note: fromFileZIP() is overwriting prior file HelloWorldProgramOutput_CommandLineUnzipped.x3d Unzipped HelloWorldProgramOutput_CommandLineUnzipped.x3d size=23585 bytes [X3DLoaderDOM] load result: true =========================================== ConfigurationProperties.setDebugModeActive(true); x3dModel.validate() results with ConfigurationProperties.setDebugModeActive(true): ProtoInstance ArtDeco01Material DEF='' has corresponding ProtoDeclare ProtoInstance ArtDeco02Material DEF='ArtDeco02MaterialDEF' has corresponding ExternProtoDeclare (but node type is unconfirmed) ProtoInstance MaterialModulator DEF='MyMaterialModulator' has corresponding ProtoDeclare ProtoInstance NewWorldInfo DEF='Proto1' has corresponding ProtoDeclare ProtoInstance NewWorldInfo DEF='Proto3' has corresponding ProtoDeclare ProtoInstance ShaderProto DEF='TestShader3' has corresponding ProtoDeclare =========================================== HelloWorldProgram complete. =========================================== testBlenderLauncher(); // check Blender capabilities Blender default path=[Blender path not set] Blender.checkBlenderPath() updated path=C:\Program Files\Blender Foundation\Blender 4.1\ ================================= BlenderLauncher.hasBlender()=true ================================= Blender version=Blender 4.1.1 =========================================== BlenderLauncher.run("-help") Usage: java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.BlenderLauncher sourceFile [-convert [resultFile]] [-toImage [snapshotName.*]] [-home | -help | -version | -properties fileName.properties | -BLENDER_PATH directoryPath] https://www.blender.org Blender help: Blender 4.1.1 Usage: blender [args ...] [file] [args ...] Render Options: -b or --background Run in background (often used for UI-less rendering). -a or --render-anim Render frames from start to end (inclusive). -S or --scene Set the active scene for rendering. -f or --render-frame Render frame and save it. * + start frame relative, - end frame relative. * A comma separated list of frames can also be used (no spaces). * A range of frames can be expressed using '..' separator between the first and last frames (inclusive). -s or --frame-start Set start to frame , supports +/- for relative frames too. -e or --frame-end Set end to frame , supports +/- for relative frames too. -j or --frame-jump Set number of frames to step forward after each rendered frame. -o or --render-output Set the render path and file name. Use '//' at the start of the path to render relative to the blend-file. The '#' characters are replaced by the frame number, and used to define zero padding. * 'animation_##_test.png' becomes 'animation_01_test.png' * 'test-######.png' becomes 'test-000001.png' When the filename does not contain '#', The suffix '####' is added to the filename. The frame number will be added at the end of the filename, eg: # blender -b animation.blend -o //render_ -F PNG -x 1 -a '//render_' becomes '//render_####', writing frames as '//render_0001.png' -E or --engine Specify the render engine. Use '-E help' to list available engines. -t or --threads Use amount of for rendering and other operations [1-1024], 0 for systems processor count. Cycles Render Options: Cycles add-on options must be specified following a double dash. --cycles-device Set the device used for rendering. Valid options are: 'CPU' 'CUDA' 'OPTIX' 'HIP' 'ONEAPI' 'METAL'. Append +CPU to a GPU device to render on both CPU and GPU. Example: # blender -b file.blend -f 20 -- --cycles-device OPTIX --cycles-print-stats Log statistics about render memory and time usage. Format Options: -F or --render-format Set the render format. Valid options are: 'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'AVIRAW' 'AVIJPEG' 'PNG' 'BMP' 'HDR' 'TIFF'. Formats that can be compiled into Blender, not available on all systems: 'OPEN_EXR' 'OPEN_EXR_MULTILAYER' 'FFMPEG' 'CINEON' 'DPX' 'JP2' 'WEBP'. -x or --use-extension Set option to add the file extension to the end of the file. Animation Playback Options: -a Instead of showing Blender's user interface, this runs Blender as an animation player, to view movies and image sequences rendered in Blender (ignored if '-b' is set). Playback Arguments: -p Open with lower left corner at , . -m Read from disk (Do not buffer). -f Specify FPS to start with. -j Set frame step to . -s Play from . -e Play until . -c Amount of memory in megabytes to allow for caching images during playback. Zero disables (clamping to a fixed number of frames instead). Window Options: -w or --window-border Force opening with borders. -W or --window-fullscreen Force opening in full-screen mode. -p or --window-geometry Open with lower left corner at , and width and height as , . -M or --window-maximized Force opening maximized. -con or --start-console Start with the console window open (ignored if '-b' is set), (Windows only). --no-native-pixels Do not use native pixel size, for high resolution displays (MacBook 'Retina'). --no-window-focus Open behind other windows and without taking focus. Python Options: -y or --enable-autoexec Enable automatic Python script execution. -Y or --disable-autoexec Disable automatic Python script execution (Python-drivers & startup scripts), (default). -P or --python Run the given Python script file. --python-text Run the given Python script text block. --python-expr Run the given expression as a Python script. --python-console Run Blender with an interactive console. --python-exit-code Set the exit-code in [0..255] to exit if a Python exception is raised (only for scripts executed from the command line), zero disables. --python-use-system-env Allow Python to use system environment variables such as 'PYTHONPATH' and the user site-packages directory. --addons Comma separated list (no spaces) of add-ons to enable in addition to any default add-ons. Logging Options: --log Enable logging categories, taking a single comma separated argument. Multiple categories can be matched using a '.*' suffix, so '--log "wm.*"' logs every kind of window-manager message. Sub-string can be matched using a '*' prefix and suffix, so '--log "*undo*"' logs every kind of undo-related message. Use "^" prefix to ignore, so '--log "*,^wm.operator.*"' logs all except for 'wm.operators.*' Use "*" to log everything. --log-level Set the logging verbosity level (higher for more details) defaults to 1, use -1 to log all levels. --log-show-basename Only show file name in output (not the leading path). --log-show-backtrace Show a back trace for each log message (debug builds only). --log-show-timestamp Show a timestamp for each log message in seconds since start. --log-file Set a file to output the log to. Debug Options: -d or --debug Turn debugging on. * Enables memory error detection * Disables mouse grab (to interact with a debugger in some cases) * Keeps Python's 'sys.stdin' rather than setting it to None --debug-value Set debug value of on startup. --debug-events Enable debug messages for the event system. --debug-ffmpeg Enable debug messages from FFmpeg library. --debug-handlers Enable debug messages for event handling. --debug-libmv Enable debug messages from libmv library. --debug-cycles Enable debug messages from Cycles. --debug-memory Enable fully guarded memory allocation and debugging. --debug-jobs Enable time profiling for background jobs. --debug-python Enable debug messages for Python. --debug-depsgraph Enable all debug messages from dependency graph. --debug-depsgraph-eval Enable debug messages from dependency graph related on evaluation. --debug-depsgraph-build Enable debug messages from dependency graph related on graph construction. --debug-depsgraph-tag Enable debug messages from dependency graph related on tagging. --debug-depsgraph-no-threads Switch dependency graph to a single threaded evaluation. --debug-depsgraph-time Enable debug messages from dependency graph related on timing. --debug-depsgraph-pretty Enable colors for dependency graph debug messages. --debug-depsgraph-uid Verify validness of session-wide identifiers assigned to ID data-blocks. --debug-ghost Enable debug messages for Ghost (Linux only). --debug-wintab Enable debug messages for Wintab. --debug-gpu Enable GPU debug context and information for OpenGL 4.3+. --debug-gpu-force-workarounds Enable workarounds for typical GPU issues and disable all GPU extensions. --debug-gpu-compile-shaders Compile all statically defined shaders to test platform compatibility. --debug-wm Enable debug messages for the window manager, shows all operators in search, shows keymap errors. --debug-xr Enable debug messages for virtual reality contexts. Enables the OpenXR API validation layer, (OpenXR) debug messages and general information prints. --debug-xr-time Enable debug messages for virtual reality frame rendering times. --debug-all Enable all debug messages. --debug-io Enable debug messages for I/O (Collada, ...). --debug-fpe Enable floating-point exceptions. --debug-exit-on-error Immediately exit when internal errors are detected. --debug-freestyle Enable debug messages for Freestyle. --disable-crash-handler Disable the crash handler. --disable-abort-handler Disable the abort handler. --verbose Set the logging verbosity level for debug messages that support it. GPU Options: --gpu-backend Force to use a specific GPU backend. Valid options: 'opengl'. Misc Options: --open-last Open the most recently opened blend file, instead of the default startup file. --app-template