package Basic.LatticeXvl;
/*
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.Grouping.*;
import org.web3d.x3d.jsail.Rendering.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Texturing.*;
// Javadoc annotations follow, see below for source.
/**
*
Example XvlShell model.
Related links: XvlShellModelStar.java source, XvlShellModelStar catalog page, X3D Resources, X3D Scene Authoring Hints, and X3D Tooltips.
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 Marc Jablonski
*/
public class XvlShellModelStar
{
/** Default constructor to create this object. */
public XvlShellModelStar ()
{
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_0)
.setHead(new headObject()
.addMeta(new metaObject().setName(metaObject.NAME_TITLE ).setContent("XvlShellModelStar.x3d"))
.addMeta(new metaObject().setName(metaObject.NAME_DESCRIPTION).setContent("Example XvlShell model."))
.addMeta(new metaObject().setName(metaObject.NAME_CREATOR ).setContent("Marc Jablonski"))
.addMeta(new metaObject().setName(metaObject.NAME_CREATED ).setContent("24 January 2002"))
.addMeta(new metaObject().setName(metaObject.NAME_MODIFIED ).setContent("20 March 2016"))
.addMeta(new metaObject().setName(metaObject.NAME_ERROR ).setContent("Test X3D DTD experimental extensions mechanisms, the XVL nodes are not legal X3D"))
.addMeta(new metaObject().setName(metaObject.NAME_REFERENCE ).setContent("readme.txt"))
.addMeta(new metaObject().setName(metaObject.NAME_REFERENCE ).setContent("docs/LatticeXvl/LatticeXvlOverview.html"))
.addMeta(new metaObject().setName(metaObject.NAME_REFERENCE ).setContent("http://www.web3d.org/x3d/content/examples/Basic/LatticeXvl/docs/LatticeXvl/LatticeXvlOverview.html"))
.addMeta(new metaObject().setName(metaObject.NAME_REFERENCE ).setContent("http://www.xvl3d.com"))
.addMeta(new metaObject().setName(metaObject.NAME_IDENTIFIER ).setContent("http://www.web3d.org/x3d/content/examples/Basic/LatticeXvl/XvlShellModelStar.x3d"))
.addMeta(new metaObject().setName(metaObject.NAME_SUBJECT ).setContent("Lattice XVL parametric geometry X3D VRML"))
.addMeta(new metaObject().setName(metaObject.NAME_GENERATOR ).setContent("Xvl3ToX3d, http://www.lattice3d.com"))
.addMeta(new metaObject().setName(metaObject.NAME_LICENSE ).setContent("../license.html")))
.setScene(new SceneObject()
.addChild(new TransformObject("_G1")
.addChild(new GroupObject("_S1")
.addChild(new ShapeObject()
.setAppearance(new AppearanceObject()
.setMaterial(new MaterialObject("SGE_DEF_MATERIAL"))
.setTexture(new ImageTextureObject("metal").setUrl(new String[] {"metal.jpg","http://www.web3d.org/x3d/content/examples/Basic/LatticeXvl/metal.jpg"})))
.setGeometry(new XvlShellObject().setFaceCoordIndex(getXvlShell_6_19_faceCoordIndex()).setFaceTexCoordIndex(getXvlShell_6_19_faceTexCoordIndex()).setShellType("LATTICE_MESH").setVertexRound(new float[] {1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,0.946602f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,0.946602f,0.946602f,0.946602f,0.946602f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,0.946602f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f})
.setCoord(new CoordinateObject("COORD0").setPoint(getCOORD0_7_19_point()))
.setTexCoord(new TextureCoordinateObject("TEXCOORD0").setPoint(new MFVec2fObject(new float[] {0f,0f,0f,0.513936f,0f,0.544969f,0f,0.544973f,0f,0.969199f,0f,0.969203f,0f,1.28484f,0f,1.36242f,0f,2.02328f,0f,2.02329f,0f,2.42301f,0f,2.52911f,8.88178e-016f,0f,8.88178e-016f,1.28484f,4.89897e-006f,0f,4.89897e-006f,1.36242f,4.89899e-006f,0f,4.89899e-006f,2.42301f,0.62944f,0.0f,0.62944f,2.53722f,0.66745f,0.0f,0.66745f,2.56826f,0.667453f,0.0f,0.667453f,2.56826f,1.18702f,0.0f,1.18702f,2.99248f,1.46018f,0.0f,1.46018f,2.52911f,1.652f,0.0f,1.652f,2.53722f,1.652f,2.56826f,1.652f,2.99248f,2.28144f,0.513936f,2.28144f,2.02328f,2.31945f,0.544969f,2.31945f,0.544973f,2.31945f,2.02328f,2.31945f,2.02329f,2.83903f,0.969199f,2.83903f,0.969203f,2.83903f,2.02328f,2.92036f,0.0f,2.92036f,2.52911f,4.12999f,0.0f,4.12999f,1.36242f,4.13f,0.0f,4.13f,1.36242f,4.13001f,0.0f,4.13001f,1.28484f,4.13001f,2.42301f,4.13002f,0.0f,4.13002f,2.42301f}))))))));
}
// end of initialize() method
/** Define subarrays using type int[] */
private int[] getXvlShell_6_19_faceCoordIndex_1()
{
int[] value = {11,9,26,22,-1,67,69,52,56,-1,73,67,56,77,-1,69,73,77,52,-1,66,68,72,-1,70,62,64,-1,6,14,12,-1,8,4,10,-1,13,15,7,-1,9,11,5,-1,73,69,67,-1,63,71,65,-1,46,58,61,39,-1,42,46,39,37,-1,58,42,37,61,-1,59,43,40,61,-1,47,59,61,38,-1,43,47,38,40,-1,45,41,37,38,-1,57,45,38,61,-1,41,57,61,37,-1,31,35,40,38,-1,19,31,38,16,-1,35,19,16,40,-1,29,17,16,38,-1,33,29,38,37,-1,17,33,37,16,-1,20,36,40,16,-1,32,20,16,39,-1,36,32,39,40,-1,18,30,39,16,-1,34,18,16,37,-1,30,34,37,39,-1,48,44,40,39,-1,60,48,39,61,-1,44,60,61,40,-1,54,75,58,46,-1,50,54,46,42,-1,75,50,42,58,-1,76,51,43,59,-1,55,76,59,47,-1,51,55,47,43,-1,53,49,41,45,-1,74,53,45,57,-1,49,74,57,41,-1,23,27,35,31,-1,2,23,31,19,-1,27,2,19,35,-1,21,0,17,29,-1,25,21,29,33,-1,0,25,33,17,-1,3,28,36,20,-1,24,3,20,32,-1,28,24,32,36,-1,1,22,30,18,-1,26,1,18,34,-1,22,26,34,30,-1,56,52,44,48,-1,77,56,48,60,-1,52,77,60,44,-1,65,71,75,54,-1,63,65,54,50,-1,71,63,50,75,-1,72,68,51,76,-1,66,72,76,55,-1,68,66,55,51,-1,64,62,49,53,-1,70,64,53,74,-1,62,70,74,49,-1,12,14,27,23,-1,6,12,23,2,-1,14,6,2,27,-1,10,4,0,21,-1,8,10,21,25,-1,4,8,25,0,-1,7,15,28,3,-1,13,7,3,24,-1,15,13,24,28,-1,5,11,22,1,-1,9,5,1,26,-1};
return value;
}
/** Define subarrays using type int[] */
private int[] getXvlShell_6_19_faceTexCoordIndex_1()
{
int[] value = {8,28,32,19,-1,32,19,8,28,-1,48,13,0,47,-1,29,1,18,33,-1,41,27,0,-1,11,26,42,-1,41,27,0,-1,26,42,11,-1,41,27,0,-1,26,42,11,-1,41,27,0,-1,26,42,11,-1,14,43,46,7,-1,22,36,30,2,-1,8,28,34,21,-1,35,23,9,28,-1,44,15,0,45,-1,30,3,20,37,-1,8,28,34,21,-1,14,43,46,7,-1,22,36,30,2,-1,35,23,9,28,-1,44,15,0,45,-1,30,3,20,37,-1,14,43,46,7,-1,22,36,30,2,-1,8,28,34,21,-1,35,23,9,28,-1,44,15,0,45,-1,30,3,20,37,-1,14,43,46,7,-1,22,36,30,2,-1,8,28,34,21,-1,35,23,9,28,-1,44,15,0,45,-1,30,3,20,37,-1,0,50,49,17,-1,24,40,31,5,-1,8,28,39,25,-1,38,25,8,28,-1,51,10,16,47,-1,31,4,24,40,-1,8,28,39,25,-1,0,50,49,17,-1,24,40,31,5,-1,38,25,8,28,-1,51,10,16,47,-1,31,4,24,40,-1,0,50,49,17,-1,24,40,31,5,-1,8,28,39,25,-1,38,25,8,28,-1,51,10,16,47,-1,31,4,24,40,-1,0,50,49,17,-1,24,40,31,5,-1,8,28,39,25,-1,38,25,8,28,-1,51,10,16,47,-1,31,4,24,40,-1,12,47,48,6,-1,18,33,29,1,-1,8,28,32,19,-1,32,19,8,28,-1,48,13,0,47,-1,29,1,18,33,-1,8,28,32,19,-1,12,47,48,6,-1,18,33,29,1,-1,32,19,8,28,-1,48,13,0,47,-1,29,1,18,33,-1,12,47,48,6,-1,18,33,29,1,-1,8,28,32,19,-1,32,19,8,28,-1,48,13,0,47,-1,29,1,18,33,-1,12,47,48,6,-1,18,33,29,1,-1};
return value;
}
/** Large attribute array: XvlShell faceCoordIndex field, scene-graph level=6, element #19, 392 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 getXvlShell_6_19_faceCoordIndex()
{
MFInt32Object XvlShell_6_19_faceCoordIndex = new MFInt32Object()/*2.finalize*/
.append(new MFInt32Object(getXvlShell_6_19_faceCoordIndex_1()));
return XvlShell_6_19_faceCoordIndex;
}
/** Large attribute array: XvlShell faceTexCoordIndex field, scene-graph level=6, element #19, 392 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 getXvlShell_6_19_faceTexCoordIndex()
{
MFInt32Object XvlShell_6_19_faceTexCoordIndex = new MFInt32Object()/*2.finalize*/
.append(new MFInt32Object(getXvlShell_6_19_faceTexCoordIndex_1()));
return XvlShell_6_19_faceTexCoordIndex;
}
/** Large attribute array: Coordinate DEF='COORD0' point field, scene-graph level=7, element #19, 234 total numbers made up of 78 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 getCOORD0_7_19_point()
{
MFVec3fObject COORD0_7_19_point = new MFVec3fObject(new float[] {-3.55104f,-0.960228f,-0.960231f,-3.55104f,-0.960228f,0.960231f,-3.55104f,0.960228f,-0.960231f,-3.55104f,0.960228f,0.960231f,-3.37616f,-1.69009f,-1.69009f,-3.37616f,-1.69009f,1.69009f,-3.37616f,1.69009f,-1.69009f,-3.37616f,1.69009f,1.69009f,-1.69009f,-3.37616f,-1.69009f,-1.69009f,-3.37616f,1.69009f,-1.69009f,-1.69009f,-3.37616f,-1.69009f,-1.69009f,3.37616f,-1.69009f,1.69009f,-3.37616f,-1.69009f,1.69009f,3.37616f,-1.69009f,3.37616f,-1.69009f,-1.69009f,3.37616f,1.69009f,-1.68607f,0.0f,0.0f,-1.63219f,-0.708152f,-0.708154f,-1.63219f,-0.708152f,0.708154f,-1.63219f,0.708152f,-0.708154f,-1.63219f,0.708152f,0.708154f,-0.960232f,-0.960228f,-3.55104f,-0.960232f,-0.960228f,3.55104f,-0.960232f,0.960228f,-3.55104f,-0.960232f,0.960228f,3.55104f,-0.960228f,-3.55105f,-0.960228f,-0.960228f,-3.55105f,0.960228f,-0.960228f,3.55105f,-0.960228f,-0.960228f,3.55105f,0.960228f,-0.708154f,-0.708152f,-1.63219f,-0.708154f,-0.708152f,1.63219f,-0.708154f,0.708152f,-1.63219f,-0.708154f,0.708152f,1.63219f,-0.708152f,-1.63219f,-0.708152f,-0.708152f,-1.63219f,0.708152f,-0.708152f,1.63219f,-0.708152f,-0.708152f,1.63219f,0.708152f,0.0f,-1.68607f,0.0f,0.0f,0.0f,-1.68607f,0.0f,0.0f,1.68607f,0.0f,1.68607f,0.0f,0.708152f,-1.63219f,-0.708152f,0.708152f,-1.63219f,0.708152f,0.708152f,1.63219f,-0.708152f,0.708152f,1.63219f,0.708152f,0.708154f,-0.708152f,-1.63219f,0.708154f,-0.708152f,1.63219f,0.708154f,0.708152f,-1.63219f,0.708154f,0.708152f,1.63219f,0.960228f,-3.55105f,-0.960228f,0.960228f,-3.55105f,0.960228f,0.960228f,3.55105f,-0.960228f,0.960228f,3.55105f,0.960228f,0.960232f,-0.960228f,-3.55104f,0.960232f,-0.960228f,3.55104f,0.960232f,0.960228f,-3.55104f,0.960232f,0.960228f,3.55104f,1.63219f,-0.708152f,-0.708154f,1.63219f,-0.708152f,0.708154f,1.63219f,0.708152f,-0.708154f,1.63219f,0.708152f,0.708154f,1.68607f,0.0f,0.0f,1.69009f,-3.37616f,-1.69009f,1.69009f,-3.37616f,1.69009f,1.69009f,-1.69009f,-3.37616f,1.69009f,-1.69009f,3.37616f,1.69009f,1.69009f,-3.37616f,1.69009f,1.69009f,3.37616f,1.69009f,3.37616f,-1.69009f,1.69009f,3.37616f,1.69009f,3.37616f,-1.69009f,-1.69009f,3.37616f,-1.69009f,1.69009f,3.37616f,1.69009f,-1.69009f,3.37616f,1.69009f,1.69009f,3.55104f,-0.960228f,-0.960231f,3.55104f,-0.960228f,0.960231f,3.55104f,0.960228f,-0.960231f,3.55104f,0.960228f,0.960231f});
return COORD0_7_19_point;
}
/** The initialized model object, created within initialize() method. */
private X3DObject x3dModel;
/** Provide a
* shallow copy
* of the X3D model.
* @see X3DObject
* @return XvlShellModelStar 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 XvlShellModelStar().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: \"XvlShellModelStar\" 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 \"XvlShellModelStar\" self-validation test results: ");
String validationResults = thisExampleX3dObject.validationReport();
System.out.println(validationResults);
}
}
}