Source Code Cross Referenced for PointAttributesRetained.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) 


001:        /*
002:         * $RCSfile: PointAttributesRetained.java,v $
003:         *
004:         * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
006:         *
007:         * This code is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU General Public License version 2 only, as
009:         * published by the Free Software Foundation.  Sun designates this
010:         * particular file as subject to the "Classpath" exception as provided
011:         * by Sun in the LICENSE file that accompanied this code.
012:         *
013:         * This code is distributed in the hope that it will be useful, but WITHOUT
014:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
015:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
016:         * version 2 for more details (a copy is included in the LICENSE file that
017:         * accompanied this code).
018:         *
019:         * You should have received a copy of the GNU General Public License version
020:         * 2 along with this work; if not, write to the Free Software Foundation,
021:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
022:         *
023:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
024:         * CA 95054 USA or visit www.sun.com if you need additional information or
025:         * have any questions.
026:         *
027:         * $Revision: 1.7 $
028:         * $Date: 2008/02/28 20:17:28 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        import java.util.ArrayList;
035:
036:        /**
037:         * The PointAttributesRetained object defines all rendering state that can be set
038:         * as a component object of a Shape3D node.
039:         */
040:        class PointAttributesRetained extends NodeComponentRetained {
041:            // A list of pre-defined bits to indicate which component
042:            // in this LineAttributesRetained object changed.
043:            static final int POINT_SIZE_CHANGED = 0x01;
044:            static final int POINT_AA_CHANGED = 0x02;
045:
046:            // Size, in pixels, of point primitives
047:            float pointSize = 1.0f;
048:
049:            // Point antialiasing switch
050:            boolean pointAntialiasing = false;
051:
052:            /**
053:             * Sets the point size for this appearance component object.
054:             * @param pointSize the size, in pixels, of point primitives
055:             */
056:            final void initPointSize(float pointSize) {
057:                this .pointSize = pointSize;
058:            }
059:
060:            /**
061:             * Sets the point size for this appearance component object and sends a 
062:             * message notifying the interested structures of the change.
063:             * @param pointSize the size, in pixels, of point primitives
064:             */
065:            final void setPointSize(float pointSize) {
066:                initPointSize(pointSize);
067:                sendMessage(POINT_SIZE_CHANGED, new Float(pointSize));
068:            }
069:
070:            /**
071:             * Gets the point size for this appearance component object.
072:             * @return the size, in pixels, of point primitives
073:             */
074:            final float getPointSize() {
075:                return pointSize;
076:            }
077:
078:            /**
079:             * Enables or disables point antialiasing
080:             * for this appearance component object.
081:             * @param state true or false to enable or disable point antialiasing
082:             */
083:            final void initPointAntialiasingEnable(boolean state) {
084:                pointAntialiasing = state;
085:            }
086:
087:            /**
088:             * Enables or disables point antialiasing
089:             * for this appearance component object and sends a 
090:             * message notifying the interested structures of the change.
091:             * @param state true or false to enable or disable point antialiasing
092:             */
093:            final void setPointAntialiasingEnable(boolean state) {
094:                initPointAntialiasingEnable(pointAntialiasing);
095:                sendMessage(POINT_AA_CHANGED, (state ? Boolean.TRUE
096:                        : Boolean.FALSE));
097:            }
098:
099:            /**
100:             * Retrieves the state of the point antialiasing flag.
101:             * @return true if point antialiasing is enabled,
102:             * false if point antialiasing is disabled
103:             */
104:            final boolean getPointAntialiasingEnable() {
105:                return pointAntialiasing;
106:            }
107:
108:            /**
109:             * Creates and initializes a mirror object, point the mirror object 
110:             * to the retained object if the object is not editable
111:             */
112:            synchronized void createMirrorObject() {
113:                if (mirror == null) {
114:                    // Check the capability bits and let the mirror object
115:                    // point to itself if is not editable
116:                    if (isStatic()) {
117:                        mirror = this ;
118:                    } else {
119:                        PointAttributesRetained mirrorPa = new PointAttributesRetained();
120:                        mirrorPa.set(this );
121:                        mirrorPa.source = source;
122:                        mirror = mirrorPa;
123:                    }
124:                } else {
125:                    ((PointAttributesRetained) mirror).set(this );
126:                }
127:            }
128:
129:            /**
130:             * Update the native context
131:             */
132:            void updateNative(Context ctx) {
133:                Pipeline.getPipeline().updatePointAttributes(ctx, pointSize,
134:                        pointAntialiasing);
135:            }
136:
137:            /**
138:             * Initializes a mirror object, point the mirror object to the retained
139:             * object if the object is not editable
140:             */
141:            synchronized void initMirrorObject() {
142:                ((PointAttributesRetained) mirror).set(this );
143:            }
144:
145:            /**
146:             * Update the "component" field of the mirror object with the 
147:             * given "value"
148:             */
149:            synchronized void updateMirrorObject(int component, Object value) {
150:
151:                PointAttributesRetained mirrorPa = (PointAttributesRetained) mirror;
152:
153:                if ((component & POINT_SIZE_CHANGED) != 0) {
154:                    mirrorPa.pointSize = ((Float) value).floatValue();
155:                } else if ((component & POINT_AA_CHANGED) != 0) {
156:                    mirrorPa.pointAntialiasing = ((Boolean) value)
157:                            .booleanValue();
158:                }
159:            }
160:
161:            boolean equivalent(PointAttributesRetained pr) {
162:                return ((pr != null) && (pr.pointSize == pointSize) && (pr.pointAntialiasing == pointAntialiasing));
163:            }
164:
165:            protected void set(PointAttributesRetained pr) {
166:                super .set(pr);
167:                pointSize = pr.pointSize;
168:                pointAntialiasing = pr.pointAntialiasing;
169:            }
170:
171:            final void sendMessage(int attrMask, Object attr) {
172:                ArrayList univList = new ArrayList();
173:                ArrayList gaList = Shape3DRetained.getGeomAtomsList(
174:                        mirror.users, univList);
175:
176:                // Send to rendering attribute structure, regardless of
177:                // whether there are users or not (alternate appearance case ..)
178:                J3dMessage createMessage = new J3dMessage();
179:                createMessage.threads = J3dThread.UPDATE_RENDERING_ATTRIBUTES;
180:                createMessage.type = J3dMessage.POINTATTRIBUTES_CHANGED;
181:                createMessage.universe = null;
182:                createMessage.args[0] = this ;
183:                createMessage.args[1] = new Integer(attrMask);
184:                createMessage.args[2] = attr;
185:                createMessage.args[3] = new Integer(changedFrequent);
186:                VirtualUniverse.mc.processMessage(createMessage);
187:
188:                // System.err.println("univList.size is " + univList.size());
189:                for (int i = 0; i < univList.size(); i++) {
190:                    createMessage = new J3dMessage();
191:                    createMessage.threads = J3dThread.UPDATE_RENDER;
192:                    createMessage.type = J3dMessage.POINTATTRIBUTES_CHANGED;
193:
194:                    createMessage.universe = (VirtualUniverse) univList.get(i);
195:                    createMessage.args[0] = this ;
196:                    createMessage.args[1] = new Integer(attrMask);
197:                    createMessage.args[2] = attr;
198:
199:                    ArrayList gL = (ArrayList) gaList.get(i);
200:                    GeometryAtom[] gaArr = new GeometryAtom[gL.size()];
201:                    gL.toArray(gaArr);
202:                    createMessage.args[3] = gaArr;
203:
204:                    VirtualUniverse.mc.processMessage(createMessage);
205:                }
206:
207:            }
208:
209:            void handleFrequencyChange(int bit) {
210:                if (bit == PointAttributes.ALLOW_SIZE_WRITE
211:                        || bit == PointAttributes.ALLOW_ANTIALIASING_WRITE) {
212:                    setFrequencyChangeMask(bit, 0x1);
213:                }
214:            }
215:
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.