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

📄 view.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    // This notify user thread waitForMC() to continue when     // MC finish unregisterView    volatile boolean doneUnregister = false;    static final int TRANSP_SORT_POLICY_CHANGED           = 0x0001;    static final int OTHER_ATTRS_CHANGED                  = 0x0002;    /**     * Constructs a View object with default parameters.  The default     * values are as follows:     * <ul>     * view policy : SCREEN_VIEW<br>     * projection policy : PERSPECTIVE_PROJECTION<br>     * screen scale policy : SCALE_SCREEN_SIZE<br>     * window resize policy : PHYSICAL_WORLD<br>     * window movement policy : PHYSICAL_WORLD<br>     * window eyepoint policy : RELATIVE_TO_FIELD_OF_VIEW<br>     * monoscopic view policy : CYCLOPEAN_EYE_VIEW<br>     * front clip policy : PHYSICAL_EYE<br>     * back clip policy : PHYSICAL_EYE<br>     * visibility policy : VISIBILITY_DRAW_VISIBLE<br>     * transparency sorting policy : TRANSPARENCY_SORT_NONE<br>     * coexistenceCentering flag : true<br>     * compatibility mode : false<br>     * left projection : identity<br>     * right projection : identity<br>     * vpc to ec transform : identity<br>     * physical body : null<br>     * physical environment : null<br>     * screen scale : 1.0<br>     * field of view : PI/4<br>     * left manual eye in coexistence : (-0.033, 0.0, 0.4572)<br>     * right manual eye in coexistence : (0.033, 0.0, 0.4572)<br>     * front clip distance : 0.1<br>     * back clip distance : 10.0<br>     * tracking enable : false<br>     * user head to vworld enable : false<br>     * list of Canvas3D objects : empty<br>     * depth buffer freeze transparent : true<br>     * scene antialiasing : false<br>     * local eye lighting : false<br>     * view platform : null<br>     * behavior scheduler running : true<br>     * view running : true<br>     * minimum frame cycle time : 0<br>     * </ul>     */    public View() {        viewCache = new ViewCache(this);    }    /**     * Sets the policy for view computation.     * This variable specifies how Java 3D uses its transforms in     * computing new viewpoints.     * <UL>     * <LI>SCREEN_VIEW specifies that Java 3D should compute a new viewpoint     * using the sequence of transforms appropriate to screen-based     * head-tracked display environments (fish-tank VR/portals/VR-desks).     * </LI>     * <LI>HMD_VIEW specifies that Java 3D should compute a new viewpoint     * using the sequence of transforms appropriate to head mounted     * display environments.     * </LI>     * </UL>     * The default view policy is SCREEN_VIEW.     * @param policy the new policy, one of SCREEN_VIEW or HMD_VIEW     * @exception IllegalArgumentException if policy is a value other than     * SCREEN_VIEW or HMD_VIEW     * @exception IllegalStateException if the specified policy     * is HMD_VIEW and if any canvas associated with this view is     * a stereo canvas with a monoscopicEyePolicy of CYCLOPEAN_EYE_VIEW     */    public void setViewPolicy(int policy) {	if (policy != HMD_VIEW &&	    policy != SCREEN_VIEW) {	    	    throw new IllegalArgumentException(J3dI18N.getString("View0"));	}	if(policy == HMD_VIEW) {	    // Check the following :	    // 1) If the view is in HMD mode and there exists a canvas in	    // CYCLOPEAN_EYE_VIEW mode then throw exception.	    synchronized (canvasList) {		for (int i=canvases.size()-1; i>=0; i--) {		    Canvas3D c3d = (Canvas3D)canvases.elementAt(i);		    		    if ((c3d.monoscopicViewPolicy == View.CYCLOPEAN_EYE_VIEW) &&			(!c3d.useStereo)){			throw new			    IllegalStateException(J3dI18N.getString("View31"));		    }		}	    }	}	synchronized(this) {	    this.viewPolicy = policy;	    vDirtyMask |= View.VIEW_POLICY_DIRTY;	}	repaint();    }    /**     * Retrieves the current view computation policy for this View.     * @return one of: SCREEN_VIEW or HMD_VIEW.     */    public int getViewPolicy() {	return this.viewPolicy;    }      /**     * Sets the projection policy for this View.     * This variable specifies the type of projection transform that     * will be generated.  A value of PARALLEL_PROJECTION specifies that     * a parallel projection transform is generated.  A value of     * PERSPECTIVE_PROJECTION specifies that     * a perspective projection transform is generated.     * The default projection policy is PERSPECTIVE.     * @param policy the new policy, one of PARALLEL_PROJECTION or     * PERSPECTIVE_PROJECTION     * @exception IllegalArgumentException if policy is a value other than     * PARALLEL_PROJECTION or PERSPECTIVE_PROJECTION     */    public void setProjectionPolicy(int policy) {	if (policy != PERSPECTIVE_PROJECTION &&	    policy != PARALLEL_PROJECTION) {	    throw new IllegalArgumentException(J3dI18N.getString("View1"));	}	synchronized(this) {	    this.projectionPolicy = policy;	    vDirtyMask |= View.PROJECTION_POLICY_DIRTY;	}	repaint();    }    /**     * Retrieves the current projection policy for this View.     * @return one of: PARALLEL_PROJECTION or PERSPECTIVE_PROJECTION.     */    public int getProjectionPolicy() {	return this.projectionPolicy;    }      /**     * Sets the screen scale policy for this view.     * This policy specifies how the screen scale is derived.     * The value is either SCALE_SCREEN_SIZE or SCALE_EXPLICIT.     * A value of SCALE_SCREEN_SIZE specifies that the scale is derived     * from the size of the physical screen.  A value of SCALE_EXPLICIT     * specifies that the scale is taken directly from the screenScale     * parameter.     * The default screen scale policy is SCALE_SCREEN_SIZE.     * @param policy the new policy, one of SCALE_SCREEN_SIZE or     * SCALE_EXPLICIT.     */    public void setScreenScalePolicy(int policy) {	synchronized(this) {	    this.screenScalePolicy = policy;	    vDirtyMask |= View.SCREEN_SCALE_POLICY_DIRTY;	}	repaint();    }    /**     * Returns the current screen scale policy, one of:     * SCALE_SCREEN_SIZE or SCALE_EXPLICIT.     * @return the current screen scale policy     */    public int getScreenScalePolicy() {	return this.screenScalePolicy;    }    /**     * Sets the window resize policy.     * This variable specifies how Java 3D modifies the view when     * users resize windows. The variable can contain one of     * VIRTUAL_WORLD or PHYSICAL_WORLD.     * A value of VIRTUAL_WORLD implies that the original image     * remains the same size on the screen but the user sees more     * or less of the virtual world depending on whether the window     * grew or shrank in size.     * A value of PHYSICAL_WORLD implies that the original image     * continues to fill the window in the same way using more or     * less pixels depending on whether the window grew or shrank     * in size.     * The default window resize policy is PHYSICAL_WORLD.     * @param policy the new policy, one of VIRTUAL_WORLD or PHYSICAL_WORLD     */    public void setWindowResizePolicy(int policy) {	synchronized(this) {	    this.windowResizePolicy = policy;	    vDirtyMask |= View.WINDOW_RESIZE_POLICY_DIRTY;	}	repaint();    }    /**     * Returns the current window resize policy, one of:     * VIRTUAL_WORLD or PHYSICAL_WORLD.     * @return the current window resize policy     */    public int getWindowResizePolicy() {	return this.windowResizePolicy;    }    /**     * Sets the window movement policy.     * This variable specifies what part of the virtual world Java 3D     * draws as a function of window placement on the screen. The     * variable can contain one of VIRTUAL_WORLD or PHYSICAL_WORLD.     * A value of VIRTUAL_WORLD implies that the image seen in the     * window changes as the position of the window shifts on the     * screen.  (This mode acts as if the window were a window into     * the virtual world.)     * A value of PHYSICAL_WORLD implies that the image seen in the     * window remains the same no matter where the user positions     * the window on the screen.     * The default window movement policy is PHYSICAL_WORLD.     * @param policy the new policy, one of VIRTUAL_WORLD or PHYSICAL_WORLD     */    public void setWindowMovementPolicy(int policy) {	synchronized(this) {	    this.windowMovementPolicy = policy;	    vDirtyMask |= View.WINDOW_MOVEMENT_POLICY_DIRTY;	}	repaint();    }    /**     * Returns the current window movement policy,     * one of: VIRTUAL_WORLD or PHYSICAL_WORLD.     * @return the current window movement policy     */    public int getWindowMovementPolicy() {	return this.windowMovementPolicy;    }    /**     * Sets the view model's window eyepoint policy.     * This variable specifies how Java 3D handles the predefined eye     * point in a non-head-tracked environment.  The variable can contain     * one of:     * <UL>     * <LI>RELATIVE_TO_SCREEN, Java 3D should interpret the     * given fixed-eyepoint position as relative to the screen (this     * implies that the view frustum shape will change whenever a     * user moves the location of a window on the screen).     * </LI>     * <LI>RELATIVE_TO_WINDOW, Java 3D should interpret the     * given fixed-eyepoint position as relative to the window.  In this     * mode, the X and Y values are taken as the center of the window and     * the Z value is taken from the canvas eyepoint position.     * </LI>     * <LI>RELATIVE_TO_FIELD_OF_VIEW, Java 3D should     * modify the position of the eyepoint to match any changes in field     * of view (the view frustum will change whenever the application     * program changes the field of view).     * </LI>     * <LI>RELATIVE_TO_COEXISTENCE, Java 3D should interpret the eye's     * position in coexistence coordinates. In this mode, the eye position     * is taken from the view (rather than the Canvas3D) and transformed from     * coexistence coordinates to image plate coordinates for each     * Canvas3D.  The resulting eye position is relative to the screen (this     * implies that the view frustum shape will change whenever a     * user moves the location of a window on the screen).     * </LI>     * </UL>     * The default window eyepoint policy is RELATIVE_TO_FIELD_OF_VIEW.     * @param policy the new policy, one of RELATIVE_TO_SCREEN,     * RELATIVE_TO_WINDOW, RELATIVE_TO_FIELD_OF_VIEW, or     * RELATIVE_TO_COEXISTENCE     */    public void setWindowEyepointPolicy(int policy) {	synchronized(this) {	    this.windowEyepointPolicy = policy;	    vDirtyMask |= View.WINDOW_EYE_POINT_POLICY_DIRTY;	}	repaint();    }    /**     * Returns the current window eyepoint policy, one of:     * RELATIVE_TO_SCREEN, RELATIVE_TO_WINDOW, RELATIVE_TO_FIELD_OF_VIEW or     * RELATIVE_TO_COEXISTENCE.     * @return the current window eyepoint policy     */    public int getWindowEyepointPolicy() {	return this.windowEyepointPolicy;    }    /**     * @deprecated As of Java 3D version 1.2, replaced by     * <code>Canvas3D.setMonoscopicViewPolicy</code>     */    public void setMonoscopicViewPolicy(int policy) {	synchronized(this) {	    this.monoscopicViewPolicy = policy;	    vDirtyMask |= View.MONOSCOPIC_VIEW_POLICY_DIRTY;	}	repaint();    }    /**     * @deprecated As of Java 3D version 1.2, replaced by     * <code>Canvas3D.getMonoscopicViewPolicy</code>     */    public int getMonoscopicViewPolicy() {	return this.monoscopicViewPolicy;    }    /**     * Sets the coexistenceCentering enable flag to true or false.     * If the coexistenceCentering flag is true, the center of     * coexistence in image plate coordinates, as specified by the     * trackerBaseToImagePlate transform, is translated to the center     * of either the window or the screen in image plate coordinates,     * according to the value of windowMovementPolicy.     *     * <p>     * By default, coexistenceCentering is enabled.  It should be     * disabled if the trackerBaseToImagePlate calibration transform     * is set to a value other than the identity (for example, when     * rendering to multiple screens or when head tracking is     * enabled).  This flag is ignored for HMD mode, or when the     * coexistenceCenterInPworldPolicy is <i>not</i>     * NOMINAL_SCREEN.     *     * @param flag the new coexistenceCentering enable flag     *     * @since Java 3D 1.2     */    public void setCoexistenceCenteringEnable(boolean flag) {	synchronized(this) {	    this.coexistenceCenteringEnable = flag;	    vDirtyMask |= View.COEXISTENCE_CENTERING_ENABLE_DIRTY;

⌨️ 快捷键说明

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