📄 renderingattributes.java
字号:
* * @param state true or false to enable or disable depth buffer mode * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see GraphicsConfigTemplate3D#setDepthSize */ public void setDepthBufferEnable(boolean state){ if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DEPTH_ENABLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes0")); if (isLive()) ((RenderingAttributesRetained)this.retained).setDepthBufferEnable(state); else ((RenderingAttributesRetained)this.retained).initDepthBufferEnable(state); } /** * Retrieves the state of zBuffer Enable flag * @return true if depth buffer mode is enabled, false * if depth buffer mode is disabled * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getDepthBufferEnable(){ if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DEPTH_ENABLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes1")); return ((RenderingAttributesRetained)this.retained).getDepthBufferEnable(); } /** * Enables or disables writing the depth buffer for this object. * During the transparent rendering pass, * this attribute can be overridden by * the depthBufferFreezeTransparent attribute in the View object. * @param state true or false to enable or disable depth buffer Write mode * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * @see View#setDepthBufferFreezeTransparent */ public void setDepthBufferWriteEnable(boolean state) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DEPTH_ENABLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes2")); if (isLive()) ((RenderingAttributesRetained)this.retained).setDepthBufferWriteEnable(state); else ((RenderingAttributesRetained)this.retained).initDepthBufferWriteEnable(state); } /** * Retrieves the state of Depth Buffer Write Enable flag. * @return true if depth buffer is writable, false * if depth buffer is read-only * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public boolean getDepthBufferWriteEnable(){ if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_DEPTH_ENABLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes3")); return ((RenderingAttributesRetained)this.retained).getDepthBufferWriteEnable(); } /** * Set alpha test value used by alpha test function. This value is * compared to the alpha value of each rendered pixel. * @param value the alpha test value * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAlphaTestValue(float value){ if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ALPHA_TEST_VALUE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes4")); if (isLive()) ((RenderingAttributesRetained)this.retained).setAlphaTestValue(value); else ((RenderingAttributesRetained)this.retained).initAlphaTestValue(value); } /** * Retrieves the alpha test value. * @return the alpha test value. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public float getAlphaTestValue(){ if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ALPHA_TEST_VALUE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes5")); return ((RenderingAttributesRetained)this.retained).getAlphaTestValue(); } /** * Set alpha test function. This function is used to compare * each incoming (source) per-pixel alpha value with the alpha test value. * If the test passes, the pixel is written otherwise the pixel is not * written. * @param function the new alpha test function. One of * ALWAYS, NEVER, EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER, * GREATER_OR_EQUAL * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setAlphaTestFunction(int function){ if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ALPHA_TEST_FUNCTION_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes6")); if (isLive()) ((RenderingAttributesRetained)this.retained).setAlphaTestFunction(function); else ((RenderingAttributesRetained)this.retained).initAlphaTestFunction(function); } /** * Retrieves current alpha test function. * @return the current alpha test function * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public int getAlphaTestFunction(){ if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_ALPHA_TEST_FUNCTION_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes7")); return ((RenderingAttributesRetained)this.retained).getAlphaTestFunction(); } /** * Sets the visibility flag for this RenderingAttributes * component object. Invisible objects are not rendered (subject to * the visibility policy for the current view), but they can be picked * or collided with. The default value is true. * @param visible true or false to enable or disable visibility * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see View#setVisibilityPolicy * * @since Java 3D 1.2 */ public void setVisible(boolean visible) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_VISIBLE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes8")); if (isLive()) ((RenderingAttributesRetained)this.retained).setVisible(visible); else ((RenderingAttributesRetained)this.retained).initVisible(visible); } /** * Retrieves the visibility flag for this RenderingAttributes object. * @return true if the object is visible; false * if the object is invisible. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 */ public boolean getVisible() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_VISIBLE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes9")); return ((RenderingAttributesRetained)this.retained).getVisible(); } /** * Sets a flag that indicates whether vertex colors are ignored * for this RenderingAttributes object. If * <code>ignoreVertexColors</code> is false, per-vertex * colors are used, when present in the associated Geometry * objects, taking precedence over the ColoringAttributes color * and the specified Material color(s). If <code>ignoreVertexColors</code> * is true, per-vertex colors are ignored. In this case, if * lighting is enabled, the Material diffuse color will be * used as the object color. If lighting is disabled, the * ColoringAttributes color will be used. The default value is false. * * @param ignoreVertexColors true or false to enable or disable * the ignoring of per-vertex colors * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see ColoringAttributes * @see Material * * @since Java 3D 1.2 */ public void setIgnoreVertexColors(boolean ignoreVertexColors) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_IGNORE_VERTEX_COLORS_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes12")); if (isLive()) ((RenderingAttributesRetained)this.retained).setIgnoreVertexColors(ignoreVertexColors); else ((RenderingAttributesRetained)this.retained).initIgnoreVertexColors(ignoreVertexColors); } /** * Retrieves the ignoreVertexColors flag for this * RenderingAttributes object. * @return true if per-vertex colors are ignored; false * if per-vertex colors are used. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 */ public boolean getIgnoreVertexColors() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_IGNORE_VERTEX_COLORS_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes13")); return ((RenderingAttributesRetained)this.retained).getIgnoreVertexColors(); } /** * Sets the rasterOp enable flag for this RenderingAttributes * component object. When set to true, this enables logical * raster operations as specified by the setRasterOp method. * Enabling raster operations effectively disables alpha blending, * which is used for transparency and antialiasing. Raster * operations, especially XOR mode, are primarily useful when * rendering to the front buffer in immediate mode. Most * applications will not wish to enable this mode. * * @param rasterOpEnable true or false to enable or disable * raster operations * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see #setRasterOp * * @since Java 3D 1.2 */ public void setRasterOpEnable(boolean rasterOpEnable) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_RASTER_OP_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes10")); if (isLive()) ((RenderingAttributesRetained)this.retained).setRasterOpEnable(rasterOpEnable); else ((RenderingAttributesRetained)this.retained).initRasterOpEnable(rasterOpEnable); } /** * Retrieves the rasterOp enable flag for this RenderingAttributes * object. * @return true if raster operations are enabled; false * if raster operations are disabled. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 */ public boolean getRasterOpEnable() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_RASTER_OP_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes11")); return ((RenderingAttributesRetained)this.retained).getRasterOpEnable(); } /** * Sets the raster operation function for this RenderingAttributes * component object. * * @param rasterOp the logical raster operation, one of: * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED, * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT, * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 */ public void setRasterOp(int rasterOp) { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_RASTER_OP_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes10")); if (isLive()) ((RenderingAttributesRetained)this.retained).setRasterOp(rasterOp); else ((RenderingAttributesRetained)this.retained).initRasterOp(rasterOp); } /** * Retrieves the current raster operation for this RenderingAttributes * object. * @return one of: * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED, * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT, * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.2 */ public int getRasterOp() { if (isLiveOrCompiled()) if (!this.getCapability(ALLOW_RASTER_OP_READ)) throw new CapabilityNotSetException(J3dI18N.getString("RenderingAttributes11")); return ((RenderingAttributesRetained)this.retained).getRasterOp(); } /** * Creates a retained mode RenderingAttributesRetained object that this * RenderingAttributes component object will point to. */ void createRetained() { this.retained = new RenderingAttributesRetained(); this.retained.setSource(this); } /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { RenderingAttributes ra = new RenderingAttributes(); ra.duplicateNodeComponent(this); return ra; } /** * Copies all node information from <code>originalNodeComponent</code> into * the current node. This method is called from the * <code>duplicateNode</code> method. This routine does * the actual duplication of all "local data" (any data defined in * this object). * * @param originalNodeComponent the original node to duplicate. * @param forceDuplicate when set to <code>true</code>, causes the * <code>duplicateOnCloneTree</code> flag to be ignored. When * <code>false</code>, the value of each node's * <code>duplicateOnCloneTree</code> variable determines whether * NodeComponent data is duplicated or copied. * * @see Node#cloneTree * @see NodeComponent#setDuplicateOnCloneTree */ void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) { super.duplicateAttributes(originalNodeComponent, forceDuplicate); RenderingAttributesRetained attr = (RenderingAttributesRetained) originalNodeComponent.retained; RenderingAttributesRetained rt = (RenderingAttributesRetained) retained;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -