Source Code Cross Referenced for ShaderAttributeArrayRetained.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: ShaderAttributeArrayRetained.java,v $
0003:         *
0004:         * Copyright 2005-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.8 $
0028:         * $Date: 2008/02/28 20:17:29 $
0029:         * $State: Exp $
0030:         */
0031:
0032:        package javax.media.j3d;
0033:
0034:        import javax.vecmath.*;
0035:
0036:        /**
0037:         * The ShaderAttributeArray object encapsulates a uniform shader
0038:         * attribute whose value is specified explicitly.
0039:         */
0040:
0041:        class ShaderAttributeArrayRetained extends
0042:                ShaderAttributeObjectRetained {
0043:
0044:            ShaderAttributeArrayRetained() {
0045:            }
0046:
0047:            void initValue(int index, Object value) {
0048:                /*
0049:                System.err.println("ShaderAttributeObjectRetained : attrName = " + attrName +
0050:                		   ", index = " + index + ", value = " + value +
0051:                		   ", value.class = " + value.getClass());
0052:                 */
0053:                ((ArrayWrapper) attrWrapper).set(index, value);
0054:
0055:            }
0056:
0057:            /**
0058:             * Sets the specified array element of the value of this shader
0059:             * attribute to the specified value.
0060:             * A copy of the object is stored.
0061:             *
0062:             * @param value the new value of the shader attribute
0063:             *
0064:             * @exception NullPointerException if value is null
0065:             *
0066:             * @exception ClassCastException if value is not an instance of
0067:             * the same base class as the individual elements of the array object
0068:             * used to construct this shader attribute object.
0069:             *
0070:             * @exception CapabilityNotSetException if appropriate capability is 
0071:             * not set and this object is part of live or compiled scene graph
0072:             */
0073:            void setValue(int index, Object value) {
0074:                initValue(index, value);
0075:                // We should only need to update the array instead of replacing it.
0076:                // Until this become a really bottleneck, it will just be a convenience 
0077:                // method for end user. 
0078:                // An efficient approach is to 
0079:                // (1) Create a new ShaderAttributeValue object for the "value" object 
0080:                // and pass it to sendMessage(), (2) Create a new sendMessage that take in
0081:                // a third arguement, ie. index.
0082:                setValue(attrWrapper.getRef());
0083:            }
0084:
0085:            /**
0086:             * Returns the number of elements in the value array.
0087:             *
0088:             * @return the number of elements in the value array
0089:             *
0090:             * @exception CapabilityNotSetException if appropriate capability is 
0091:             * not set and this object is part of live or compiled scene graph
0092:             */
0093:            int length() {
0094:                return ((ArrayWrapper) attrWrapper).length();
0095:
0096:            }
0097:
0098:            // Helper methods ...
0099:
0100:            synchronized void createMirrorObject() {
0101:                // System.err.println("ShaderAttributeArrayRetained : createMirrorObject");
0102:                // This method should only call by setLive().
0103:                if (mirror == null) {
0104:                    ShaderAttributeArrayRetained mirrorSAA = new ShaderAttributeArrayRetained();
0105:                    mirrorSAA.createObjectData(getValue());
0106:                    mirror = mirrorSAA;
0107:                    mirror.source = source;
0108:
0109:                }
0110:                initMirrorObject();
0111:            }
0112:
0113:            /**
0114:             * Computes the base class from the specified object. A
0115:             * ClassCastException is thrown if the object is not an array of
0116:             * one of the allowed classes.
0117:             */
0118:            int computeClassType(Object value) {
0119:                Class objClass = value.getClass();
0120:                if (!objClass.isArray()) {
0121:                    throw new ClassCastException(objClass
0122:                            + " -- must be array class");
0123:                }
0124:
0125:                for (int i = 0; i < classTable.length; i++) {
0126:                    if (classTableArr[i].isInstance(value)) {
0127:                        return i;
0128:                    }
0129:                }
0130:                throw new ClassCastException(objClass
0131:                        + " -- unrecognized class");
0132:            }
0133:
0134:            /**
0135:             * Returns the base class represented by the specified class type.
0136:             */
0137:            Class getBaseClass(int classType) {
0138:                return classTableArr[classType];
0139:            }
0140:
0141:            /**
0142:             * Creates an attribute wrapper object of the specified class
0143:             * type, and stores the specified array of objects.
0144:             */
0145:            AttrWrapper createAttrWrapper(Object value, int classType) {
0146:                ArrayWrapper attrWrapper = null;
0147:                switch (classType) {
0148:                case TYPE_INTEGER:
0149:                    attrWrapper = new IntegerArrayWrapper();
0150:                    break;
0151:                case TYPE_FLOAT:
0152:                    attrWrapper = new FloatArrayWrapper();
0153:                    break;
0154:                //	case TYPE_DOUBLE:
0155:                //	    attrWrapper = new DoubleArrayWrapper();
0156:                //	    break;
0157:                case TYPE_TUPLE2I:
0158:                    attrWrapper = new Tuple2iArrayWrapper();
0159:                    break;
0160:                case TYPE_TUPLE2F:
0161:                    attrWrapper = new Tuple2fArrayWrapper();
0162:                    break;
0163:                //	case TYPE_TUPLE2D:
0164:                //	    attrWrapper = new Tuple2dArrayWrapper();
0165:                //	    break;
0166:                case TYPE_TUPLE3I:
0167:                    attrWrapper = new Tuple3iArrayWrapper();
0168:                    break;
0169:                case TYPE_TUPLE3F:
0170:                    attrWrapper = new Tuple3fArrayWrapper();
0171:                    break;
0172:                //	case TYPE_TUPLE3D:
0173:                //	    attrWrapper = new Tuple3dArrayWrapper();
0174:                //	    break;
0175:                case TYPE_TUPLE4I:
0176:                    attrWrapper = new Tuple4iArrayWrapper();
0177:                    break;
0178:                case TYPE_TUPLE4F:
0179:                    attrWrapper = new Tuple4fArrayWrapper();
0180:                    break;
0181:                //	case TYPE_TUPLE4D:
0182:                //	    attrWrapper = new Tuple4dArrayWrapper();
0183:                //	    break;
0184:                case TYPE_MATRIX3F:
0185:                    attrWrapper = new Matrix3fArrayWrapper();
0186:                    break;
0187:                //	case TYPE_MATRIX3D:
0188:                //	    attrWrapper = new Matrix3dArrayWrapper();
0189:                //	    break;
0190:                case TYPE_MATRIX4F:
0191:                    attrWrapper = new Matrix4fArrayWrapper();
0192:                    break;
0193:                //	case TYPE_MATRIX4D:
0194:                //	    attrWrapper = new Matrix4dArrayWrapper();
0195:                //	    break;
0196:                default:
0197:                    // Should never get here
0198:                    assert false;
0199:                    return null;
0200:                }
0201:
0202:                attrWrapper.set(value);
0203:                return attrWrapper;
0204:            }
0205:
0206:            //
0207:            // The following wrapper classes are used to store a copy of the
0208:            // user-specified shader attribute value. There is a wrapper class
0209:            // for each supported base class.
0210:            //
0211:
0212:            // Base wrapper class for array attribute types
0213:            static abstract class ArrayWrapper extends AttrWrapper {
0214:                int length = 0;
0215:
0216:                /**
0217:                 * Returns the length of the array
0218:                 */
0219:                int length() {
0220:                    return length;
0221:                }
0222:
0223:                /**
0224:                 * Sets the specified array element of the value of this
0225:                 * shader attribute to the specified value.
0226:                 */
0227:                abstract void set(int index, Object value);
0228:            }
0229:
0230:            // Wrapper class for Integer
0231:            static class IntegerArrayWrapper extends ArrayWrapper {
0232:                private int[] value = new int[0];
0233:
0234:                void set(Object value) {
0235:                    Integer[] arr = (Integer[]) value;
0236:                    if (this .length != arr.length) {
0237:                        this .length = arr.length;
0238:                        this .value = new int[this .length];
0239:                    }
0240:                    for (int i = 0; i < this .length; i++) {
0241:                        this .value[i] = arr[i].intValue();
0242:                    }
0243:                }
0244:
0245:                void set(int index, Object value) {
0246:                    this .value[index] = ((Integer) value).intValue();
0247:                }
0248:
0249:                Object get() {
0250:                    Integer[] arr = new Integer[this .length];
0251:                    for (int i = 0; i < this .length; i++) {
0252:                        arr[i] = new Integer(this .value[i]);
0253:                    }
0254:                    return arr;
0255:                }
0256:
0257:                Object getRef() {
0258:                    return this .value;
0259:                }
0260:            }
0261:
0262:            // Wrapper class for Float
0263:            static class FloatArrayWrapper extends ArrayWrapper {
0264:                private float[] value = new float[0];
0265:
0266:                void set(Object value) {
0267:                    Float[] arr = (Float[]) value;
0268:                    if (this .length != arr.length) {
0269:                        this .length = arr.length;
0270:                        this .value = new float[this .length];
0271:                    }
0272:                    for (int i = 0; i < this .length; i++) {
0273:                        this .value[i] = arr[i].floatValue();
0274:                    }
0275:                }
0276:
0277:                void set(int index, Object value) {
0278:                    this .value[index] = ((Float) value).floatValue();
0279:                }
0280:
0281:                Object get() {
0282:                    Float[] arr = new Float[this .length];
0283:                    for (int i = 0; i < this .length; i++) {
0284:                        arr[i] = new Float(this .value[i]);
0285:                    }
0286:                    return arr;
0287:                }
0288:
0289:                Object getRef() {
0290:                    return this .value;
0291:                }
0292:            }
0293:
0294:            /*
0295:            // Wrapper class for Double
0296:            static class DoubleArrayWrapper extends ArrayWrapper {
0297:            private double[] value = new double[0];
0298:
0299:            void set(Object value) {
0300:                Double[] arr = (Double[])value;
0301:                if (this.length != arr.length) {
0302:            	this.length = arr.length;
0303:            	this.value = new double[this.length];
0304:                }
0305:                for (int i = 0; i < this.length; i++) {
0306:            	this.value[i] = arr[i].doubleValue();
0307:                }
0308:            }
0309:
0310:            void set(int index, Object value) {
0311:                this.value[index] = ((Double)value).doubleValue();
0312:            }
0313:
0314:            Object get() {
0315:                Double[] arr = new Double[this.length];
0316:                for (int i = 0; i < this.length; i++) {
0317:            	arr[i] = new Double(this.value[i]);
0318:                }
0319:                return arr;
0320:            }
0321:
0322:            Object getRef() {
0323:                return this.value;
0324:            }
0325:            }
0326:             */
0327:
0328:            // Wrapper class for Tuple2i
0329:            static class Tuple2iArrayWrapper extends ArrayWrapper {
0330:                private int[] value = new int[0];
0331:
0332:                void set(Object value) {
0333:                    Tuple2i[] arr = (Tuple2i[]) value;
0334:                    if (this .length != arr.length) {
0335:                        this .length = arr.length;
0336:                        this .value = new int[this .length * 2];
0337:                    }
0338:                    for (int i = 0; i < this .length; i++) {
0339:                        int j = i * 2;
0340:                        this .value[j + 0] = arr[i].x;
0341:                        this .value[j + 1] = arr[i].y;
0342:                    }
0343:                }
0344:
0345:                void set(int index, Object value) {
0346:                    int j = index * 2;
0347:                    this .value[j + 0] = ((Tuple2i) value).x;
0348:                    this .value[j + 1] = ((Tuple2i) value).y;
0349:                }
0350:
0351:                Object get() {
0352:                    Tuple2i[] arr = new Tuple2i[this .length];
0353:                    for (int i = 0; i < this .length; i++) {
0354:                        int j = i * 2;
0355:                        arr[i] = new Point2i();
0356:                        arr[i].x = this .value[j + 0];
0357:                        arr[i].y = this .value[j + 1];
0358:                    }
0359:                    return arr;
0360:                }
0361:
0362:                Object getRef() {
0363:                    return this .value;
0364:                }
0365:            }
0366:
0367:            // Wrapper class for Tuple2f
0368:            static class Tuple2fArrayWrapper extends ArrayWrapper {
0369:                private float[] value = new float[0];
0370:
0371:                void set(Object value) {
0372:                    Tuple2f[] arr = (Tuple2f[]) value;
0373:                    if (this .length != arr.length) {
0374:                        this .length = arr.length;
0375:                        this .value = new float[this .length * 2];
0376:                    }
0377:                    for (int i = 0; i < this .length; i++) {
0378:                        int j = i * 2;
0379:                        this .value[j + 0] = arr[i].x;
0380:                        this .value[j + 1] = arr[i].y;
0381:                    }
0382:                }
0383:
0384:                void set(int index, Object value) {
0385:                    int j = index * 2;
0386:                    this .value[j + 0] = ((Tuple2f) value).x;
0387:                    this .value[j + 1] = ((Tuple2f) value).y;
0388:                }
0389:
0390:                Object get() {
0391:                    Tuple2f[] arr = new Tuple2f[this .length];
0392:                    for (int i = 0; i < this .length; i++) {
0393:                        int j = i * 2;
0394:                        arr[i] = new Point2f();
0395:                        arr[i].x = this .value[j + 0];
0396:                        arr[i].y = this .value[j + 1];
0397:                    }
0398:                    return arr;
0399:                }
0400:
0401:                Object getRef() {
0402:                    return this .value;
0403:                }
0404:            }
0405:
0406:            /*
0407:            // Wrapper class for Tuple2d
0408:            static class Tuple2dArrayWrapper extends ArrayWrapper {
0409:            private double[] value = new double[0];
0410:
0411:            void set(Object value) {
0412:                Tuple2d[] arr = (Tuple2d[])value;
0413:                if (this.length != arr.length) {
0414:            	this.length = arr.length;
0415:            	this.value = new double[this.length*2];
0416:                }
0417:                for (int i = 0; i < this.length; i++) {
0418:            	int j = i * 2;
0419:            	this.value[j+0] = arr[i].x;
0420:            	this.value[j+1] = arr[i].y;
0421:                }
0422:            }
0423:
0424:            void set(int index, Object value) {
0425:                int j = index * 2;
0426:                this.value[j+0] = ((Tuple2d)value).x;
0427:                this.value[j+1] = ((Tuple2d)value).y;
0428:            }
0429:
0430:            Object get() {
0431:                Tuple2d[] arr = new Tuple2d[this.length];
0432:                for (int i = 0; i < this.length; i++) {
0433:            	int j = i * 2;
0434:                        arr[i] = new Point2d();
0435:            	arr[i].x = this.value[j+0];
0436:            	arr[i].y = this.value[j+1];
0437:                }
0438:                return arr;
0439:            }
0440:
0441:            Object getRef() {
0442:                return this.value;
0443:            }
0444:            }
0445:             */
0446:
0447:            // Wrapper class for Tuple3i
0448:            static class Tuple3iArrayWrapper extends ArrayWrapper {
0449:                private int[] value = new int[0];
0450:
0451:                void set(Object value) {
0452:                    Tuple3i[] arr = (Tuple3i[]) value;
0453:                    if (this .length != arr.length) {
0454:                        this .length = arr.length;
0455:                        this .value = new int[this .length * 3];
0456:                    }
0457:                    for (int i = 0; i < this .length; i++) {
0458:                        int j = i * 3;
0459:                        this .value[j + 0] = arr[i].x;
0460:                        this .value[j + 1] = arr[i].y;
0461:                        this .value[j + 2] = arr[i].z;
0462:                    }
0463:                }
0464:
0465:                void set(int index, Object value) {
0466:                    int j = index * 3;
0467:                    this .value[j + 0] = ((Tuple3i) value).x;
0468:                    this .value[j + 1] = ((Tuple3i) value).y;
0469:                    this .value[j + 2] = ((Tuple3i) value).z;
0470:                }
0471:
0472:                Object get() {
0473:                    Tuple3i[] arr = new Tuple3i[this .length];
0474:                    for (int i = 0; i < this .length; i++) {
0475:                        int j = i * 3;
0476:                        arr[i] = new Point3i();
0477:                        arr[i].x = this .value[j + 0];
0478:                        arr[i].y = this .value[j + 1];
0479:                        arr[i].z = this .value[j + 2];
0480:                    }
0481:                    return arr;
0482:                }
0483:
0484:                Object getRef() {
0485:                    return this .value;
0486:                }
0487:            }
0488:
0489:            // Wrapper class for Tuple3f
0490:            static class Tuple3fArrayWrapper extends ArrayWrapper {
0491:                private float[] value = new float[0];
0492:
0493:                void set(Object value) {
0494:                    Tuple3f[] arr = (Tuple3f[]) value;
0495:                    if (this .length != arr.length) {
0496:                        this .length = arr.length;
0497:                        this .value = new float[this .length * 3];
0498:                    }
0499:                    for (int i = 0; i < this .length; i++) {
0500:                        int j = i * 3;
0501:                        this .value[j + 0] = arr[i].x;
0502:                        this .value[j + 1] = arr[i].y;
0503:                        this .value[j + 2] = arr[i].z;
0504:                    }
0505:                }
0506:
0507:                void set(int index, Object value) {
0508:                    int j = index * 3;
0509:                    this .value[j + 0] = ((Tuple3f) value).x;
0510:                    this .value[j + 1] = ((Tuple3f) value).y;
0511:                    this .value[j + 2] = ((Tuple3f) value).z;
0512:                }
0513:
0514:                Object get() {
0515:                    Tuple3f[] arr = new Tuple3f[this .length];
0516:                    for (int i = 0; i < this .length; i++) {
0517:                        int j = i * 3;
0518:                        arr[i] = new Point3f();
0519:                        arr[i].x = this .value[j + 0];
0520:                        arr[i].y = this .value[j + 1];
0521:                        arr[i].z = this .value[j + 2];
0522:                    }
0523:                    return arr;
0524:                }
0525:
0526:                Object getRef() {
0527:                    return this .value;
0528:                }
0529:            }
0530:
0531:            /*
0532:            // Wrapper class for Tuple3d
0533:            static class Tuple3dArrayWrapper extends ArrayWrapper {
0534:            private double[] value = new double[0];
0535:
0536:            void set(Object value) {
0537:                Tuple3d[] arr = (Tuple3d[])value;
0538:                if (this.length != arr.length) {
0539:            	this.length = arr.length;
0540:            	this.value = new double[this.length*3];
0541:                }
0542:                for (int i = 0; i < this.length; i++) {
0543:            	int j = i * 3;
0544:            	this.value[j+0] = arr[i].x;
0545:            	this.value[j+1] = arr[i].y;
0546:            	this.value[j+2] = arr[i].z;
0547:                }
0548:            }
0549:
0550:            void set(int index, Object value) {
0551:                int j = index * 3;
0552:                this.value[j+0] = ((Tuple3d)value).x;
0553:                this.value[j+1] = ((Tuple3d)value).y;
0554:                this.value[j+2] = ((Tuple3d)value).z;
0555:            }
0556:
0557:            Object get() {
0558:                Tuple3d[] arr = new Tuple3d[this.length];
0559:                for (int i = 0; i < this.length; i++) {
0560:            	int j = i * 3;
0561:                        arr[i] = new Point3d();
0562:            	arr[i].x = this.value[j+0];
0563:            	arr[i].y = this.value[j+1];
0564:            	arr[i].z = this.value[j+2];
0565:                }
0566:                return arr;
0567:            }
0568:
0569:            Object getRef() {
0570:                return this.value;
0571:            }
0572:            }
0573:             */
0574:
0575:            // Wrapper class for Tuple4i
0576:            static class Tuple4iArrayWrapper extends ArrayWrapper {
0577:                private int[] value = new int[0];
0578:
0579:                void set(Object value) {
0580:                    Tuple4i[] arr = (Tuple4i[]) value;
0581:                    if (this .length != arr.length) {
0582:                        this .length = arr.length;
0583:                        this .value = new int[this .length * 4];
0584:                    }
0585:                    for (int i = 0; i < this .length; i++) {
0586:                        int j = i * 4;
0587:                        this .value[j + 0] = arr[i].x;
0588:                        this .value[j + 1] = arr[i].y;
0589:                        this .value[j + 2] = arr[i].z;
0590:                        this .value[j + 3] = arr[i].w;
0591:                    }
0592:                }
0593:
0594:                void set(int index, Object value) {
0595:                    int j = index * 4;
0596:                    this .value[j + 0] = ((Tuple4i) value).x;
0597:                    this .value[j + 1] = ((Tuple4i) value).y;
0598:                    this .value[j + 2] = ((Tuple4i) value).z;
0599:                    this .value[j + 3] = ((Tuple4i) value).w;
0600:                }
0601:
0602:                Object get() {
0603:                    Tuple4i[] arr = new Tuple4i[this .length];
0604:                    for (int i = 0; i < this .length; i++) {
0605:                        int j = i * 4;
0606:                        arr[i] = new Point4i();
0607:                        arr[i].x = this .value[j + 0];
0608:                        arr[i].y = this .value[j + 1];
0609:                        arr[i].z = this .value[j + 2];
0610:                        arr[i].w = this .value[j + 3];
0611:                    }
0612:                    return arr;
0613:                }
0614:
0615:                Object getRef() {
0616:                    return this .value;
0617:                }
0618:            }
0619:
0620:            // Wrapper class for Tuple4f
0621:            static class Tuple4fArrayWrapper extends ArrayWrapper {
0622:                private float[] value = new float[0];
0623:
0624:                void set(Object value) {
0625:                    Tuple4f[] arr = (Tuple4f[]) value;
0626:                    if (this .length != arr.length) {
0627:                        this .length = arr.length;
0628:                        this .value = new float[this .length * 4];
0629:                    }
0630:                    for (int i = 0; i < this .length; i++) {
0631:                        int j = i * 4;
0632:                        this .value[j + 0] = arr[i].x;
0633:                        this .value[j + 1] = arr[i].y;
0634:                        this .value[j + 2] = arr[i].z;
0635:                        this .value[j + 3] = arr[i].w;
0636:                    }
0637:                }
0638:
0639:                void set(int index, Object value) {
0640:                    int j = index * 4;
0641:                    this .value[j + 0] = ((Tuple4f) value).x;
0642:                    this .value[j + 1] = ((Tuple4f) value).y;
0643:                    this .value[j + 2] = ((Tuple4f) value).z;
0644:                    this .value[j + 3] = ((Tuple4f) value).w;
0645:                }
0646:
0647:                Object get() {
0648:                    Tuple4f[] arr = new Tuple4f[this .length];
0649:                    for (int i = 0; i < this .length; i++) {
0650:                        int j = i * 4;
0651:                        arr[i] = new Point4f();
0652:                        arr[i].x = this .value[j + 0];
0653:                        arr[i].y = this .value[j + 1];
0654:                        arr[i].z = this .value[j + 2];
0655:                        arr[i].w = this .value[j + 3];
0656:                    }
0657:                    return arr;
0658:                }
0659:
0660:                Object getRef() {
0661:                    return this .value;
0662:                }
0663:            }
0664:
0665:            /*
0666:            // Wrapper class for Tuple4d
0667:            static class Tuple4dArrayWrapper extends ArrayWrapper {
0668:            private double[] value = new double[0];
0669:
0670:            void set(Object value) {
0671:                Tuple4d[] arr = (Tuple4d[])value;
0672:                if (this.length != arr.length) {
0673:            	this.length = arr.length;
0674:            	this.value = new double[this.length*4];
0675:                }
0676:                for (int i = 0; i < this.length; i++) {
0677:            	int j = i * 4;
0678:            	this.value[j+0] = arr[i].x;
0679:            	this.value[j+1] = arr[i].y;
0680:            	this.value[j+2] = arr[i].z;
0681:            	this.value[j+3] = arr[i].w;
0682:                }
0683:            }
0684:
0685:            void set(int index, Object value) {
0686:                int j = index * 4;
0687:                this.value[j+0] = ((Tuple4d)value).x;
0688:                this.value[j+1] = ((Tuple4d)value).y;
0689:                this.value[j+2] = ((Tuple4d)value).z;
0690:                this.value[j+3] = ((Tuple4d)value).w;
0691:            }
0692:
0693:            Object get() {
0694:                Tuple4d[] arr = new Tuple4d[this.length];
0695:                for (int i = 0; i < this.length; i++) {
0696:            	int j = i * 4;
0697:                        arr[i] = new Point4d();
0698:            	arr[i].x = this.value[j+0];
0699:            	arr[i].y = this.value[j+1];
0700:            	arr[i].z = this.value[j+2];
0701:            	arr[i].w = this.value[j+3];
0702:                }
0703:                return arr;
0704:            }
0705:
0706:            Object getRef() {
0707:                return this.value;
0708:            }
0709:            }
0710:             */
0711:
0712:            // Wrapper class for Matrix3f
0713:            static class Matrix3fArrayWrapper extends ArrayWrapper {
0714:                private float[] value = new float[0];
0715:
0716:                void set(Object value) {
0717:                    Matrix3f[] arr = (Matrix3f[]) value;
0718:                    if (this .length != arr.length) {
0719:                        this .length = arr.length;
0720:                        this .value = new float[this .length * 9];
0721:                    }
0722:                    for (int i = 0; i < this .length; i++) {
0723:                        int j = i * 9;
0724:                        this .value[j + 0] = arr[i].m00;
0725:                        this .value[j + 1] = arr[i].m01;
0726:                        this .value[j + 2] = arr[i].m02;
0727:                        this .value[j + 3] = arr[i].m10;
0728:                        this .value[j + 4] = arr[i].m11;
0729:                        this .value[j + 5] = arr[i].m12;
0730:                        this .value[j + 6] = arr[i].m20;
0731:                        this .value[j + 7] = arr[i].m21;
0732:                        this .value[j + 8] = arr[i].m22;
0733:                    }
0734:                }
0735:
0736:                void set(int index, Object value) {
0737:                    int j = index * 9;
0738:                    Matrix3f m = (Matrix3f) value;
0739:
0740:                    this .value[j + 0] = m.m00;
0741:                    this .value[j + 1] = m.m01;
0742:                    this .value[j + 2] = m.m02;
0743:                    this .value[j + 3] = m.m10;
0744:                    this .value[j + 4] = m.m11;
0745:                    this .value[j + 5] = m.m12;
0746:                    this .value[j + 6] = m.m20;
0747:                    this .value[j + 7] = m.m21;
0748:                    this .value[j + 8] = m.m22;
0749:                }
0750:
0751:                Object get() {
0752:                    Matrix3f[] arr = new Matrix3f[this .length];
0753:                    for (int i = 0; i < this .length; i++) {
0754:                        int j = i * 9;
0755:                        arr[i] = new Matrix3f();
0756:                        arr[i].m00 = this .value[j + 0];
0757:                        arr[i].m01 = this .value[j + 1];
0758:                        arr[i].m02 = this .value[j + 2];
0759:                        arr[i].m10 = this .value[j + 3];
0760:                        arr[i].m11 = this .value[j + 4];
0761:                        arr[i].m12 = this .value[j + 5];
0762:                        arr[i].m20 = this .value[j + 6];
0763:                        arr[i].m21 = this .value[j + 7];
0764:                        arr[i].m22 = this .value[j + 8];
0765:                    }
0766:                    return arr;
0767:                }
0768:
0769:                Object getRef() {
0770:                    return this .value;
0771:                }
0772:            }
0773:
0774:            /*
0775:            // Wrapper class for Matrix3d
0776:            static class Matrix3dArrayWrapper extends ArrayWrapper {
0777:            private double[] value = new double[0];
0778:
0779:            void set(Object value) {
0780:                Matrix3d[] arr = (Matrix3d[])value;
0781:                if (this.length != arr.length) {
0782:            	this.length = arr.length;
0783:            	this.value = new double[this.length * 9];
0784:                }
0785:                for (int i = 0; i < this.length; i++) {
0786:            	int j = i * 9;
0787:            	this.value[j+0] = arr[i].m00;
0788:            	this.value[j+1] = arr[i].m01;
0789:            	this.value[j+2] = arr[i].m02;
0790:            	this.value[j+3] = arr[i].m10;
0791:            	this.value[j+4] = arr[i].m11;
0792:            	this.value[j+5] = arr[i].m12;
0793:            	this.value[j+6] = arr[i].m20;
0794:            	this.value[j+7] = arr[i].m21;
0795:            	this.value[j+8] = arr[i].m22;
0796:                }
0797:            }
0798:
0799:            void set(int index, Object value) {
0800:                int j = index * 9;
0801:                Matrix3d m = (Matrix3d)value;
0802:
0803:                this.value[j+0] = m.m00;
0804:                this.value[j+1] = m.m01;
0805:                this.value[j+2] = m.m02;
0806:                this.value[j+3] = m.m10;
0807:                this.value[j+4] = m.m11;
0808:                this.value[j+5] = m.m12;
0809:                this.value[j+6] = m.m20;
0810:                this.value[j+7] = m.m21;
0811:                this.value[j+8] = m.m22;
0812:            }
0813:
0814:            Object get() {
0815:                Matrix3d[] arr = new Matrix3d[this.length];
0816:                for (int i = 0; i < this.length; i++) {
0817:            	int j = i * 9;
0818:                        arr[i] = new Matrix3d();
0819:            	arr[i].m00 = this.value[j+0];
0820:            	arr[i].m01 = this.value[j+1];
0821:            	arr[i].m02 = this.value[j+2];
0822:            	arr[i].m10 = this.value[j+3];
0823:            	arr[i].m11 = this.value[j+4];
0824:            	arr[i].m12 = this.value[j+5];
0825:            	arr[i].m20 = this.value[j+6];
0826:            	arr[i].m21 = this.value[j+7];
0827:            	arr[i].m22 = this.value[j+8];
0828:                }
0829:                return arr;
0830:            }
0831:
0832:            Object getRef() {
0833:                return this.value;
0834:            }
0835:            }
0836:             */
0837:
0838:            // Wrapper class for Matrix4f
0839:            static class Matrix4fArrayWrapper extends ArrayWrapper {
0840:                private float[] value = new float[0];
0841:
0842:                void set(Object value) {
0843:                    Matrix4f[] arr = (Matrix4f[]) value;
0844:                    if (this .length != arr.length) {
0845:                        this .length = arr.length;
0846:                        this .value = new float[this .length * 16];
0847:                    }
0848:                    for (int i = 0; i < this .length; i++) {
0849:                        int j = i * 16;
0850:                        this .value[j + 0] = arr[i].m00;
0851:                        this .value[j + 1] = arr[i].m01;
0852:                        this .value[j + 2] = arr[i].m02;
0853:                        this .value[j + 3] = arr[i].m03;
0854:                        this .value[j + 4] = arr[i].m10;
0855:                        this .value[j + 5] = arr[i].m11;
0856:                        this .value[j + 6] = arr[i].m12;
0857:                        this .value[j + 7] = arr[i].m13;
0858:                        this .value[j + 8] = arr[i].m20;
0859:                        this .value[j + 9] = arr[i].m21;
0860:                        this .value[j + 10] = arr[i].m22;
0861:                        this .value[j + 11] = arr[i].m23;
0862:                        this .value[j + 12] = arr[i].m30;
0863:                        this .value[j + 13] = arr[i].m31;
0864:                        this .value[j + 14] = arr[i].m32;
0865:                        this .value[j + 15] = arr[i].m33;
0866:                    }
0867:                }
0868:
0869:                void set(int index, Object value) {
0870:                    int j = index * 16;
0871:                    Matrix4f m = (Matrix4f) value;
0872:
0873:                    this .value[j + 0] = m.m00;
0874:                    this .value[j + 1] = m.m01;
0875:                    this .value[j + 2] = m.m02;
0876:                    this .value[j + 3] = m.m03;
0877:                    this .value[j + 4] = m.m10;
0878:                    this .value[j + 5] = m.m11;
0879:                    this .value[j + 6] = m.m12;
0880:                    this .value[j + 7] = m.m13;
0881:                    this .value[j + 8] = m.m20;
0882:                    this .value[j + 9] = m.m21;
0883:                    this .value[j + 10] = m.m22;
0884:                    this .value[j + 11] = m.m23;
0885:                    this .value[j + 12] = m.m30;
0886:                    this .value[j + 13] = m.m31;
0887:                    this .value[j + 14] = m.m32;
0888:                    this .value[j + 15] = m.m33;
0889:                }
0890:
0891:                Object get() {
0892:                    Matrix4f[] arr = new Matrix4f[this .length];
0893:                    for (int i = 0; i < this .length; i++) {
0894:                        int j = i * 16;
0895:                        arr[i] = new Matrix4f();
0896:                        arr[i].m00 = this .value[j + 0];
0897:                        arr[i].m01 = this .value[j + 1];
0898:                        arr[i].m02 = this .value[j + 2];
0899:                        arr[i].m03 = this .value[j + 3];
0900:                        arr[i].m10 = this .value[j + 4];
0901:                        arr[i].m11 = this .value[j + 5];
0902:                        arr[i].m12 = this .value[j + 6];
0903:                        arr[i].m13 = this .value[j + 7];
0904:                        arr[i].m20 = this .value[j + 8];
0905:                        arr[i].m21 = this .value[j + 9];
0906:                        arr[i].m22 = this .value[j + 10];
0907:                        arr[i].m23 = this .value[j + 11];
0908:                        arr[i].m30 = this .value[j + 12];
0909:                        arr[i].m31 = this .value[j + 13];
0910:                        arr[i].m32 = this .value[j + 14];
0911:                        arr[i].m33 = this .value[j + 15];
0912:                    }
0913:                    return arr;
0914:                }
0915:
0916:                Object getRef() {
0917:                    return this .value;
0918:                }
0919:            }
0920:
0921:            /*
0922:            // Wrapper class for Matrix4d
0923:            static class Matrix4dArrayWrapper extends ArrayWrapper {
0924:            private double[] value = new double[0];
0925:
0926:            void set(Object value) {
0927:                Matrix4d[] arr = (Matrix4d[])value;
0928:                if (this.length != arr.length) {
0929:            	this.length = arr.length;
0930:            	this.value = new double[this.length * 16];
0931:                }
0932:                for (int i = 0; i < this.length; i++) {
0933:            	int j = i * 16;
0934:            	this.value[j+0]  = arr[i].m00;
0935:            	this.value[j+1]  = arr[i].m01;
0936:            	this.value[j+2]  = arr[i].m02;
0937:            	this.value[j+3]  = arr[i].m03;
0938:            	this.value[j+4]  = arr[i].m10;
0939:            	this.value[j+5]  = arr[i].m11;
0940:            	this.value[j+6]  = arr[i].m12;
0941:            	this.value[j+7]  = arr[i].m13;
0942:            	this.value[j+8]  = arr[i].m20;
0943:            	this.value[j+9]  = arr[i].m21;
0944:            	this.value[j+10] = arr[i].m22;
0945:            	this.value[j+11] = arr[i].m23;
0946:            	this.value[j+12] = arr[i].m30;
0947:            	this.value[j+13] = arr[i].m31;
0948:            	this.value[j+14] = arr[i].m32;
0949:            	this.value[j+15] = arr[i].m33;
0950:                }
0951:            }
0952:
0953:            void set(int index, Object value) {
0954:                int j = index * 16;
0955:                Matrix4d m = (Matrix4d)value;
0956:
0957:                this.value[j+0]  = m.m00;
0958:                this.value[j+1]  = m.m01;
0959:                this.value[j+2]  = m.m02;
0960:                this.value[j+3]  = m.m03;
0961:                this.value[j+4]  = m.m10;
0962:                this.value[j+5]  = m.m11;
0963:                this.value[j+6]  = m.m12;
0964:                this.value[j+7]  = m.m13;
0965:                this.value[j+8]  = m.m20;
0966:                this.value[j+9]  = m.m21;
0967:                this.value[j+10] = m.m22;
0968:                this.value[j+11] = m.m23;
0969:                this.value[j+12] = m.m30;
0970:                this.value[j+13] = m.m31;
0971:                this.value[j+14] = m.m32;
0972:                this.value[j+15] = m.m33;
0973:            }
0974:
0975:            Object get() {
0976:                Matrix4d[] arr = new Matrix4d[this.length];
0977:                for (int i = 0; i < this.length; i++) {
0978:            	int j = i * 16;
0979:                        arr[i] = new Matrix4d();
0980:            	arr[i].m00 = this.value[j+0];
0981:            	arr[i].m01 = this.value[j+1];
0982:            	arr[i].m02 = this.value[j+2];
0983:            	arr[i].m03 = this.value[j+3];
0984:            	arr[i].m10 = this.value[j+4];
0985:            	arr[i].m11 = this.value[j+5];
0986:            	arr[i].m12 = this.value[j+6];
0987:            	arr[i].m13 = this.value[j+7];
0988:            	arr[i].m20 = this.value[j+8];
0989:            	arr[i].m21 = this.value[j+9];
0990:            	arr[i].m22 = this.value[j+10];
0991:            	arr[i].m23 = this.value[j+11];
0992:            	arr[i].m30 = this.value[j+12];
0993:            	arr[i].m31 = this.value[j+13];
0994:            	arr[i].m32 = this.value[j+14];
0995:            	arr[i].m33 = this.value[j+15];
0996:                }
0997:                return arr;
0998:            }
0999:
1000:            Object getRef() {
1001:                return this.value;
1002:            }
1003:            }
1004:             */
1005:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.