📄 textureattributes.java
字号:
} /** * Sets the function for the rgb components of the specified color operand * for this object. * * @param index color operand in the combine operation * @param function the color function, one of: * <code>COMBINE_SRC_COLOR</code>, * <code>COMBINE_ONE_MINUS_SRC_COLOR</code>, * <code>COMBINE_SRC_ALPHA</code>, or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception IllegalArgumentException if <code>function</code> * is a value other than <code>COMBINE_SRC_COLOR</code>, * <code>COMBINE_ONE_MINUS_SRC_COLOR</code>, * <code>COMBINE_SRC_ALPHA</code>, or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see Canvas3D#queryProperties * * @since Java 3D 1.3 */ public void setCombineRgbFunction(int index, int function) { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_WRITE)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes27")); } } if ((index < 0) || (index > 2)) { throw new IndexOutOfBoundsException( J3dI18N.getString("TextureAttributes25")); } if ((function < COMBINE_SRC_COLOR) || (function > COMBINE_ONE_MINUS_SRC_ALPHA)) { throw new IllegalArgumentException( J3dI18N.getString("TextureAttributes31")); } if (isLive()) { ((TextureAttributesRetained)this.retained).setCombineRgbFunction( index, function); } else { ((TextureAttributesRetained)this.retained).initCombineRgbFunction( index, function); } } /** * Sets the function for the alpha component of the specified color operand * for this object. * * @param index color operand in the combine operation * @param function the color function, one of: * <code>COMBINE_SRC_ALPHA</code>, or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception IllegalArgumentException if <code>function</code> * is a value other than * <code>COMBINE_SRC_ALPHA</code> or * <code>COMBINE_ONE_MINUS_SRC_ALPHA</code> * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see Canvas3D#queryProperties * * @since Java 3D 1.3 */ public void setCombineAlphaFunction(int index, int function) { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_WRITE)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes29")); } } if ((index < 0) || (index > 2)) { throw new IndexOutOfBoundsException( J3dI18N.getString("TextureAttributes25")); } if ((function < COMBINE_SRC_ALPHA) || (function > COMBINE_ONE_MINUS_SRC_ALPHA)) { throw new IllegalArgumentException( J3dI18N.getString("TextureAttributes31")); } if (isLive()) { ((TextureAttributesRetained)this.retained).setCombineAlphaFunction( index, function); } else { ((TextureAttributesRetained)this.retained).initCombineAlphaFunction( index, function); } } /** * Retrieves the function for the rgb components of the specified color * operand for this object. * * @param index color operand in the combine operation * * @return the function for the rgb components of the specified color * operand for this object. * * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 */ public int getCombineRgbFunction(int index) { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_READ)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes28")); } } if ((index < 0) || (index > 2)) { throw new IndexOutOfBoundsException( J3dI18N.getString("TextureAttributes25")); } return ((TextureAttributesRetained)this.retained).getCombineRgbFunction(index); } /** * Retrieves the function for the alpha component of the specified color * operand for this object. * * @param index color operand in the combine operation * * @return the function for the alpha component of the specified color * operand for this object. * * @exception IndexOutOfBoundsException if <code>index</code> < 0 or * <code>index</code> > 2 * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 */ public int getCombineAlphaFunction(int index) { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_READ)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes30")); } } if ((index < 0) || (index > 2)) { throw new IndexOutOfBoundsException( J3dI18N.getString("TextureAttributes25")); } return ((TextureAttributesRetained)this.retained).getCombineAlphaFunction(index); } /** * Sets the scale factor for the rgb components of the output color * for this object. * * @param scale the scale factor for the rgb components of the output * color. It must be one of the following: 1, 2, or 4. * * @exception IllegalArgumentException if <code>scale</code> is a * value other than 1, 2, or 4. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see Canvas3D#queryProperties * * @since Java 3D 1.3 */ public void setCombineRgbScale(int scale) { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_WRITE)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes32")); } } if ((scale != 1) && (scale != 2) && (scale != 4)) { throw new IllegalArgumentException( J3dI18N.getString("TextureAttributes36")); } if (isLive()) { ((TextureAttributesRetained)this.retained).setCombineRgbScale(scale); } else { ((TextureAttributesRetained)this.retained).initCombineRgbScale(scale); } } /** * Sets the scale factor for the alpha component of the output color * for this object. * * @param scale the scale factor for the alpha component of the output * color. It must be one of the following: 1, 2, or 4. * * @exception IllegalArgumentException if <code>scale</code> is a * value other than 1, 2, or 4. * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @see Canvas3D#queryProperties * * @since Java 3D 1.3 */ public void setCombineAlphaScale(int scale) { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_WRITE)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes34")); } } if ((scale != 1) && (scale != 2) && (scale != 4)) { throw new IllegalArgumentException( J3dI18N.getString("TextureAttributes36")); } if (isLive()) { ((TextureAttributesRetained)this.retained).setCombineAlphaScale(scale); } else { ((TextureAttributesRetained)this.retained).initCombineAlphaScale(scale); } } /** * Retrieves the scale factor for the rgb components of the output color * for this object. * * @return the scale factor for the rgb components of the output color * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 */ public int getCombineRgbScale() { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_READ)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes33")); } } return ((TextureAttributesRetained)this.retained).getCombineRgbScale(); } /** * Retrieves the scale factor for the alpha component of the output color * for this object. * * @return the scale factor for the alpha component of the output color * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @since Java 3D 1.3 */ public int getCombineAlphaScale() { if (isLiveOrCompiled()) { if (!this.getCapability(ALLOW_COMBINE_READ)) { throw new CapabilityNotSetException( J3dI18N.getString("TextureAttributes35")); } } return ((TextureAttributesRetained)this.retained).getCombineAlphaScale(); } /** * Creates a retained mode TextureAttributesRetained object that this * TextureAttributes component object will point to. */ void createRetained() { this.retained = new TextureAttributesRetained(); this.retained.setSource(this); } /** * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate) */ public NodeComponent cloneNodeComponent() { TextureAttributes ta = new TextureAttributes(); ta.duplicateNodeComponent(this); return ta; } /** * 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); TextureAttributesRetained attr = (TextureAttributesRetained) originalNodeComponent.retained; TextureAttributesRetained rt = (TextureAttributesRetained) retained; Color4f c = new Color4f(); attr.getTextureBlendColor(c); Transform3D t = new Transform3D(); attr.getTextureTransform(t); rt.initTextureMode(attr.getTextureMode()); rt.initPerspectiveCorrectionMode(attr.getPerspectiveCorrectionMode()); rt.initTextureBlendColor(c); rt.initTextureTransform(t); if ((attr.getNumTextureColorTableComponents() != 0) && (attr.getTextureColorTableSize() != 0)) { int table[][] = new int[attr.getNumTextureColorTableComponents()][attr.getTextureColorTableSize()]; attr.getTextureColorTable(table); rt.initTextureColorTable(table); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -