package X3dForAdvancedModeling.SanCarlosCathedral;

import org.web3d.x3d.jsail.Core.*;
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.Lighting.*;
import org.web3d.x3d.jsail.PointingDeviceSensor.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Text.*;
import org.web3d.x3d.jsail.Time.*;

// Javadoc metadata annotations follow, see below for X3DJSAIL Java source code.
/**
 * <p> Lighting alternatives for best rendering the cathedral. </p>
 <p> Related links: Catalog page <a href="../../../SanCarlosCathedral/LightingAlternativesIndex.html" target="_blank">LightingAlternatives</a>,  source <a href="../../../SanCarlosCathedral/LightingAlternatives.java">LightingAlternatives.java</a>, <a href="https://www.web3d.org/x3d/content/examples/X3dResources.html" target="_blank">X3D Resources</a>, <a href="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html" target="_blank">X3D Scene Authoring Hints</a>, and <a href="https://www.web3d.org/x3d/content/X3dTooltips.html" target="_blank">X3D Tooltips</a>. </p>
	<table style="color:black; border:0px solid; border-spacing:10px 0px;">
        <caption>Scene Meta Information</caption>
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center; padding:10px 0px;"><i>meta tags</i></td>
			<td style="text-align:left;   padding:10px 0px;">&nbsp; Document Metadata </td>
		</tr>

		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> title </i> </td>
			<td> <a href="../../../SanCarlosCathedral/LightingAlternatives.x3d">LightingAlternatives.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> description </i> </td>
			<td> Lighting alternatives for best rendering the cathedral. </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> creator </i> </td>
			<td> Michele Foti and Don Brutzman </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> created </i> </td>
			<td> 19 March 2012 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> modified </i> </td>
			<td> 20 October 2019 </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="../../../SanCarlosCathedral/TODO.html">TODO.html</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="http://www.sancarloscathedral.net" target="_blank">http://www.sancarloscathedral.net</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="../../../SanCarlosCathedral/RoyalPresidioChapelHistoricalReferences.pdf">RoyalPresidioChapelHistoricalReferences.pdf</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> <a href="../../../SanCarlosCathedral/CulturalHeritageProjectSanCarlosCathedral.pdf">CulturalHeritageProjectSanCarlosCathedral.pdf</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> reference </i> </td>
			<td> originals/ </td>
		</tr>
		<tr style="color:burntorange">
			<td style="text-align:right; vertical-align: text-top;"> <i> warning </i> </td>
			<td> under development </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> identifier </i> </td>
			<td> <a href="https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/SanCarlosCathedral/LightingAlternatives.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/SanCarlosCathedral/LightingAlternatives.x3d</a> </td>
		</tr>
		<tr>
			<td style="text-align:right; vertical-align: text-top;"> <i> generator </i> </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;"> <i> license </i> </td>
			<td> <a href="../../../SanCarlosCathedral/../license.html">../license.html</a> </td>
		</tr>
		<tr style="background-color:silver; border-color:silver;">
			<td style="text-align:center;" colspan="2">  &nbsp; </td>
		</tr>
	</table>

	<p>
		This program uses the
		<a href="https://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="https://www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank">X3dToJava.xslt</a>
		stylesheet
	       (<a href="https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/X3dToJava.xslt" target="_blank">version control</a>)
                which is used to create Java source code from an original <code>.x3d</code> model.
	</p>

	* @author Michele Foti and Don Brutzman
 */

public class LightingAlternatives
{
	/** Default constructor to create this object. */
	public LightingAlternatives ()
	{
	  initialize();
	}

	/** Create and initialize the X3D model for this object. */
	public final void initialize()
	{
            try { // catch-all
  x3dModel = new X3D().setProfile(X3D.PROFILE_IMMERSIVE).setVersion(X3D.VERSION_3_3)
  .setHead(new head()
    .addMeta(new meta().setName(meta.NAME_TITLE      ).setContent("LightingAlternatives.x3d"))
    .addMeta(new meta().setName(meta.NAME_DESCRIPTION).setContent("Lighting alternatives for best rendering the cathedral."))
    .addMeta(new meta().setName(meta.NAME_CREATOR    ).setContent("Michele Foti and Don Brutzman"))
    .addMeta(new meta().setName(meta.NAME_CREATED    ).setContent("19 March 2012"))
    .addMeta(new meta().setName(meta.NAME_MODIFIED   ).setContent("20 October 2019"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("TODO.html"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("http://www.sancarloscathedral.net"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("RoyalPresidioChapelHistoricalReferences.pdf"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("CulturalHeritageProjectSanCarlosCathedral.pdf"))
    .addMeta(new meta().setName(meta.NAME_REFERENCE  ).setContent("originals/"))
    .addMeta(new meta().setName(meta.NAME_WARNING    ).setContent("under development"))
    .addMeta(new meta().setName(meta.NAME_IDENTIFIER ).setContent("https://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/SanCarlosCathedral/LightingAlternatives.x3d"))
    .addMeta(new meta().setName(meta.NAME_GENERATOR  ).setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"))
    .addMeta(new meta().setName(meta.NAME_LICENSE    ).setContent("../license.html")))
  .addComments(" Index for DEF nodes: DirectionalLights, LightSwitch, Spotlights ")
  .setScene(new Scene()
    .addComments(" Note that turning off initial NavigationInfo headlight for WALK mode (interior viewing) must occur in parent scene, SanCarlosCathedral.x3d ")
    .addChild(new WorldInfo().setTitle("LightingAlternatives.x3d"))
    .addChild(new Switch("LightSwitch").setWhichChoice(0)
      .addChild(new Group("AlternativeLight1")
        .addComments(" Spotlights from windows (left side) ")
        .addChild(new SpotLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setCutOffAngle(1).setDirection(20.0,1.0,-40.0).setIntensity(0.2).setLocation(-6.0,1.0,-35.0))
        .addChild(new SpotLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setCutOffAngle(1).setDirection(20.0,1.0,-30.0).setIntensity(0.2).setLocation(1.7,1.0,-25.4))
        .addChild(new SpotLight().setAmbientIntensity(0.2).setColor(0.7,0.7,0.7).setCutOffAngle(1).setDirection(20.0,1.0,-20.0).setIntensity(0.4).setLocation(1.7,1.0,-17.0)))
      .addChild(new Group("AlternativeLight2")
        .addComments(" DirectionalLights. They don't seem to work when child of a group node ")
        .addChild(new DirectionalLight().setColor(0.4,0.4,0.4).setDirection(-20.0,1.0,0.0))
        .addChild(new DirectionalLight().setColor(0.4,0.4,0.4).setDirection(20.0,1.0,0.0))
        .addChild(new DirectionalLight().setColor(0.4,0.4,0.4).setDirection(0.0,1.0,20.0))
        .addChild(new DirectionalLight().setColor(0.4,0.4,0.4).setDirection(0.0,1.0,-60.0)))
      .addChild(new Group("AlternativeLight3")
        .addComments(" Spotlights from windows (left side). It simulates a \"First morning beam\" ")
        .addChild(new DirectionalLight().setColor(0.5,0.5,0.5).setDirection(20.0,1.0,30.0).setIntensity(0.5))
        .addChild(new DirectionalLight().setColor(0.5,0.5,0.5).setDirection(-20.0,1.0,30.0).setIntensity(0.5))
        .addChild(new SpotLight().setAmbientIntensity(0.4).setBeamWidth(1.5).setCutOffAngle(1).setDirection(20.0,1.0,-50.0).setLocation(-6.0,1.0,-35.0).setRadius(10))
        .addChild(new SpotLight().setAmbientIntensity(0.4).setBeamWidth(1.5).setCutOffAngle(1).setDirection(20.0,1.0,-40.0).setLocation(1.7,1.0,-25.4).setRadius(10))
        .addChild(new SpotLight().setAmbientIntensity(0.4).setBeamWidth(1.5).setCutOffAngle(1).setDirection(20.0,1.0,-57.0).setLocation(1.7,1.0,-17.0).setRadius(10)))
      .addChild(new Group("AlternativeLight4")
        .addComments(" Spotlights from windows (left side). It simulates a \"Morning Light\" ")
        .addChild(new DirectionalLight().setColor(0.6,0.6,0.6).setDirection(20.0,1.0,-30.0).setIntensity(0.6))
        .addChild(new DirectionalLight().setColor(0.6,0.6,0.6).setDirection(-20.0,1.0,-30.0).setIntensity(0.6))
        .addChild(new SpotLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setCutOffAngle(1).setDirection(20.0,1.0,-40.0).setIntensity(0.6).setLocation(-6.0,1.0,-35.0).setRadius(10))
        .addChild(new SpotLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setCutOffAngle(1).setDirection(20.0,1.0,-30.0).setIntensity(0.6).setLocation(1.7,1.0,-25.4).setRadius(10))
        .addChild(new SpotLight().setAmbientIntensity(0.2).setBeamWidth(1).setColor(0.6,0.6,0.6).setCutOffAngle(1).setDirection(20.0,1.0,-20.0).setIntensity(0.6).setLocation(1.7,1.0,-17.0).setRadius(10)))
      .addChild(new Group("AlternativeLight5")
        .addComments(" PointLights from chandeliers, simulating artificial light ")
        .addChild(new PointLight("Point1").setColor(0.8,0.8,0.8).setIntensity(0.8).setLocation(5.8,2.4,-11.5).setRadius(12.5))
        .addChild(new PointLight("Point2").setColor(0.8,0.8,0.8).setIntensity(0.8).setLocation(5.8,2.4,-23.0).setRadius(12.5))
        .addChild(new PointLight("Point3").setColor(0.8,0.8,0.8).setIntensity(0.8).setLocation(-1.4,2.4,-34.5).setRadius(12.5))
        .addChild(new PointLight("Point4").setColor(0.8,0.8,0.8).setIntensity(0.8).setLocation(13.0,2.4,-34.5).setRadius(12.5))
        .addChild(new PointLight("Point5").setColor(0.8,0.8,0.8).setIntensity(0.8).setLocation(5.8,2.4,-34.5).setRadius(12.5))
        .addChild(new PointLight("Point6").setColor(0.8,0.8,0.8).setIntensity(0.8).setLocation(5.8,1.0,-1.0).setRadius(12.5))
        .addChild(new PointLight("Point7").setColor(0.8,0.8,0.8).setIntensity(0.8).setLocation(5.8,1.0,-5.0).setRadius(12.5)))
      .addChild(new Group("AlternativeLight6")
        .addComments(" PointLights from chandeliers, simulating artificial light. Tested with HeadLight ON ")
        .addChild(new PointLight("Point1a").setColor(0.5,0.5,0.5).setIntensity(0.5).setLocation(5.8,2.4,-11.5).setRadius(8))
        .addChild(new PointLight("Point2a").setColor(0.5,0.5,0.5).setIntensity(0.5).setLocation(5.8,2.4,-23.0).setRadius(8))
        .addChild(new PointLight("Point3a").setColor(0.5,0.5,0.5).setIntensity(0.5).setLocation(-1.4,2.4,-34.5).setRadius(8))
        .addChild(new PointLight("Point4a").setColor(0.5,0.5,0.5).setIntensity(0.5).setLocation(13.0,2.4,-34.5).setRadius(8))
        .addChild(new PointLight("Point5a").setColor(0.5,0.5,0.5).setIntensity(0.5).setLocation(5.8,2.4,-34.5).setRadius(8))
        .addChild(new PointLight("Point6a").setColor(0.5,0.5,0.5).setIntensity(0.5).setLocation(5.8,1.0,-1.0).setRadius(8))
        .addChild(new PointLight("Point7a").setColor(0.5,0.5,0.5).setIntensity(0.5).setLocation(5.8,1.0,-5.0).setRadius(8)))
      .addChild(new Group("AlternativeLight7")
        .addComments(" PointLights from windows (left side). Simulating sunlight ")
        .addChild(new PointLight().setIntensity(0.5).setLocation(-6.0,1.0,-35.0))
        .addChild(new PointLight().setColor(0.1,0.1,0.1).setIntensity(0.05).setLocation(1.7,1.0,-25.4).setRadius(10))
        .addChild(new PointLight().setAmbientIntensity(0.4).setColor(0.5,0.5,0.5).setIntensity(0.7).setLocation(1.7,1.0,-17.0).setRadius(10))
        .addChild(new PointLight().setAmbientIntensity(0.4).setColor(0.5,0.5,0.5).setIntensity(0.8).setLocation(1.7,1.0,-7.5).setRadius(10)))
      .addChild(new Group("AlternativeLight8")
        .addComments(" PointLights from windows (left side). Simulating sunlight. Changing Radius Changes the \"Intensity\" ")
        .addChild(new PointLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setIntensity(0.2).setLocation(-6.0,1.0,-35.0).setRadius(30))
        .addChild(new PointLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setIntensity(0.2).setLocation(1.7,1.0,-25.4).setRadius(30))
        .addChild(new PointLight().setAmbientIntensity(0.4).setColor(0.7,0.7,0.7).setIntensity(0.4).setLocation(1.7,1.0,-17.0).setRadius(30))
        .addChild(new PointLight().setAmbientIntensity(0.4).setColor(0.7,0.7,0.7).setIntensity(0.4).setLocation(1.7,1.0,-7.5).setRadius(30)))
      .addChild(new Group("AlternativeLight9")
        .addComments(" PointLights from windows (both sides, six windows). Good inside navigation. ")
        .addChild(new PointLight().setAmbientIntensity(0.6).setColor(0.5,0.5,0.5).setIntensity(0.6).setLocation(1.7,1.0,-25.4).setRadius(30))
        .addChild(new PointLight().setAmbientIntensity(0.3).setColor(0.7,0.7,0.7).setIntensity(0.3).setLocation(1.7,1.0,-17.0).setRadius(10))
        .addChild(new PointLight().setAmbientIntensity(0.01).setColor(0.4,0.4,0.4).setIntensity(0.01).setLocation(1.7,1.0,-7.5).setRadius(5))
        .addChild(new PointLight().setAmbientIntensity(0.6).setColor(0.5,0.5,0.5).setIntensity(0.6).setLocation(9.0,1.0,-25.4).setRadius(30))
        .addChild(new PointLight().setAmbientIntensity(0.3).setColor(0.7,0.7,0.7).setIntensity(0.3).setLocation(9.0,1.0,-17.0).setRadius(10))
        .addChild(new PointLight().setAmbientIntensity(0.01).setColor(0.1,0.1,0.1).setIntensity(0.01).setLocation(9.0,1.0,-7.5).setRadius(5)))
      .addChild(new Group("AlternativeLight10")
        .addComments(" PointLights from windows (left side). Good inside navigation, but the light is too uniform on one side ")
        .addChild(new PointLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setIntensity(0.2).setLocation(-6.0,1.0,-35.0))
        .addChild(new PointLight().setAmbientIntensity(0.2).setColor(0.4,0.4,0.4).setIntensity(0.2).setLocation(1.7,1.0,-25.4))
        .addChild(new PointLight().setAmbientIntensity(0.4).setColor(0.7,0.7,0.7).setIntensity(0.4).setLocation(1.7,1.0,-17.0))
        .addChild(new PointLight().setAmbientIntensity(0.4).setColor(0.7,0.7,0.7).setIntensity(0.4).setLocation(1.7,1.0,-7.5))))
    .addChild(new Transform("Maintch").setTranslation(2.0,2.4,-16.75)
      .addChild(new TouchSensor("touch").setDescription("Click here to start"))
      .addChild(new Shape()
        .setGeometry(new Sphere())
        .setAppearance(new Appearance()
          .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
    .addChild(new Transform("maintouch").setTranslation(0.0,-5.0,0.0)
      .addChild(new Transform("tch0").setTranslation(3.0,1.7,-15.525)
        .addChild(new Transform("tex0").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light1"})
              .setFontStyle(new FontStyle("TextFontStyle").setJustify(FontStyle.JUSTIFY_MIDDLE_MIDDLE).setSize(0.15)))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0)))))
        .addChild(new Transform("tex02").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light1"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch0").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch1").setTranslation(3.5,1.7,-15.525)
        .addChild(new Transform("tex1").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light2"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex12").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light2"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch1").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch2").setTranslation(4.0,1.7,-15.525)
        .addChild(new Transform("tex2").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light3"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex22").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light3"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch2").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch3").setTranslation(4.5,1.7,-15.525)
        .addChild(new Transform("tex3").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light4"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex32").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light4"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch3").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch4").setTranslation(5.0,1.7,-15.525)
        .addChild(new Transform("tex4").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light5"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex42").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light5"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch4").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch5").setTranslation(5.5,1.7,-15.525)
        .addChild(new Transform("tex5").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light6"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex52").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light6"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch5").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch6").setTranslation(6.0,1.7,-15.525)
        .addChild(new Transform("tex6").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light7"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex62").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light7"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch6").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch7").setTranslation(6.5,1.7,-15.525)
        .addChild(new Transform("tex7").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light8"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex72").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light8"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch7").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch8").setTranslation(7.0,1.7,-15.525)
        .addChild(new Transform("tex8").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light9"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex82").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light9"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch8").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0)))))
      .addChild(new Transform("tch9").setTranslation(7.5,1.7,-15.525)
        .addChild(new Transform("tex9").setTranslation(-0.15,-0.05,0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light10"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new Transform("tex92").setRotation(0.0,1.0,0.0,3.14).setTranslation(0.15,-0.05,-0.2)
          .addChild(new Shape()
            .setGeometry(new Text().setString(new String[] {"Light10"})
              .setFontStyle(new FontStyle().setUSE("TextFontStyle")))
            .setAppearance(new Appearance()
              .setMaterial(new Material().setDiffuseColor(1.0,1.0,1.0).setTransparency(1)))))
        .addChild(new TouchSensor("touch9").setDescription("Click here to start"))
        .addChild(new Shape()
          .setGeometry(new Sphere().setRadius(0.2))
          .setAppearance(new Appearance()
            .setMaterial(new Material().setDiffuseColor(1.0,0.0,1.0))))))
    .addChild(new TimeSensor("time").setCycleInterval(15))
    .addChild(new TimeSensor("time0"))
    .addChild(new TimeSensor("time1"))
    .addChild(new TimeSensor("time2"))
    .addChild(new TimeSensor("time3"))
    .addChild(new TimeSensor("time4"))
    .addChild(new TimeSensor("time5"))
    .addChild(new TimeSensor("time6"))
    .addChild(new TimeSensor("time7"))
    .addChild(new TimeSensor("time8"))
    .addChild(new TimeSensor("time9"))
    .addChild(new ROUTE().setFromNode("touch").setFromField("touchTime").setToNode("time").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch0").setFromField("touchTime").setToNode("time0").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch1").setFromField("touchTime").setToNode("time1").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch2").setFromField("touchTime").setToNode("time2").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch3").setFromField("touchTime").setToNode("time3").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch4").setFromField("touchTime").setToNode("time4").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch5").setFromField("touchTime").setToNode("time5").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch6").setFromField("touchTime").setToNode("time6").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch7").setFromField("touchTime").setToNode("time7").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch8").setFromField("touchTime").setToNode("time8").setToField("startTime"))
    .addChild(new ROUTE().setFromNode("touch9").setFromField("touchTime").setToNode("time9").setToField("startTime"))
    .addChild(new PositionInterpolator("Sequenc").setKey(new double[] {0.0,0.01,0.99,1.0}).setKeyValue(new MFVec3f(new double[] {0.0,-5.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-5.0,0.0})))
    .addChild(new IntegerSequencer("Sequenc0").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,0}))
    .addChild(new IntegerSequencer("Sequenc1").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,1}))
    .addChild(new IntegerSequencer("Sequenc2").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,2}))
    .addChild(new IntegerSequencer("Sequenc3").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,3}))
    .addChild(new IntegerSequencer("Sequenc4").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,4}))
    .addChild(new IntegerSequencer("Sequenc5").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,5}))
    .addChild(new IntegerSequencer("Sequenc6").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,6}))
    .addChild(new IntegerSequencer("Sequenc7").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,7}))
    .addChild(new IntegerSequencer("Sequenc8").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,8}))
    .addChild(new IntegerSequencer("Sequenc9").setKey(new double[] {0.0,1.0}).setKeyValue(new int[] {0,9}))
    .addChild(new ROUTE().setFromNode("time").setFromField("fraction_changed").setToNode("Sequenc").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time0").setFromField("fraction_changed").setToNode("Sequenc0").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time1").setFromField("fraction_changed").setToNode("Sequenc1").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time2").setFromField("fraction_changed").setToNode("Sequenc2").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time3").setFromField("fraction_changed").setToNode("Sequenc3").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time4").setFromField("fraction_changed").setToNode("Sequenc4").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time5").setFromField("fraction_changed").setToNode("Sequenc5").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time6").setFromField("fraction_changed").setToNode("Sequenc6").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time7").setFromField("fraction_changed").setToNode("Sequenc7").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time8").setFromField("fraction_changed").setToNode("Sequenc8").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("time9").setFromField("fraction_changed").setToNode("Sequenc9").setToField("set_fraction"))
    .addChild(new ROUTE().setFromNode("Sequenc").setFromField("value_changed").setToNode("maintouch").setToField("translation"))
    .addChild(new ROUTE().setFromNode("Sequenc0").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc1").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc2").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc3").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc4").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc5").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc6").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc7").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc8").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice"))
    .addChild(new ROUTE().setFromNode("Sequenc9").setFromField("value_changed").setToNode("LightSwitch").setToField("whichChoice")));
            }
            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 
	 * <a href="https://dzone.com/articles/java-copy-shallow-vs-deep-in-which-you-will-swim" target="_blank">shallow copy</a>
	 * of the X3D model.
	 * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html">X3D</a>
	 * @return LightingAlternatives 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 <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#handleArguments-java.lang.String:A-">X3D.handleArguments(args)</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/Core/X3D.html#validationReport--">X3D.validationReport()</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html">CommandLine</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/CommandLine.html#USAGE">CommandLine.USAGE</a>
     * @see <a href="https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html">ConfigurationProperties</a>
     */
    public static void main(String args[])
    {
        System.out.println("Build this X3D model, showing validation diagnostics...");
        X3D thisExampleX3dModel = new LightingAlternatives().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: \"X3dForAdvancedModeling.SanCarlosCathedral.LightingAlternatives\" 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("X3dForAdvancedModeling.SanCarlosCathedral.LightingAlternatives self-validation test confirmation: ");
                if (!validationResults.equals("success"))
                    System.out.println();
                System.out.println(validationResults.trim());

                // experimental: test X3DJSAIL output files
                // SanCarlosCathedral/LightingAlternatives_JavaExport.* file validation is checked when building X3D Example Archives
                String filenameX3D  = "SanCarlosCathedral/LightingAlternatives_JavaExport.x3d"; 
                String filenameX3DV = "SanCarlosCathedral/LightingAlternatives_JavaExport.x3dv"; 
                String filenameJSON = "SanCarlosCathedral/LightingAlternatives_JavaExport.json";
                thisExampleX3dModel.toFileX3D        (filenameX3D);
                thisExampleX3dModel.toFileClassicVRML(filenameX3DV);
// TODO         thisExampleX3dModel.toFileJSON       (filenameJSON);
        }
    }
}
