Source Code Cross Referenced for RenderingAttributes.java in  » 6.0-JDK-Modules » java-3d » javax » media » j3d » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » javax.media.j3d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * $RCSfile: RenderingAttributes.java,v $
0003:         *
0004:         * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
0005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0006:         *
0007:         * This code is free software; you can redistribute it and/or modify it
0008:         * under the terms of the GNU General Public License version 2 only, as
0009:         * published by the Free Software Foundation.  Sun designates this
0010:         * particular file as subject to the "Classpath" exception as provided
0011:         * by Sun in the LICENSE file that accompanied this code.
0012:         *
0013:         * This code is distributed in the hope that it will be useful, but WITHOUT
0014:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0015:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0016:         * version 2 for more details (a copy is included in the LICENSE file that
0017:         * accompanied this code).
0018:         *
0019:         * You should have received a copy of the GNU General Public License version
0020:         * 2 along with this work; if not, write to the Free Software Foundation,
0021:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0022:         *
0023:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0024:         * CA 95054 USA or visit www.sun.com if you need additional information or
0025:         * have any questions.
0026:         *
0027:         * $Revision: 1.6 $
0028:         * $Date: 2008/02/28 20:17:29 $
0029:         * $State: Exp $
0030:         */
0031:
0032:        package javax.media.j3d;
0033:
0034:        /**
0035:         * The RenderingAttributes object defines common rendering attributes
0036:         * for all primitive types. The rendering attributes are:<p>
0037:         * <ul>
0038:         * <li>Depth test function - used to compare the incoming (source) depth of
0039:         * each pixel with depth of the pixel stored in frame buffer. If the test
0040:         * passes, the pixel is written, otherwise the pixel is not written. The depth test
0041:         * function is set with the <code>setDepthTestFunction</code>
0042:         * method. By default, LESS_OR_EQUAL is the function used. The depth test
0043:         * function is one of the following:</li><p>
0044:         * <ul>
0045:         * <li>ALWAYS - pixels are always drawn, irrespective of the depth
0046:         * value. This effectively disables depth testing.</li><p>
0047:         *
0048:         * <li>NEVER - pixels are never drawn, irrespective of the depth
0049:         * value.</li><p>
0050:         *
0051:         * <li>EQUAL - pixels are drawn if the incoming pixel depth is equal
0052:         * to the stored pixel depth in the frame buffer.</li><p>
0053:         *
0054:         * <li>NOT_EQUAL - pixels are drawn if the incoming pixel depth is
0055:         * not equal to the stored pixel depth in the frame buffer.</li><p>
0056:         * 
0057:         * <li>LESS - pixels are drawn if the incoming pixel depth is less
0058:         * than the stored pixel depth in the frame buffer.</li><p>
0059:         * 
0060:         * <li>LESS_OR_EQUAL - pixels are drawn if the incoming pixel depth
0061:         * is less than or equal to the stored pixel depth in the frame buffer.
0062:         * This is the default setting.</li><p>
0063:         * 
0064:         * <li>GREATER - pixels are drawn if the incoming pixel depth is greater
0065:         * than the stored pixel depth in the frame buffer.</li><p>
0066:         * 
0067:         * <li>GREATER_OR_EQUAL - pixels are drawn if the incoming pixel depth
0068:         * is greater than or equal to the stored pixel depth in the frame buffer.</li><p>
0069:         * </ul>
0070:         *
0071:         * <li>Alpha test function - used to compare the incoming (source) alpha value
0072:         * of each pixel with the alpha test value. If the test passes, the pixel is
0073:         * written, otherwise the pixel is not written. The alpha test
0074:         * function is set with the <code>setAlphaTestFunction</code>
0075:         * method. The alpha test
0076:         * function is one of the following:</li><p>
0077:         * <ul>
0078:         * <li>ALWAYS - pixels are always drawn, irrespective of the alpha
0079:         * value. This effectively disables alpha testing.
0080:         * This is the default setting.</li><p>
0081:         *
0082:         * <li>NEVER - pixels are never drawn, irrespective of the alpha
0083:         * value.</li><p>
0084:         *
0085:         * <li>EQUAL - pixels are drawn if the incoming pixel alpha value is equal
0086:         * to the alpha test value.</li><p>
0087:         *
0088:         * <li>NOT_EQUAL - pixels are drawn if the incoming pixel alpha value is
0089:         * not equal to the alpha test value.</li><p>
0090:         * 
0091:         * <li>LESS - pixels are drawn if the incoming pixel alpha value is less
0092:         * than the alpha test value.</li><p>
0093:         * 
0094:         * <li>LESS_OR_EQUAL - pixels are drawn if the incoming pixel alpha value
0095:         * is less than or equal to the alpha test value.</li><p>
0096:         * 
0097:         * <li>GREATER - pixels are drawn if the incoming pixel alpha value is greater
0098:         * than the alpha test value.</li><p>
0099:         * 
0100:         * <li>GREATER_OR_EQUAL - pixels are drawn if the incoming pixel alpha
0101:         * value is greater than or equal to the alpha test value.</li><p>
0102:         * </ul>
0103:         *
0104:         * <li>Alpha test value - the test value used by the alpha test function.
0105:         * This value is compared to the alpha value of each rendered pixel.
0106:         * The alpha test value is set with the <code>setAlphaTestValue</code>
0107:         * method. The default alpha test value is 0.0.</li><p>
0108:         * 
0109:         * <li>Raster operation - the raster operation function for this
0110:         * RenderingAttributes component object. The raster operation is
0111:         * set with the <code>setRasterOp</code> method. The raster operation
0112:         * is enabled or disabled with the <code>setRasterOpEnable</code>
0113:         * method. The raster operation is one of the following:</li><p>
0114:         * <ul>
0115:         * <li>ROP_CLEAR - DST = 0.</li>
0116:         * <li>ROP_AND DST = SRC & DST.</li>
0117:         * <li>ROP_AND_REVERSE DST = SRC & ~DST.</li>
0118:         * <li>ROP_COPY - DST = SRC. This is the default operation.</li>
0119:         * <li>ROP_AND_INVERTED - DST = ~SRC & DST.</li>
0120:         * <li>ROP_NOOP - DST = DST.</li>
0121:         * <li>ROP_XOR - DST = SRC ^ DST.</li>
0122:         * <li>ROP_OR - DST = DST | SRC.</li>
0123:         * <li>ROP_NOR - DST = ~( DST | SRC .)</li>
0124:         * <li>ROP_EQUIV - DST = ~( DST ^ SRC .)</li>
0125:         * <li>ROP_INVERT - DST = ~DST.</li>
0126:         * <li>ROP_OR_REVERSE - DST = src | ~DST.</li>
0127:         * <li>ROP_COPY_INVERTED - DST = ~SRC.</li>
0128:         * <li>ROP_OR_INVERTED - DST = ~SRC | DST.</li>
0129:         * <li>ROP_NAND - DST = ~(SRC & DST.)</li>
0130:         * <li>ROP_SET - DST = 1.</li><p>
0131:         * </ul>
0132:         * <li>Vertex colors - vertex colors can be ignored for this
0133:         * RenderingAttributes object. This capability is set with the
0134:         * <code>setIgnoreVertexColors</code> method. If 
0135:         * ignoreVertexColors is false, per-vertex colors are used, when 
0136:         * present in the associated geometry objects, taking
0137:         * precedence over the ColoringAttributes color and the
0138:         * specified Material color(s). If ignoreVertexColors is true, per-vertex
0139:         * colors are ignored. In this case, if lighting is enabled, the 
0140:         * Material diffuse color will be used as the object color.
0141:         * if lighting is disabled, the ColoringAttributes color is
0142:         * used. The default value is false.</li><p>
0143:         * 
0144:         * <li>Visibility flag - when set, invisible objects are
0145:         * not rendered (subject to the visibility policy for
0146:         * the current view), but they can be picked or collided with.
0147:         * This flag is set with the <code>setVisible</code>
0148:         * method. By default, the visibility flag is true.</li><p>
0149:         * 
0150:         * <li>Depth buffer - can be enabled or disabled for this
0151:         * RenderingAttributes component object. The 
0152:         * <code>setDepthBufferEnable</code> method enables
0153:         * or disabled the depth buffer. The 
0154:         * <code>setDepthBufferWriteEnable</code> method enables or disables
0155:         * writing the depth buffer for this object. During the transparent
0156:         * rendering pass, this attribute can be overridden by the
0157:         * depthBufferFreezeTransparent attribute in the View
0158:         * object. Transparent objects include BLENDED transparent and
0159:         * antialiased lines and points. Transparent objects do not
0160:         * include opaque objects or primitives rendered with
0161:         * SCREEN_DOOR transparency. By default, the depth buffer
0162:         * is enabled and the depth buffer write is enabled.</li><p>
0163:         *
0164:         * <li>Stencil buffer - can be enabled or disabled for this RenderingAttributes
0165:         * component object using the <code>setStencilEnable</code> method. If the
0166:         * stencil buffer is disabled, the stencil operation and function are ignored.
0167:         * If a scene graph is rendered on a Canvas3D that does not have a stencil
0168:         * buffer, the stencil buffer will be implicitly disabled for that
0169:         * canvas.</li><p>
0170:         *
0171:         * <li>Stencil write mask - mask that controls which bits of the stencil
0172:         * buffer are written when the stencil buffer is enabled. The default value is
0173:         * <code>~0</code> (all ones).</li><p>
0174:         *
0175:         * <li>Stencil operation - a set of three stencil operations performed
0176:         * when: 1)&nbsp;the stencil test fails; 2)&nbsp;the stencil test passes, but
0177:         * the depth test fails; or 3)&nbsp;both the stencil test and depth test pass.
0178:         * The stencil operations are set with the <code>setStencilOp</code>
0179:         * method. The stencil operation is one of the following:</li><p>
0180:         * <ul>
0181:         * <li>STENCIL_KEEP - keeps the current value (no operation performed).
0182:         * This is the default setting.</li>
0183:         * <li>STENCIL_ZERO - Sets the stencil buffer value to 0.</li>
0184:         * <li>STENCIL_REPLACE - Sets the stencil buffer value to
0185:         * <code>refValue</code>, as specified by <code>setStencilFunction</code>.</li>
0186:         * <li>STENCIL_INCR - Increments the current stencil buffer value.</li>
0187:         * <li>STENCIL_DECR - Decrements the current stencil buffer value.</li>
0188:         * <li>STENCIL_INVERT - Bitwise inverts the current stencil buffer value.</li><p>
0189:         * </ul>
0190:         *
0191:         * <li>Stencil test function - used to compare the stencil reference value with
0192:         * the per-pixel stencil value stored in the frame buffer. If the test passes,
0193:         * the pixel is written, otherwise the pixel is not written. The stencil
0194:         * test function, reference value, and comparison mask are set with the
0195:         * <code>setStencilFunction</code> method. The stencil comparison mask is
0196:         * bitwise-ANDed with both the stencil reference value and the stored stencil
0197:         * value prior to doing the comparison. The default value for the reference value
0198:         * is 0. The default value for the comparison mask is <code>~0</code> (all ones).
0199:         * The stencil test function is one of the following:</li><p>
0200:         * <ul>
0201:         * <li>ALWAYS - pixels are always drawn, irrespective of the stencil
0202:         * value. This effectively disables stencil testing.
0203:         * This is the default setting.</li><p>
0204:         *
0205:         * <li>NEVER - pixels are never drawn, irrespective of the stencil
0206:         * value.</li><p>
0207:         *
0208:         * <li>EQUAL - pixels are drawn if the stencil reference value is equal
0209:         * to the stored stencil value in the frame buffer.</li><p>
0210:         *
0211:         * <li>NOT_EQUAL - pixels are drawn if the stencil reference value is
0212:         * not equal to the stored stencil value in the frame buffer.</li><p>
0213:         * 
0214:         * <li>LESS - pixels are drawn if the stencil reference value is less
0215:         * than the stored stencil value in the frame buffer.</li><p>
0216:         * 
0217:         * <li>LESS_OR_EQUAL - pixels are drawn if the stencil reference value
0218:         * is less than or equal to the stored stencil value in the frame buffer.</li><p>
0219:         * 
0220:         * <li>GREATER - pixels are drawn if the stencil reference value is greater
0221:         * than the stored stencil value in the frame buffer.</li><p>
0222:         * 
0223:         * <li>GREATER_OR_EQUAL - pixels are drawn if the stencil reference value
0224:         * is greater than or equal to the stored stencil value in the frame buffer.</li><p>
0225:         * </ul>
0226:         *
0227:         * </ul>
0228:         *
0229:         * <p>Note: the alpha test, depth test, and stencil functions all use
0230:         * the same enums.</p>
0231:         *
0232:         * @see Appearance
0233:         */
0234:        public class RenderingAttributes extends NodeComponent {
0235:
0236:            /**
0237:             * Specifies that this RenderingAttributes object
0238:             * allows reading its alpha test value component information.
0239:             */
0240:            public static final int ALLOW_ALPHA_TEST_VALUE_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_ALPHA_TEST_VALUE_READ;
0241:
0242:            /**
0243:             * Specifies that this RenderingAttributes object
0244:             * allows writing its alpha test value component information.
0245:             */
0246:            public static final int ALLOW_ALPHA_TEST_VALUE_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_ALPHA_TEST_VALUE_WRITE;
0247:
0248:            /**
0249:             * Specifies that this RenderingAttributes object
0250:             * allows reading its alpha test function component information.
0251:             */
0252:            public static final int ALLOW_ALPHA_TEST_FUNCTION_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_ALPHA_TEST_FUNCTION_READ;
0253:
0254:            /**
0255:             * Specifies that this RenderingAttributes object
0256:             * allows writing its alpha test function component information.
0257:             */
0258:            public static final int ALLOW_ALPHA_TEST_FUNCTION_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_ALPHA_TEST_FUNCTION_WRITE;
0259:
0260:            /**
0261:             * Specifies that this RenderingAttributes object
0262:             * allows reading its depth test function component information.
0263:             *
0264:             * @since Java 3D 1.4
0265:             */
0266:            public static final int ALLOW_DEPTH_TEST_FUNCTION_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_DEPTH_TEST_FUNCTION_READ;
0267:
0268:            /**
0269:             * Specifies that this RenderingAttributes object
0270:             * allows writing its depth test function component information.
0271:             *
0272:             * @since Java 3D 1.4
0273:             */
0274:            public static final int ALLOW_DEPTH_TEST_FUNCTION_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_DEPTH_TEST_FUNCTION_WRITE;
0275:
0276:            /**
0277:             * Specifies that this RenderingAttributes object
0278:             * allows reading its depth buffer enable and depth buffer write enable
0279:             * component information.
0280:             */
0281:            public static final int ALLOW_DEPTH_ENABLE_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_DEPTH_ENABLE_READ;
0282:
0283:            /**
0284:             * Specifies that this RenderingAttributes object
0285:             * allows writing its depth buffer enable and depth buffer write enable
0286:             * component information.
0287:             *
0288:             * @since Java 3D 1.3
0289:             */
0290:            public static final int ALLOW_DEPTH_ENABLE_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_DEPTH_ENABLE_WRITE;
0291:
0292:            /**
0293:             * Specifies that this RenderingAttributes object
0294:             * allows reading its visibility information.
0295:             *
0296:             * @since Java 3D 1.2
0297:             */
0298:            public static final int ALLOW_VISIBLE_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_VISIBLE_READ;
0299:
0300:            /**
0301:             * Specifies that this RenderingAttributes object
0302:             * allows writing its visibility information.
0303:             *
0304:             * @since Java 3D 1.2
0305:             */
0306:            public static final int ALLOW_VISIBLE_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_VISIBLE_WRITE;
0307:
0308:            /**
0309:             * Specifies that this RenderingAttributes object
0310:             * allows reading its ignore vertex colors information.
0311:             *
0312:             * @since Java 3D 1.2
0313:             */
0314:            public static final int ALLOW_IGNORE_VERTEX_COLORS_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_IGNORE_VERTEX_COLORS_READ;
0315:
0316:            /**
0317:             * Specifies that this RenderingAttributes object
0318:             * allows writing its ignore vertex colors information.
0319:             *
0320:             * @since Java 3D 1.2
0321:             */
0322:            public static final int ALLOW_IGNORE_VERTEX_COLORS_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_IGNORE_VERTEX_COLORS_WRITE;
0323:
0324:            /**
0325:             * Specifies that this RenderingAttributes object
0326:             * allows reading its raster operation information.
0327:             *
0328:             * @since Java 3D 1.2
0329:             */
0330:            public static final int ALLOW_RASTER_OP_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_RASTER_OP_READ;
0331:
0332:            /**
0333:             * Specifies that this RenderingAttributes object
0334:             * allows writing its raster operation information.
0335:             *
0336:             * @since Java 3D 1.2
0337:             */
0338:            public static final int ALLOW_RASTER_OP_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_RASTER_OP_WRITE;
0339:
0340:            /**
0341:             * Specifies that this RenderingAttributes object allows reading
0342:             * its stencil enable, stencil op, stencil function, and
0343:             * stencil write mask information.
0344:             *
0345:             * @since Java 3D 1.4
0346:             */
0347:            public static final int ALLOW_STENCIL_ATTRIBUTES_READ = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_STENCIL_ATTRIBUTES_READ;
0348:
0349:            /**
0350:             * Specifies that this RenderingAttributes object allows writing
0351:             * its stencil enable, stencil op, stencil function, and
0352:             * stencil write mask information.
0353:             *
0354:             * @since Java 3D 1.4
0355:             */
0356:            public static final int ALLOW_STENCIL_ATTRIBUTES_WRITE = CapabilityBits.RENDERING_ATTRIBUTES_ALLOW_STENCIL_ATTRIBUTES_WRITE;
0357:
0358:            //
0359:            // Enums for alpha test, depth test, and stencil test
0360:            //
0361:
0362:            /**
0363:             * Specifies that pixels are always drawn irrespective of the
0364:             * values being tested.
0365:             * Can be used to specify the alpha test function, the depth test function,
0366:             * or the stencil function.
0367:             * This setting effectively disables alpha, depth, or stencil testing.
0368:             *
0369:             * @see #setAlphaTestFunction
0370:             * @see #setDepthTestFunction
0371:             * @see #setStencilFunction(int,int,int)
0372:             */
0373:            public static final int ALWAYS = 0;
0374:
0375:            /**
0376:             * Specifies that pixels are never drawn irrespective of the
0377:             * values being tested.
0378:             * Can be used to specify the alpha test function, the depth test function,
0379:             * or the stencil function.
0380:             *
0381:             * @see #setAlphaTestFunction
0382:             * @see #setDepthTestFunction
0383:             * @see #setStencilFunction(int,int,int)
0384:             */
0385:            public static final int NEVER = 1;
0386:
0387:            /**
0388:             * Specifies that pixels are drawn if the two values being tested are equal.
0389:             * Can be used to specify the alpha test function, the depth test function,
0390:             * or the stencil function.
0391:             *
0392:             * @see #setAlphaTestFunction
0393:             * @see #setDepthTestFunction
0394:             * @see #setStencilFunction(int,int,int)
0395:             */
0396:            public static final int EQUAL = 2;
0397:
0398:            /**
0399:             * Specifies that pixels are drawn if the two values being tested are not equal.
0400:             * Can be used to specify the alpha test function, the depth test function,
0401:             * or the stencil function.
0402:             *
0403:             * @see #setAlphaTestFunction
0404:             * @see #setDepthTestFunction
0405:             * @see #setStencilFunction(int,int,int)
0406:             */
0407:            public static final int NOT_EQUAL = 3;
0408:
0409:            /**
0410:             * Specifies that pixels are drawn if the source/reference value is less 
0411:             * than the destination/test value.
0412:             * Can be used to specify the alpha test function, the depth test function,
0413:             * or the stencil function.
0414:             *
0415:             * @see #setAlphaTestFunction
0416:             * @see #setDepthTestFunction
0417:             * @see #setStencilFunction(int,int,int)
0418:             */
0419:            public static final int LESS = 4;
0420:
0421:            /**
0422:             * Specifies that pixels are drawn if the source/reference value is less 
0423:             * than or equal to the destination/test value.
0424:             * Can be used to specify the alpha test function, the depth test function,
0425:             * or the stencil function.
0426:             *
0427:             * @see #setAlphaTestFunction
0428:             * @see #setDepthTestFunction
0429:             * @see #setStencilFunction(int,int,int)
0430:             */
0431:            public static final int LESS_OR_EQUAL = 5;
0432:
0433:            /**
0434:             * Specifies that pixels are drawn if the source/reference value is greater 
0435:             * than the destination/test value.
0436:             * Can be used to specify the alpha test function, the depth test function,
0437:             * or the stencil function.
0438:             *
0439:             * @see #setAlphaTestFunction
0440:             * @see #setDepthTestFunction
0441:             * @see #setStencilFunction(int,int,int)
0442:             */
0443:            public static final int GREATER = 6;
0444:
0445:            /**
0446:             * Specifies that pixels are drawn if the source/reference value is greater 
0447:             * than or equal to the destination/test value.
0448:             * Can be used to specify the alpha test function, the depth test function,
0449:             * or the stencil function.
0450:             *
0451:             * @see #setAlphaTestFunction
0452:             * @see #setDepthTestFunction
0453:             * @see #setStencilFunction(int,int,int)
0454:             */
0455:            public static final int GREATER_OR_EQUAL = 7;
0456:
0457:            //
0458:            // Raster op enums
0459:            //
0460:
0461:            /**
0462:             * Raster operation: <code>DST = 0</code>.
0463:             * @see #setRasterOp
0464:             *
0465:             * @since Java 3D 1.4
0466:             */
0467:            public static final int ROP_CLEAR = 0x0;
0468:
0469:            /**
0470:             * Raster operation: <code>DST = SRC & DST</code>.
0471:             * @see #setRasterOp
0472:             *
0473:             * @since Java 3D 1.4
0474:             */
0475:            public static final int ROP_AND = 0x1;
0476:
0477:            /**
0478:             * Raster operation: <code>DST = SRC & ~DST</code>.
0479:             * @see #setRasterOp
0480:             *
0481:             * @since Java 3D 1.4
0482:             */
0483:            public static final int ROP_AND_REVERSE = 0x2;
0484:
0485:            /**
0486:             * Raster operation: <code>DST = SRC</code>.
0487:             * @see #setRasterOp
0488:             *
0489:             * @since Java 3D 1.2
0490:             */
0491:            public static final int ROP_COPY = 0x3;
0492:
0493:            /**
0494:             * Raster operation: <code>DST = ~SRC & DST</code>.
0495:             * @see #setRasterOp
0496:             *
0497:             * @since Java 3D 1.4
0498:             */
0499:            public static final int ROP_AND_INVERTED = 0x4;
0500:
0501:            /**
0502:             * Raster operation: <code>DST = DST</code>.
0503:             * @see #setRasterOp
0504:             *
0505:             * @since Java 3D 1.4
0506:             */
0507:            public static final int ROP_NOOP = 0x5;
0508:
0509:            /**
0510:             * Raster operation: <code>DST = SRC ^ DST</code>.
0511:             * @see #setRasterOp
0512:             *
0513:             * @since Java 3D 1.2
0514:             */
0515:            public static final int ROP_XOR = 0x6;
0516:
0517:            /**
0518:             * Raster operation: <code>DST = DST | SRC</code>.
0519:             * @see #setRasterOp
0520:             *
0521:             * @since Java 3D 1.4
0522:             */
0523:            public static final int ROP_OR = 0x7;
0524:
0525:            /**
0526:             * Raster operation: <code>DST = ~( DST | SRC )</code>.
0527:             * @see #setRasterOp
0528:             *
0529:             * @since Java 3D 1.4
0530:             */
0531:            public static final int ROP_NOR = 0x8;
0532:
0533:            /**
0534:             * Raster operation: <code>DST = ~( DST ^ SRC )</code>.
0535:             * @see #setRasterOp
0536:             *
0537:             * @since Java 3D 1.4
0538:             */
0539:            public static final int ROP_EQUIV = 0x9;
0540:
0541:            /**
0542:             * Raster operation: <code>DST = ~DST</code>.
0543:             * @see #setRasterOp
0544:             *
0545:             * @since Java 3D 1.4
0546:             */
0547:            public static final int ROP_INVERT = 0xA;
0548:
0549:            /**
0550:             * Raster operation: <code>DST = src | ~DST</code>.
0551:             * @see #setRasterOp
0552:             *
0553:             * @since Java 3D 1.4
0554:             */
0555:            public static final int ROP_OR_REVERSE = 0xB;
0556:
0557:            /**
0558:             * Raster operation: <code>DST = ~SRC</code>.
0559:             * @see #setRasterOp
0560:             *
0561:             * @since Java 3D 1.4
0562:             */
0563:            public static final int ROP_COPY_INVERTED = 0xC;
0564:
0565:            /**
0566:             * Raster operation: <code>DST = ~SRC | DST</code>.
0567:             * @see #setRasterOp
0568:             *
0569:             * @since Java 3D 1.4
0570:             */
0571:            public static final int ROP_OR_INVERTED = 0xD;
0572:
0573:            /**
0574:             * Raster operation: <code>DST = ~(SRC & DST)</code>.
0575:             * @see #setRasterOp
0576:             *
0577:             * @since Java 3D 1.4
0578:             */
0579:            public static final int ROP_NAND = 0xE;
0580:
0581:            /**
0582:             * Raster operation: <code>DST = 1</code>.
0583:             * @see #setRasterOp
0584:             *
0585:             * @since Java 3D 1.4
0586:             */
0587:            public static final int ROP_SET = 0xF;
0588:
0589:            //
0590:            // Stencil op enums
0591:            //
0592:
0593:            /**
0594:             * Stencil operation: <code>DST = DST</code>
0595:             * @see #setStencilOp(int,int,int)
0596:             *
0597:             * @since Java 3D 1.4
0598:             */
0599:            public static final int STENCIL_KEEP = 1;
0600:
0601:            /**
0602:             * Stencil operation: <code>DST = 0</code>
0603:             * @see #setStencilOp(int,int,int)
0604:             *
0605:             * @since Java 3D 1.4
0606:             */
0607:            public static final int STENCIL_ZERO = 2;
0608:
0609:            /**
0610:             * Stencil operation: <code>DST = REF</code>
0611:             * @see #setStencilOp(int,int,int)
0612:             *
0613:             * @since Java 3D 1.4
0614:             */
0615:            public static final int STENCIL_REPLACE = 3;
0616:
0617:            /**
0618:             * Stencil operation: <code>DST = DST + 1</code>
0619:             * @see #setStencilOp(int,int,int)
0620:             *
0621:             * @since Java 3D 1.4
0622:             */
0623:            public static final int STENCIL_INCR = 4;
0624:
0625:            /**
0626:             * Stencil operation: <code>DST = DST - 1</code>
0627:             * @see #setStencilOp(int,int,int)
0628:             *
0629:             * @since Java 3D 1.4
0630:             */
0631:            public static final int STENCIL_DECR = 5;
0632:
0633:            /**
0634:             * Stencil operation: <code>DST = ~DST</code>
0635:             * @see #setStencilOp(int,int,int)
0636:             *
0637:             * @since Java 3D 1.4
0638:             */
0639:            public static final int STENCIL_INVERT = 6;
0640:
0641:            // Array for setting default read capabilities
0642:            private static final int[] readCapabilities = {
0643:                    ALLOW_ALPHA_TEST_FUNCTION_READ,
0644:                    ALLOW_ALPHA_TEST_VALUE_READ, ALLOW_DEPTH_ENABLE_READ,
0645:                    ALLOW_DEPTH_TEST_FUNCTION_READ,
0646:                    ALLOW_IGNORE_VERTEX_COLORS_READ, ALLOW_RASTER_OP_READ,
0647:                    ALLOW_STENCIL_ATTRIBUTES_READ, ALLOW_VISIBLE_READ };
0648:
0649:            /**
0650:             * Constructs a RenderingAttributes object with default parameters.
0651:             * The default values are as follows:
0652:             * <ul>
0653:             * depth buffer enable : true<br>
0654:             * depth buffer write enable : true<br>
0655:             * alpha test function : ALWAYS<br>
0656:             * alpha test value : 0.0f<br>
0657:             * visible : true<br>
0658:             * ignore vertex colors : false<br>
0659:             * raster operation enable : false<br>
0660:             * raster operation : ROP_COPY<br>
0661:             * depth test: LESS_OR_EQUAL<br>
0662:             * stencil enable : false<br>
0663:             * stencil write mask : ~0 (all ones)<br>
0664:             * stencil op - failOp : STENCIL_KEEP<br>
0665:             * stencil op - zFailOp : STENCIL_KEEP<br>
0666:             * stencil op - zPassOp : STENCIL_KEEP<br>
0667:             * stencil function : ALWAYS<br>
0668:             * stencil reference value : 0<br>
0669:             * stencil comparison mask : ~0 (all ones)
0670:             * </ul>
0671:             */
0672:            public RenderingAttributes() {
0673:                // Just use default attributes
0674:                // set default read capabilities
0675:                setDefaultReadCapabilities(readCapabilities);
0676:            }
0677:
0678:            /**
0679:             * Constructs a RenderingAttributes object with specified values.
0680:             * @param depthBufferEnable a flag to turn depth buffer on/off
0681:             * @param depthBufferWriteEnable a flag to to make depth buffer
0682:             * read/write or read only
0683:             * @param alphaTestValue the alpha test reference value
0684:             * @param alphaTestFunction the function for comparing alpha values
0685:             */
0686:            public RenderingAttributes(boolean depthBufferEnable,
0687:                    boolean depthBufferWriteEnable, float alphaTestValue,
0688:                    int alphaTestFunction) {
0689:
0690:                this (depthBufferEnable, depthBufferWriteEnable, alphaTestValue,
0691:                        alphaTestFunction, true, false, false, ROP_COPY);
0692:            }
0693:
0694:            /**
0695:             * Constructs a RenderingAttributes object with specified values
0696:             * @param depthBufferEnable a flag to turn depth buffer on/off
0697:             * @param depthBufferWriteEnable a flag to make depth buffer
0698:             * read/write or read only
0699:             * @param alphaTestValue the alpha test reference value
0700:             * @param alphaTestFunction the function for comparing alpha values
0701:             * @param visible a flag that specifies whether the object is visible
0702:             * @param ignoreVertexColors a flag to enable or disable
0703:             * the ignoring of per-vertex colors
0704:             * @param rasterOpEnable a flag that specifies whether logical
0705:             * raster operations are enabled for this RenderingAttributes object.
0706:             * This disables all alpha blending operations.
0707:             * @param rasterOp the logical raster operation, one of:
0708:             * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED,
0709:             * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT,
0710:             * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET
0711:             *
0712:             * @since Java 3D 1.2
0713:             */
0714:            public RenderingAttributes(boolean depthBufferEnable,
0715:                    boolean depthBufferWriteEnable, float alphaTestValue,
0716:                    int alphaTestFunction, boolean visible,
0717:                    boolean ignoreVertexColors, boolean rasterOpEnable,
0718:                    int rasterOp) {
0719:                // set default read capabilities
0720:                setDefaultReadCapabilities(readCapabilities);
0721:
0722:                ((RenderingAttributesRetained) this .retained)
0723:                        .initDepthBufferEnable(depthBufferEnable);
0724:                ((RenderingAttributesRetained) this .retained)
0725:                        .initDepthBufferWriteEnable(depthBufferWriteEnable);
0726:                ((RenderingAttributesRetained) this .retained)
0727:                        .initAlphaTestValue(alphaTestValue);
0728:                ((RenderingAttributesRetained) this .retained)
0729:                        .initAlphaTestFunction(alphaTestFunction);
0730:                ((RenderingAttributesRetained) this .retained)
0731:                        .initVisible(visible);
0732:
0733:                ((RenderingAttributesRetained) this .retained)
0734:                        .initIgnoreVertexColors(ignoreVertexColors);
0735:                ((RenderingAttributesRetained) this .retained)
0736:                        .initRasterOpEnable(rasterOpEnable);
0737:                ((RenderingAttributesRetained) this .retained)
0738:                        .initRasterOp(rasterOp);
0739:            }
0740:
0741:            /**
0742:             * Enables or disables depth buffer mode for this RenderingAttributes
0743:             * component object.
0744:             *
0745:             * @param state true or false to enable or disable depth buffer mode
0746:             *
0747:             * @exception CapabilityNotSetException if appropriate capability is 
0748:             * not set and this object is part of live or compiled scene graph
0749:             *
0750:             * @see GraphicsConfigTemplate3D#setDepthSize
0751:             */
0752:            public void setDepthBufferEnable(boolean state) {
0753:                if (isLiveOrCompiled())
0754:                    if (!this .getCapability(ALLOW_DEPTH_ENABLE_WRITE))
0755:                        throw new CapabilityNotSetException(J3dI18N
0756:                                .getString("RenderingAttributes0"));
0757:
0758:                if (isLive())
0759:                    ((RenderingAttributesRetained) this .retained)
0760:                            .setDepthBufferEnable(state);
0761:                else
0762:                    ((RenderingAttributesRetained) this .retained)
0763:                            .initDepthBufferEnable(state);
0764:
0765:            }
0766:
0767:            /**
0768:             * Retrieves the state of zBuffer Enable flag
0769:             * @return true if depth buffer mode is enabled, false
0770:             * if depth buffer mode is disabled
0771:             * @exception CapabilityNotSetException if appropriate capability is 
0772:             * not set and this object is part of live or compiled scene graph
0773:             */
0774:            public boolean getDepthBufferEnable() {
0775:                if (isLiveOrCompiled())
0776:                    if (!this .getCapability(ALLOW_DEPTH_ENABLE_READ))
0777:                        throw new CapabilityNotSetException(J3dI18N
0778:                                .getString("RenderingAttributes1"));
0779:
0780:                return ((RenderingAttributesRetained) this .retained)
0781:                        .getDepthBufferEnable();
0782:            }
0783:
0784:            /**
0785:             * Enables or disables writing the depth buffer for this object.
0786:             * During the transparent rendering pass,
0787:             * this attribute can be overridden by
0788:             * the depthBufferFreezeTransparent attribute in the View object.
0789:             * @param state true or false to enable or disable depth buffer Write mode
0790:             * @exception CapabilityNotSetException if appropriate capability is 
0791:             * not set and this object is part of live or compiled scene graph
0792:             * @see View#setDepthBufferFreezeTransparent
0793:             */
0794:            public void setDepthBufferWriteEnable(boolean state) {
0795:                if (isLiveOrCompiled())
0796:                    if (!this .getCapability(ALLOW_DEPTH_ENABLE_WRITE))
0797:                        throw new CapabilityNotSetException(J3dI18N
0798:                                .getString("RenderingAttributes2"));
0799:                if (isLive())
0800:                    ((RenderingAttributesRetained) this .retained)
0801:                            .setDepthBufferWriteEnable(state);
0802:                else
0803:                    ((RenderingAttributesRetained) this .retained)
0804:                            .initDepthBufferWriteEnable(state);
0805:            }
0806:
0807:            /**
0808:             * Retrieves the state of Depth Buffer Write Enable flag.
0809:             * @return true if depth buffer is writable, false
0810:             * if depth buffer is read-only
0811:             * @exception CapabilityNotSetException if appropriate capability is 
0812:             * not set and this object is part of live or compiled scene graph
0813:             */
0814:            public boolean getDepthBufferWriteEnable() {
0815:                if (isLiveOrCompiled())
0816:                    if (!this .getCapability(ALLOW_DEPTH_ENABLE_READ))
0817:                        throw new CapabilityNotSetException(J3dI18N
0818:                                .getString("RenderingAttributes3"));
0819:
0820:                return ((RenderingAttributesRetained) this .retained)
0821:                        .getDepthBufferWriteEnable();
0822:            }
0823:
0824:            /**
0825:             * Set alpha test value used by alpha test function.  This value is
0826:             * compared to the alpha value of each rendered pixel.
0827:             * @param value the alpha test value
0828:             * @exception CapabilityNotSetException if appropriate capability is 
0829:             * not set and this object is part of live or compiled scene graph
0830:             */
0831:            public void setAlphaTestValue(float value) {
0832:                if (isLiveOrCompiled())
0833:                    if (!this .getCapability(ALLOW_ALPHA_TEST_VALUE_WRITE))
0834:                        throw new CapabilityNotSetException(J3dI18N
0835:                                .getString("RenderingAttributes4"));
0836:                if (isLive())
0837:                    ((RenderingAttributesRetained) this .retained)
0838:                            .setAlphaTestValue(value);
0839:                else
0840:                    ((RenderingAttributesRetained) this .retained)
0841:                            .initAlphaTestValue(value);
0842:
0843:            }
0844:
0845:            /**
0846:             * Retrieves the alpha test value.
0847:             * @return the alpha test value.
0848:             * @exception CapabilityNotSetException if appropriate capability is 
0849:             * not set and this object is part of live or compiled scene graph
0850:             */
0851:            public float getAlphaTestValue() {
0852:                if (isLiveOrCompiled())
0853:                    if (!this .getCapability(ALLOW_ALPHA_TEST_VALUE_READ))
0854:                        throw new CapabilityNotSetException(J3dI18N
0855:                                .getString("RenderingAttributes5"));
0856:
0857:                return ((RenderingAttributesRetained) this .retained)
0858:                        .getAlphaTestValue();
0859:            }
0860:
0861:            /**
0862:             * Set alpha test function. This function is used to compare
0863:             * each incoming (source) per-pixel alpha value with the alpha test value.
0864:             * If the test passes, the pixel is written otherwise the pixel is not
0865:             * written.
0866:             * @param function the new alpha test function.  One of
0867:             * ALWAYS, NEVER, EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER,
0868:             * GREATER_OR_EQUAL
0869:             * @exception CapabilityNotSetException if appropriate capability is 
0870:             * not set and this object is part of live or compiled scene graph
0871:             */
0872:            public void setAlphaTestFunction(int function) {
0873:                if (isLiveOrCompiled())
0874:                    if (!this .getCapability(ALLOW_ALPHA_TEST_FUNCTION_WRITE))
0875:                        throw new CapabilityNotSetException(J3dI18N
0876:                                .getString("RenderingAttributes6"));
0877:
0878:                if (isLive())
0879:                    ((RenderingAttributesRetained) this .retained)
0880:                            .setAlphaTestFunction(function);
0881:                else
0882:                    ((RenderingAttributesRetained) this .retained)
0883:                            .initAlphaTestFunction(function);
0884:
0885:            }
0886:
0887:            /**
0888:             * Retrieves current alpha test function.
0889:             * @return the current alpha test function
0890:             * @exception CapabilityNotSetException if appropriate capability is 
0891:             * not set and this object is part of live or compiled scene graph
0892:             */
0893:            public int getAlphaTestFunction() {
0894:                if (isLiveOrCompiled())
0895:                    if (!this .getCapability(ALLOW_ALPHA_TEST_FUNCTION_READ))
0896:                        throw new CapabilityNotSetException(J3dI18N
0897:                                .getString("RenderingAttributes7"));
0898:
0899:                return ((RenderingAttributesRetained) this .retained)
0900:                        .getAlphaTestFunction();
0901:            }
0902:
0903:            /**
0904:             * Sets the visibility flag for this RenderingAttributes
0905:             * component object.  Invisible objects are not rendered (subject to
0906:             * the visibility policy for the current view), but they can be picked
0907:             * or collided with. The default value is true.
0908:             * @param visible true or false to enable or disable visibility
0909:             * @exception CapabilityNotSetException if appropriate capability is 
0910:             * not set and this object is part of live or compiled scene graph
0911:             *
0912:             * @see View#setVisibilityPolicy
0913:             *
0914:             * @since Java 3D 1.2
0915:             */
0916:            public void setVisible(boolean visible) {
0917:                if (isLiveOrCompiled())
0918:                    if (!this .getCapability(ALLOW_VISIBLE_WRITE))
0919:                        throw new CapabilityNotSetException(J3dI18N
0920:                                .getString("RenderingAttributes8"));
0921:
0922:                if (isLive())
0923:                    ((RenderingAttributesRetained) this .retained)
0924:                            .setVisible(visible);
0925:                else
0926:                    ((RenderingAttributesRetained) this .retained)
0927:                            .initVisible(visible);
0928:            }
0929:
0930:            /**
0931:             * Retrieves the visibility flag for this RenderingAttributes object.
0932:             * @return true if the object is visible; false
0933:             * if the object is invisible.
0934:             * @exception CapabilityNotSetException if appropriate capability is 
0935:             * not set and this object is part of live or compiled scene graph
0936:             *
0937:             * @since Java 3D 1.2
0938:             */
0939:            public boolean getVisible() {
0940:                if (isLiveOrCompiled())
0941:                    if (!this .getCapability(ALLOW_VISIBLE_READ))
0942:                        throw new CapabilityNotSetException(J3dI18N
0943:                                .getString("RenderingAttributes9"));
0944:
0945:                return ((RenderingAttributesRetained) this .retained)
0946:                        .getVisible();
0947:            }
0948:
0949:            /**
0950:             * Sets a flag that indicates whether vertex colors are ignored
0951:             * for this RenderingAttributes object.  If
0952:             * <code>ignoreVertexColors</code> is false, per-vertex
0953:             * colors are used, when present in the associated Geometry
0954:             * objects, taking precedence over the ColoringAttributes color
0955:             * and the specified Material color(s).  If <code>ignoreVertexColors</code>
0956:             * is true, per-vertex colors are ignored.  In this case, if
0957:             * lighting is enabled, the Material diffuse color will be
0958:             * used as the object color.  If lighting is disabled, the
0959:             * ColoringAttributes color will be used.  The default value is false.
0960:             *
0961:             * @param ignoreVertexColors true or false to enable or disable
0962:             * the ignoring of per-vertex colors
0963:             * @exception CapabilityNotSetException if appropriate capability is 
0964:             * not set and this object is part of live or compiled scene graph
0965:             *
0966:             * @see ColoringAttributes
0967:             * @see Material
0968:             *
0969:             * @since Java 3D 1.2
0970:             */
0971:            public void setIgnoreVertexColors(boolean ignoreVertexColors) {
0972:                if (isLiveOrCompiled())
0973:                    if (!this .getCapability(ALLOW_IGNORE_VERTEX_COLORS_WRITE))
0974:                        throw new CapabilityNotSetException(J3dI18N
0975:                                .getString("RenderingAttributes12"));
0976:
0977:                if (isLive())
0978:                    ((RenderingAttributesRetained) this .retained)
0979:                            .setIgnoreVertexColors(ignoreVertexColors);
0980:                else
0981:                    ((RenderingAttributesRetained) this .retained)
0982:                            .initIgnoreVertexColors(ignoreVertexColors);
0983:            }
0984:
0985:            /**
0986:             * Retrieves the ignoreVertexColors flag for this
0987:             * RenderingAttributes object.
0988:             * @return true if per-vertex colors are ignored; false
0989:             * if per-vertex colors are used.
0990:             * @exception CapabilityNotSetException if appropriate capability is 
0991:             * not set and this object is part of live or compiled scene graph
0992:             *
0993:             * @since Java 3D 1.2
0994:             */
0995:            public boolean getIgnoreVertexColors() {
0996:                if (isLiveOrCompiled())
0997:                    if (!this .getCapability(ALLOW_IGNORE_VERTEX_COLORS_READ))
0998:                        throw new CapabilityNotSetException(J3dI18N
0999:                                .getString("RenderingAttributes13"));
1000:
1001:                return ((RenderingAttributesRetained) this .retained)
1002:                        .getIgnoreVertexColors();
1003:            }
1004:
1005:            /**
1006:             * Sets the rasterOp enable flag for this RenderingAttributes
1007:             * component object.  When set to true, this enables logical
1008:             * raster operations as specified by the setRasterOp method.
1009:             * Enabling raster operations effectively disables alpha blending,
1010:             * which is used for transparency and antialiasing.  Raster
1011:             * operations, especially XOR mode, are primarily useful when
1012:             * rendering to the front buffer in immediate mode.  Most
1013:             * applications will not wish to enable this mode.
1014:             *
1015:             * @param rasterOpEnable true or false to enable or disable
1016:             * raster operations
1017:             * @exception CapabilityNotSetException if appropriate capability is 
1018:             * not set and this object is part of live or compiled scene graph
1019:             *
1020:             * @see #setRasterOp
1021:             *
1022:             * @since Java 3D 1.2
1023:             */
1024:            public void setRasterOpEnable(boolean rasterOpEnable) {
1025:                if (isLiveOrCompiled())
1026:                    if (!this .getCapability(ALLOW_RASTER_OP_WRITE))
1027:                        throw new CapabilityNotSetException(J3dI18N
1028:                                .getString("RenderingAttributes10"));
1029:
1030:                if (isLive())
1031:                    ((RenderingAttributesRetained) this .retained)
1032:                            .setRasterOpEnable(rasterOpEnable);
1033:                else
1034:                    ((RenderingAttributesRetained) this .retained)
1035:                            .initRasterOpEnable(rasterOpEnable);
1036:            }
1037:
1038:            /**
1039:             * Retrieves the rasterOp enable flag for this RenderingAttributes
1040:             * object.
1041:             * @return true if raster operations are enabled; false
1042:             * if raster operations are disabled.
1043:             * @exception CapabilityNotSetException if appropriate capability is 
1044:             * not set and this object is part of live or compiled scene graph
1045:             *
1046:             * @since Java 3D 1.2
1047:             */
1048:            public boolean getRasterOpEnable() {
1049:                if (isLiveOrCompiled())
1050:                    if (!this .getCapability(ALLOW_RASTER_OP_READ))
1051:                        throw new CapabilityNotSetException(J3dI18N
1052:                                .getString("RenderingAttributes11"));
1053:
1054:                return ((RenderingAttributesRetained) this .retained)
1055:                        .getRasterOpEnable();
1056:            }
1057:
1058:            /**
1059:             * Sets the raster operation function for this RenderingAttributes
1060:             * component object.
1061:             *
1062:             * @param rasterOp the logical raster operation, one of:
1063:             * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED,
1064:             * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT,
1065:             * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET.
1066:             * @exception CapabilityNotSetException if appropriate capability is 
1067:             * not set and this object is part of live or compiled scene graph
1068:             *
1069:             * @since Java 3D 1.2
1070:             */
1071:            public void setRasterOp(int rasterOp) {
1072:                if (isLiveOrCompiled())
1073:                    if (!this .getCapability(ALLOW_RASTER_OP_WRITE))
1074:                        throw new CapabilityNotSetException(J3dI18N
1075:                                .getString("RenderingAttributes10"));
1076:
1077:                if (isLive())
1078:                    ((RenderingAttributesRetained) this .retained)
1079:                            .setRasterOp(rasterOp);
1080:                else
1081:                    ((RenderingAttributesRetained) this .retained)
1082:                            .initRasterOp(rasterOp);
1083:            }
1084:
1085:            /**
1086:             * Retrieves the current raster operation for this RenderingAttributes
1087:             * object.
1088:             * @return one of:
1089:             * ROP_CLEAR, ROP_AND, ROP_AND_REVERSE, ROP_COPY, ROP_AND_INVERTED,
1090:             * ROP_NOOP, ROP_XOR, ROP_OR, ROP_NOR, ROP_EQUIV, ROP_INVERT,
1091:             * ROP_OR_REVERSE, ROP_COPY_INVERTED, ROP_OR_INVERTED, ROP_NAND or ROP_SET
1092:             * @exception CapabilityNotSetException if appropriate capability is 
1093:             * not set and this object is part of live or compiled scene graph
1094:             *
1095:             * @since Java 3D 1.2
1096:             */
1097:            public int getRasterOp() {
1098:                if (isLiveOrCompiled())
1099:                    if (!this .getCapability(ALLOW_RASTER_OP_READ))
1100:                        throw new CapabilityNotSetException(J3dI18N
1101:                                .getString("RenderingAttributes11"));
1102:
1103:                return ((RenderingAttributesRetained) this .retained)
1104:                        .getRasterOp();
1105:            }
1106:
1107:            /**
1108:             * Creates a retained mode RenderingAttributesRetained object that this
1109:             * RenderingAttributes component object will point to.
1110:             */
1111:            void createRetained() {
1112:                this .retained = new RenderingAttributesRetained();
1113:                this .retained.setSource(this );
1114:            }
1115:
1116:            /**
1117:             * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate)  
1118:             */
1119:            public NodeComponent cloneNodeComponent() {
1120:                RenderingAttributes ra = new RenderingAttributes();
1121:                ra.duplicateNodeComponent(this );
1122:                return ra;
1123:            }
1124:
1125:            /**
1126:             * Copies all node information from <code>originalNodeComponent</code> into
1127:             * the current node.  This method is called from the
1128:             * <code>duplicateNode</code> method. This routine does
1129:             * the actual duplication of all "local data" (any data defined in
1130:             * this object). 
1131:             *
1132:             * @param originalNodeComponent the original node to duplicate.
1133:             * @param forceDuplicate when set to <code>true</code>, causes the
1134:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
1135:             *  <code>false</code>, the value of each node's
1136:             *  <code>duplicateOnCloneTree</code> variable determines whether
1137:             *  NodeComponent data is duplicated or copied.
1138:             *
1139:             * @see Node#cloneTree
1140:             * @see NodeComponent#setDuplicateOnCloneTree
1141:             */
1142:            void duplicateAttributes(NodeComponent originalNodeComponent,
1143:                    boolean forceDuplicate) {
1144:
1145:                super 
1146:                        .duplicateAttributes(originalNodeComponent,
1147:                                forceDuplicate);
1148:
1149:                RenderingAttributesRetained attr = (RenderingAttributesRetained) originalNodeComponent.retained;
1150:                RenderingAttributesRetained rt = (RenderingAttributesRetained) retained;
1151:
1152:                rt.initDepthBufferEnable(attr.getDepthBufferEnable());
1153:                rt.initDepthBufferWriteEnable(attr.getDepthBufferWriteEnable());
1154:                rt.initDepthTestFunction(attr.getDepthTestFunction());
1155:                rt.initAlphaTestValue(attr.getAlphaTestValue());
1156:                rt.initAlphaTestFunction(attr.getAlphaTestFunction());
1157:                rt.initVisible(attr.getVisible());
1158:                rt.initIgnoreVertexColors(attr.getIgnoreVertexColors());
1159:                rt.initRasterOpEnable(attr.getRasterOpEnable());
1160:                rt.initRasterOp(attr.getRasterOp());
1161:                rt.initStencilEnable(attr.getStencilEnable());
1162:                int[] ops = new int[3];
1163:                attr.getStencilOp(ops);
1164:                rt.initStencilOp(ops[0], ops[1], ops[2]);
1165:                attr.getStencilFunction(ops);
1166:                rt.initStencilFunction(ops[0], ops[1], ops[2]);
1167:                rt.initStencilWriteMask(attr.getStencilWriteMask());
1168:
1169:            }
1170:
1171:            /**
1172:             * Set depth test function.  This function is used to compare each
1173:             * incoming (source) per-pixel depth test value with the stored per-pixel
1174:             * depth value in the frame buffer.  If the test
1175:             * passes, the pixel is written, otherwise the pixel is not
1176:             * written.
1177:             * @param function the new depth test function.  One of
1178:             * ALWAYS, NEVER, EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER,
1179:             * or GREATER_OR_EQUAL.
1180:             * The default value is LESS_OR_EQUAL.
1181:             * @exception CapabilityNotSetException if appropriate capability is 
1182:             * not set and this object is part of live or compiled scene graph
1183:             *
1184:             * @since Java 3D 1.4
1185:             */
1186:            public void setDepthTestFunction(int function) {
1187:                if (isLiveOrCompiled())
1188:                    if (!this .getCapability(ALLOW_DEPTH_TEST_FUNCTION_WRITE))
1189:                        throw new CapabilityNotSetException(J3dI18N
1190:                                .getString("RenderingAttributes14"));
1191:
1192:                if (isLive())
1193:                    ((RenderingAttributesRetained) this .retained)
1194:                            .setDepthTestFunction(function);
1195:                else
1196:                    ((RenderingAttributesRetained) this .retained)
1197:                            .initDepthTestFunction(function);
1198:            }
1199:
1200:            /**
1201:             * Retrieves current depth test function.
1202:             * @return the current depth test function
1203:             * @exception CapabilityNotSetException if appropriate capability is 
1204:             * not set and this object is part of live or compiled scene graph
1205:             *
1206:             * @since Java 3D 1.4
1207:             */
1208:            public int getDepthTestFunction() {
1209:                if (isLiveOrCompiled())
1210:                    if (!this .getCapability(ALLOW_DEPTH_TEST_FUNCTION_READ))
1211:                        throw new CapabilityNotSetException(J3dI18N
1212:                                .getString("RenderingAttributes15"));
1213:
1214:                return ((RenderingAttributesRetained) this .retained)
1215:                        .getDepthTestFunction();
1216:            }
1217:
1218:            /**
1219:             * Enables or disables the stencil buffer for this RenderingAttributes
1220:             * component object. If the stencil buffer is disabled, the
1221:             * stencil operation and function are ignored.  If a scene graph
1222:             * is rendered on a Canvas3D that does not have a stencil buffer,
1223:             * the stencil buffer will be implicitly disabled for that canvas.
1224:             *
1225:             * @param state true or false to enable or disable stencil buffer
1226:             * operations.
1227:             * If this is set to false, the stencilOp and stencilFunction parameters
1228:             * are not used.
1229:             *
1230:             * @exception CapabilityNotSetException if appropriate capability is 
1231:             * not set and this object is part of live or compiled scene graph
1232:             *
1233:             * @see GraphicsConfigTemplate3D#setStencilSize
1234:             *
1235:             * @since Java 3D 1.4
1236:             */
1237:            public void setStencilEnable(boolean state) {
1238:                if (isLiveOrCompiled()) {
1239:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_WRITE)) {
1240:                        throw new CapabilityNotSetException(J3dI18N
1241:                                .getString("RenderingAttributes16"));
1242:                    }
1243:                }
1244:
1245:                if (isLive())
1246:                    ((RenderingAttributesRetained) this .retained)
1247:                            .setStencilEnable(state);
1248:                else
1249:                    ((RenderingAttributesRetained) this .retained)
1250:                            .initStencilEnable(state);
1251:
1252:            }
1253:
1254:            /**
1255:             * Retrieves the stencil buffer enable flag for this RenderingAttributes
1256:             * object.
1257:             *
1258:             * @return true if stencil buffer operations are enabled; false
1259:             * if stencil buffer operations are disabled.
1260:             *
1261:             * @exception CapabilityNotSetException if appropriate capability is 
1262:             * not set and this object is part of live or compiled scene graph
1263:             *
1264:             * @since Java 3D 1.4
1265:             */
1266:            public boolean getStencilEnable() {
1267:                if (isLiveOrCompiled()) {
1268:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_READ)) {
1269:                        throw new CapabilityNotSetException(J3dI18N
1270:                                .getString("RenderingAttributes17"));
1271:                    }
1272:                }
1273:
1274:                return ((RenderingAttributesRetained) this .retained)
1275:                        .getStencilEnable();
1276:            }
1277:
1278:            /**
1279:             * Sets the stencil operations for this RenderingAttributes object to the
1280:             * specified parameters.
1281:             *
1282:             * @param failOp operation performed when the stencil test fails, one of:
1283:             * STENCIL_KEEP, STENCIL_ZERO, STENCIL_REPLACE, STENCIL_INCR, STENCIL_DECR,
1284:             * or STENCIL_INVERT.
1285:             *
1286:             * @param zFailOp operation performed when the stencil test passes and the
1287:             * depth test fails, one of:
1288:             * STENCIL_KEEP, STENCIL_ZERO, STENCIL_REPLACE, STENCIL_INCR, STENCIL_DECR,
1289:             * or STENCIL_INVERT.
1290:             *
1291:             * @param zPassOp operation performed when both the stencil test and the
1292:             * depth test pass, one of:
1293:             * STENCIL_KEEP, STENCIL_ZERO, STENCIL_REPLACE, STENCIL_INCR, STENCIL_DECR,
1294:             * or STENCIL_INVERT.
1295:             *
1296:             * @exception CapabilityNotSetException if appropriate capability is 
1297:             * not set and this object is part of live or compiled scene graph
1298:             *
1299:             * @since Java 3D 1.4
1300:             */
1301:            public void setStencilOp(int failOp, int zFailOp, int zPassOp) {
1302:                if (isLiveOrCompiled()) {
1303:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_WRITE)) {
1304:                        throw new CapabilityNotSetException(J3dI18N
1305:                                .getString("RenderingAttributes16"));
1306:                    }
1307:                }
1308:
1309:                if (isLive())
1310:                    ((RenderingAttributesRetained) this .retained).setStencilOp(
1311:                            failOp, zFailOp, zPassOp);
1312:                else
1313:                    ((RenderingAttributesRetained) this .retained)
1314:                            .initStencilOp(failOp, zFailOp, zPassOp);
1315:
1316:            }
1317:
1318:            /**
1319:             * Sets the stencil operations for this RenderingAttributes object to the
1320:             * specified parameters.
1321:             *
1322:             * @param stencilOps an array of three integers that specifies the new
1323:             * set of stencil operations. Element 0 of the array specifies the
1324:             * <code>failOp</code> parameter, element 1 specifies the
1325:             * <code>zFailOp</code> parameter, and element 2 specifies the
1326:             * <code>zPassOp</code> parameter.
1327:             *
1328:             * @exception CapabilityNotSetException if appropriate capability is 
1329:             * not set and this object is part of live or compiled scene graph
1330:             *
1331:             * @see #setStencilOp(int,int,int)
1332:             *
1333:             * @since Java 3D 1.4
1334:             */
1335:            public void setStencilOp(int[] stencilOps) {
1336:                if (isLiveOrCompiled()) {
1337:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_WRITE)) {
1338:                        throw new CapabilityNotSetException(J3dI18N
1339:                                .getString("RenderingAttributes16"));
1340:                    }
1341:                }
1342:
1343:                if (isLive())
1344:                    ((RenderingAttributesRetained) this .retained).setStencilOp(
1345:                            stencilOps[0], stencilOps[1], stencilOps[2]);
1346:                else
1347:                    ((RenderingAttributesRetained) this .retained)
1348:                            .initStencilOp(stencilOps[0], stencilOps[1],
1349:                                    stencilOps[2]);
1350:            }
1351:
1352:            /**
1353:             * Retrieves the current set of stencil operations, and copies them
1354:             * into the specified array. The caller must ensure that this array
1355:             * has been allocated with enough space to hold the results.
1356:             *
1357:             * @param stencilOps array that will receive the current set of
1358:             * three stencil operations. The <code>failOp</code> parameter is copied
1359:             * into element 0 of the array, the <code>zFailOp</code> parameter is copied
1360:             * into element 1, and the <code>zPassOp</code> parameter is copied
1361:             * into element 2.
1362:             *
1363:             * @exception CapabilityNotSetException if appropriate capability is 
1364:             * not set and this object is part of live or compiled scene graph
1365:             *
1366:             * @since Java 3D 1.4
1367:             */
1368:            public void getStencilOp(int[] stencilOps) {
1369:                if (isLiveOrCompiled()) {
1370:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_READ)) {
1371:                        throw new CapabilityNotSetException(J3dI18N
1372:                                .getString("RenderingAttributes17"));
1373:                    }
1374:                }
1375:
1376:                ((RenderingAttributesRetained) this .retained)
1377:                        .getStencilOp(stencilOps);
1378:            }
1379:
1380:            /**
1381:             * Sets the stencil function, reference value, and comparison mask
1382:             * for this RenderingAttributes object to the specified parameters.
1383:             *
1384:             * @param function the stencil test function, used to compare the
1385:             * stencil reference value with the stored per-pixel
1386:             * stencil value in the frame buffer.  If the test
1387:             * passes, the pixel is written, otherwise the pixel is not
1388:             * written. The stencil function is one of:
1389:             * ALWAYS, NEVER, EQUAL, NOT_EQUAL, LESS, LESS_OR_EQUAL, GREATER,
1390:             * or GREATER_OR_EQUAL.
1391:             *
1392:             * @param refValue the stencil reference value that is tested against
1393:             * the stored per-pixel stencil value
1394:             *
1395:             * @param compareMask a mask that limits which bits are compared; it is
1396:             * bitwise-ANDed with both the stencil reference value and the stored
1397:             * per-pixel stencil value before doing the comparison.
1398:             *
1399:             * @exception CapabilityNotSetException if appropriate capability is
1400:             * not set and this object is part of live or compiled scene graph
1401:             *
1402:             * @since Java 3D 1.4
1403:             */
1404:            public void setStencilFunction(int function, int refValue,
1405:                    int compareMask) {
1406:                if (isLiveOrCompiled()) {
1407:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_WRITE)) {
1408:                        throw new CapabilityNotSetException(J3dI18N
1409:                                .getString("RenderingAttributes16"));
1410:                    }
1411:                }
1412:                if (isLive())
1413:                    ((RenderingAttributesRetained) this .retained)
1414:                            .setStencilFunction(function, refValue, compareMask);
1415:                else
1416:                    ((RenderingAttributesRetained) this .retained)
1417:                            .initStencilFunction(function, refValue,
1418:                                    compareMask);
1419:            }
1420:
1421:            /**
1422:             * Sets the stencil function, reference value, and comparison mask
1423:             * for this RenderingAttributes object to the specified parameters.
1424:             *
1425:             * @param params an array of three integers that specifies the new
1426:             * stencil function, reference value, and comparison mask.
1427:             * Element 0 of the array specifies the
1428:             * stencil function, element 1 specifies the
1429:             * reference value, and element 2 specifies the
1430:             * comparison mask.
1431:             *
1432:             * @exception CapabilityNotSetException if appropriate capability is 
1433:             * not set and this object is part of live or compiled scene graph
1434:             *
1435:             * @see #setStencilFunction(int,int,int)
1436:             *
1437:             * @since Java 3D 1.4
1438:             */
1439:            public void setStencilFunction(int[] params) {
1440:                if (isLiveOrCompiled()) {
1441:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_WRITE)) {
1442:                        throw new CapabilityNotSetException(J3dI18N
1443:                                .getString("RenderingAttributes16"));
1444:                    }
1445:                }
1446:
1447:                if (isLive())
1448:                    ((RenderingAttributesRetained) this .retained)
1449:                            .setStencilFunction(params[0], params[1], params[2]);
1450:                else
1451:                    ((RenderingAttributesRetained) this .retained)
1452:                            .initStencilFunction(params[0], params[1],
1453:                                    params[2]);
1454:
1455:            }
1456:
1457:            /**
1458:             * Retrieves the stencil function, reference value, and comparison mask,
1459:             * and copies them into the specified array. The caller must ensure
1460:             * that this array has been allocated with enough space to hold the results.
1461:             *
1462:             * @param params array that will receive the current stencil function,
1463:             * reference value, and comparison mask. The stencil function is copied
1464:             * into element 0 of the array, the reference value is copied
1465:             * into element 1, and the comparison mask is copied
1466:             * into element 2.
1467:             *
1468:             * @exception CapabilityNotSetException if appropriate capability is 
1469:             * not set and this object is part of live or compiled scene graph
1470:             *
1471:             * @since Java 3D 1.4
1472:             */
1473:            public void getStencilFunction(int[] params) {
1474:                if (isLiveOrCompiled()) {
1475:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_READ)) {
1476:                        throw new CapabilityNotSetException(J3dI18N
1477:                                .getString("RenderingAttributes17"));
1478:                    }
1479:                }
1480:
1481:                ((RenderingAttributesRetained) this .retained)
1482:                        .getStencilFunction(params);
1483:            }
1484:
1485:            /**
1486:             * Sets the stencil write mask for this RenderingAttributes
1487:             * object. This mask controls which bits of the
1488:             * stencil buffer are written.
1489:             * The default value is <code>~0</code> (all ones).
1490:             *
1491:             * @param mask the new stencil write mask.
1492:             *
1493:             * @exception CapabilityNotSetException if appropriate capability is 
1494:             * not set and this object is part of live or compiled scene graph
1495:             *
1496:             * @since Java 3D 1.4
1497:             */
1498:            public void setStencilWriteMask(int mask) {
1499:                if (isLiveOrCompiled()) {
1500:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_WRITE)) {
1501:                        throw new CapabilityNotSetException(J3dI18N
1502:                                .getString("RenderingAttributes16"));
1503:                    }
1504:                }
1505:
1506:                if (isLive())
1507:                    ((RenderingAttributesRetained) this .retained)
1508:                            .setStencilWriteMask(mask);
1509:                else
1510:                    ((RenderingAttributesRetained) this .retained)
1511:                            .initStencilWriteMask(mask);
1512:            }
1513:
1514:            /**
1515:             * Retrieves the current stencil write mask for this RenderingAttributes
1516:             * object.
1517:             *
1518:             * @return the stencil write mask.
1519:             *
1520:             * @exception CapabilityNotSetException if appropriate capability is 
1521:             * not set and this object is part of live or compiled scene graph
1522:             *
1523:             * @since Java 3D 1.4
1524:             */
1525:            public int getStencilWriteMask() {
1526:                if (isLiveOrCompiled()) {
1527:                    if (!this .getCapability(ALLOW_STENCIL_ATTRIBUTES_READ)) {
1528:                        throw new CapabilityNotSetException(J3dI18N
1529:                                .getString("RenderingAttributes17"));
1530:                    }
1531:                }
1532:
1533:                return ((RenderingAttributesRetained) this.retained)
1534:                        .getStencilWriteMask();
1535:            }
1536:
1537:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.