[x3d-public] questions on X3DJSAIL usage: Java syntax update

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Wed May 8 08:43:29 PDT 2019


Java syntax update:

On 5/6/2019 12:18 AM, Brutzman, Donald (Don) (CIV) wrote:
> [...]
> 3. Spent the day refactoring the X3D Examples Archive projects from Netbeans plain-old freeform projects to Netbeans Java freeform projects.  This doesn't limit any functionality but it does make Java experimentation much simpler... menu items now include Compile/Run/Debug options.

This is working well for all example archives.  It will speed development and testing even further.

Java forms of all models in the X3D Examples Archives have been updated and deployed.  Refreshed build log (showing essential soundness and occasional gaps) updated at

http://www.web3d.org/x3d/content/examples/build.java.all.log.txt

https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/build.java.all.log.txt

> 4. Am further noticing from above that the following single-string .java construct
> 
> 	.setString(new MFStringObject("\"Hello\" \"world!\""))
> 
> is more readable as a String array instead:
> 
> 	.setString(new MFStringObject(new String[] {"Hello","world!"}))
> 
> or even more simply as:
> 
> 	.setString(new String[] {"Hello","world!"})
> 
> Have improved X3dToJava.xslt conversions to simplify accordingly.  Will rerun all java conversions tonight and hopefully redeploy Web3D example archives tomorrow.

This worked.  Yes more readable.  Improved a regular expression in X3dToJava.xslt for MFString dissection of quoted SFStrings, it seems to work pretty well.

Autogenerated version of example above follows.  Yes indeed much cleaner!  No doubt easier for programmers to author.

http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorldIndex.html
http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorld.java

   .setScene(new SceneObject()
     .addComments(" Example scene to illustrate X3D nodes and fields (XML elements and attributes) ")
     .addChild(new GroupObject()
       .addChild(new ViewpointObject("ViewUpClose").setDescription("Hello world!").setCenterOfRotation(0.0f,-1.0f,0.0f).setPosition(0.0f,-1.0f,7.0f))
       .addChild(new TransformObject().setRotation(0.0f,1.0f,0.0f,3.0f)
         .addChild(new ShapeObject()
           .setGeometry(new SphereObject())
           .setAppearance(new AppearanceObject()
             .setMaterial(new MaterialObject("MaterialLightBlue").setDiffuseColor(0.1f,0.5f,1.0f))
             .setTexture(new ImageTextureObject("ImageCloudlessEarth").setUrl(new String[] {"earth-topo.png","earth-topo.jpg","earth-topo-small.gif","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.png","http://www.web3d.org/x3d/content/examples/Basic/earth-topo.jpg","http://www.web3d.org/x3d/content/examples/Basic/earth-topo-small.gif"})))))
       .addChild(new TransformObject().setTranslation(0.0f,-2.0f,0.0f)
         .addChild(new ShapeObject()
           .setGeometry(new TextObject("TextMessage").setString(new String[] {"Hello","world!"})
             .setFontStyle(new FontStyleObject().setJustify(FontStyleObject.JUSTIFY_MIDDLE_MIDDLE)))
           .setAppearance(new AppearanceObject()
             .setMaterial(new MaterialObject().setUSE("MaterialLightBlue")))))));
     }

> Then retest python build [...]

'Tis proposal season here, much too busy... looking forward to further python refinements when possible.  Better and better!

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


More information about the x3d-public mailing list