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

📄 textureattributes.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
     * @since Java 3D 1.3     * @see #setCombineRgbSource     * @see #setCombineAlphaSource     */    public static final int COMBINE_TEXTURE_COLOR	= 1;    /**     * Texture blend color.      *     * @since Java 3D 1.3     * @see #setCombineRgbSource     * @see #setCombineAlphaSource     */    public static final int COMBINE_CONSTANT_COLOR	= 2;    /**     * Color from the previous texture unit state.     *     * @since Java 3D 1.3     * @see #setCombineRgbSource     * @see #setCombineAlphaSource     */    public static final int COMBINE_PREVIOUS_TEXTURE_UNIT_STATE	= 3;    /**      * Color function is f = C<sub>rgb</sub>     *     * @since Java 3D 1.3     * @see #setCombineRgbFunction     */    public static final int COMBINE_SRC_COLOR		= 0;    /**      * Color function is f = (1 - C<sub>rgb</sub>)     *     * @since Java 3D 1.3     * @see #setCombineRgbFunction     */    public static final int COMBINE_ONE_MINUS_SRC_COLOR	= 1;    /**      * Color function is f = C<sub>a</sub>     *     * @since Java 3D 1.3     * @see #setCombineRgbFunction     * @see #setCombineAlphaFunction     */    public static final int COMBINE_SRC_ALPHA		= 2;    /**      * Color function is f = (1 - C<sub>a</sub>)     *     * @since Java 3D 1.3     * @see #setCombineRgbFunction     * @see #setCombineAlphaFunction     */    public static final int COMBINE_ONE_MINUS_SRC_ALPHA	= 3;   // Array for setting default read capabilities    private static final int[] readCapabilities = {        ALLOW_BLEND_COLOR_READ,        ALLOW_COLOR_TABLE_READ,        ALLOW_COMBINE_READ,        ALLOW_MODE_READ,        ALLOW_TRANSFORM_READ            };        /**     * Constructs a TextureAttributes object with default parameters.     * The default values are as follows:     * <ul>     * texture mode : REPLACE<br>     * blend color : black (0,0,0,0)<br>     * transform : identity<br>     * perspective correction mode : NICEST<br>     * texture color table : null<br>     * combine rgb mode : COMBINE_MODULATE<br>     * combine alpha mode : COMBINE_MODULATE<br>     * combine rgb source :      * <ul>     * 		C<sub>0</sub>=COMBINE_TEXTURE_COLOR<br>     *          C<sub>1</sub>=COMBINE_PREVIOUS_TEXTURE_UNIT_STATE<br>     *          C<sub>2</sub>=COMBINE_CONSTANT_COLOR<br>     * </ul>     * combine alpha source :      * <ul>     * 		C<sub>0</sub>=COMBINE_TEXTURE_COLOR<br>     *          C<sub>1</sub>=COMBINE_PREVIOUS_TEXTURE_UNIT_STATE<br>     *          C<sub>2</sub>=COMBINE_CONSTANT_COLOR<br>     * </ul>     * combine rgb function : COMBINE_SRC_COLOR<br>     * combine alpha function : COMBINE_SRC_ALPHA<br>      * combine rgb scale : 1<br>     * combine alpha scale : 1<br>     * </ul>     */    public TextureAttributes()  {        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);    }      /**     * Constructs a TextureAttributes object with the specified values.     * @param textureMode the texture mode; one of <code>MODULATE</code>,      * <code>DECAL</code>, <code>BLEND</code>, <code>REPLACE</code>, or     * <code>COMBINE</code>     * @param transform the transform object, used to transform texture     * coordinates     * @param textureBlendColor the texture constant color     * @param perspCorrectionMode the perspective correction mode to      * be used for color and/or texture coordinate interpolation;     * one of <code>NICEST</code> or <code>FASTEST</code>     * @exception IllegalArgumentException if <code>textureMode</code>     * is a value other than <code>MODULATE</code>,     * <code>DECAL</code>, <code>BLEND</code>, <code>REPLACE</code>, or     * <code>COMBINE</code>     * @exception IllegalArgumentException if mode value is other     * than <code>FASTEST</code> or <code>NICEST</code>.     */    public TextureAttributes(int textureMode, Transform3D transform,			     Color4f textureBlendColor,			     int perspCorrectionMode) {	if ((textureMode < MODULATE) || (textureMode > COMBINE)) {	    throw new IllegalArgumentException(J3dI18N.getString("TextureAttributes10"));	}	if ((perspCorrectionMode != FASTEST) && 	    (perspCorrectionMode!= NICEST)) {	    throw new IllegalArgumentException(J3dI18N.getString("TextureAttributes9"));	}        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);        ((TextureAttributesRetained)this.retained).initTextureMode(textureMode);	((TextureAttributesRetained)this.retained).initTextureBlendColor(textureBlendColor);	((TextureAttributesRetained)this.retained).initTextureTransform(transform);	((TextureAttributesRetained)this.retained).initPerspectiveCorrectionMode(perspCorrectionMode);    }      /**     * Sets the texture  mode parameter for this     * appearance component object.     * @param textureMode the texture  mode, one of: <code>MODULATE</code>,     * <code>DECAL</code>, <code>BLEND</code>, <code>REPLACE</code>, or     * <code>COMBINE</code>     * @exception IllegalArgumentException if <code>textureMode</code>     * is a value other than <code>MODULATE</code>,     * <code>DECAL</code>, <code>BLEND</code>, <code>REPLACE</code>, or     * <code>COMBINE</code>     *     * @see Canvas3D#queryProperties     */    public void setTextureMode(int textureMode) {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_MODE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes0"));	if ((textureMode < MODULATE) || (textureMode > COMBINE)) {	    throw new IllegalArgumentException(J3dI18N.getString("TextureAttributes10"));	}	if (isLive())	    ((TextureAttributesRetained)this.retained).setTextureMode(textureMode);	else	    ((TextureAttributesRetained)this.retained).initTextureMode(textureMode);    }    /**     * Gets the texture  mode parameter for this     * texture attributes object.     * @return textureMode the texture  mode     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public int getTextureMode() {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_MODE_READ))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes1"));	return ((TextureAttributesRetained)this.retained).getTextureMode();    }    /**     * Sets the texture constant color for this     * texture attributes object.     * @param textureBlendColor the texture constant color     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public void setTextureBlendColor(Color4f textureBlendColor) {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_BLEND_COLOR_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes2"));	if (isLive())	    ((TextureAttributesRetained)this.retained).setTextureBlendColor(textureBlendColor);	else	    ((TextureAttributesRetained)this.retained).initTextureBlendColor(textureBlendColor);    }    /**     * Sets the texture blend color for this     * appearance component object.       * @param r the red component of the color     * @param g the green component of the color     * @param b the blue component of the color     * @param a the alpha component of the color     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public void setTextureBlendColor(float r, float g, float b, float a) {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_BLEND_COLOR_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes3"));	if (isLive())	    ((TextureAttributesRetained)this.retained).setTextureBlendColor(r, g, b, a);	else	    ((TextureAttributesRetained)this.retained).initTextureBlendColor(r, g, b, a);    }    /**     * Gets the texture blend color for this     * appearance component object.     * @param textureBlendColor the vector that will receive the texture     * constant color      * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public void getTextureBlendColor(Color4f textureBlendColor) {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_BLEND_COLOR_READ))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes4"));	((TextureAttributesRetained)this.retained).getTextureBlendColor(textureBlendColor);    }    /**     * Sets the texture transform object used to transform texture     * coordinates.  A copy of the specified Transform3D object is     * stored in this TextureAttributes object.     * @param transform the new transform object     * @exception CapabilityNotSetException if the method is called     * when this object is part of live or compiled scene graph.     */    public void setTextureTransform(Transform3D transform) {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_TRANSFORM_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes5"));	if (isLive())	    ((TextureAttributesRetained)this.retained).setTextureTransform(transform);	else	    ((TextureAttributesRetained)this.retained).initTextureTransform(transform);    }    /**     * Retrieves a copy of the texture transform object.     * @param transform the transform object that will receive the     * current texture transform     * @exception CapabilityNotSetException if the method is called     * when this object is part of live or compiled scene graph.     */    public void getTextureTransform(Transform3D transform) {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_TRANSFORM_READ))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes6"));	((TextureAttributesRetained)this.retained).getTextureTransform(transform);    }    /**     * Sets perspective correction mode to be used for color     * and/or texture coordinate interpolation.     * A value of <code>NICEST</code> indicates that perspective correction should be     * performed and that the highest quality method should be used.     * A value of <code>FASTEST</code> indicates that the most efficient perspective     * correction method should be used.     * @param mode one of <code>NICEST</code> or <code>FASTEST</code>     * The default value is <code>NICEST</code>.     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     * @exception IllegalArgumentException if mode value is other     * than <code>FASTEST</code> or <code>NICEST</code>.     */    public void setPerspectiveCorrectionMode(int mode) {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_MODE_WRITE))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes7"));	if ((mode != FASTEST) && (mode!= NICEST))	    throw new IllegalArgumentException(J3dI18N.getString("TextureAttributes9"));	if (isLive())	    ((TextureAttributesRetained)this.retained).setPerspectiveCorrectionMode(mode);	else	    ((TextureAttributesRetained)this.retained).initPerspectiveCorrectionMode(mode);    }    /**     * Gets perspective correction mode value.     * @return mode the value of perspective correction mode     * @exception CapabilityNotSetException if appropriate capability is      * not set and this object is part of live or compiled scene graph     */    public int getPerspectiveCorrectionMode() {	if (isLiveOrCompiled())	    if (!this.getCapability(ALLOW_MODE_READ))		throw new CapabilityNotSetException(J3dI18N.getString("TextureAttributes8"));	return ((TextureAttributesRetained)this.retained).getPerspectiveCorrectionMode();    }    /**     * Sets the texture color table from the specified table.  The     * individual integer array elements are copied.  The array is     * indexed first by color component (<i>r</i>, <i>g</i>, <i>b</i>,     * and <i>a</i>, respectively) and then by color value;     * <code>table.length</code> defines the number of color     * components and <code>table[0].length</code> defines the texture     * color table size.  If the table is non-null, the number of     * color components must either be 3, for <i>rgb</i> data, or 4,     * for <i>rgba</i> data.  The size of each array for each color     * component must be the same and must be a power of 2.  If table     * is null or if the texture color table size is 0, the texture     * color table is disabled.  If the texture color table size is     * greater than the device-dependent maximum texture color table     * size for a particular Canvas3D, the texture color table is     * ignored for that canvas.     *     * <p>     * When enabled, the texture color table is applied after the     * texture filtering operation and before texture application.     * Each of the <i>r</i>, <i>g</i>, <i>b</i>, and <i>a</i>     * components are clamped to the range [0,1], multiplied by     * <code>textureColorTableSize-1</code>, and rounded to the     * nearest integer.  The resulting value for each component is     * then used as an index into the respective table for that     * component.  If the texture color table contains 3 components,     * alpha is passed through unmodified.     *     * @param table the new texture color table     *     * @exception IllegalArgumentException if <code>table.length</code>     * is not 3 or 4, or if the arrays for each component are not all     * the same length, or if the texture color table size     * is not a power of 2     * @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.2     */

⌨️ 快捷键说明

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