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

📄 texture.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        }        int widthLevels;        int heightLevels;                widthLevels = getLevelsNPOT(width);        heightLevels = getLevelsNPOT(height);	if (boundaryWidth < 0 || boundaryWidth > 1)	    throw new IllegalArgumentException(J3dI18N.getString("Texture30"));	((TextureRetained)this.retained).initialize(format, width, widthLevels,				height, heightLevels, mipMapMode, boundaryWidth);    }    /**     * Sets the boundary mode for the S coordinate in this texture object.     * @param boundaryModeS the boundary mode for the S coordinate.     * One of: CLAMP, WRAP, CLAMP_TO_EDGE, or CLAMP_TO_BOUNDARY.     * @exception RestrictedAccessException if the method is called     * when this object is part of live or compiled scene graph.     * @exception IllegalArgumentException if <code>boundaryModeS</code>     * is a value other than <code>CLAMP</code>, <code>WRAP</code>,     * <code>CLAMP_TO_EDGE</code>, or <code>CLAMP_TO_BOUNDARY</code>.     */    public void setBoundaryModeS(int boundaryModeS) {	checkForLiveOrCompiled();	switch (boundaryModeS) {        case Texture.CLAMP:	case Texture.WRAP:	case Texture.CLAMP_TO_EDGE:	case Texture.CLAMP_TO_BOUNDARY:	    break;	default:	    throw new IllegalArgumentException(J3dI18N.getString("Texture31"));	}	((TextureRetained)this.retained).initBoundaryModeS(boundaryModeS);    }    /**     * Retrieves the boundary mode for the S coordinate.     * @return the current boundary mode for the S coordinate.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getBoundaryModeS() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_BOUNDARY_MODE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("Texture4"));	return ((TextureRetained)this.retained).getBoundaryModeS();    }    /**     * Sets the boundary mode for the T coordinate in this texture object.     * @param boundaryModeT the boundary mode for the T coordinate.     * One of: CLAMP, WRAP, CLAMP_TO_EDGE, or CLAMP_TO_BOUNDARY.     * @exception RestrictedAccessException if the method is called     * when this object is part of live or compiled scene graph.     * @exception IllegalArgumentException if <code>boundaryModeT</code>     * is a value other than <code>CLAMP</code>, <code>WRAP</code>,     * <code>CLAMP_TO_EDGE</code>, or <code>CLAMP_TO_BOUNDARY</code>.     */    public void setBoundaryModeT(int boundaryModeT) {	checkForLiveOrCompiled();	switch (boundaryModeT) {        case Texture.CLAMP:	case Texture.WRAP:	case Texture.CLAMP_TO_EDGE:	case Texture.CLAMP_TO_BOUNDARY:	    break;	default:	    throw new IllegalArgumentException(J3dI18N.getString("Texture31"));	}	((TextureRetained)this.retained).initBoundaryModeT(boundaryModeT);    }    /**     * Retrieves the boundary mode for the T coordinate.     * @return the current boundary mode for the T coordinate.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getBoundaryModeT() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_BOUNDARY_MODE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("Texture4"));	return ((TextureRetained)this.retained).getBoundaryModeT();    }    /**     * Sets the minification filter function.  This     * function is used when the pixel being rendered maps to an area     * greater than one texel.     * @param minFilter the minification filter. One of:     * FASTEST, NICEST, BASE_LEVEL_POINT, BASE_LEVEL_LINEAR,      * MULTI_LEVEL_POINT, MULTI_LEVEL_LINEAR, 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>MULTI_LEVEL_POINT</code>, <code>MULTI_LEVEL_LINEAR</code>, or     * <code>FILTER4</code>.     *     * @see Canvas3D#queryProperties     */    public void setMinFilter(int minFilter) {	checkForLiveOrCompiled();	switch (minFilter) {	case FASTEST:	case NICEST:	case BASE_LEVEL_POINT:	case BASE_LEVEL_LINEAR:	case MULTI_LEVEL_POINT:	case MULTI_LEVEL_LINEAR:	case FILTER4:	    break;	default:	    throw new IllegalArgumentException(J3dI18N.getString("Texture28"));	}	((TextureRetained)this.retained).initMinFilter(minFilter);    }    /**     * Retrieves the minification filter.     * @return the current minification filter function.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getMinFilter() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_FILTER_READ))              throw new CapabilityNotSetException(J3dI18N.getString("Texture6"));	return ((TextureRetained)this.retained).getMinFilter();    }    /**     * 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_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>magFilter</code>     * is a value other than <code>FASTEST</code>, <code>NICEST</code>,     * <code>BASE_LEVEL_POINT</code>, <code>BASE_LEVEL_LINEAR</code>,     * <code>LINEAR_SHARPEN</code>, <code>LINEAR_SHARPEN_RGB</code>,      * <code>LINEAR_SHARPEN_ALPHA</code>,  or     * <code>FILTER4</code>.     *     * @see Canvas3D#queryProperties     */    public void setMagFilter(int magFilter) {	checkForLiveOrCompiled();	switch (magFilter) {	case FASTEST:	case NICEST:	case BASE_LEVEL_POINT:	case BASE_LEVEL_LINEAR:	case LINEAR_SHARPEN:	case LINEAR_SHARPEN_RGB:	case LINEAR_SHARPEN_ALPHA:	case FILTER4:	    break;	default:	    throw new IllegalArgumentException(J3dI18N.getString("Texture29"));	}	((TextureRetained)this.retained).initMagFilter(magFilter);    }    /**     * Retrieves the magnification filter.     * @return the current magnification filter function.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public int getMagFilter() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_FILTER_READ))              throw new CapabilityNotSetException(J3dI18N.getString("Texture6"));	return ((TextureRetained)this.retained).getMagFilter();    }    /**     * Sets the image for a specified mipmap level. Note that the image size     * must be the correct size for the specified mipmap level. The image size     * of  the base level image, that is level 0, must be the same size     * in each dimension (width, height, depth) as this     * texture, excluding the border, if any.     * Each successive mipmap level must be 1/2 the size of the previous level,     * such that <code>size[n]&nbsp;=&nbsp;floor(size[n-1]/2)</code>, exluding     * the border.     *     * @param level mipmap level to set: 0 is the base level     * @param image ImageComponent object containing the texture image     * for the specified mipmap level     *     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @exception IllegalArgumentException if an ImageComponent3D is     * used in a Texture2D object or if an ImageComponent2D is used in a     * Texture3D object.     *     * @exception IllegalArgumentException if the image being set at this     * level is not the correct size for this level.     *     * @exception IllegalSharingException if this Texture is live and     * the specified image is being used by a Canvas3D as an off-screen buffer.     *     * @exception IllegalSharingException if this Texture is     * being used by an immediate mode context and     * the specified image is being used by a Canvas3D as an off-screen buffer.     */    public void setImage(int level, ImageComponent image) {        if (isLiveOrCompiled()) {	  if(!this.getCapability(ALLOW_IMAGE_WRITE))	    throw new CapabilityNotSetException(J3dI18N.getString("Texture15"));	}                // Do illegal sharing check        validateImageIllegalSharing(image);            	if (isLive())	    ((TextureRetained)this.retained).setImage(level, image);	else	    ((TextureRetained)this.retained).initImage(level, image);    }    /**     * Retrieves the image for a specified mipmap level.     * @param level mipmap level to get: 0 is the base level     * @return the ImageComponent object containing the texture image at     * the specified mipmap level.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public ImageComponent getImage(int level) {        if (isLiveOrCompiled()) {	  if(!this.getCapability(ALLOW_IMAGE_READ))	    throw new CapabilityNotSetException(J3dI18N.getString("Texture9"));	}	return ((TextureRetained)this.retained).getImage(level);    }    /**     * Sets the array of images for all mipmap levels. Note that the image size     * of  the base level image, <code>images[0]</code>, must be the same size     * in each dimension (width, height, depth) as this     * texture, excluding the border, if any.     * Each successive mipmap level must be 1/2 the size of the previous level,     * such that <code>size[n]&nbsp;=&nbsp;floor(size[n-1]/2)</code>, exluding     * the border.     *     * @param images array of ImageComponent objects     * containing the texture images for all mipmap levels     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @exception IllegalArgumentException if an ImageComponent3D is     * used in a Texture2D object or if an ImageComponent2D is used in a     * Texture3D object.     *     * @exception IllegalArgumentException if <code>images.length</code> is     * not equal to the total number of mipmap levels.     *     * @exception IllegalArgumentException if the size of each dimension     * of the image at a given level in the     * <code>images</code> array is not the correct size.     *     * @exception IllegalSharingException if this Texture is live and     * any of the specified images are being used by a Canvas3D as an     * off-screen buffer.     *     * @exception IllegalSharingException if this Texture is     * being used by an immediate mode context and     * any of the specified images are being used by a Canvas3D as an     * off-screen buffer.     *     * @since Java 3D 1.2     */    public void setImages(ImageComponent[] images) {        if (isLiveOrCompiled()) {	  if(!this.getCapability(ALLOW_IMAGE_WRITE))	    throw new CapabilityNotSetException(J3dI18N.getString("Texture15"));	}        // Do illegal sharing check             for(int i=0; i<images.length; i++) {            validateImageIllegalSharing(images[i]);        }        	if (images == null)	    throw new IllegalArgumentException(J3dI18N.getString("Texture20"));	if (isLive())	    ((TextureRetained)this.retained).setImages(images);	else	    ((TextureRetained)this.retained).initImages(images);    }    /**     * Retrieves the array of images for all mipmap levels.     * @return the array of ImageComponent objects for this Texture.     * @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 ImageComponent[] getImages() {        if (isLiveOrCompiled()) {	  if(!this.getCapability(ALLOW_IMAGE_READ))	    throw new CapabilityNotSetException(J3dI18N.getString("Texture9"));	}	return ((TextureRetained)this.retained).getImages();    }    /**     * Retrieves the format of this Texture object.     * @return the format of this Texture object.     * @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 getFormat() {        if (isLiveOrCompiled()) {            if(!this.getCapability(ALLOW_FORMAT_READ))              throw new CapabilityNotSetException(J3dI18N.getString("Texture19"));	}	return ((TextureRetained)this.retained).getFormat();    }    /**     * Retrieves the width of this Texture object.     * @return the width of this Texture object.     * @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 getWidth() {        if (isLiveOrCompiled()) {            if(!this.getCapability(ALLOW_SIZE_READ))              throw new CapabilityNotSetException(J3dI18N.getString("Texture16"));

⌨️ 快捷键说明

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