001: /*
002: * $RCSfile: IndexedGeometryStripArray.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 IndexedGeometryStripArray object is an abstract class that is extended for
036: * a set of IndexedGeometryArray strip primitives. These include LINE_STRIP,
037: * TRIANGLE_STRIP, and TRIANGLE_FAN.
038: */
039:
040: public abstract class IndexedGeometryStripArray extends
041: IndexedGeometryArray {
042:
043: // non-public, no parameter constructor
044: IndexedGeometryStripArray() {
045: }
046:
047: /**
048: * Constructs an empty IndexedGeometryStripArray object with the specified
049: * number of vertices, vertex format, number of indices, and
050: * array of per-strip index counts.
051: *
052: * @param vertexCount
053: * see {@link GeometryArray#GeometryArray(int,int)}
054: * for a description of this parameter.
055: *
056: * @param vertexFormat
057: * see {@link GeometryArray#GeometryArray(int,int)}
058: * for a description of this parameter.
059: *
060: * @param indexCount
061: * see {@link IndexedGeometryArray#IndexedGeometryArray(int,int,int)}
062: * for a description of this parameter.
063: *
064: * @param stripIndexCounts array that specifies
065: * the count of the number of indices for each separate strip.
066: * The length of this array is the number of separate strips.
067: * The sum of the elements in this array defines the total number
068: * of valid indexed vertices that are rendered (validIndexCount).
069: *
070: * @exception IllegalArgumentException if
071: * <code>validIndexCount > indexCount</code>
072: * ;<br>
073: * See {@link GeometryArray#GeometryArray(int,int)}
074: * for more exceptions that can be thrown
075: */
076: public IndexedGeometryStripArray(int vertexCount, int vertexFormat,
077: int indexCount, int[] stripIndexCounts) {
078:
079: super (vertexCount, vertexFormat, indexCount);
080: ((IndexedGeometryStripArrayRetained) this .retained)
081: .setStripIndexCounts(stripIndexCounts);
082: }
083:
084: /**
085: * Constructs an empty IndexedGeometryStripArray object with the specified
086: * number of vertices, vertex format, number of texture coordinate
087: * sets, texture coordinate mapping array, number of indices, and
088: * array of per-strip index counts.
089: *
090: * @param vertexCount
091: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
092: * for a description of this parameter.
093: *
094: * @param vertexFormat
095: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
096: * for a description of this parameter.
097: *
098: * @param texCoordSetCount
099: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
100: * for a description of this parameter.
101: *
102: * @param texCoordSetMap
103: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
104: * for a description of this parameter.
105: *
106: * @param indexCount
107: * see {@link IndexedGeometryArray#IndexedGeometryArray(int,int,int,int[],int)}
108: * for a description of this parameter.
109: *
110: * @param stripIndexCounts array that specifies
111: * the count of the number of indices for each separate strip.
112: * The length of this array is the number of separate strips.
113: * The sum of the elements in this array defines the total number
114: * of valid indexed vertices that are rendered (validIndexCount).
115: *
116: * @exception IllegalArgumentException if
117: * <code>validIndexCount > indexCount</code>
118: * ;<br>
119: * See {@link GeometryArray#GeometryArray(int,int,int,int[])}
120: * for more exceptions that can be thrown
121: *
122: * @since Java 3D 1.2
123: */
124: public IndexedGeometryStripArray(int vertexCount, int vertexFormat,
125: int texCoordSetCount, int[] texCoordSetMap, int indexCount,
126: int[] stripIndexCounts) {
127:
128: super (vertexCount, vertexFormat, texCoordSetCount,
129: texCoordSetMap, indexCount);
130: ((IndexedGeometryStripArrayRetained) this .retained)
131: .setStripIndexCounts(stripIndexCounts);
132: }
133:
134: /**
135: * Constructs an empty IndexedGeometryStripArray object with the
136: * specified number of vertices, vertex format, number of texture
137: * coordinate sets, texture coordinate mapping array, vertex
138: * attribute count, vertex attribute sizes array, number of
139: * indices, and array of per-strip index counts.
140: *
141: * @param vertexCount
142: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
143: * for a description of this parameter.
144: *
145: * @param vertexFormat
146: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
147: * for a description of this parameter.
148: *
149: * @param texCoordSetMap
150: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
151: * for a description of this parameter.
152: *
153: * @param vertexAttrCount
154: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
155: * for a description of this parameter.
156: *
157: * @param vertexAttrSizes
158: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
159: * for a description of this parameter.
160: *
161: * @param indexCount
162: * see {@link IndexedGeometryArray#IndexedGeometryArray(int,int,int,int[],int,int[],int)}
163: * for a description of this parameter.
164: *
165: * @param stripIndexCounts array that specifies
166: * the count of the number of indices for each separate strip.
167: * The length of this array is the number of separate strips.
168: * The sum of the elements in this array defines the total number
169: * of valid indexed vertices that are rendered (validIndexCount).
170: *
171: * @exception IllegalArgumentException if
172: * <code>validIndexCount > indexCount</code>
173: * ;<br>
174: * See {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
175: * for more exceptions that can be thrown
176: *
177: * @since Java 3D 1.4
178: */
179: public IndexedGeometryStripArray(int vertexCount, int vertexFormat,
180: int texCoordSetCount, int[] texCoordSetMap,
181: int vertexAttrCount, int[] vertexAttrSizes, int indexCount,
182: int[] stripIndexCounts) {
183:
184: super (vertexCount, vertexFormat, texCoordSetCount,
185: texCoordSetMap, vertexAttrCount, vertexAttrSizes,
186: indexCount);
187:
188: ((IndexedGeometryStripArrayRetained) this .retained)
189: .setStripIndexCounts(stripIndexCounts);
190: }
191:
192: /**
193: * Get number of strips in the GeometryStripArray
194: * @return numStrips number of strips
195: */
196: public int getNumStrips() {
197: if (isLiveOrCompiled())
198: if (!this .getCapability(GeometryArray.ALLOW_COUNT_READ))
199: throw new CapabilityNotSetException(J3dI18N
200: .getString("IndexedGeometryStripArray0"));
201:
202: return ((IndexedGeometryStripArrayRetained) this .retained)
203: .getNumStrips();
204: }
205:
206: /**
207: * Sets the array of strip index counts. The length of this
208: * array is the number of separate strips. The elements in this
209: * array specify the number of indices for each separate strip.
210: * The sum of the elements in this array defines the total number
211: * of valid indexed vertices that are rendered (validIndexCount).
212: *
213: * @param stripIndexCounts array that specifies
214: * the count of the number of indices for each separate strip.
215: *
216: * @exception IllegalArgumentException if
217: * <code>initialIndexIndex + validIndexCount > indexCount</code>
218: *
219: * @since Java 3D 1.3
220: */
221: public void setStripIndexCounts(int[] stripIndexCounts) {
222: if (isLiveOrCompiled())
223: if (!this .getCapability(GeometryArray.ALLOW_COUNT_WRITE))
224: throw new CapabilityNotSetException(J3dI18N
225: .getString("IndexedGeometryStripArray2"));
226:
227: ((IndexedGeometryStripArrayRetained) this .retained)
228: .setStripIndexCounts(stripIndexCounts);
229:
230: }
231:
232: /**
233: * Gets a list of indexCounts for each strip. The list is
234: * copied into the specified array. The array must be
235: * large enough to hold all of the ints.
236: * @param stripIndexCounts an array that will receive indexCounts
237: */
238: public void getStripIndexCounts(int[] stripIndexCounts) {
239: if (isLiveOrCompiled())
240: if (!this .getCapability(GeometryArray.ALLOW_COUNT_READ))
241: throw new CapabilityNotSetException(J3dI18N
242: .getString("IndexedGeometryStripArray1"));
243:
244: ((IndexedGeometryStripArrayRetained) this .retained)
245: .getStripIndexCounts(stripIndexCounts);
246: }
247:
248: /**
249: * This method is not supported for indexed geometry strip arrays.
250: * The sum of the elements in the strip index counts array defines
251: * the valid index count.
252: *
253: * @exception UnsupportedOperationException this method is not supported
254: *
255: * @since Java 3D 1.3
256: */
257: public void setValidIndexCount(int validIndexCount) {
258: throw new UnsupportedOperationException();
259: }
260:
261: }
|