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

📄 texture2d.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * $RCSfile: Texture2D.java,v $ * * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * * Use is subject to license terms. * * $Revision: 1.7 $ * $Date: 2007/02/09 17:18:26 $ * $State: Exp $ */package javax.media.j3d;import javax.vecmath.*;/** * Texture2D is a subclass of Texture class. It extends Texture * class by adding a constructor and a mutator method for * setting a 2D texture image. * <p> * Note that as of Java 3D 1.5, the texture width and height are no longer * required to be an exact power of two. However, not all graphics devices * supports non-power-of-two textures. If non-power-of-two texture mapping is * unsupported on a particular Canvas3D, textures with a width or height that * are not an exact power of two are ignored for that canvas. * * @see Canvas3D#queryProperties */public class Texture2D extends Texture {    /**     * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     * Specifies that this Texture object allows reading its detail     * texture information (e.g., detail texture image, detail texture mode,     * detail texture function, detail texture function points count,     * detail texture level)     *     * @since Java 3D 1.3     */    public static final int    ALLOW_DETAIL_TEXTURE_READ = CapabilityBits.TEXTURE2D_ALLOW_DETAIL_TEXTURE_READ;    /**      * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     * Performs linear sampling in both the base level     * texture image and the detail texture image, and combines the two     * texture values according to the detail texture mode.     *     * @since Java 3D 1.3     * @see #setMagFilter     */    public static final int LINEAR_DETAIL         = 6;    /**     * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     * Performs linear detail 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_DETAIL_RGB     = 7;    /**     * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     * Performs linear detail 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_DETAIL_ALPHA   = 8;    /**     * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     * Adds the detail texture image to the level 0 image of this texture     * object     *     * @since Java 3D 1.3     * @see #setDetailTextureMode     */    public static final int DETAIL_ADD = 0;    /**     * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     * Modulates the detail texture image with the level 0 image of this     * texture object     *     * @since Java 3D 1.3     * @see #setDetailTextureMode     */    public static final int DETAIL_MODULATE = 1;    // Array for setting default read capabilities    private static final int[] readCapabilities = {	ALLOW_DETAIL_TEXTURE_READ    };    /**     * Constructs a texture object using default values.     *     * The default values are as follows:     * <ul>     * detail texture image: null<br>     * detail texture mode: DETAIL_MODULATE<br>     * detail texture func: null<br>     * detail texture level: 2<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 Texture2D() {	super();        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);    }    /**     * Constructs an empty Texture2D object with specified mipmapMode     * format, width and height. Image at base level must be set by     * the application using 'setImage' method. If mipmapMode is     * set to MULTI_LEVEL_MIPMAP, images for 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 invalid format/mipmapMode is specified.     */    public Texture2D(            int		mipMapMode,            int		format,            int		width,            int		height) {	super(mipMapMode, format, width, height);        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);    }    /**     * Constructs an empty Texture2D 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 Texture2D(int          mipMapMode,                   int          format,                   int          width,                   int          height,                   int          boundaryWidth) {        super(mipMapMode, format, width, height, boundaryWidth);        // set default read capabilities        setDefaultReadCapabilities(readCapabilities);    }    /**     * Sets the magnification filter function.  This     * function is used when the pixel being rendered maps to an area     * less than or equal to one texel.     * @param magFilter the magnification filter, one of:     * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR,      * LINEAR_DETAIL, LINEAR_DETAIL_RGB, LINEAR_DETAIL_ALPHA,     * LINEAR_SHARPEN, LINEAR_SHARPEN_RGB, LINEAR_SHARPEN_ALPHA, or FILTER4.     *     * @exception RestrictedAccessException if the method is called     * when this object is part of live or compiled scene graph.     * @exception IllegalArgumentException if <code>minFilter</code>     * is a value other than <code>FASTEST</code>, <code>NICEST</code>,     * <code>BASE_LEVEL_POINT</code>, <code>BASE_LEVEL_LINEAR</code>,     * <code>LINEAR_DETAIL</code>, <code>LINEAR_DETAIL_RGB</code>,      * <code>LINEAR_DETAIL_ALPHA</code>,      * <code>LINEAR_SHARPEN</code>, <code>LINEAR_SHARPEN_RGB</code>,      * <code>LINEAR_SHARPEN_ALPHA</code>,  or     * <code>FILTER4</code>.     *     * @see Canvas3D#queryProperties     *     * @since Java 3D 1.3     */    public void setMagFilter(int magFilter) {	checkForLiveOrCompiled();	switch (magFilter) {	case FASTEST:	case NICEST:	case BASE_LEVEL_POINT:	case BASE_LEVEL_LINEAR:	case LINEAR_DETAIL:	case LINEAR_DETAIL_RGB:	case LINEAR_DETAIL_ALPHA:	case LINEAR_SHARPEN:	case LINEAR_SHARPEN_RGB:	case LINEAR_SHARPEN_ALPHA:	case FILTER4:	    break;	default:	    throw new IllegalArgumentException(J3dI18N.getString("Texture29"));	}	((Texture2DRetained)this.retained).initMagFilter(magFilter);    }    /**     * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     *     * @param detailTexture ImageComponent2D object containing the     * detail texture image.     * @exception RestrictedAccessException if the method is called     * when this object is part of live or compiled scene graph.     *     * @since Java 3D 1.3     * @see Canvas3D#queryProperties     */    public void setDetailImage(ImageComponent2D detailTexture) {        checkForLiveOrCompiled();        ((Texture2DRetained)this.retained).initDetailImage(detailTexture);    }    /**     * @deprecated As of Java 3D 1.5 the optional detail texture feature is no     * longer supported.     *     * @return ImageComponent2D object containing the detail texture image.     *     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */

⌨️ 快捷键说明

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