📄 simpleuniverse.java
字号:
/* * $RCSfile: SimpleUniverse.java,v $ * * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistribution 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 Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * This software is provided "AS IS," without a warranty of any * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * * You acknowledge that this software is not designed, licensed or * intended for use in the design, construction, operation or * maintenance of any nuclear facility. * * $Revision: 1.7 $ * $Date: 2007/02/09 17:20:45 $ * $State: Exp $ */package com.sun.j3d.utils.universe;import com.sun.j3d.utils.geometry.Primitive;import java.awt.GraphicsEnvironment;import java.awt.GraphicsConfiguration;import java.net.URL;import javax.media.j3d.*;/** * This class sets up a minimal user environment to quickly and easily * get a Java 3D program up and running. This utility class creates * all the necessary objects on the "view" side of the scene graph. * Specifically, this class creates a locale, a single ViewingPlatform, * and a Viewer object (both with their default values). * Many basic Java 3D applications * will find that SimpleUniverse provides all necessary functionality * needed by their applications. More sophisticated applications * may find that they need more control in order to get extra functionality * and will not be able to use this class. * * @see Viewer * @see ViewingPlatform */public class SimpleUniverse extends VirtualUniverse { /** * Locale reference needed to create the "view" portion * of the scene graph. */ protected Locale locale; /** * Viewer reference needed to create the "view" portion * of the scene graph. */ protected Viewer[] viewer = null; /** * Creates a locale, a single ViewingPlatform, and * and a Viewer object (both with their default values). * * @see Locale * @see Viewer * @see ViewingPlatform */ public SimpleUniverse() { // call main constructor with default values. this(null, 1, null, null); } /** * Creates a locale, a single ViewingPlatform, and a Viewer object * (with default values). The ViewingPlatform is created with the * specified number of TransformGroups. * * @param numTransforms The number of transforms to be in the * MultiTransformGroup object. * * @see Locale * @see Viewer * @see ViewingPlatform * * @since Java 3D 1.2.1 */ public SimpleUniverse(int numTransforms) { // call main constructor with default values except numTransforms this(null, numTransforms, null, null); } /** * Creates a locale, a single ViewingPlatform (with default values), and * and a Viewer object. The Viewer object uses default values for * everything but the canvas. * * @param canvas The canvas to associate with the Viewer object. Passing * in null will cause this parameter to be ignored and a canvas to be * created by the utility. * * @see Locale * @see Viewer * @see ViewingPlatform */ public SimpleUniverse(Canvas3D canvas) { // call main constructor with default values for everything but // the canvas parameter. this(null, 1, canvas, null); } /** * Creates a locale, a single ViewingPlatform, and a Viewer object * The Viewer object uses default values for everything but the canvas. * The ViewingPlatform is created with the specified number of * TransformGroups. * * @param canvas The canvas to associate with the Viewer object. Passing * in null will cause this parameter to be ignored and a canvas to be * created by the utility. * @param numTransforms The number of transforms to be in the * MultiTransformGroup object. * * @see Locale * @see Viewer * @see ViewingPlatform * @see MultiTransformGroup * * @since Java 3D 1.2.1 */ public SimpleUniverse(Canvas3D canvas, int numTransforms) { // call main constructor with default values except canvas // and numTransforms this(null, numTransforms, canvas, null); } /** * Creates a locale, a single ViewingPlatform, and a Viewer object * The Viewer object uses default values for everything but the canvas. * The ViewingPlatform is created with the specified number of * TransformGroups. * * @param canvas The canvas to associate with the Viewer object. Passing * in null will cause this parameter to be ignored and a canvas to be * created by the utility. * @param numTransforms The number of transforms to be in the * MultiTransformGroup object. * @param localeFactory Factory for creating the locale * * @see Locale * @see Viewer * @see ViewingPlatform * @see MultiTransformGroup * * @since Java 3D 1.5.1 */ public SimpleUniverse(Canvas3D canvas, int numTransforms, LocaleFactory localeFactory) { // call main constructor with default values except canvas, // numTransforms and localeFactory this(null, numTransforms, canvas, null, localeFactory); } /** * Creates the "view" side of the scene graph. The passed in parameters * override the default values where appropriate. * * @param origin The origin used to set the origin of the Locale object. * If this object is null, then 0.0 is used. * @param numTransforms The number of transforms to be in the * MultiTransformGroup object. * @param canvas The canvas to draw into. If this is null, it is * ignored and a canvas will be created by the utility. * @param userConfig The URL to the user's configuration file, used * by the Viewer object. This is never examined and default values are * always taken. * * @see Locale * @see Viewer * @see ViewingPlatform * @see MultiTransformGroup * @deprecated use ConfiguredUniverse constructors to read a * configuration file */ public SimpleUniverse(HiResCoord origin, int numTransforms, Canvas3D canvas, URL userConfig) { this( origin, numTransforms, canvas, userConfig, null ); } /** * Creates the "view" side of the scene graph. The passed in parameters * override the default values where appropriate. * * @param origin The origin used to set the origin of the Locale object. * If this object is null, then 0.0 is used. * @param numTransforms The number of transforms to be in the * MultiTransformGroup object. * @param canvas The canvas to draw into. If this is null, it is * ignored and a canvas will be created by the utility. * @param userConfig The URL to the user's configuration file, used * by the Viewer object. This is never examined and default values are * always taken. * @param localeFactory The Locale Factory which will instantiate the * locale(s) for this universe. * * @see Locale
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -