[x3d-public] initial release: X3D to Java translations, javadoc in X3D Examples Archives

Don Brutzman brutzman at nps.edu
Mon Apr 3 09:38:36 PDT 2017


Am happy to report that initial release of 250 Java translations for X3D programs in the Web3D Example Archives is now online.

Initial releases include X3dForWebAuthors and X3dForAdvancedModeling.

	http://x3dgraphics.com/examples/X3dForWebAuthors
	http://x3dgraphics.com/examples/X3dForWebAuthors/javadoc

	http://x3dgraphics.com/examples/X3dForAdvancedModeling
	http://x3dgraphics.com/examples/X3dForAdvancedModeling/javadoc

As described in the docs, this uses the X3dToJava.xslt stylesheet for conversions.  Each index page for each example model has links to corresponding java and javadoc (as well as .x3d .x3dv .json x3dom cobweb html etc. of course) for comparison.

John, this should really help us with ongoing testing and improvement of X3DJSAIL API and X3D Java programs.  Thanks for your patience with the short hiatus for this important unit-testing milestone.  It is pretty exciting actually since it lets us compare java-to-java code patterns and also can make the API even better.

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

Let's pick one model as an example.  How about BoxSwitch.x3d scene:

	http://x3dgraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitchIndex.html

	http://x3dgraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitch.java
	http://x3dgraphics.com/examples/X3dForAdvancedModeling/javadoc/index.html?X3dForAdvancedModeling/Animation/BoxSwitch.html

	http://x3dgraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitch.json

John, please skip past the header and javadoc business and look closely at the java/json source below.  This will also help us debug and improve the .json converters at the same time.  How do these versions look?  Improvements and conundrums welcome...  Files also attached "for the official record."  8)

The challenge encountered during this process was the need to rename directory names and file names to omit hyphen and period characters - those are not allowed as Java package or class names.  A number of rename fixes were made for X3dForAdvancedModeling.  *Hopefully the corresponding online link fixes are satisfactory* - trouble reports welcome.  Next "on deck" is the VRML 2 Sourcebook, lots of renaming is necessary for this to work.  Naming conventions can be found in the X3D Scene Authoring Hints at

	http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#NamingConventions

As an example of debugging strength, this publishing process revealed a number of conversion problems for MFDouble, SFImage, field/fieldValue.addChild invocations, etc.  All discovered deficiencies fixed in the converter, no new bugs found on X3DJSAIL, changes checked in steadily, continued progress expected.

So, onward we go.  Have fun with X3D Java!  8)

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

/*
Copyright (c) 1995-2017 held by the author(s).  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer
      in the documentation and/or other materials provided with the
      distribution.
    * Neither the name of the Web3D Consortium (http://www.web3D.org)
      nor the names of its contributors may be used to endorse or
      promote products derived from this software without specific
      prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/

import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.EnvironmentalEffects.*;
import org.web3d.x3d.jsail.EventUtilities.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.Interpolation.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Texturing.*;
import org.web3d.x3d.jsail.Time.*;

// Javadoc annotations follow, see below for source.
/**
 * <p> Demonstrate simple Switch animation by sequencing through a set of Box nodes that are each covered by a different ImageTexture. </p>
 <p> Related links: <a href="../../../Animation/BoxSwitch.java">BoxSwitch.java</a> source, <a href="../../../Animation/BoxSwitchIndex.html" target="_top">BoxSwitch catalog page</a>, <a href="http://www.web3d.org/x3d/content/examples/X3dResources.html" target="_blank">X3D Resources</a>, <a href="http://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html" target="_blank">X3D Scene Authoring Hints</a> and <a href="http://www.web3d.org/x3d/content/X3dTooltips.html" target="_blank">X3D Tooltips</a>. </p>
	<table style="color:black; border:0px solid; border-spacing:10px 0px;" summary="Scene Metadata">
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center;">meta tags</td>
			<td style="text-align:left;"> Scene Metadata </td>
		</tr>

		<tr>
			<td style="text-align:right; vertical-align: text-top;"> title </td>
			<td> <a href="../../../Animation/BoxSwitch.x3d">BoxSwitch.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> creator </td>
			<td> Don Brutzman </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> created </td>
			<td> 30 December 2015 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> modified </td>
			<td> 1 April 2017 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> description </td>
			<td> Demonstrate simple Switch animation by sequencing through a set of Box nodes that are each covered by a different ImageTexture. </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> MovingImage </td>
			<td> <a href="../../../Animation/BoxSwitch.mp4">BoxSwitch.mp4</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> reference </td>
			<td> <a href="../../../Animation/../GeometricShapes/CubeWithLabeledSides.x3d">../GeometricShapes/CubeWithLabeledSides.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> drawing </td>
			<td> <a href="../../../Animation/../GeometricShapes/images/CubeSideImages.vsd">../GeometricShapes/images/CubeSideImages.vsd</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> identifier </td>
			<td> <a href="http://x3dGraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitch.x3d" target="_blank">http://x3dGraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitch.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> generator </td>
			<td> X3D-Edit 3.3, <a href="https://savage.nps.edu/X3D-Edit" target="_blank">https://savage.nps.edu/X3D-Edit</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> license </td>
			<td> <a href="../../../Animation/../license.html">../license.html</a> </td>
		</tr>
		<tr> <td colspan="2"> <hr> </td> </tr>
	</table>

	<p>
		This program uses the
		<a href="http://www.web3d.org/specifications/java/X3DJSAIL.html" target="_blank">X3D Java Scene Access Interface Library (X3DJSAIL)</a>.
		It has been produced using the 
		<a href="http://www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank">X3dToJava.xslt</a>
		stylesheet to create Java source code from an <code>.x3d</code> scene.
	</p>

 * @author Don Brutzman
 */

public class BoxSwitch
{
  /** Default constructor to create this object. */
  public BoxSwitch ()
  {
    initialize();
  }
	
  /** Create and initialize the X3D model. */
  public void initialize()
  {
  X3DObject x3dModelObjectTree = new X3DObject().setProfile("Immersive").setVersion("3.3")
  .setHead(new headObject()
    .setMeta(new metaObject().setName("title").setContent("BoxSwitch.x3d"))
    .setMeta(new metaObject().setName("creator").setContent("Don Brutzman"))
    .setMeta(new metaObject().setName("created").setContent("30 December 2015"))
    .setMeta(new metaObject().setName("modified").setContent("1 April 2017"))
    .setMeta(new metaObject().setName("description").setContent("Demonstrate simple Switch animation by sequencing through a set of Box nodes that are each covered by a different ImageTexture."))
    .setMeta(new metaObject().setName("MovingImage").setContent("BoxSwitch.mp4"))
    .setMeta(new metaObject().setName("reference").setContent("../GeometricShapes/CubeWithLabeledSides.x3d"))
    .setMeta(new metaObject().setName("drawing").setContent("../GeometricShapes/images/CubeSideImages.vsd"))
    .setMeta(new metaObject().setName("identifier").setContent("http://x3dGraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitch.x3d"))
    .setMeta(new metaObject().setName("generator").setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"))
    .setMeta(new metaObject().setName("license").setContent("../license.html")))
  .setScene(new SceneObject()
    .addChild(new BackgroundObject().setSkyColor(new MFColorObject(new float[] {0.8f,0.8f,0.9f})))
    .addChild(new NavigationInfoObject())
    .addChild(new SwitchObject("BoxSwitcher").setWhichChoice(-1)
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/RedImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/RedImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/GreenImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/GreenImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/TurquoiseImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/TurquoiseImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/YellowImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/YellowImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/WhiteImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/WhiteImage.png\"")))))
      .addChild(new ShapeObject()
        .setGeometry(new BoxObject().setUSE("UnitBox"))
        .setAppearance(new AppearanceObject()
          .setTexture(new ImageTextureObject().setUrl(new MFStringObject("\"../GeometricShapes/images/GreyImage.png\" \"http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/GreyImage.png\""))))))
    .addComments(" Animated Box ")
    .addChild(new TimeSensorObject("Clock").setCycleInterval(12).setLoop(true))
    .addChild(new IntegerSequencerObject("Sequencer").setKey(new float[] {0.0f,0.1667f,0.3333f,0.5f,0.6667f,0.8333f,1.0f}).setKeyValue(new int[] {0,1,2,3,4,5,0}))
    .addChild(new ROUTEObject().setFromField("fraction_changed").setFromNode("Clock").setToField("set_fraction").setToNode("Sequencer"))
    .addChild(new ROUTEObject().setFromField("value_changed").setFromNode("Sequencer").setToField("whichChoice").setToNode("BoxSwitcher"))
    .addChild(new ViewpointObject("OrbitingView").setPosition(-8.0f,0.0f,0.0f).setOrientation(0.0f,1.0f,0.0f,-1.57f).setDescription("Orbiting view"))
    .addComments(" Animated Viewpoint, orbiting about the origin ")
    .addChild(new PositionInterpolatorObject("CircularPathPositionInterpolator").setKeyValue(new MFVec3fObject() /* splitting up long array to improve compilability */
.append(new MFVec3fObject(new float[] {0.0f,0.0f,8.0f,1.389f,0.0f,7.878f,2.736f,0.0f,7.518f,4.0f,0.0f,6.928f,5.142f,0.0f,6.128f,6.128f,0.0f,5.142f,6.928f,0.0f,4.0f,7.518f,0.0f,2.736f,7.878f,0.0f,1.389f,8.0f,0.0f,0.0f}))
.append(new MFVec3fObject(new float[] {7.878f,0.0f,-1.389f,7.518f,0.0f,-2.736f,6.928f,0.0f,-4.0f,6.128f,0.0f,-5.142f,5.142f,0.0f,-6.128f,4.0f,0.0f,-6.928f,2.736f,0.0f,-7.518f,1.389f,0.0f,-7.878f,0.0f,0.0f,-8.0f,-1.389f,0.0f,-7.878f}))
.append(new MFVec3fObject(new float[] {-2.736f,0.0f,-7.518f,-4.0f,0.0f,-6.928f,-5.142f,0.0f,-6.128f,-6.128f,0.0f,-5.142f,-6.928f,0.0f,-4.0f,-7.518f,0.0f,-2.736f,-7.878f,0.0f,-1.389f,-8.0f,0.0f,-0.0f,-7.878f,0.0f,1.389f,-7.518f,0.0f,2.736f}))
.append(new MFVec3fObject(new float[] {-6.928f,0.0f,4.0f,-6.128f,0.0f,5.142f,-5.142f,0.0f,6.128f,-4.0f,0.0f,6.928f,-2.736f,0.0f,7.518f,-1.389f,0.0f,7.878f,0.0f,0.0f,8.0f}))).setKey(new float[] {0.0f,0.02778f,0.05556f,0.08333f,0.11111f,0.13889f,0.16667f,0.19444f,0.22222f,0.25f,0.27778f,0.30556f,0.33333f,0.36111f,0.38889f,0.41667f,0.44444f,0.47222f,0.5f,0.52778f,0.55556f,0.58333f,0.61111f,0.63889f,0.66667f,0.69444f,0.72222f,0.75f,0.77778f,0.80556f,0.83333f,0.86111f,0.88889f,0.91667f,0.94444f,0.97222f,1.0f}))
    .addChild(new ROUTEObject().setFromField("fraction_changed").setFromNode("Clock").setToField("set_fraction").setToNode("CircularPathPositionInterpolator"))
    .addChild(new ROUTEObject().setFromField("value_changed").setFromNode("CircularPathPositionInterpolator").setToField("position").setToNode("OrbitingView"))
    .addChild(new OrientationInterpolatorObject("CenterFacingOrientationInterpolator").setKey(new float[] {0.0f,0.3333f,0.6667f,1.0f}).setKeyValue(new MFRotationObject(new float[] {0.0f,1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,2.094395f,0.0f,1.0f,0.0f,4.18879f,0.0f,1.0f,0.0f,0.0f})))
    .addChild(new ROUTEObject().setFromField("fraction_changed").setFromNode("Clock").setToField("set_fraction").setToNode("CenterFacingOrientationInterpolator"))
    .addChild(new ROUTEObject().setFromField("value_changed").setFromNode("CenterFacingOrientationInterpolator").setToField("orientation").setToNode("OrbitingView"))
    .addComments(" Additional Viewpoints ")
    .addChild(new ViewpointObject().setOrientation(0.0f,1.0f,0.0f,1.57f).setPosition(8.0f,0.0f,0.0f).setDescription("Front view"))
    .addChild(new ViewpointObject().setPosition(-8.0f,0.0f,0.0f).setOrientation(0.0f,1.0f,0.0f,-1.57f).setDescription("Back view"))
    .addChild(new ViewpointObject().setPosition(0.0f,0.0f,8.0f).setDescription("Left view"))
    .addChild(new ViewpointObject().setPosition(0.0f,0.0f,-8.0f).setOrientation(0.0f,1.0f,0.0f,3.1416f).setDescription("Right view"))
    .addChild(new ViewpointObject().setPosition(0.0f,8.0f,0.0f).setOrientation(1.0f,0.0f,0.0f,-1.57f).setDescription("Top view"))
    .addChild(new ViewpointObject().setPosition(0.0f,-8.0f,0.0f).setOrientation(1.0f,0.0f,0.0f,1.57f).setDescription("Bottom view")));

  }
  /** The initialized model object. */
  private X3DObject x3dModel = new X3DObject();
  
  /** Provide a shallow copy of the X3D model.
   * @return BoxSwitch model
   */
  public X3DObject getX3dModel ()
  {	  
	  return x3dModel;
  }
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BoxSwitch.x3d
Type: model/x3d+xml
Size: 5546 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170403/dce30e76/attachment-0001.x3d>
-------------- next part --------------
{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Immersive",
    "@version":"3.3",
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"BoxSwitch.x3d"
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"30 December 2015"
          },
          {
            "@name":"modified",
            "@content":"1 April 2017"
          },
          {
            "@name":"description",
            "@content":"Demonstrate simple Switch animation by sequencing through a set of Box nodes that are each covered by a different ImageTexture."
          },
          {
            "@name":"MovingImage",
            "@content":"BoxSwitch.mp4"
          },
          {
            "@name":"reference",
            "@content":"../GeometricShapes/CubeWithLabeledSides.x3d"
          },
          {
            "@name":"drawing",
            "@content":"../GeometricShapes/images/CubeSideImages.vsd"
          },
          {
            "@name":"identifier",
            "@content":"http://x3dGraphics.com/examples/X3dForAdvancedModeling/Animation/BoxSwitch.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"01 April 2017"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, http://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"warning",
            "@content":"An experimental version of X3D JSON encoding is used for this scene.  Status online at http://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "Background":
            {
              "@skyColor":[0.8,0.8,0.9]
            }
          },
          { "NavigationInfo":
            {
            }
          },
          { "Switch":
            {
              "@DEF":"BoxSwitcher",
              "@whichChoice":-1,
              "-children":[
                { "Shape":
                  {
                    "-geometry":
                      { "Box":
                        {
                          "@DEF":"UnitBox"
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-texture":
                            { "ImageTexture":
                              {
                                "@url":["../GeometricShapes/images/RedImage.png","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/RedImage.png"]
                              }
                            }
                        }
                      }
                  }
                },
                { "Shape":
                  {
                    "-geometry":
                      { "Box":
                        {
                          "@USE":"UnitBox"
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-texture":
                            { "ImageTexture":
                              {
                                "@url":["../GeometricShapes/images/GreenImage.png","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/GreenImage.png"]
                              }
                            }
                        }
                      }
                  }
                },
                { "Shape":
                  {
                    "-geometry":
                      { "Box":
                        {
                          "@USE":"UnitBox"
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-texture":
                            { "ImageTexture":
                              {
                                "@url":["../GeometricShapes/images/TurquoiseImage.png","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/TurquoiseImage.png"]
                              }
                            }
                        }
                      }
                  }
                },
                { "Shape":
                  {
                    "-geometry":
                      { "Box":
                        {
                          "@USE":"UnitBox"
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-texture":
                            { "ImageTexture":
                              {
                                "@url":["../GeometricShapes/images/YellowImage.png","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/YellowImage.png"]
                              }
                            }
                        }
                      }
                  }
                },
                { "Shape":
                  {
                    "-geometry":
                      { "Box":
                        {
                          "@USE":"UnitBox"
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-texture":
                            { "ImageTexture":
                              {
                                "@url":["../GeometricShapes/images/WhiteImage.png","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/WhiteImage.png"]
                              }
                            }
                        }
                      }
                  }
                },
                { "Shape":
                  {
                    "-geometry":
                      { "Box":
                        {
                          "@USE":"UnitBox"
                        }
                      },
                    "-appearance":
                      { "Appearance":
                        {
                          "-texture":
                            { "ImageTexture":
                              {
                                "@url":["../GeometricShapes/images/GreyImage.png","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/images/GreyImage.png"]
                              }
                            }
                        }
                      }
                  }
                }
              ]
            }
          },
          {
            "#comment":"Animated Box"
          },
          { "TimeSensor":
            {
              "@DEF":"Clock",
              "@cycleInterval":12,
              "@loop":true
            }
          },
          { "IntegerSequencer":
            {
              "@DEF":"Sequencer",
              "@key":[0,0.1667,0.3333,0.5,0.6667,0.8333,1],
              "@keyValue":[0,1,2,3,4,5,0]
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"Clock",
              "@toField":"set_fraction",
              "@toNode":"Sequencer"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"Sequencer",
              "@toField":"whichChoice",
              "@toNode":"BoxSwitcher"
            }
          },
          { "Viewpoint":
            {
              "@DEF":"OrbitingView",
              "@description":"Orbiting view",
              "@orientation":[0,1,0,-1.57],
              "@position":[-8,0,0]
            }
          },
          {
            "#comment":"Animated Viewpoint, orbiting about the origin"
          },
          { "PositionInterpolator":
            {
              "@DEF":"CircularPathPositionInterpolator",
              "@key":[0,0.02778,0.05556,0.08333,0.11111,0.13889,0.16667,0.19444,0.22222,0.25,0.27778,0.30556,0.33333,0.36111,0.38889,0.41667,0.44444,0.47222,0.5,0.52778,0.55556,0.58333,0.61111,0.63889,0.66667,0.69444,0.72222,0.75,0.77778,0.80556,0.83333,0.86111,0.88889,0.91667,0.94444,0.97222,1],
              "@keyValue":[0,0,8,1.389,0,7.878,2.736,0,7.518,4,0,6.928,5.142,0,6.128,6.128,0,5.142,6.928,0,4,7.518,0,2.736,7.878,0,1.389,8,0,0,7.878,0,-1.389,7.518,0,-2.736,6.928,0,-4,6.128,0,-5.142,5.142,0,-6.128,4,0,-6.928,2.736,0,-7.518,1.389,0,-7.878,0,0,-8,-1.389,0,-7.878,-2.736,0,-7.518,-4,0,-6.928,-5.142,0,-6.128,-6.128,0,-5.142,-6.928,0,-4,-7.518,0,-2.736,-7.878,0,-1.389,-8,0,-0,-7.878,0,1.389,-7.518,0,2.736,-6.928,0,4,-6.128,0,5.142,-5.142,0,6.128,-4,0,6.928,-2.736,0,7.518,-1.389,0,7.878,0,0,8]
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"Clock",
              "@toField":"set_fraction",
              "@toNode":"CircularPathPositionInterpolator"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"CircularPathPositionInterpolator",
              "@toField":"position",
              "@toNode":"OrbitingView"
            }
          },
          { "OrientationInterpolator":
            {
              "@DEF":"CenterFacingOrientationInterpolator",
              "@key":[0,0.3333,0.6667,1],
              "@keyValue":[0,1,0,0,0,1,0,2.094395,0,1,0,4.18879,0,1,0,0]
            }
          },
          { "ROUTE":
            {
              "@fromField":"fraction_changed",
              "@fromNode":"Clock",
              "@toField":"set_fraction",
              "@toNode":"CenterFacingOrientationInterpolator"
            }
          },
          { "ROUTE":
            {
              "@fromField":"value_changed",
              "@fromNode":"CenterFacingOrientationInterpolator",
              "@toField":"orientation",
              "@toNode":"OrbitingView"
            }
          },
          {
            "#comment":"Additional Viewpoints"
          },
          { "Viewpoint":
            {
              "@description":"Front view",
              "@orientation":[0,1,0,1.57],
              "@position":[8,0,0]
            }
          },
          { "Viewpoint":
            {
              "@description":"Back view",
              "@orientation":[0,1,0,-1.57],
              "@position":[-8,0,0]
            }
          },
          { "Viewpoint":
            {
              "@description":"Left view",
              "@position":[0,0,8]
            }
          },
          { "Viewpoint":
            {
              "@description":"Right view",
              "@orientation":[0,1,0,3.1416],
              "@position":[0,0,-8]
            }
          },
          { "Viewpoint":
            {
              "@description":"Top view",
              "@orientation":[1,0,0,-1.57],
              "@position":[0,8,0]
            }
          },
          { "Viewpoint":
            {
              "@description":"Bottom view",
              "@orientation":[1,0,0,1.57],
              "@position":[0,-8,0]
            }
          }
        ]
    }
  }
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BoxSwitch.mp4
Type: video/mp4
Size: 247566 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170403/dce30e76/attachment-0001.mp4>


More information about the x3d-public mailing list