📄 screen3d.java
字号:
* @since Java 3D 1.2 */ public void setSize(int width, int height) { if (!offScreen) throw new IllegalStateException(J3dI18N.getString("Screen3D1")); synchronized(this) { screenSize.width = width; screenSize.height = height; scrDirtyMask |= SCREEN_SIZE_DIRTY_DIRTY; } } /** * Sets the width and height (in pixels) of this off-screen Screen3D. * The default size for off-screen Screen3D objects is (0,0). * <br> * NOTE: the size must be * set prior to rendering to the associated off-screen canvas. * Failure to do so will result in an exception. * * @param d the new dimension of this Screen3D object * * @exception IllegalStateException if this Screen3D is not in * off-screen mode. * * @since Java 3D 1.2 */ public void setSize(Dimension d) { if (!offScreen) throw new IllegalStateException(J3dI18N.getString("Screen3D1")); synchronized(this) { screenSize.width = d.width; screenSize.height = d.height; scrDirtyMask |= SCREEN_SIZE_DIRTY_DIRTY; } } /** * Sets the screen physical width in meters. In the case of a * head-mounted display, this should be the apparent width * at the focal plane. * @param width the screen's physical width in meters */ public void setPhysicalScreenWidth(double width) { synchronized(this) { physicalScreenWidth = width; scrDirtyMask |= PHYSICAL_SCREEN_SIZE_DIRTY; } notifyUsers(); } /** * Retrieves the screen's physical width in meters. * @return the screen's physical width in meters */ public double getPhysicalScreenWidth() { return physicalScreenWidth; } /** * Sets the screen physical height in meters. In the case of a * head-mounted display, this should be the apparent height * at the focal plane. * @param height the screen's physical height in meters */ public void setPhysicalScreenHeight(double height) { synchronized(this) { physicalScreenHeight = height; scrDirtyMask |= PHYSICAL_SCREEN_SIZE_DIRTY; } notifyUsers(); } /** * Retrieves the the screen's physical height in meters. * @return the screen's physical height in meters */ public double getPhysicalScreenHeight() { return physicalScreenHeight; } public String toString() { return "Screen3D: size = " + "(" + getSize().width + " x " + getSize().height + ")" + ", physical size = " + "(" + getPhysicalScreenWidth() + "m x " + getPhysicalScreenHeight() + "m)"; } // Static initializer for Screen3D class static { VirtualUniverse.loadLibraries(); } /** * Construct a new Screen3D object with the specified size in pixels. * Note that currently, there is no AWT equivalent of screen so Java 3D * users need to get this through the Canvas3D object (via getScreen()) if * they need it. * @param graphicsConfiguration the AWT graphics configuration associated * with this Screen3D * @param offScreen a flag that indicates whether this Screen3D is * associated with an off-screen Canvas3D */ Screen3D(GraphicsConfiguration graphicsConfiguration, boolean offScreen) { this.offScreen = offScreen; this.graphicsDevice = graphicsConfiguration.getDevice(); screenViewCache = new ScreenViewCache(this); // Get the display handle and the screen number from the Pipeline display = Pipeline.getPipeline().getDisplay(); screen = Pipeline.getPipeline().getScreen(graphicsDevice); if (debug) System.err.println("Screen3D: display " + display + " screen " + screen + " hashcode " + this.hashCode()); if (!offScreen) { // Store the information in this screen object Rectangle bounds = graphicsConfiguration.getBounds(); screenSize.width = bounds.width; screenSize.height = bounds.height; } // Set the default physical size based on size in pixels physicalScreenWidth = screenSize.width * METERS_PER_PIXEL; physicalScreenHeight = screenSize.height * METERS_PER_PIXEL; } /** * Sets the tracker-base coordinate system to image-plate coordinate * system transform. This transform * is typically a calibration constant. * This is used only in SCREEN_VIEW mode. * @param t the new transform * @exception BadTransformException if the transform is not rigid */ public void setTrackerBaseToImagePlate(Transform3D t) { synchronized(this) { if (!t.isRigid()) { throw new BadTransformException(J3dI18N.getString("Screen3D0")); } trackerBaseToImagePlate.setWithLock(t); scrDirtyMask |= Screen3D.TRACKER_BASE_TO_IMAGE_PLATE_DIRTY; } notifyUsers(); } /** * Retrieves the tracker-base coordinate system to image-plate * coordinate system transform and copies it into the specified * Transform3D object. * @param t the object that will receive the transform */ public void getTrackerBaseToImagePlate(Transform3D t) { t.set(trackerBaseToImagePlate); } /** * Sets the head-tracker coordinate system to left image-plate coordinate * system transform. This transform * is typically a calibration constant. * This is used only in HMD_VIEW mode. * @param t the new transform * @exception BadTransformException if the transform is not rigid */ public void setHeadTrackerToLeftImagePlate(Transform3D t) { synchronized(this) { if (!t.isRigid()) { throw new BadTransformException(J3dI18N.getString("Screen3D0")); } headTrackerToLeftImagePlate.setWithLock(t); scrDirtyMask |= Screen3D.HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY; } notifyUsers(); } /** * Retrieves the head-tracker coordinate system to left image-plate * coordinate system transform and copies it into the specified * Transform3D object. * @param t the object that will receive the transform */ public void getHeadTrackerToLeftImagePlate(Transform3D t) { t.set(headTrackerToLeftImagePlate); } /** * Sets the head-tracker coordinate system to right image-plate coordinate * system transform. This transform * is typically a calibration constant. * This is used only in HMD_VIEW mode. * @param t the new transform * @exception BadTransformException if the transform is not rigid */ public void setHeadTrackerToRightImagePlate(Transform3D t) { synchronized(this) { if (!t.isRigid()) { throw new BadTransformException(J3dI18N.getString("Screen3D0")); } headTrackerToRightImagePlate.setWithLock(t); scrDirtyMask |= Screen3D.HEAD_TRACKER_TO_IMAGE_PLATE_DIRTY; } notifyUsers(); } /** * Retrieves the head-tracker coordinate system to right image-plate * coordinate system transform and copies it into the specified * Transform3D object. * @param t the object that will receive the transform */ public void getHeadTrackerToRightImagePlate(Transform3D t) { t.set(headTrackerToRightImagePlate); } /** * Update the view cache associated with this screen. */ void updateViewCache() { if (false) System.err.println("Screen3D.updateViewCache()"); synchronized(this) { screenViewCache.snapshot(); } } /** * Increment canvas count, initialize renderer if needed */ synchronized void incCanvasCount() { canvasCount++; } /** * Decrement canvas count, kill renderer if needed */ synchronized void decCanvasCount() { canvasCount--; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -