📄 textureattributes.java
字号:
/* * $RCSfile: TextureAttributes.java,v $ * * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * * Use is subject to license terms. * * $Revision: 1.5 $ * $Date: 2007/02/09 17:18:26 $ * $State: Exp $ */package javax.media.j3d;import javax.vecmath.Color4f;/** * The TextureAttributes object defines attributes that apply to * texture mapping. * The texture attributes include the following:<P> * <UL> * <LI>Texture mode - defines how the object and texture colors * are blended. The mode may be one of the following:</LI><P> * <UL> * <LI>MODULATE - modulates the incoming color with the texture * color.<P> * <UL> * C' = C Ct * </UL></LI><P> * <LI>DECAL - applies the texture color to the incoming color as a decal.<P> * <UL> * C'<sub>rgb</sub> = C<sub>rgb</sub> (1 - Ct<sub>a</sub>) + Ct<sub>rgb</sub> Ct<sub>a</sub><P> * C'<sub>a</sub> = C<sub>a</sub> * </UL></LI><P> * <LI>BLEND - blends the texture blend color with the incoming color.<P> * <UL> * C'<sub>rgb</sub> = C<sub>rgb</sub> (1 - Ct<sub>rgb</sub>) + Cb<sub>rgb</sub> Ct<sub>rgb</sub><P> * C'<sub>a</sub> = C<sub>a</sub> Ct<sub>a</sub><P> * </UL> * Note that if the texture format is INTENSITY, alpha is computed identically * to red, green, and blue: <P> * <UL> * C'<sub>a</sub> = C<sub>a</sub> (1 - Ct<sub>a</sub>) + Cb<sub>a</sub> Ct<sub>a</sub> * </UL></LI><P> * <LI>REPLACE - replaces the incoming color with the texture color.<P> * <UL> * C' = Ct <P> * </UL></LI><P> * <LI>COMBINE - combines the object color with the texture color or texture * blend color according to the combine operation as specified in the * texture combine mode. </LI><P> * <p> * </UL> * C = Incoming color to the texture unit state. For texture unit state 0, C is the object color * Ct = Texture color<br> * Cb = Texture blend color<br> * <p> * <LI>Combine Mode - defines the combine operation when texture mode * specifies COMBINE. The combine mode includes the following:<p> * <UL> * <LI>COMBINE_REPLACE<P> * <UL> * C' = C<sub>0</sub> <P> * </UL></LI><P> * <LI>COMBINE_MODULATE<P> * <UL> * C' = C<sub>0</sub> C<sub>1</sub> * </UL></LI><P> * <LI>COMBINE_ADD<P> * <UL> * C' = C<sub>0</sub> + C<sub>1</sub> <P> * </UL></LI><P> * <LI>COMBINE_ADD_SIGNED <P> * <UL> * C' = C<sub>0</sub> + C<sub>1</sub> - 0.5 <P> * </UL></LI><P> * <LI>COMBINE_SUBTRACT <P> * <UL> * C' = C<sub>0</sub> - C<sub>1</sub> <P> * </UL></LI><P> * <LI>COMBINE_INTERPOLATE<P> * <UL> * C' = C<sub>0</sub> C<sub>2</sub> + C<sub>1</sub> (1 - C<sub>2</sub>) <P> * </UL></LI><P> * <LI>COMBINE_DOT3<P> * <UL> * C' = 4 * ( * (C<sub>0<sub>r</sub></sub> - 0.5) * (C<sub>1<sub>r</sub></sub> - 0.5) + * (C<sub>0<sub>g</sub></sub> - 0.5) * (C<sub>1<sub>g</sub></sub> - 0.5) + * (C<sub>0<sub>b</sub></sub> - 0.5) * (C<sub>1<sub>b</sub></sub> - 0.5))<P> * where C<sub>N<sub>x</sub></sub> is the x component of the Nth color operand * in the combine operation.<P> * The value C' will be placed to the all three r,g,b components or the * a component of the output. * </UL></LI><P> * </UL></LI><P> * where C<sub>0</sub>, C<sub>1</sub> and C<sub>2</sub> are determined by * the color source, and the color operand. * </UL></LI><P> * <UL> * <LI>Combine Color Source - defines the source for a color operand in the * combine operation. The color source includes the following:<p> * <UL> * <LI> COMBINE_OBJECT_COLOR - object color<P> * <LI> COMBINE_TEXTURE_COLOR - texture color<P> * <LI> COMBINE_CONSTANT_COLOR - texture blend color<P> * <LI> COMBINE_PREVIOUS_TEXTURE_UNIT_STATE - color from the previous texture * unit state. For texture unit state 0, this is equivalent to * COMBINE_OBJECT_COLOR.<P> * </UL></LI><P> * <LI>Combine Color Function - specifies the function for a color operand * in the combine operation. The valid values are:<P> * <UL> * <LI>COMBINE_SRC_COLOR - the color function is f = C<sub>rgb</sub><P> * <LI>COMBINE_ONE_MINUS_SRC_COLOR - the color function is f = (1 - C<sub>rgb</sub>)<P> * <LI>COMBINE_SRC_ALPHA - the color function is f = C<sub>a</sub><P> * <LI>COMBINE_ONE_MINUS_SRC_ALPHA - the color function is f = (1 - C<sub>a</sub>)<P> * </UL></LI><P> * <LI>Combine scale factor - specifies the scale factor to be applied to * the output color of the combine operation. The valid values include: * 1, 2, or 4.</LI><P> * <LI>Transform - the texture transform object used to transform * texture coordinates. The texture transform can translate, scale, * or rotate the texture coordinates before the texture is applied * to the object.</LI><P> * <LI>Blend color - the constant texture blend color</LI><P> * <LI>Perspective correction - the perspective correction mode * used for color and texture coordinate interpolation. One of * the following:</LI><P> * <UL> * <LI>NICEST - uses the nicest (highest quality) available * method for texture mapping perspective correction.</LI><P> * <LI>FASTEST - uses the fastest available method for texture * mapping perspective correction.</LI><P> * </UL> * <LI>Texture color table - defines a table that is used to look up * texture colors before applying the texture mode.</LI> * </UL> * * @see Appearance * @see Canvas3D#queryProperties */public class TextureAttributes extends NodeComponent { /** * Specifies that this TextureAttributes object allows * reading its texture mode component * information and perspective correction mode. */ public static final int ALLOW_MODE_READ = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_MODE_READ; /** * Specifies that this TextureAttributes object allows * writing its texture mode component * information and perspective correction mode. */ public static final int ALLOW_MODE_WRITE = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_MODE_WRITE; /** * Specifies that this TextureAttributes object allows * reading its texture blend color component * information. */ public static final int ALLOW_BLEND_COLOR_READ = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_BLEND_COLOR_READ; /** * Specifies that this TextureAttributes object allows * writing its texture blend color component * information. */ public static final int ALLOW_BLEND_COLOR_WRITE = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_BLEND_COLOR_WRITE; /** * Specifies that this TextureAttributes object allows * reading its texture transform component * information. */ public static final int ALLOW_TRANSFORM_READ = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_TRANSFORM_READ; /** * Specifies that this TextureAttributes object allows * writing its texture transform component * information. */ public static final int ALLOW_TRANSFORM_WRITE = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_TRANSFORM_WRITE; /** * Specifies that this TextureAttributes object allows * reading its texture color table component * information. * * @since Java 3D 1.2 */ public static final int ALLOW_COLOR_TABLE_READ = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_COLOR_TABLE_READ; /** * Specifies that this TextureAttributes object allows * writing its texture color table component * information. * * @since Java 3D 1.2 */ public static final int ALLOW_COLOR_TABLE_WRITE = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_COLOR_TABLE_WRITE; /** * Specifies that this TextureAttributes object allows * reading its texture combine mode information. (e.g. combine mode, * combine color source, combine color function, combine scale factor) * * @since Java 3D 1.3 */ public static final int ALLOW_COMBINE_READ = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_COMBINE_READ; /** * Specifies that this TextureAttributes object allows * writing its texture combine mode information. (e.g. combine mode, * combine color source, combine color function, combine scale factor) * * @since Java 3D 1.3 */ public static final int ALLOW_COMBINE_WRITE = CapabilityBits.TEXTURE_ATTRIBUTES_ALLOW_COMBINE_WRITE; /** * Use the fastest available method for perspective correction. * @see #setPerspectiveCorrectionMode */ public static final int FASTEST = 0; /** * Use the nicest (highest quality) available method for texture * mapping perspective correction. * @see #setPerspectiveCorrectionMode */ public static final int NICEST = 1; /** * Modulate the object color with the texture color. * @see #setTextureMode */ public static final int MODULATE = 2; /** * Apply the texture color to the object as a decal. * @see #setTextureMode */ public static final int DECAL = 3; /** * Blend the texture blend color with the object color. * @see #setTextureMode */ public static final int BLEND = 4; /** * Replace the object color with the texture color. * @see #setTextureMode */ public static final int REPLACE = 5; /** * Combine the object color with texture color as specified in * the combine mode. * * @see #setTextureMode * @since Java 3D 1.3 */ public static final int COMBINE = 6; /** * Replace the input color with the specified color. * * @since Java 3D 1.3 * @see #setCombineRgbMode * @see #setCombineAlphaMode */ public static final int COMBINE_REPLACE = 0; /** * Modulates one color with another color. * * @since Java 3D 1.3 * @see #setCombineRgbMode * @see #setCombineAlphaMode */ public static final int COMBINE_MODULATE = 1; /** * Add two colors. * * @since Java 3D 1.3 * @see #setCombineRgbMode * @see #setCombineAlphaMode */ public static final int COMBINE_ADD = 2; /** * Add two colors plus an implicit offset. * * @since Java 3D 1.3 * @see #setCombineRgbMode * @see #setCombineAlphaMode */ public static final int COMBINE_ADD_SIGNED = 3; /** * Subtract one color from another color. * * @since Java 3D 1.3 * @see #setCombineRgbMode * @see #setCombineAlphaMode */ public static final int COMBINE_SUBTRACT = 4; /** * Interpolate two colors with a factor. * * @since Java 3D 1.3 * @see #setCombineRgbMode * @see #setCombineAlphaMode */ public static final int COMBINE_INTERPOLATE = 5; /** * Dot product of two colors. * * @since Java 3D 1.3 * @see #setCombineRgbMode * @see #setCombineAlphaMode */ public static final int COMBINE_DOT3 = 6; /** * Object color coming into the texturing state. * * @since Java 3D 1.3 * @see #setCombineRgbSource * @see #setCombineAlphaSource */ public static final int COMBINE_OBJECT_COLOR = 0; /** * Texture color of the corresponding texture unit state. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -