Source Code Cross Referenced for Texture2DRetained.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: Texture2DRetained.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.6 $
028:         * $Date: 2008/02/28 20:17:31 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        import java.util.*;
035:        import javax.vecmath.*;
036:
037:        /**
038:         * Texture2D is a subclass of Texture class. It extends Texture
039:         * class by adding a constructor and a mutator method for
040:         * setting a 2D texture image.
041:         */
042:        class Texture2DRetained extends TextureRetained {
043:
044:            // Note : There is hardly any HW vendor supports detail Image. 
045:            //        Detail Image operation is simply no-op in 1.5.
046:
047:            // currently detail image is only applicable to 2D texture
048:            // detail texture info
049:
050:            // These members are unused except for public set and get methods.
051:            private ImageComponent2DRetained detailImage = null;
052:            private int detailTextureMode = Texture2D.DETAIL_MODULATE;
053:            private int detailTextureLevel = 2;
054:            private int numDetailTextureFuncPts = 0;
055:            private float detailTextureFuncPts[] = null; // array of pairs of floats
056:
057:            // first value for LOD
058:            // second value for the fcn value
059:
060:            /**
061:             * Set detail texture image
062:             */
063:            final void initDetailImage(ImageComponent2D image) {
064:                if (image == null) {
065:                    detailImage = null;
066:                } else {
067:                    detailImage = (ImageComponent2DRetained) image.retained;
068:                }
069:            }
070:
071:            /**
072:             * Get detail texture image
073:             */
074:            final ImageComponent2D getDetailImage() {
075:                if (detailImage != null) {
076:                    return (ImageComponent2D) detailImage.source;
077:                } else {
078:                    return null;
079:                }
080:            }
081:
082:            /**
083:             * Set detail texture mode
084:             */
085:            final void initDetailTextureMode(int mode) {
086:                detailTextureMode = mode;
087:            }
088:
089:            /**
090:             * Get detail texture mode
091:             */
092:            final int getDetailTextureMode() {
093:                return detailTextureMode;
094:            }
095:
096:            /**
097:             * Set detail texture level
098:             */
099:            final void initDetailTextureLevel(int level) {
100:                detailTextureLevel = level;
101:            }
102:
103:            /**
104:             * Get detail texture level
105:             */
106:            final int getDetailTextureLevel() {
107:                return detailTextureLevel;
108:            }
109:
110:            /**
111:             * Set detail texture function
112:             */
113:            final void initDetailTextureFunc(float[] lod, float[] pts) {
114:                if (lod == null) { // pts will be null too.
115:                    detailTextureFuncPts = null;
116:                    numDetailTextureFuncPts = 0;
117:                } else {
118:                    numDetailTextureFuncPts = lod.length;
119:                    if ((detailTextureFuncPts == null)
120:                            || (detailTextureFuncPts.length != lod.length * 2)) {
121:                        detailTextureFuncPts = new float[lod.length * 2];
122:                    }
123:                    for (int i = 0, j = 0; i < lod.length; i++) {
124:                        detailTextureFuncPts[j++] = lod[i];
125:                        detailTextureFuncPts[j++] = pts[i];
126:                    }
127:                }
128:            }
129:
130:            final void initDetailTextureFunc(Point2f[] pts) {
131:                if (pts == null) {
132:                    detailTextureFuncPts = null;
133:                    numDetailTextureFuncPts = 0;
134:                } else {
135:                    numDetailTextureFuncPts = pts.length;
136:                    if ((detailTextureFuncPts == null)
137:                            || (detailTextureFuncPts.length != pts.length * 2)) {
138:                        detailTextureFuncPts = new float[pts.length * 2];
139:                    }
140:                    for (int i = 0, j = 0; i < pts.length; i++) {
141:                        detailTextureFuncPts[j++] = pts[i].x;
142:                        detailTextureFuncPts[j++] = pts[i].y;
143:                    }
144:                }
145:            }
146:
147:            final void initDetailTextureFunc(float[] pts) {
148:                if (pts == null) {
149:                    detailTextureFuncPts = null;
150:                    numDetailTextureFuncPts = 0;
151:                } else {
152:                    numDetailTextureFuncPts = pts.length / 2;
153:                    if ((detailTextureFuncPts == null)
154:                            || (detailTextureFuncPts.length != pts.length)) {
155:                        detailTextureFuncPts = new float[pts.length];
156:                    }
157:                    for (int i = 0; i < pts.length; i++) {
158:                        detailTextureFuncPts[i] = pts[i];
159:                    }
160:                }
161:            }
162:
163:            /**
164:             * Get number of points in the detail texture LOD function
165:             */
166:            final int getDetailTextureFuncPointsCount() {
167:                return numDetailTextureFuncPts;
168:            }
169:
170:            /**
171:             * Copies the array of detail texture LOD function points into the
172:             * specified arrays
173:             */
174:            final void getDetailTextureFunc(float[] lod, float[] pts) {
175:                if (detailTextureFuncPts != null) {
176:                    for (int i = 0, j = 0; i < numDetailTextureFuncPts; i++) {
177:                        lod[i] = detailTextureFuncPts[j++];
178:                        pts[i] = detailTextureFuncPts[j++];
179:                    }
180:                }
181:            }
182:
183:            final void getDetailTextureFunc(Point2f[] pts) {
184:                if (detailTextureFuncPts != null) {
185:                    for (int i = 0, j = 0; i < numDetailTextureFuncPts; i++) {
186:                        pts[i].x = detailTextureFuncPts[j++];
187:                        pts[i].y = detailTextureFuncPts[j++];
188:                    }
189:                }
190:            }
191:
192:            /**
193:             * internal method only -- returns the detail texture LOD function
194:             */
195:            final float[] getDetailTextureFunc() {
196:                return detailTextureFuncPts;
197:            }
198:
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.