001: /*
002: * $RCSfile: IcosahedronITSA.java,v $
003: *
004: * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: *
010: * - Redistribution of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * - Redistribution in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in
015: * the documentation and/or other materials provided with the
016: * distribution.
017: *
018: * Neither the name of Sun Microsystems, Inc. or the names of
019: * contributors may be used to endorse or promote products derived
020: * from this software without specific prior written permission.
021: *
022: * This software is provided "AS IS," without a warranty of any
023: * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
024: * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
025: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
026: * EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL
027: * NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
028: * USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
029: * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
030: * ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
031: * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
032: * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
033: * INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
034: * POSSIBILITY OF SUCH DAMAGES.
035: *
036: * You acknowledge that this software is not designed, licensed or
037: * intended for use in the design, construction, operation or
038: * maintenance of any nuclear facility.
039: *
040: * $Revision: 1.2 $
041: * $Date: 2007/02/09 17:21:47 $
042: * $State: Exp $
043: */
044:
045: package org.jdesktop.j3d.examples.picking;
046:
047: import javax.media.j3d.*;
048: import javax.vecmath.*;
049:
050: class IcosahedronITSA extends IndexedTriangleStripArray {
051:
052: private static final int[] sVertCnt = { 3, 11, 5, 4, 5, 4 };
053:
054: IcosahedronITSA() {
055: super (12, GeometryArray.COORDINATES | GeometryArray.COLOR_3,
056: 32, sVertCnt);
057:
058: Point3f verts[] = new Point3f[12];
059: Color3f colors[] = new Color3f[12];
060:
061: verts[0] = new Point3f(0.0f, 1.4f, 0.8652f);
062: verts[1] = new Point3f(0.0f, 1.4f, -0.8652f);
063: verts[2] = new Point3f(1.4f, 0.8652f, 0.0f);
064: verts[3] = new Point3f(1.4f, -0.8652f, 0.0f);
065: verts[4] = new Point3f(0.0f, -1.4f, -0.8652f);
066: verts[5] = new Point3f(0.0f, -1.4f, 0.8652f);
067: verts[6] = new Point3f(0.8652f, 0.0f, 1.4f);
068: verts[7] = new Point3f(-0.8652f, 0.0f, 1.4f);
069: verts[8] = new Point3f(0.8652f, 0.0f, -1.4f);
070: verts[9] = new Point3f(-0.8652f, 0.0f, -1.4f);
071: verts[10] = new Point3f(-1.4f, 0.8652f, 0.0f);
072: verts[11] = new Point3f(-1.4f, -0.8652f, 0.0f);
073:
074: colors[0] = new Color3f(1.0f, 0.0f, 0.0f);
075: colors[1] = new Color3f(0.0f, 1.0f, 0.0f);
076: colors[2] = new Color3f(0.0f, 0.0f, 1.0f);
077: colors[3] = new Color3f(1.0f, 1.0f, 0.0f);
078: colors[4] = new Color3f(0.0f, 1.0f, 1.0f);
079: colors[5] = new Color3f(1.0f, 0.0f, 1.0f);
080: colors[6] = new Color3f(0.0f, 0.5f, 0.0f);
081: colors[7] = new Color3f(0.0f, 0.0f, 0.5f);
082: colors[8] = new Color3f(0.5f, 0.5f, 0.0f);
083: colors[9] = new Color3f(0.0f, 0.5f, 0.5f);
084: colors[10] = new Color3f(0.5f, 0.0f, 0.5f);
085: colors[11] = new Color3f(0.5f, 0.5f, 0.5f);
086:
087: int pntsIndex[] = new int[32];
088: int clrsIndex[] = new int[32];
089:
090: pntsIndex[0] = 4;
091: clrsIndex[0] = 4;
092: pntsIndex[1] = 5;
093: clrsIndex[1] = 5;
094: pntsIndex[2] = 11;
095: clrsIndex[2] = 11;
096:
097: pntsIndex[3] = 11;
098: clrsIndex[3] = 11;
099: pntsIndex[4] = 5;
100: clrsIndex[4] = 5;
101: pntsIndex[5] = 7;
102: clrsIndex[5] = 7;
103:
104: pntsIndex[6] = 6;
105: clrsIndex[6] = 6;
106:
107: pntsIndex[7] = 0;
108: clrsIndex[7] = 0;
109:
110: pntsIndex[8] = 2;
111: clrsIndex[8] = 2;
112:
113: pntsIndex[9] = 1;
114: clrsIndex[9] = 1;
115:
116: pntsIndex[10] = 8;
117: clrsIndex[10] = 8;
118:
119: pntsIndex[11] = 9;
120: clrsIndex[11] = 9;
121:
122: pntsIndex[12] = 4;
123: clrsIndex[12] = 4;
124:
125: pntsIndex[13] = 11;
126: clrsIndex[13] = 11;
127:
128: pntsIndex[14] = 2;
129: clrsIndex[14] = 2;
130: pntsIndex[15] = 6;
131: clrsIndex[15] = 6;
132: pntsIndex[16] = 3;
133: clrsIndex[16] = 3;
134:
135: pntsIndex[17] = 5;
136: clrsIndex[17] = 5;
137:
138: pntsIndex[18] = 4;
139: clrsIndex[18] = 4;
140:
141: pntsIndex[19] = 4;
142: clrsIndex[19] = 4;
143: pntsIndex[20] = 8;
144: clrsIndex[20] = 8;
145: pntsIndex[21] = 3;
146: clrsIndex[21] = 3;
147:
148: pntsIndex[22] = 2;
149: clrsIndex[22] = 2;
150:
151: pntsIndex[23] = 0;
152: clrsIndex[23] = 0;
153: pntsIndex[24] = 1;
154: clrsIndex[24] = 1;
155: pntsIndex[25] = 10;
156: clrsIndex[25] = 10;
157:
158: pntsIndex[26] = 9;
159: clrsIndex[26] = 9;
160:
161: pntsIndex[27] = 11;
162: clrsIndex[27] = 11;
163:
164: pntsIndex[28] = 0;
165: clrsIndex[28] = 0;
166: pntsIndex[29] = 10;
167: clrsIndex[29] = 10;
168: pntsIndex[30] = 7;
169: clrsIndex[30] = 7;
170:
171: pntsIndex[31] = 11;
172: clrsIndex[31] = 11;
173:
174: setCoordinates(0, verts);
175: setCoordinateIndices(0, pntsIndex);
176: setColors(0, colors);
177: setColorIndices(0, clrsIndex);
178: }
179: }
|