[x3d-public] X3DJSAIL, X3dToJava.xslt updates

Don Brutzman brutzman at nps.edu
Sun Apr 22 23:13:06 PDT 2018

Release announcement: lots of improvements checked in and deployed tonight.

	X3D Java Scene Access Interface Library (X3DJSAIL) supports programmers with
	standards-based X3D Java interfaces and objects, all as open source.



1. X3D Example Archives testing and X3DJSAIL improvements.

Added X3DJSAIL CommandLine -toJava switch.

Great suggestion to focus on serious testing to shake out the DOM loader.

Figured out a new Ant build.xml task that invokes X3DJSAIL CommandLine class to -validate all .java translations in each archive.

Fixed a number of Prototype problems, most of which resulted when we said ProtoInstance USE nodes no longer include a name attribute.  A few warnings remain but most appear to be fixed.  Diagnostic testing and improvements continue.

Best part of -validate testing is that it really exercises the expected majority of all DOM-based X3DLoader tests.  Made a number of valuable fixes.  Added design pattern to handle setting ProtoInstance as an SFNode field.  Will need another pattern for handling addition of a single ProtoInstance to an MFNode field (other than X3DGroupingNode and similar children), which are rare but important cases.

John: I think that you will find a number of your prior problem cases are fixed now.


2.  X3dToJava.xslt stylesheet (converts .x3d model to X3DJSAIL .java code)

a. Improved self-validation diagnostics output.

b. Lots of work trying to get past the 64K method limit in compiled Java for very-large CAD and scan scenes.  Limited success, but the autogenerated code is highly modularized for large arrays and likely provides more coverage now.  Minor tuning on split values may continue.  Links and snippet follow.



		private float[] getCoordinate_11_27_point_15 ()
			float[] value = {44.0423f,2.50799f,0.800294f,43.8924f,2.50799f,1.58088f,43.6466f,2.50799f,2.32254f,43.9513f,1.83688f,2.51659f,44.1587f,1.12054f,2.64868f,44.2636f,0.376604f,2.71555f,44.2636f,-0.376604f,2.71555f,44.1587f,-1.12054f,2.64868f,43.9513f,-1.83688f,2.51659f,44.0423f,-2.50799f,0.800294f,44.2176f,-1.83688f,1.71297f,44.38f,-1.83688f,0.86716f,44.0927f,-2.50799f,0.0f,44.0423f,-2.50799f,-0.800294f,44.38f,-1.83688f,-0.86716f,44.2176f,-1.83688f,-1.71297f,44.4389f,-1.12054f,-1.80287f,44.551f,-0.376604f,-1.84839f,44.551f,0.376604f,-1.84839f,44.4389f,1.12054f,-1.80287f,44.2176f,1.83688f,-1.71297f,44.38f,1.83688f,-0.86716f,44.4346f,1.83688f,0.0f,44.38f,1.83688f,0.86716f,44.2176f,1.83688f,1.71297f,44.4389f,1.12054f,1.80287f,44.551f,0.376604f,1.84839f,44.551f,-0.376604f,1.84839f,44.4389f,-1.12054f,1.80287f,44.6099f,-1.12054f,0.912673f,44.6674f,-1.12054f,0.0f,44.4346f,-1.83688f,0.0f,44.6099f,-1.12054f,-0.912673f,44.7263f,-0.376604f,-0.935713f,44.7263f,0.376604f,-0.935713f,44.6099f,1.12054f,-0.912673f,44.6674f,1.12054f,0.0f,44.6099f,1.12054f,0.912673f,44.7263f,0.376604f,0.935713f,44.7263f,-0.376604f,0.935713f,44.7852f,-0.376604f,0.0f,44.7852f,0.376604f,0.0f};
			return value;

		/** Large attribute array: Coordinate point field, scene-graph level=11, element #27, 4326 total numbers made up of 1442 3-tuple values
		 * Provide large array value via a separate method, in order to avoid 'code too large' Java compilation errors.
		 * Individual Java methods (including aggregated initializations) are limited to 64KB.
		 * @see https://stackoverflow.com/questions/2407912/code-too-large-compilation-error-in-java
		 * @see https://stackoverflow.com/questions/11437905/java-too-many-constants-jvm-error
		private MFVec3fObject getCoordinate_11_27_point ()
				/* splitting up long array to improve readability */
				MFVec3fObject Coordinate_11_27_point = new MFVec3fObject()
				.append(new MFVec3fObject(getCoordinate_11_27_point_1()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_2()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_3()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_4()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_5()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_6()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_7()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_8()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_9()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_10()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_11()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_12()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_13()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_14()))
				.append(new MFVec3fObject(getCoordinate_11_27_point_15()));

			return Coordinate_11_27_point;


3. More to follow.

John your examples were very helpful and focused me on several key problems that needed remedying.  A lot is fixed, more is needed.

Better and better...  I will stick with the organized review of DOM-based X3DLoader.java to try to achieve thoroughness, probably next weekend.

As requested, I added an ant build.xml task "get.X3DJSAIL.update" which allows end users to update the copy of X3DJSAIL contained within each of the X3D Example Archives.  Console excerpt:

get latest X3DJSAIL update from http://www.web3d.org/specifications/java/X3DJSAIL.html
Getting: http://www.web3d.org/specifications/java/jars/X3DJSAIL.3.3.full.jar
To: E:\x3d-code\www.web3d.org\x3d\content\examples\X3dForAdvancedModeling\lib\X3DJSAIL.3.3.full.jar
Download complete, lib/X3DJSAIL.3.3.full.jar size 30355885 bytes
BUILD SUCCESSFUL (total time: 1 minute 54 seconds)

In general I keep library updates as a feature deliberately triggered by developers, and not automatic, since such libaries get tested with the content that gets deployed and we don't want to break local-user content when future changes occur.

Have fun with X3D and Java!  8)

On 4/18/2018 7:16 PM, John Carlson wrote:
> It will be important for the JSON to DOM loader, once we start stress testing that.
> John
> On Wed, Apr 18, 2018, 10:09 PM Don Brutzman wrote:
>     [cc: list, now that we've diagnosed the cause]
> [...]
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