⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mastercontrol.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    boolean sharedStereoZBuffer = true;    // True to disable all underlying multisampling API so it uses    // the setting in the driver.     boolean implicitAntialiasing = false;    // False to disable compiled vertex array extensions if support    boolean isCompiledVertexArray = true;    // Number of reserved vertex attribute locations for GLSL (must be at    // least 1).    // Issue 269 - need to reserve up to 6 vertex attribtue locations to ensure    // that we don't collide with a predefined gl_* attribute on nVidia cards.    int glslVertexAttrOffset = 6;    // Hashtable that maps a GraphicsDevice to its associated    // Screen3D--this is only used for on-screen Canvas3Ds    Hashtable deviceScreenMap = new Hashtable();    // Use to store all requests from user threads.    UnorderList requestObjList = new UnorderList();    private UnorderList requestTypeList = new UnorderList(Integer.class);    // Temporary storage to store stop request for requestViewList    private UnorderList tempViewList = new UnorderList();    private UnorderList renderOnceList = new UnorderList();    // This flag is true when there is pending request    // i.e. false when the above requestxxx Lists are all empty.    private boolean pendingRequest = false;    // Root ThreadGroup for creating Java 3D threads    private static ThreadGroup rootThreadGroup;    // Thread priority for all Java 3D threads    private static int threadPriority;    static private Object mcThreadLock = new Object();    private ArrayList timestampUpdateList = new ArrayList(3);    private UnorderList freeMessageList = new UnorderList(8);    // Native AWT object    long awt;    // Maximum number of lights    int maxLights;    // This is used for D3D only    int resendTexTimestamp = 0;    // Indicates that the property to disable Xinerama mode was set and    // successfully disabled.    boolean xineramaDisabled = false;    // Set by the -Dj3d.sortShape3DBounds property, When this flag is    // set to true, the bounds of the Shape3D node will be used in    // place of the computed GeometryArray bounds for transparency    // sorting for those Shape3D nodes whose boundsAutoCompute    // attribute is set to false.    boolean sortShape3DBounds = false;    //Set by -Dj3d.forceReleaseView property.    //Setting this flag as true disables the bug fix 4267395 in View deactivate().    //The bug 4267395 can lock-up *some* systems, but the bug fix can    //produce memory leaks in applications which creates and destroy Canvas3D    //from time to time.    //Set as true if you have memory leaks after disposing Canvas3D.    //Default false value does affect Java3D View dispose behavior.    boolean forceReleaseView = false;        // Issue 480: Cache the bounds of nodes so that getBounds does not     // recompute the boounds of the entire graph per call    boolean cacheAutoComputedBounds = false;    /**     * Constructs a new MasterControl object.  Note that there is     * exatly one MasterControl object, created statically by     * VirtualUniverse.     */    MasterControl() {        assert librariesLoaded;	// Get AWT handle	awt = Pipeline.getPipeline().getAWT();        // Initialize the start time upon which alpha's and behaviors        // are synchronized to (if it isn't already set).        if (systemStartTime == 0L) {            systemStartTime = J3dClock.currentTimeMillis();        }	if(J3dDebug.devPhase) {	    // Check to see whether debug mode is allowed	    J3dDebug.debug = getBooleanProperty("j3d.debug", false,						"J3dDebug.debug");	}	// Check to see whether shared contexts are allowed	if (!isD3D()) {	    isSharedCtx =		getBooleanProperty("j3d.sharedctx", isSharedCtx, "shared contexts");	}	doCompaction = getBooleanProperty("j3d.docompaction", doCompaction,					  "compaction");	// by MIK OF CLASSX	transparentOffScreen = getBooleanProperty("j3d.transparentOffScreen", transparentOffScreen, "transparent OffScreen");	usePbuffer = getBooleanProperty("j3d.usePbuffer",					usePbuffer,					"Off-screen Pbuffer");	viewFrustumCulling = getBooleanProperty("j3d.viewFrustumCulling", viewFrustumCulling,"View frustum culling in the renderer is");		sortShape3DBounds =	    getBooleanProperty("j3d.sortShape3DBounds", sortShape3DBounds,			       "Shape3D bounds enabled for transparency sorting",			       "Shape3D bounds *ignored* for transparency sorting");	forceReleaseView =	    getBooleanProperty("j3d.forceReleaseView", forceReleaseView,			       "forceReleaseView  after Canvas3D dispose enabled",			       "forceReleaseView  after Canvas3D dispose disabled");	useCombiners = getBooleanProperty("j3d.usecombiners", useCombiners,					  "Using NV_register_combiners if available",					  "NV_register_combiners disabled");	if (getProperty("j3d.disablecompile") != null) {	    disableCompile = true;	    System.err.println("Java 3D: BranchGroup.compile disabled");	}	if (getProperty("j3d.disableSeparateSpecular") != null) {	    disableSeparateSpecularColor = true;	    System.err.println("Java 3D: separate specular color disabled if possible");	}	isDisplayList = getBooleanProperty("j3d.displaylist", isDisplayList,					   "display list");	implicitAntialiasing =	    getBooleanProperty("j3d.implicitAntialiasing",			       implicitAntialiasing,			       "implicit antialiasing");	isCompiledVertexArray =	    getBooleanProperty("j3d.compiledVertexArray",			       isCompiledVertexArray,			       "compiled vertex array");        boolean j3dOptimizeSpace =	    getBooleanProperty("j3d.optimizeForSpace", true,			       "optimize for space");        if (isDisplayList) {            // Build Display list for by-ref geometry            // ONLY IF optimizeForSpace is false            if (!j3dOptimizeSpace) {                buildDisplayListIfPossible = true;            }            // Build display lists for geometry with vertex attributes            // ONLY if we are in GLSL mode and GLSL shaders are available            if (glslLibraryAvailable) {                vertexAttrsInDisplayList = true;            }        }        // Check to see whether Renderer can run without DSI lock	doDsiRenderLock = getBooleanProperty("j3d.renderLock",					     doDsiRenderLock,					     "render lock");                // Check to see whether we enforce power-of-two textures        enforcePowerOfTwo = getBooleanProperty("j3d.textureEnforcePowerOfTwo",					       enforcePowerOfTwo,					       "checking power-of-two textures");        // Issue 249 - check to see whether the soleUser optimization is permitted        allowSoleUser = getBooleanProperty("j3d.allowSoleUser",					   allowSoleUser,					   "sole-user mode");        // Issue 266 - check to see whether null graphics configs are allowed        allowNullGraphicsConfig = getBooleanProperty("j3d.allowNullGraphicsConfig",						     allowNullGraphicsConfig,						     "null graphics configs");        // Issue 239 - check to see whether per-frame stencil clear is enabled        stencilClear = getBooleanProperty("j3d.stencilClear",                                          stencilClear,                                          "per-frame stencil clear");        // Check to see if stereo mode is sharing the Z-buffer for both eyes.	sharedStereoZBuffer = 	    getBooleanProperty("j3d.sharedstereozbuffer",			       sharedStereoZBuffer,			       "shared stereo Z buffer");	// Get the maximum number of concurrent threads (CPUs)	final int defaultThreadLimit = getNumberOfProcessors() + 1;	Integer threadLimit =	    (Integer) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    return Integer.getInteger("j3d.threadLimit",					      defaultThreadLimit);		}	    });	cpuLimit = threadLimit.intValue();	if (cpuLimit < 1)	    cpuLimit = 1;	if (J3dDebug.debug || cpuLimit != defaultThreadLimit) {	    System.err.println("Java 3D: concurrent threadLimit = " +			       cpuLimit);	}	// Get the input device scheduler sampling time	Integer samplingTime  =	    (Integer) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    return Integer.getInteger("j3d.deviceSampleTime", 0);		}	    });		if (samplingTime.intValue() > 0) {	    InputDeviceScheduler.samplingTime =		samplingTime.intValue();	    System.err.println("Java 3D: Input device sampling time = "			       + samplingTime + " ms");	}	// Get the glslVertexAttrOffset	final int defaultGLSLVertexAttrOffset = glslVertexAttrOffset;	Integer vattrOffset =	    (Integer) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {		public Object run() {		    return Integer.getInteger("j3d.glslVertexAttrOffset",					      defaultGLSLVertexAttrOffset);		}	    });	glslVertexAttrOffset = vattrOffset.intValue();        if (glslVertexAttrOffset < 1) {            glslVertexAttrOffset = 1;        }	if (J3dDebug.debug || glslVertexAttrOffset != defaultGLSLVertexAttrOffset) {	    System.err.println("Java 3D: glslVertexAttrOffset = " +			       glslVertexAttrOffset);	}        // See if Xinerama should be disabled for better performance.	boolean disableXinerama = false;	if (getProperty("j3d.disableXinerama") != null) {	    disableXinerama = true;	}        // Issue 480 : Cache bounds returned by getBounds()	cacheAutoComputedBounds = 	    getBooleanProperty("j3d.cacheAutoComputeBounds",			       cacheAutoComputedBounds,			       "Cache AutoCompute Bounds, accelerates getBounds()");        // Initialize the native J3D library	if (!Pipeline.getPipeline().initializeJ3D(disableXinerama)) {	    throw new RuntimeException(J3dI18N.getString("MasterControl0"));	}	if (xineramaDisabled) {	    // initializeJ3D() successfully disabled Xinerama.	    System.err.println("Java 3D: Xinerama disabled");	}	else if (disableXinerama) {	    // j3d.disableXinerama is true, but attempt failed.	    System.err.println("Java 3D: could not disable Xinerama");	}        // Check for obsolete properties        String[] obsoleteProps = {            "j3d.backgroundtexture",                        "j3d.forceNormalized",            "j3d.g2ddrawpixel",            "j3d.simulatedMultiTexture",                        "j3d.useFreeLists",                    };        for (int i = 0; i < obsoleteProps.length; i++) {            if (getProperty(obsoleteProps[i]) != null) {                System.err.println("Java 3D: " + obsoleteProps[i] + " property ignored");            }        }	// Get the maximum Lights	maxLights = Pipeline.getPipeline().getMaximumLights();	// create the freelists 	FreeListManager.createFreeLists();	// create an array canvas use registers	// The 32 limit can be lifted once the	// resourceXXXMasks in other classes 	// are change not to use integer.	canvasIds = new boolean[32];	for(int i=0; i<canvasIds.length; i++) {	    canvasIds[i] = false;	}        canvasFreeIndex = 0;    }    private static boolean initLogger(Logger logger, Level defaultLevel) {        if (logger == null) {            return false;        }        if (defaultLevel != null &&                logger.getLevel() == null &&                Logger.getLogger("j3d").getLevel() == null) {            try {                // Set default logger level rather than inheriting from system global                logger.setLevel(defaultLevel);            } catch (SecurityException ex) {                System.err.println(ex);                return false;            }        }        return logger.isLoggable(Level.SEVERE);    }    // Called by the static initializer to initialize the loggers    private static void initLoggers() {        coreLogger = Logger.getLogger("j3d.core");        devLogger = Logger.getLogger("j3d.developer");        statsLogger = Logger.getLogger("j3d.stats");        java.security.AccessController.doPrivileged(            new java.security.PrivilegedAction() {                public Object run() {                    coreLoggerEnabled = initLogger(coreLogger, null);                    devLoggerEnabled = initLogger(devLogger, Level.OFF);                    statsLoggerEnabled = initLogger(statsLogger, Level.OFF);                    return null;                }        });    }    /**     * Get the developer logger -- OFF by default     *     * WARNING - for probable incorrect or inconsistent api usage     * INFO - for informational messages such as performance hints (less verbose than FINE)     * FINE - for informational messages from inner loops     * FINER - using default values which may not be optimal     */    static Logger getDevLogger() {        return devLogger;    }    static boolean isDevLoggable(Level level) {        return devLoggerEnabled && devLogger.isLoggable(level);    }    /**     * Get the stats logger -- OFF by default     *     * WARNING - statistical anomalies     * INFO - basic performance stats - not too verbose and minimally intrusive     * FINE - somewhat verbose and intrusive     * FINER - more verbose and intrusive     * FINEST - most verbose and intrusive     */    static Logger getStatsLogger() {        return statsLogger;    }    static boolean isStatsLoggable(Level level) {        return statsLoggerEnabled && statsLogger.isLoggable(level);    }    /**     * Get the core logger -- level is INFO by default     *     * SEVERE - Serious internal errors     * WARNING - Possible internal errors or anomalies     * INFO - General informational messages     * FINE - Internal debugging information - somewhat verbose     * FINER - Internal debugging information - more verbose     * FINEST - Internal debugging information - most verbose     */    static Logger getCoreLogger() {        return coreLogger;    }    static boolean isCoreLoggable(Level level) {        return coreLoggerEnabled && coreLogger.isLoggable(level);    }    private static String getProperty(final String prop) {	return (String) java.security.AccessController.doPrivileged(	    new java.security.PrivilegedAction() {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -