001: /*
002: * $RCSfile: IndexedPointArray.java,v $
003: *
004: * Copyright 1997-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:24 $
029: * $State: Exp $
030: */
031:
032: package javax.media.j3d;
033:
034: /**
035: * The IndexedPointArray object draws the array of vertices as
036: * individual points.
037: */
038:
039: public class IndexedPointArray extends IndexedGeometryArray {
040:
041: /**
042: * Package scoped default constructor.
043: */
044: IndexedPointArray() {
045: }
046:
047: /**
048: * Constructs an empty IndexedPointArray object using the specified
049: * parameters.
050: *
051: * @param vertexCount
052: * see {@link GeometryArray#GeometryArray(int,int)}
053: * for a description of this parameter.
054: *
055: * @param vertexFormat
056: * see {@link GeometryArray#GeometryArray(int,int)}
057: * for a description of this parameter.
058: *
059: * @param indexCount
060: * see {@link IndexedGeometryArray#IndexedGeometryArray(int,int,int)}
061: * for a description of this parameter.
062: *
063: * @exception IllegalArgumentException if vertexCount is less than 1
064: * or indexCount is less than 1
065: * ;<br>
066: * See {@link GeometryArray#GeometryArray(int,int)}
067: * for more exceptions that can be thrown
068: */
069: public IndexedPointArray(int vertexCount, int vertexFormat,
070: int indexCount) {
071: super (vertexCount, vertexFormat, indexCount);
072:
073: if (vertexCount < 1)
074: throw new IllegalArgumentException(J3dI18N
075: .getString("IndexedPointArray0"));
076:
077: if (indexCount < 1)
078: throw new IllegalArgumentException(J3dI18N
079: .getString("IndexedPointArray1"));
080: }
081:
082: /**
083: * Constructs an empty IndexedPointArray object using the specified
084: * parameters.
085: *
086: * @param vertexCount
087: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
088: * for a description of this parameter.
089: *
090: * @param vertexFormat
091: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
092: * for a description of this parameter.
093: *
094: * @param texCoordSetCount
095: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
096: * for a description of this parameter.
097: *
098: * @param texCoordSetMap
099: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
100: * for a description of this parameter.
101: *
102: * @param indexCount
103: * see {@link IndexedGeometryArray#IndexedGeometryArray(int,int,int,int[],int)}
104: * for a description of this parameter.
105: *
106: * @exception IllegalArgumentException if vertexCount is less than 1
107: * or indexCount is less than 1
108: * ;<br>
109: * See {@link GeometryArray#GeometryArray(int,int,int,int[])}
110: * for more exceptions that can be thrown
111: *
112: * @since Java 3D 1.2
113: */
114: public IndexedPointArray(int vertexCount, int vertexFormat,
115: int texCoordSetCount, int[] texCoordSetMap, int indexCount) {
116:
117: super (vertexCount, vertexFormat, texCoordSetCount,
118: texCoordSetMap, indexCount);
119:
120: if (vertexCount < 1)
121: throw new IllegalArgumentException(J3dI18N
122: .getString("IndexedPointArray0"));
123:
124: if (indexCount < 1)
125: throw new IllegalArgumentException(J3dI18N
126: .getString("IndexedPointArray1"));
127: }
128:
129: /**
130: * Constructs an empty IndexedPointArray object using the specified
131: * parameters.
132: *
133: * @param vertexCount
134: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
135: * for a description of this parameter.
136: *
137: * @param vertexFormat
138: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
139: * for a description of this parameter.
140: *
141: * @param texCoordSetMap
142: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
143: * for a description of this parameter.
144: *
145: * @param vertexAttrCount
146: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
147: * for a description of this parameter.
148: *
149: * @param vertexAttrSizes
150: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
151: * for a description of this parameter.
152: *
153: * @param indexCount
154: * see {@link IndexedGeometryArray#IndexedGeometryArray(int,int,int,int[],int,int[],int)}
155: * for a description of this parameter.
156: *
157: * @exception IllegalArgumentException if vertexCount is less than 1
158: * or indexCount is less than 1
159: * ;<br>
160: * See {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
161: * for more exceptions that can be thrown
162: *
163: * @since Java 3D 1.4
164: */
165: public IndexedPointArray(int vertexCount, int vertexFormat,
166: int texCoordSetCount, int[] texCoordSetMap,
167: int vertexAttrCount, int[] vertexAttrSizes, int indexCount) {
168:
169: super (vertexCount, vertexFormat, texCoordSetCount,
170: texCoordSetMap, vertexAttrCount, vertexAttrSizes,
171: indexCount);
172:
173: if (vertexCount < 1)
174: throw new IllegalArgumentException(J3dI18N
175: .getString("IndexedPointArray0"));
176:
177: if (indexCount < 1)
178: throw new IllegalArgumentException(J3dI18N
179: .getString("IndexedPointArray1"));
180: }
181:
182: /**
183: * Creates the retained mode IndexedPointArrayRetained object that this
184: * IndexedPointArray object will point to.
185: */
186: void createRetained() {
187: this .retained = new IndexedPointArrayRetained();
188: this .retained.setSource(this );
189: }
190:
191: /**
192: * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate)
193: */
194: public NodeComponent cloneNodeComponent() {
195: IndexedPointArrayRetained rt = (IndexedPointArrayRetained) retained;
196: int texSetCount = rt.getTexCoordSetCount();
197: int[] texMap = null;
198: int vertexAttrCount = rt.getVertexAttrCount();
199: int[] vertexAttrSizes = null;
200: if (texSetCount > 0) {
201: texMap = new int[rt.getTexCoordSetMapLength()];
202: rt.getTexCoordSetMap(texMap);
203: }
204: if (vertexAttrCount > 0) {
205: vertexAttrSizes = new int[vertexAttrCount];
206: rt.getVertexAttrSizes(vertexAttrSizes);
207: }
208: IndexedPointArray p = new IndexedPointArray(
209: rt.getVertexCount(), rt.getVertexFormat(), texSetCount,
210: texMap, vertexAttrCount, vertexAttrSizes, rt
211: .getIndexCount());
212: p.duplicateNodeComponent(this);
213: return p;
214: }
215: }
|