Source Code Cross Referenced for Texture3DRetained.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: Texture3DRetained.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.9 $
028:         * $Date: 2008/02/28 20:17:31 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        import java.util.Enumeration;
035:        import java.util.BitSet;
036:
037:        /**
038:         * Texture3D is a subclass of Texture class. It extends Texture
039:         * class by adding a third co-ordinate, constructor and a mutator 
040:         * method for setting a 3D texture image. 
041:         */
042:
043:        class Texture3DRetained extends TextureRetained {
044:            // Boundary mode for R coordinate (wrap, clamp)
045:            int boundaryModeR = Texture.WRAP;
046:            int depth = 1; // Depth (num slices) of texture map (2**p)
047:
048:            final void setDepth(int depth) {
049:                this .depth = depth;
050:            }
051:
052:            final int getDepth() {
053:                return this .depth;
054:            }
055:
056:            /**
057:             * Sets the boundary mode for the R coordinate in this texture object.
058:             * @param boundaryModeR the boundary mode for the R coordinate,
059:             * one of: CLAMP or WRAP.
060:             * @exception RestrictedAccessException if the method is called
061:             * when this object is part of live or compiled scene graph.
062:             */
063:            final void initBoundaryModeR(int boundaryModeR) {
064:                this .boundaryModeR = boundaryModeR;
065:            }
066:
067:            /**
068:             * Retrieves the boundary mode for the R coordinate.
069:             * @return the current boundary mode for the R coordinate.
070:             * @exception RestrictedAccessException if the method is called
071:             * when this object is part of live or compiled scene graph.
072:             */
073:            final int getBoundaryModeR() {
074:                return boundaryModeR;
075:            }
076:
077:            /**
078:             * This method updates the native context. 
079:             */
080:            void bindTexture(Context ctx, int objectId, boolean enable) {
081:                Pipeline.getPipeline().bindTexture3D(ctx, objectId, enable);
082:            }
083:
084:            void updateTextureBoundary(Context ctx, int boundaryModeS,
085:                    int boundaryModeT, int boundaryModeR, float boundaryRed,
086:                    float boundaryGreen, float boundaryBlue, float boundaryAlpha) {
087:
088:                Pipeline.getPipeline()
089:                        .updateTexture3DBoundary(ctx, boundaryModeS,
090:                                boundaryModeT, boundaryModeR, boundaryRed,
091:                                boundaryGreen, boundaryBlue, boundaryAlpha);
092:            }
093:
094:            void updateTextureFilterModes(Context ctx, int minFilter,
095:                    int magFilter) {
096:
097:                Pipeline.getPipeline().updateTexture3DFilterModes(ctx,
098:                        minFilter, magFilter);
099:            }
100:
101:            void updateTextureSharpenFunc(Context ctx,
102:                    int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) {
103:
104:                Pipeline.getPipeline().updateTexture3DSharpenFunc(ctx,
105:                        numSharpenTextureFuncPts, sharpenTextureFuncPts);
106:            }
107:
108:            void updateTextureFilter4Func(Context ctx, int numFilter4FuncPts,
109:                    float[] filter4FuncPts) {
110:
111:                Pipeline.getPipeline().updateTexture3DFilter4Func(ctx,
112:                        numFilter4FuncPts, filter4FuncPts);
113:            }
114:
115:            void updateTextureAnisotropicFilter(Context ctx, float degree) {
116:                Pipeline.getPipeline().updateTexture3DAnisotropicFilter(ctx,
117:                        degree);
118:            }
119:
120:            // Wrapper around the native call for 3D textures
121:            void updateTextureImage(Canvas3D cv, int face, int numLevels,
122:                    int level, int textureFormat, int imageFormat, int width,
123:                    int height, int depth, int boundaryWidth,
124:                    int imageDataType, Object imageData) {
125:
126:                Pipeline.getPipeline().updateTexture3DImage(cv.ctx, numLevels,
127:                        level, textureFormat, imageFormat, width, height,
128:                        depth, boundaryWidth, imageDataType, imageData,
129:                        useAutoMipMapGeneration(cv));
130:            }
131:
132:            // Wrapper around the native call for 3D textures
133:            void updateTextureSubImage(Canvas3D cv, int face, int level,
134:                    int xoffset, int yoffset, int zoffset, int textureFormat,
135:                    int imageFormat, int imgXOffset, int imgYOffset,
136:                    int imgZOffset, int tilew, int tileh, int width,
137:                    int height, int depth, int imageDataType, Object imageData) {
138:
139:                Pipeline.getPipeline().updateTexture3DSubImage(cv.ctx, level,
140:                        xoffset, yoffset, zoffset, textureFormat, imageFormat,
141:                        imgXOffset, imgYOffset, imgZOffset, tilew, tileh,
142:                        width, height, depth, imageDataType, imageData,
143:                        useAutoMipMapGeneration(cv));
144:            }
145:
146:            // get an ID for Texture3D 
147:
148:            int getTextureId() {
149:                return (VirtualUniverse.mc.getTexture3DId());
150:            }
151:
152:            // get a Texture3D Id
153:
154:            void freeTextureId(int id) {
155:                synchronized (resourceLock) {
156:                    if (objectId == id) {
157:                        objectId = -1;
158:                        VirtualUniverse.mc.freeTexture3DId(id);
159:                    }
160:                }
161:            }
162:
163:            // load level 0 image with null data pointer, just to enable
164:            // mipmapping when level 0 is not the base level
165:
166:            void updateTextureDimensions(Canvas3D cv) {
167:                if (images[0][0] != null) {
168:                    updateTextureImage(cv, maxLevels, 0, 0, format,
169:                            images[0][0].getImageFormatTypeIntValue(false),
170:                            width, height, depth, boundaryWidth, images[0][0]
171:                                    .getImageDataTypeIntValue(), null);
172:                }
173:            }
174:
175:            void updateTextureBoundary(Canvas3D cv) {
176:                updateTextureBoundary(cv.ctx, boundaryModeS, boundaryModeT,
177:                        boundaryModeR, boundaryColor.x, boundaryColor.y,
178:                        boundaryColor.z, boundaryColor.w);
179:            }
180:
181:            void updateTextureLodRange(Context ctx, int baseLevel,
182:                    int maximumLevel, float minimumLod, float maximumLod) {
183:
184:                Pipeline.getPipeline().updateTexture3DLodRange(ctx, baseLevel,
185:                        maximumLevel, minimumLod, maximumLod);
186:            }
187:
188:            void updateTextureLodOffset(Context ctx, float lodOffsetX,
189:                    float lodOffsetY, float lodOffsetZ) {
190:
191:                Pipeline.getPipeline().updateTexture3DLodOffset(ctx,
192:                        lodOffsetX, lodOffsetY, lodOffsetZ);
193:            }
194:
195:            void reloadTextureImage(Canvas3D cv, int face, int level,
196:                    ImageComponentRetained image, int numLevels) {
197:
198:                /*
199:                 System.err.println("Texture3D.reloadTextureImage: level= " + level +
200:                 " image.imageYup= " + image.imageYup + " w= " + image.width + 
201:                 " h= " + image.height + " d= " + depth + 
202:                 " numLevels= " + numLevels);
203:                 */
204:
205:                // Texture3D does not need to support Raster
206:                ImageComponentRetained.ImageData imageData = image
207:                        .getImageData(false);
208:
209:                updateTextureImage(cv, 0, numLevels, level, format, image
210:                        .getImageFormatTypeIntValue(false), image.width,
211:                        image.height, depth, boundaryWidth, image
212:                                .getImageDataTypeIntValue(), imageData.get());
213:            }
214:
215:            void reloadTextureSubImage(Canvas3D cv, int level, int face,
216:                    ImageComponentUpdateInfo info, ImageComponentRetained image) {
217:                int x = info.x, y = info.y, z = info.z, width = info.width, height = info.height;
218:
219:                int xoffset = x;
220:                int yoffset = y;
221:                // Texture3D does not need to support Raster        
222:                ImageComponentRetained.ImageData imageData = image
223:                        .getImageData(false);
224:
225:                updateTextureSubImage(cv, 0, level, xoffset, yoffset, z,
226:                        format, image.getImageFormatTypeIntValue(false),
227:                        xoffset, yoffset, z, image.width, image.height, width,
228:                        height, 1, image.getImageDataTypeIntValue(), imageData
229:                                .get());
230:            }
231:
232:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.