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

📄 texture.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    /**     * Uses the fastest available method for processing geometry.     * This value can be used as a parameter to setMinFilter and     * setMagFilter.     * @see #setMinFilter	 * @see #setMagFilter	 */    public static final int FASTEST = 0;    /**     * Uses the nicest available method for processing geometry.     * This value can be used as a parameter to setMinFilter and     * setMagFilter.     * @see #setMinFilter     * @see #setMagFilter     */    public static final int NICEST  = 1;    /**     * Select the nearest texel in level 0 texture map.     * Maps to NEAREST.     * @see #setMinFilter     * @see #setMagFilter     */    public static final int BASE_LEVEL_POINT = 2;      /**     * Performs bilinear interpolation on the four nearest texels     * in level 0 texture map.     * Maps to LINEAR.     * @see #setMinFilter     * @see #setMagFilter     */    public static final int BASE_LEVEL_LINEAR = 3;      /**     * Selects the nearest texel in the nearest mipmap.     * Maps to NEAREST_MIPMAP_NEAREST.     * @see #setMinFilter     */    public static final int MULTI_LEVEL_POINT = 4;      /**     * Performs tri-linear interpolation of texels between four     * texels each from two nearest mipmap levels.     * Maps to LINEAR_MIPMAP_LINEAR, but an implementation can      * fall back to LINEAR_MIPMAP_NEAREST or NEAREST_MIPMAP_LINEAR.     * @see #setMinFilter     */    public static final int MULTI_LEVEL_LINEAR    = 5;    // NOTE: values 6, 7, and 8 are reserved for the LINEAR_DETAIL*    // filter modes in Texture2D    /**     * Sharpens the resulting image by extrapolating     * from the base level plus one image to the base level image of this     * texture object.     *     * @since Java 3D 1.3     * @see #setMagFilter     */    public static final int LINEAR_SHARPEN        = 9;    /**     * Performs linear sharpen filter for the rgb     * components only. The alpha component is computed using      * BASE_LEVEL_LINEAR filter.     *     * @since Java 3D 1.3     * @see #setMagFilter     */    public static final int LINEAR_SHARPEN_RGB    = 10;    /**     * Performs linear sharpen filter for the alpha     * component only. The rgb components are computed using      * BASE_LEVEL_LINEAR filter.     *     * @since Java 3D 1.3     * @see #setMagFilter     */    public static final int LINEAR_SHARPEN_ALPHA  = 11;    /**     * Applies an application-supplied weight function     * on the nearest 4x4 texels in the base level texture image.     *     * @since Java 3D 1.3     * @see #setMinFilter     * @see #setMagFilter     */    public static final int FILTER4               = 12;      // Texture boundary mode parameter values    /**     * Clamps texture coordinates to be in the range [0, 1].     * Texture boundary texels or the constant boundary color if boundary     * width is 0 will be used for U,V values that fall     * outside this range.     */    public static final int CLAMP  = 2;    /**     * Repeats the texture by wrapping texture coordinates that are outside     * the range [0,1].  Only the fractional portion of the texture     * coordinates is used; the integer portion is discarded.     */    public static final int WRAP = 3;    /**     * Clamps texture coordinates such that filtering     * will not sample a texture boundary texel. Texels at the edge of the     * texture will be used instead.     *     * @since Java 3D 1.3     */    public static final int CLAMP_TO_EDGE = 4;    /**     * Clamps texture coordinates such that filtering     * will sample only texture boundary texels. If the texture does not     * have a boundary, that is the boundary width is equal to 0, then the     * constant boundary color will be used.</LI></P>     *     * @since Java 3D 1.3     */    public static final int CLAMP_TO_BOUNDARY = 5;    /**     * Indicates that Texture object only has one level. If multiple     * levels are needed, they will be implicitly computed.     */    public static final int BASE_LEVEL = 1;    /**     * Indicates that this Texture object has multiple images, one for      * each mipmap level.  In this mode, there are     * <code>log<sub><font size=-2>2</font></sub>(max(width,height))+1</code>     * separate images.     */    public static final int MULTI_LEVEL_MIPMAP = 2;    // Texture format parameter values    /**     * Specifies Texture contains only Intensity values.     */    public static final int INTENSITY = 1;    /**     * Specifies Texture contains only luminance values.     */    public static final int LUMINANCE = 2;    /**     * Specifies Texture contains only Alpha values.     */    public static final int ALPHA = 3;    /**     * Specifies Texture contains Luminance and Alpha values.     */    public static final int LUMINANCE_ALPHA = 4;    /**     * Specifies Texture contains Red, Green and Blue color values.     */    public static final int RGB = 5;    /**     * Specifies Texture contains Red, Green, Blue color values     * and Alpha value.     */    public static final int RGBA = 6;    /**     * No anisotropic filter.     *     * @since Java 3D 1.3     * @see #setAnisotropicFilterMode     */    public static final int ANISOTROPIC_NONE = 0;    /**     * Uses the degree of anisotropy in both the minification and     * magnification filters.     *     * @since Java 3D 1.3     * @see #setAnisotropicFilterMode     */    public static final int ANISOTROPIC_SINGLE_VALUE = 1;       // Array for setting default read capabilities    private static final int[] readCapabilities = {        ALLOW_ANISOTROPIC_FILTER_READ,        ALLOW_BOUNDARY_COLOR_READ,        ALLOW_BOUNDARY_MODE_READ,                ALLOW_ENABLE_READ,        ALLOW_FILTER4_READ,        ALLOW_FILTER_READ,                ALLOW_FORMAT_READ,        ALLOW_IMAGE_READ,        ALLOW_LOD_RANGE_READ,        ALLOW_MIPMAP_MODE_READ,                ALLOW_SHARPEN_TEXTURE_READ,        ALLOW_SIZE_READ            };    /**     * Constructs a Texture object with default parameters.     * The default values are as follows:     * <ul>     * enable flag : true<br>     * width : 0<br>     * height : 0<br>     * mipmap mode : BASE_LEVEL<br>     * format : RGB<br>     * boundary mode S : WRAP<br>     * boundary mode T : WRAP<br>     * min filter : BASE_LEVEL_POINT<br>     * mag filter : BASE_LEVEL_POINT<br>     * boundary color : black (0,0,0,0)<br>     * boundary width : 0<br>     * array of images : null<br>     * baseLevel : 0<br>     * maximumLevel : <code>log<sub><font size=-2>2</font></sub>(max(width,height))</code><br>     * minimumLOD : -1000.0<br>     * maximumLOD : 1000.0<br>     * lod offset : (0, 0, 0)<br>     * anisotropic mode : ANISOTROPIC_NONE<br>     * anisotropic filter : 1.0<br>     * sharpen texture func: null<br>     * filter4 func: null<br>     * </ul>     * <p>     * Note that the default constructor creates a texture object with      * a width and height of 0 and is, therefore, not useful.     */    public Texture() {	// Just use default values        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);    }    /**     * Constructs an empty Texture object with specified mipMapMode,     * format, width and height.  Defaults are used for all other     * parameters.  If <code>mipMapMode</code> is set to     * <code>BASE_LEVEL</code>, then the image at level 0 must be set     * by the application (using either the <code>setImage</code> or     * <code>setImages</code> method). If <code>mipMapMode</code> is     * set to <code>MULTI_LEVEL_MIPMAP</code>, then images for levels     * Base Level through Maximum Level must be set.      * Note that a texture with a non-power-of-two width or height will     * only be rendered on a graphics device that supports non-power-of-two     * textures.     *     * @param mipMapMode type of mipmap for this Texture: one of     * BASE_LEVEL, MULTI_LEVEL_MIPMAP     * @param format data format of Textures saved in this object.     * One of INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, RGBA     * @param width width of image at level 0.     * @param height height of image at level 0.     * @exception IllegalArgumentException if width or height are not greater     * than 0, or if an invalid format or mipMapMode is specified.     */    public Texture(int		mipMapMode,		   int		format,		   int		width,		   int		height) {        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);        if ((mipMapMode != BASE_LEVEL) && (mipMapMode != MULTI_LEVEL_MIPMAP))	    throw new IllegalArgumentException(J3dI18N.getString("Texture0"));	if ((format != INTENSITY) && (format != LUMINANCE) && 	    (format != ALPHA) && (format != LUMINANCE_ALPHA) &&	    (format != RGB) && (format != RGBA)) {	    throw new IllegalArgumentException(J3dI18N.getString("Texture1"));	}                if (width < 1) {            throw new IllegalArgumentException(J3dI18N.getString("Texture46"));        }        if (height < 1) {            throw new IllegalArgumentException(J3dI18N.getString("Texture47"));        }	int widthLevels;        int heightLevels;                widthLevels = getLevelsNPOT(width);        heightLevels = getLevelsNPOT(height);	((TextureRetained)this.retained).initialize(format, width, widthLevels,					height, heightLevels, mipMapMode, 0);    }    /**     * Constructs an empty Texture object with specified mipMapMode,     * format, width, height, and boundaryWidth.       * Defaults are used for all other     * parameters.  If <code>mipMapMode</code> is set to     * <code>BASE_LEVEL</code>, then the image at level 0 must be set     * by the application (using either the <code>setImage</code> or     * <code>setImages</code> method). If <code>mipMapMode</code> is     * set to <code>MULTI_LEVEL_MIPMAP</code>, then images for levels     * Base Level through Maximum Level must be set.      * Note that a texture with a non-power-of-two width or height will     * only be rendered on a graphics device that supports non-power-of-two     * textures.     *     * @param mipMapMode type of mipmap for this Texture: one of     * BASE_LEVEL, MULTI_LEVEL_MIPMAP     * @param format data format of Textures saved in this object.     * One of INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, RGBA     * @param width width of image at level 0. This     * does not include the width of the boundary.     * @param height height of image at level 0. This     * does not include the width of the boundary.     * @param boundaryWidth width of the boundary, which must be 0 or 1.     * @exception IllegalArgumentException if width or height are not greater     * than 0, if an invalid format or mipMapMode is specified, or     * if the boundaryWidth is &lt; 0 or &gt; 1     *     * @since Java 3D 1.3     */    public Texture(int		mipMapMode,		   int		format,		   int		width,		   int		height,		   int		boundaryWidth) {        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);        if ((mipMapMode != BASE_LEVEL) && (mipMapMode != MULTI_LEVEL_MIPMAP))	    throw new IllegalArgumentException(J3dI18N.getString("Texture0"));	if ((format != INTENSITY) && (format != LUMINANCE) && 	    (format != ALPHA) && (format != LUMINANCE_ALPHA) &&	    (format != RGB) && (format != RGBA)) {	    throw new IllegalArgumentException(J3dI18N.getString("Texture1"));	}        if (width < 1) {            throw new IllegalArgumentException(J3dI18N.getString("Texture46"));        }        if (height < 1) {            throw new IllegalArgumentException(J3dI18N.getString("Texture47"));

⌨️ 快捷键说明

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