package Savage.ShipsMilitary.PatrolCraftNavalAcademyBrazil; /* Copyright (c) 1995-2019 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 java.util.*; import org.web3d.x3d.jsail.Core.*; 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.PointingDeviceSensor.*; import org.web3d.x3d.jsail.Rendering.*; import org.web3d.x3d.jsail.Shape.*; import org.web3d.x3d.jsail.Time.*; // Javadoc annotations follow, see below for source. /** *

Brazilian Naval Academy Training Ship.

Related links: SkylightHatch.java source, SkylightHatch catalog page, X3D Resources, X3D Scene Authoring Hints, and X3D Tooltips.

meta tags   Document Metadata
title SkylightHatch.x3d
description Brazilian Naval Academy Training Ship
creator Claudio Coreixas
created 20 October 2009
modified 13 November 2009
reference http://www.en.mar.mil.br
subject ships parts
identifier https://savage.nps.edu/Savage/ShipsMilitary/PatrolCraft-NavalAcademy-Brazil/SkylightHatch.x3d
generator X3D-Edit, https://savage.nps.edu/X3D-Edit
license ../../license.html
 

This program uses the X3D Java Scene Access Interface Library (X3DJSAIL). It has been produced using the X3dToJava.xslt stylesheet to create Java source code from an .x3d model.

* @author Claudio Coreixas */ public class SkylightHatch { /** Default constructor to create this object. */ public SkylightHatch () { initialize(); } /** Create and initialize the X3D model for this object. */ public final void initialize() { x3dModel = new X3DObject().setProfile(X3DObject.PROFILE_IMMERSIVE).setVersion(X3DObject.VERSION_3_2) .setHead(new headObject() .addMeta(new metaObject().setName(metaObject.NAME_TITLE ).setContent("SkylightHatch.x3d")) .addMeta(new metaObject().setName(metaObject.NAME_DESCRIPTION).setContent("Brazilian Naval Academy Training Ship")) .addMeta(new metaObject().setName(metaObject.NAME_CREATOR ).setContent("Claudio Coreixas")) .addMeta(new metaObject().setName(metaObject.NAME_CREATED ).setContent("20 October 2009")) .addMeta(new metaObject().setName(metaObject.NAME_MODIFIED ).setContent("13 November 2009")) .addMeta(new metaObject().setName(metaObject.NAME_REFERENCE ).setContent("http://www.en.mar.mil.br")) .addMeta(new metaObject().setName(metaObject.NAME_SUBJECT ).setContent("ships parts")) .addMeta(new metaObject().setName(metaObject.NAME_IDENTIFIER ).setContent("https://savage.nps.edu/Savage/ShipsMilitary/PatrolCraft-NavalAcademy-Brazil/SkylightHatch.x3d")) .addMeta(new metaObject().setName(metaObject.NAME_GENERATOR ).setContent("X3D-Edit, https://savage.nps.edu/X3D-Edit")) .addMeta(new metaObject().setName(metaObject.NAME_LICENSE ).setContent("../../license.html"))) .setScene(new SceneObject() .addChild(new ViewpointObject().setDescription("Door").setFieldOfView(0.45f).setOrientation(1.0f,0.0f,0.0f,0.0f).setPosition(0.0f,0.0f,1.0f)) .addChild(new TimeSensorObject("spinTimer").setCycleInterval(2)) .addChild(new OrientationInterpolatorObject("openDoor").setKey(new float[] {0.0f,1.0f}).setKeyValue(new MFRotationObject(new float[] {1.0f,0.0f,0.0f,0.0f,1.0f,0.0f,0.0f,-1.2f}))) .addChild(new ROUTEObject().setFromNode("spinTimer").setFromField("fraction_changed").setToNode("openDoor").setToField("set_fraction")) .addChild(new TransformObject("openDoorTransform").setCenter(0.0f,0.01f,-0.084f) .addChild(new ROUTEObject().setFromNode("openDoor").setFromField("value_changed").setToNode("openDoorTransform").setToField("rotation")) .addChild(new ShapeObject("TightDoor") .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setDiffuseColor(0.82f,0.78f,0.74f))) .setGeometry(new IndexedFaceSetObject("hatchIFS").setDEF("hatchIFS").setCreaseAngle(1.5f).setSolid(false).setCoordIndex(gethatchIFS_5_19_coordIndex()) .setCoord(new CoordinateObject().setPoint(getCoordinate_6_19_point())))) .addChild(new TouchSensorObject("hatchSensor").setDescription("Touch to Open Hatch")) .addChild(new ROUTEObject().setFromNode("hatchSensor").setFromField("touchTime").setToNode("spinTimer").setToField("startTime")) .addChild(new ShapeObject("window") .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject("Glass").setAmbientIntensity(0.37773332f).setDiffuseColor(0.0f,0.36666667f,0.76666665f).setShininess(0.76666665f).setSpecularColor(1.0f,1.0f,1.0f).setTransparency(0.58f))) .setGeometry(new IndexedFaceSetObject("windowIFS").setDEF("windowIFS").setCreaseAngle(1.5f).setSolid(false).setCoordIndex(new int[] {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,-1}) .setCoord(new CoordinateObject().setPoint(new MFVec3fObject(new float[] {0.0300f,0.0120f,0.0000f,0.0277f,0.0120f,0.0115f,0.0212f,0.0120f,0.0212f,0.0115f,0.0120f,0.0277f,0.0000f,0.0120f,0.0300f,-0.0115f,0.0120f,0.0277f,-0.0212f,0.0120f,0.0212f,-0.0277f,0.0120f,0.0115f,-0.0300f,0.0120f,0.0000f,-0.0277f,0.0120f,-0.0114f,-0.0213f,0.0120f,-0.0212f,-0.0115f,0.0120f,-0.0277f,-0.0001f,0.0120f,-0.0300f,0.0114f,0.0120f,-0.0277f,0.0212f,0.0120f,-0.0213f,0.0277f,0.0120f,-0.0116f,0.0300f,0.0120f,-0.0001f}))))) .addChild(new ShapeObject() .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f))) .setGeometry(new ExtrusionObject().setCrossSection(new MFVec2fObject(new float[] {-0.005f,0.0f,0.0f,0.0f,0.0f,-0.0025f,-0.005f,-0.0025f,-0.005f,-0.005f,-0.01f,-0.005f,-0.01f,0.0f,-0.005f,0.0f})).setSolid(false).setSpine(new MFVec3fObject(new float[] {0.04f,0.01f,0.0f,0.037f,0.01f,0.0153f,0.0283f,0.01f,0.0283f,0.0153f,0.01f,0.0369f,0.0f,0.01f,0.04f,-0.0153f,0.01f,0.037f,-0.0283f,0.01f,0.0283f,-0.0369f,0.01f,0.0154f,-0.04f,0.01f,0.0f,-0.037f,0.01f,-0.0152f,-0.0283f,0.01f,-0.0282f,-0.0154f,0.01f,-0.0369f,0.0f,0.01f,-0.04f,0.0152f,0.01f,-0.037f,0.0282f,0.01f,-0.0284f,0.0369f,0.01f,-0.0154f,0.04f,0.01f,0.0f})))) .addChild(new ShapeObject() .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f))) .setGeometry(new ExtrusionObject().setCrossSection(new MFVec2fObject(new float[] {0.0f,0.0f,0.001f,0.0f,0.001f,0.002f,-0.001f,0.002f,-0.001f,0.0f,0.0f,0.0f})).setSolid(false).setSpine(new MFVec3fObject(new float[] {0.0300f,0.0150f,0.0000f,-0.0300f,0.0150f,0.0000f})))) .addChild(new ShapeObject() .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f))) .setGeometry(new ExtrusionObject().setCrossSection(new MFVec2fObject(new float[] {0.0f,0.0f,0.001f,0.0f,0.001f,0.002f,-0.001f,0.002f,-0.001f,0.0f,0.0f,0.0f})).setSolid(false).setSpine(new MFVec3fObject(new float[] {0.0277f,0.0150f,0.0115f,-0.0277f,0.0150f,0.0115f})))) .addChild(new ShapeObject() .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f))) .setGeometry(new ExtrusionObject().setCrossSection(new MFVec2fObject(new float[] {0.0f,0.0f,0.001f,0.0f,0.001f,0.002f,-0.001f,0.002f,-0.001f,0.0f,0.0f,0.0f})).setSolid(false).setSpine(new MFVec3fObject(new float[] {0.0212f,0.0150f,0.0212f,-0.0212f,0.0150f,0.0212f})))) .addChild(new ShapeObject() .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f))) .setGeometry(new ExtrusionObject().setCrossSection(new MFVec2fObject(new float[] {0.0f,0.0f,0.001f,0.0f,0.001f,0.002f,-0.001f,0.002f,-0.001f,0.0f,0.0f,0.0f})).setSolid(false).setSpine(new MFVec3fObject(new float[] {-0.0277f,0.0150f,-0.0114f,0.0277f,0.0150f,-0.0116f})))) .addChild(new ShapeObject() .setAppearance(new AppearanceObject() .setMaterial(new MaterialObject().setAmbientIntensity(0.02f).setDiffuseColor(0.701961f,0.588235f,0.0f).setShininess(0.29f).setSpecularColor(1.0f,0.887979f,0.0f))) .setGeometry(new ExtrusionObject().setCrossSection(new MFVec2fObject(new float[] {0.0f,0.0f,0.001f,0.0f,0.001f,0.002f,-0.001f,0.002f,-0.001f,0.0f,0.0f,0.0f})).setSolid(false).setSpine(new MFVec3fObject(new float[] {-0.0213f,0.0150f,-0.0212f,0.0212f,0.0150f,-0.0213f})))))); } // end of initialize() method /** Define subarrays using type int[] */ private int[] gethatchIFS_5_19_coordIndex_1() { int[] value = {1,2,22,21,-1,2,3,23,22,-1,3,4,24,23,-1,4,5,25,24,-1,5,6,26,25,-1,6,7,27,26,-1,7,8,28,27,-1,8,9,29,28,-1,9,10,30,29,-1,10,11,31,30,-1,11,12,32,31,-1,12,13,33,32,-1,13,14,34,33,-1,14,15,35,34,-1,15,16,36,35,-1,16,17,37,36,-1,17,18,38,37,-1,18,19,39,38,-1,19,20,40,39,-1,20,1,21,40,-1,21,22,42,41,-1,22,23,43,42,-1,23,24,44,43,-1,24,25,45,44,-1,25,26,46,45,-1,26,27,47,46,-1,27,28,48,47,-1,28,29,49,48,-1,29,30,50,49,-1,30,31,51,50,-1,31,32,52,51,-1,32,33,53,52,-1,33,34,54,53,-1,34,35,55,54,-1,35,36,56,55,-1,36,37,57,56,-1,37,38,58,57,-1,38,39,59,58,-1,39,40,60,59,-1,40,21,41,60,-1,41,42,62,61,-1,42,43,63,62,-1,43,44,64,63,-1,44,45,65,64,-1,45,46,66,65,-1,46,47,67,66,-1,47,48,68,67,-1,48,49,69,68,-1,49,50,70,69,-1,50,51,71,70,-1,51,52,72,71,-1,52,53,73,72,-1,53,54,74,73,-1,54,55,75,74,-1,55,56,76,75,-1,56,57,77,76,-1,57,58,78,77,-1,58,59,79,78,-1,59,60,80,79,-1,60,41,61,80,-1,61,62,81,-1,62,63,81,-1,63,64,81,-1,64,65,81,-1,65,66,82,81,-1,66,67,82,-1,67,68,82,-1,68,69,82,-1,69,70,82,-1,70,71,83,82,-1,71,72,83,-1,72,73,83,-1,73,74,83,-1,74,75,83,-1,75,76,84,83,-1,76,77,84,-1,77,78,84,-1,78,79,84,-1,79,80,84,-1,80,61,81,84,-1,81,85,84,-1,84,97,83,-1,83,93,82,-1,82,89,81,-1,85,81,86,-1,86,81,87,-1,87,81,88,-1,88,81,89,-1,89,82,90,-1,90,82,91,-1,91,82,92,-1,92,82,93,-1,93,83,94,-1,94,83,95,-1,95,83,96,-1,96,83,97,-1,97,84,98,-1,98,84,99,-1,99,84,100,-1,100,84,101,-1}; return value; } /** Define subarrays using type float[] */ private float[] getCoordinate_6_19_point_1() { float[] value = {0.0000f,0.0000f,0.0000f,0.0779f,0.0000f,0.0768f,0.0772f,0.0000f,0.0806f,0.0750f,0.0000f,0.0838f,0.0718f,0.0000f,0.0860f,0.0679f,0.0000f,0.0868f,-0.0679f,0.0000f,0.0868f,-0.0717f,0.0000f,0.0860f,-0.0750f,0.0000f,0.0839f,-0.0772f,0.0000f,0.0806f,-0.0779f,0.0000f,0.0768f,-0.0779f,0.0000f,-0.0768f,-0.0772f,0.0000f,-0.0806f,-0.0750f,0.0000f,-0.0838f,-0.0718f,0.0000f,-0.0860f,-0.0680f,0.0000f,-0.0868f,0.0679f,0.0000f,-0.0868f,0.0717f,0.0000f,-0.0860f,0.0750f,0.0000f,-0.0839f,0.0772f,0.0000f,-0.0806f,0.0779f,0.0000f,-0.0768f,0.0772f,0.0038f,0.0768f,0.0765f,0.0038f,0.0803f,0.0745f,0.0038f,0.0833f,0.0715f,0.0038f,0.0853f,0.0679f,0.0038f,0.0860f,-0.0679f,0.0038f,0.0860f,-0.0715f,0.0038f,0.0853f,-0.0745f,0.0038f,0.0833f,-0.0765f,0.0038f,0.0803f,-0.0772f,0.0038f,0.0768f,-0.0772f,0.0038f,-0.0768f,-0.0765f,0.0038f,-0.0803f,-0.0745f,0.0038f,-0.0833f,-0.0715f,0.0038f,-0.0853f,-0.0680f,0.0038f,-0.0860f,0.0679f,0.0038f,-0.0860f,0.0714f,0.0038f,-0.0853f,0.0744f,0.0038f,-0.0833f,0.0765f,0.0038f,-0.0803f,0.0772f,0.0038f,-0.0768f,0.0750f,0.0071f,0.0768f,0.0745f,0.0071f,0.0795f,0.0729f,0.0071f,0.0818f,0.0706f,0.0071f,0.0833f,0.0679f,0.0071f,0.0839f,-0.0679f,0.0071f,0.0839f,-0.0706f,0.0071f,0.0833f,-0.0729f,0.0071f,0.0818f,-0.0745f,0.0071f,0.0795f,-0.0750f,0.0071f,0.0768f,-0.0750f,0.0071f,-0.0768f,-0.0745f,0.0071f,-0.0795f,-0.0729f,0.0071f,-0.0818f,-0.0707f,0.0071f,-0.0833f,-0.0679f,0.0071f,-0.0839f,0.0679f,0.0071f,-0.0839f,0.0706f,0.0071f,-0.0833f,0.0729f,0.0071f,-0.0818f,0.0745f,0.0071f,-0.0795f,0.0750f,0.0071f,-0.0768f,0.0718f,0.0092f,0.0768f,0.0715f,0.0092f,0.0782f,0.0706f,0.0092f,0.0795f,0.0694f,0.0092f,0.0803f,0.0679f,0.0092f,0.0806f,-0.0679f,0.0092f,0.0806f,-0.0694f,0.0092f,0.0803f,-0.0706f,0.0092f,0.0795f,-0.0715f,0.0092f,0.0783f,-0.0718f,0.0092f,0.0768f,-0.0718f,0.0092f,-0.0768f,-0.0715f,0.0092f,-0.0782f,-0.0706f,0.0092f,-0.0795f,-0.0694f,0.0092f,-0.0803f,-0.0679f,0.0092f,-0.0806f,0.0679f,0.0092f,-0.0806f,0.0694f,0.0092f,-0.0803f,0.0706f,0.0092f,-0.0795f,0.0715f,0.0092f,-0.0783f,0.0718f,0.0092f,-0.0768f,0.0679f,0.0100f,0.0768f,-0.0679f,0.0100f,0.0768f,-0.0679f,0.0100f,-0.0768f,0.0679f,0.0100f,-0.0768f,0.0400f,0.0100f,0.0000f,0.0370f,0.0100f,0.0153f,0.0283f,0.0100f,0.0283f,0.0153f,0.0100f,0.0369f,0.0000f,0.0100f,0.0400f,-0.0153f,0.0100f,0.0370f,-0.0283f,0.0100f,0.0283f,-0.0369f,0.0100f,0.0154f,-0.0400f,0.0100f,0.0000f,-0.0370f,0.0100f,-0.0152f,-0.0283f,0.0100f,-0.0282f,-0.0154f,0.0100f,-0.0369f,0.0000f,0.0100f,-0.0400f,0.0152f,0.0100f,-0.0370f,0.0282f,0.0100f,-0.0284f}; return value; } private float[] getCoordinate_6_19_point_2() { float[] value = {0.0369f,0.0100f,-0.0154f,0.0400f,0.0100f,0.0000f}; return value; } /** Large attribute array: IndexedFaceSet DEF='hatchIFS' coordIndex field, scene-graph level=5, element #19, 464 total numbers. * Reassemble split array as single method to improve readability and runnability. * Provide large array values via separate methods, hoping 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 MFInt32Object gethatchIFS_5_19_coordIndex() { MFInt32Object hatchIFS_5_19_coordIndex = new MFInt32Object()/*2.finalize*/ .append(new MFInt32Object(gethatchIFS_5_19_coordIndex_1())); return hatchIFS_5_19_coordIndex; } /** Large attribute array: Coordinate point field, scene-graph level=6, element #19, 306 total numbers made up of 102 3-tuple values. * Reassemble split array as single method to improve readability and runnability. * Provide large array values via separate methods, hoping 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_6_19_point() { MFVec3fObject Coordinate_6_19_point = new MFVec3fObject()/*2.finalize*/ .append(new MFVec3fObject(getCoordinate_6_19_point_1())) .append(new MFVec3fObject(getCoordinate_6_19_point_2())); return Coordinate_6_19_point; } /** The initialized model object, created within initialize() method. */ private X3DObject x3dModel; /** Provide a * shallow copy * of the X3D model. * @see X3DObject * @return SkylightHatch model */ public X3DObject 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 X3DObject.handleArguments(args) * @see X3DObject.validationReport() * @see CommandLine * @see CommandLine.USAGE * @see ConfigurationProperties */ public static void main(String args[]) { X3DObject thisExampleX3dObject = new SkylightHatch().getX3dModel(); 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(X3DObject.FILE_EXTENSION_X3D) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_CLASSICVRML) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_X3DB) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_VRML97) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_EXI) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_GZIP) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_ZIP) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_HTML) || arg.toLowerCase().endsWith(X3DObject.FILE_EXTENSION_XHTML)) { argumentsLoadNewModel = true; fileName = arg; } } } if (argumentsLoadNewModel) System.out.println("WARNING: \"SkylightHatch\" 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 thisExampleX3dObject.handleArguments(args); if (validate) { System.out.print("Java program \"SkylightHatch\" self-validation test results: "); String validationResults = thisExampleX3dObject.validationReport(); System.out.println(validationResults); } } }