[x3d-public] announce: X3D Java Scene Authoring Interface (SAI) open source, beta supports colors and field names for ROUTEs

Don Brutzman brutzman at nps.edu
Fri Nov 4 12:04:58 PDT 2016


Two nice programming features have emerged during beta-test development.

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

1.  /Complete/. Added support for numerous hexadecimal 0xRRGGBB integer colors (through defined constants and utility methods) to SFColorObject and related classes.

Reference:
CSS Color Module Level 3, 4.3. Extended color keywords
https://www.w3.org/TR/css3-color/#svg-color

147 Web colors provided as Java SFColor RGB values:
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/java/fields/SFColorObject.html
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/java/fields/SFColorObject.html#ALICEBLUE

Example source showing use:

boxMaterial.setDiffuseColor(MaterialObject.DIFFUSECOLOR_DEFAULT_VALUE);
boxMaterial.setDiffuseColor(new float[] {0, 1, 1});                                // equivalent
boxMaterial.setDiffuseColor((new SFColorObject(0.0f, 1.0f, 1.0f)).toFloatArray()); // equivalent
boxMaterial.setDiffuseColor((new SFColorObject(0x00FFFF)).toFloatArray());         // equivalent
boxMaterial.setDiffuseColor(SFColorObject.CYAN);                                   // equivalent


2. /Complete/. Add string constants naming each field eligible for ROUTE connections,
e.g. OrientationInterpolatorObject.toField_SET_FRACTION and
       OrientationInterpolatorObject.fromField_VALUE_CHANGED.

Example source showing use:
		
ROUTEObject  spinROUTE = new ROUTEObject();
spinROUTE.setFromNode(clockDEF).setFromField("fraction_changed")
		 .setToNode(orientationInterpolatorDEF).setToField("set_fraction");	// equivalent, typos possible

spinROUTE.setFromNode(clockDEF)
		 .setFromField(TimeSensorObject.fromField_FRACTION_CHANGED)
		 .setToNode(orientationInterpolatorDEF)
		 .setToField(OrientationInterpolatorObject.toField_SET_FRACTION);	// equivalent, correctly named

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/java/Interpolation/OrientationInterpolatorObject.html#toField_SET_FRACTION
http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/java/Interpolation/OrientationInterpolatorObject.html#fromField_VALUE_CHANGED

As with other Java constructs, these field names get automatically generated into the Java SAI Library by using information found the X3D Object Model.  So these string constants are always correct and always available to the programmer.  It is always valuable to try pushing error detection from end-user run time (ouch) to programmer compile time (aha, a bug to fix).  These good programming practices add up, and all help X3D Quality Assurance (QA).


3. Test program and library are getting daily improvements.  Source and resultant demo scene online at

http://www.web3d.org/specifications/java/examples/
http://www.web3d.org/specifications/java/examples/HelloWorldProgram.java
http://www.web3d.org/specifications/java/examples/HelloWorldProgramOutput.x3d

inversion control
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/java/examples

Have fun with X3D Java!

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HelloWorldProgram.java.png
Type: image/png
Size: 39287 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20161104/81aa7236/attachment-0001.png>


More information about the x3d-public mailing list