📄 renderingattributes.java
字号:
/** * Specifies that pixels are never drawn irrespective of the * values being tested. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. * * @see #setAlphaTestFunction * @see #setDepthTestFunction * @see #setStencilFunction(int,int,int) */ public static final int NEVER = 1; /** * Specifies that pixels are drawn if the two values being tested are equal. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. * * @see #setAlphaTestFunction * @see #setDepthTestFunction * @see #setStencilFunction(int,int,int) */ public static final int EQUAL = 2; /** * Specifies that pixels are drawn if the two values being tested are not equal. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. * * @see #setAlphaTestFunction * @see #setDepthTestFunction * @see #setStencilFunction(int,int,int) */ public static final int NOT_EQUAL = 3; /** * Specifies that pixels are drawn if the source/reference value is less * than the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. * * @see #setAlphaTestFunction * @see #setDepthTestFunction * @see #setStencilFunction(int,int,int) */ public static final int LESS = 4; /** * Specifies that pixels are drawn if the source/reference value is less * than or equal to the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. * * @see #setAlphaTestFunction * @see #setDepthTestFunction * @see #setStencilFunction(int,int,int) */ public static final int LESS_OR_EQUAL = 5; /** * Specifies that pixels are drawn if the source/reference value is greater * than the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. * * @see #setAlphaTestFunction * @see #setDepthTestFunction * @see #setStencilFunction(int,int,int) */ public static final int GREATER = 6; /** * Specifies that pixels are drawn if the source/reference value is greater * than or equal to the destination/test value. * Can be used to specify the alpha test function, the depth test function, * or the stencil function. * * @see #setAlphaTestFunction * @see #setDepthTestFunction * @see #setStencilFunction(int,int,int) */ public static final int GREATER_OR_EQUAL = 7; // // Raster op enums // /** * Raster operation: <code>DST = 0</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_CLEAR = 0x0; /** * Raster operation: <code>DST = SRC & DST</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_AND = 0x1; /** * Raster operation: <code>DST = SRC & ~DST</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_AND_REVERSE = 0x2; /** * Raster operation: <code>DST = SRC</code>. * @see #setRasterOp * * @since Java 3D 1.2 */ public static final int ROP_COPY = 0x3; /** * Raster operation: <code>DST = ~SRC & DST</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_AND_INVERTED = 0x4; /** * Raster operation: <code>DST = DST</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_NOOP = 0x5; /** * Raster operation: <code>DST = SRC ^ DST</code>. * @see #setRasterOp * * @since Java 3D 1.2 */ public static final int ROP_XOR = 0x6; /** * Raster operation: <code>DST = DST | SRC</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_OR = 0x7; /** * Raster operation: <code>DST = ~( DST | SRC )</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_NOR = 0x8; /** * Raster operation: <code>DST = ~( DST ^ SRC )</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_EQUIV = 0x9; /** * Raster operation: <code>DST = ~DST</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_INVERT = 0xA; /** * Raster operation: <code>DST = src | ~DST</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_OR_REVERSE = 0xB; /** * Raster operation: <code>DST = ~SRC</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_COPY_INVERTED = 0xC; /** * Raster operation: <code>DST = ~SRC | DST</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_OR_INVERTED = 0xD; /** * Raster operation: <code>DST = ~(SRC & DST)</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_NAND = 0xE; /** * Raster operation: <code>DST = 1</code>. * @see #setRasterOp * * @since Java 3D 1.4 */ public static final int ROP_SET = 0xF; // // Stencil op enums // /** * Stencil operation: <code>DST = DST</code> * @see #setStencilOp(int,int,int) * * @since Java 3D 1.4 */ public static final int STENCIL_KEEP = 1; /** * Stencil operation: <code>DST = 0</code> * @see #setStencilOp(int,int,int) * * @since Java 3D 1.4 */ public static final int STENCIL_ZERO = 2; /** * Stencil operation: <code>DST = REF</code> * @see #setStencilOp(int,int,int) * * @since Java 3D 1.4 */ public static final int STENCIL_REPLACE = 3; /** * Stencil operation: <code>DST = DST + 1</code> * @see #setStencilOp(int,int,int) * * @since Java 3D 1.4 */ public static final int STENCIL_INCR = 4; /** * Stencil operation: <code>DST = DST - 1</code> * @see #setStencilOp(int,int,int) * * @since Java 3D 1.4 */ public static final int STENCIL_DECR = 5; /** * Stencil operation: <code>DST = ~DST</code> * @see #setStencilOp(int,int,int) * * @since Java 3D 1.4 */ public static final int STENCIL_INVERT = 6; // Array for setting default read capabilities private static final int[] readCapabilities = { ALLOW_ALPHA_TEST_FUNCTION_READ, ALLOW_ALPHA_TEST_VALUE_READ, ALLOW_DEPTH_ENABLE_READ, ALLOW_DEPTH_TEST_FUNCTION_READ, ALLOW_IGNORE_VERTEX_COLORS_READ, ALLOW_RASTER_OP_READ, ALLOW_STENCIL_ATTRIBUTES_READ, ALLOW_VISIBLE_READ }; /** * Constructs a RenderingAttributes object with default parameters. * The default values are as follows: * <ul> * depth buffer enable : true<br> * depth buffer write enable : true<br> * alpha test function : ALWAYS<br> * alpha test value : 0.0f<br> * visible : true<br> * ignore vertex colors : false<br> * raster operation enable : false<br> * raster operation : ROP_COPY<br> * depth test: LESS_OR_EQUAL<br> * stencil enable : false<br> * stencil write mask : ~0 (all ones)<br> * stencil op - failOp : STENCIL_KEEP<br> * stencil op - zFailOp : STENCIL_KEEP<br> * stencil op - zPassOp : STENCIL_KEEP<br> * stencil function : ALWAYS<br> * stencil reference value : 0<br> * stencil comparison mask : ~0 (all ones) * </ul> */ public RenderingAttributes() { // Just use default attributes // set default read capabilities setDefaultReadCapabilities(readCapabilities); } /** * Constructs a RenderingAttributes object with specified values. * @param depthBufferEnable a flag to turn depth buffer on/off * @param depthBufferWriteEnable a flag to to make depth buffer * read/write or read only * @param alphaTestValue the alpha test reference value * @param alphaTestFunction the function for comparing alpha values */ public RenderingAttributes(boolean depthBufferEnable, boolean depthBufferWriteEnable, float alphaTestValue, int alphaTestFunction){ this(depthBufferEnable, depthBufferWriteEnable, alphaTestValue, alphaTestFunction, true, false, false, ROP_COPY); } /** * Constructs a RenderingAttributes object with specified values * @param depthBufferEnable a flag to turn depth buffer on/off * @param depthBufferWriteEnable a flag to make depth buffer * read/write or read only * @param alphaTestValue the alpha test reference value * @param alphaTestFunction the function for comparing alpha values * @param visible a flag that specifies whether the object is visible * @param ignoreVertexColors a flag to enable or disable * the ignoring of per-vertex colors * @param rasterOpEnable a flag that specifies whether logical * raster operations are enabled for this RenderingAttributes object. * This disables all alpha blending operations. * @param rasterOp the logical raster operation, one of: * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED, * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT, * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET * * @since Java 3D 1.2 */ public RenderingAttributes(boolean depthBufferEnable, boolean depthBufferWriteEnable, float alphaTestValue, int alphaTestFunction, boolean visible, boolean ignoreVertexColors, boolean rasterOpEnable, int rasterOp) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((RenderingAttributesRetained)this.retained).initDepthBufferEnable(depthBufferEnable); ((RenderingAttributesRetained)this.retained).initDepthBufferWriteEnable(depthBufferWriteEnable); ((RenderingAttributesRetained)this.retained).initAlphaTestValue(alphaTestValue); ((RenderingAttributesRetained)this.retained).initAlphaTestFunction(alphaTestFunction); ((RenderingAttributesRetained)this.retained).initVisible(visible); ((RenderingAttributesRetained)this.retained).initIgnoreVertexColors(ignoreVertexColors); ((RenderingAttributesRetained)this.retained).initRasterOpEnable(rasterOpEnable); ((RenderingAttributesRetained)this.retained).initRasterOp(rasterOp); } /** * Enables or disables depth buffer mode for this RenderingAttributes * component object.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -