0001: /*
0002: * $RCSfile: IndexedGeometryArray.java,v $
0003: *
0004: * Copyright 1997-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.7 $
0028: * $Date: 2008/02/28 20:17:24 $
0029: * $State: Exp $
0030: */
0031:
0032: package javax.media.j3d;
0033:
0034: import javax.vecmath.*;
0035:
0036: /**
0037: * The IndexedGeometryArray object contains separate integer arrays
0038: * that index into the arrays of positional coordinates, colors,
0039: * normals, texture coordinates, and vertex attributes.
0040: * These index arrays specify how
0041: * vertices are connected to form geometry primitives. This class is
0042: * extended to create the various indexed primitive types (e.g.,
0043: * lines, triangle strips, etc.).
0044: */
0045:
0046: public abstract class IndexedGeometryArray extends GeometryArray {
0047:
0048: // non-public, no parameter constructor
0049: IndexedGeometryArray() {
0050: // set default read capabilities
0051: setDefaultReadCapabilities(readCapabilities);
0052: }
0053:
0054: /**
0055: * Specifies that this IndexedGeometryArray allows reading the array of
0056: * coordinate indices.
0057: */
0058: public static final int ALLOW_COORDINATE_INDEX_READ = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_COORDINATE_INDEX_READ;
0059:
0060: /**
0061: * Specifies that this IndexedGeometryArray allows writing the array of
0062: * coordinate indices.
0063: */
0064: public static final int ALLOW_COORDINATE_INDEX_WRITE = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_COORDINATE_INDEX_WRITE;
0065:
0066: /**
0067: * Specifies that this IndexedGeometryArray allows reading the array of
0068: * color indices.
0069: */
0070: public static final int ALLOW_COLOR_INDEX_READ = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_COLOR_INDEX_READ;
0071:
0072: /**
0073: * Specifies that this IndexedGeometryArray allows writing the array of
0074: * color indices.
0075: */
0076: public static final int ALLOW_COLOR_INDEX_WRITE = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_COLOR_INDEX_WRITE;
0077:
0078: /**
0079: * Specifies that this IndexedGeometryArray allows reading the array of
0080: * normal indices.
0081: */
0082: public static final int ALLOW_NORMAL_INDEX_READ = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_NORMAL_INDEX_READ;
0083:
0084: /**
0085: * Specifies that this IndexedGeometryArray allows writing the array of
0086: * normal indices.
0087: */
0088: public static final int ALLOW_NORMAL_INDEX_WRITE = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_NORMAL_INDEX_WRITE;
0089:
0090: /**
0091: * Specifies that this IndexedGeometryArray allows reading the array of
0092: * texture coordinate indices.
0093: */
0094: public static final int ALLOW_TEXCOORD_INDEX_READ = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_TEXCOORD_INDEX_READ;
0095:
0096: /**
0097: * Specifies that this IndexedGeometryArray allows writing the array of
0098: * texture coordinate indices.
0099: */
0100: public static final int ALLOW_TEXCOORD_INDEX_WRITE = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_TEXCOORD_INDEX_WRITE;
0101:
0102: /**
0103: * Specifies that this IndexedGeometryArray allows reading the array of
0104: * vertex attribute indices.
0105: *
0106: * @since Java 3D 1.4
0107: */
0108: public static final int ALLOW_VERTEX_ATTR_INDEX_READ = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_INDEX_READ;
0109:
0110: /**
0111: * Specifies that this IndexedGeometryArray allows writing the array of
0112: * vertex attribute indices.
0113: *
0114: * @since Java 3D 1.4
0115: */
0116: public static final int ALLOW_VERTEX_ATTR_INDEX_WRITE = CapabilityBits.INDEXED_GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_INDEX_WRITE;
0117:
0118: // Array for setting default read capabilities
0119: private static final int[] readCapabilities = {
0120: ALLOW_COLOR_INDEX_READ, ALLOW_COORDINATE_INDEX_READ,
0121: ALLOW_NORMAL_INDEX_READ, ALLOW_TEXCOORD_INDEX_READ,
0122: ALLOW_VERTEX_ATTR_INDEX_READ };
0123:
0124: /**
0125: * Constructs an empty IndexedGeometryArray object with the specified
0126: * number of vertices, vertex format, and number of indices.
0127: * Defaults are used for all other parameters. The default values
0128: * are as follows:
0129: *
0130: * <ul>
0131: * validIndexCount : indexCount<br>
0132: * initialIndexIndex : 0<br>
0133: * all index array values : 0<br>
0134: * </ul>
0135: *
0136: * @param vertexCount
0137: * see {@link GeometryArray#GeometryArray(int,int)}
0138: * for a description of this parameter.
0139: *
0140: * @param vertexFormat
0141: * see {@link GeometryArray#GeometryArray(int,int)}
0142: * for a description of this parameter.
0143: *
0144: * @param indexCount the number of indices in this object. This
0145: * count is the maximum number of vertices that will be rendered.
0146: *
0147: * @exception IllegalArgumentException if <code>indexCount < 0</code>
0148: * ;<br>
0149: * See {@link GeometryArray#GeometryArray(int,int)}
0150: * for more exceptions that can be thrown
0151: */
0152: public IndexedGeometryArray(int vertexCount, int vertexFormat,
0153: int indexCount) {
0154: super (vertexCount, vertexFormat);
0155:
0156: // set default read capabilities
0157: setDefaultReadCapabilities(readCapabilities);
0158:
0159: ((IndexedGeometryArrayRetained) this .retained)
0160: .createIndexedGeometryArrayData(indexCount);
0161: }
0162:
0163: /**
0164: * Constructs an empty IndexedGeometryArray object with the specified
0165: * number of vertices, vertex format, number of texture coordinate
0166: * sets, texture coordinate mapping array, and number of indices.
0167: * Defaults are used for all other parameters.
0168: *
0169: * @param vertexCount
0170: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
0171: * for a description of this parameter.
0172: *
0173: * @param vertexFormat
0174: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
0175: * for a description of this parameter.
0176: *
0177: * @param texCoordSetCount
0178: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
0179: * for a description of this parameter.
0180: *
0181: * @param texCoordSetMap
0182: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
0183: * for a description of this parameter.
0184: *
0185: * @param indexCount the number of indices in this object. This
0186: * count is the maximum number of vertices that will be rendered.
0187: *
0188: * @exception IllegalArgumentException if <code>indexCount < 0</code>
0189: * ;<br>
0190: * See {@link GeometryArray#GeometryArray(int,int,int,int[])}
0191: * for more exceptions that can be thrown
0192: *
0193: * @since Java 3D 1.2
0194: */
0195: public IndexedGeometryArray(int vertexCount, int vertexFormat,
0196: int texCoordSetCount, int[] texCoordSetMap, int indexCount) {
0197: this (vertexCount, vertexFormat, texCoordSetCount,
0198: texCoordSetMap, 0, null, indexCount);
0199: }
0200:
0201: /**
0202: * Constructs an empty IndexedGeometryArray object with the
0203: * specified number of vertices, vertex format, number of texture
0204: * coordinate sets, texture coordinate mapping array, vertex
0205: * attribute count, vertex attribute sizes array, and number of
0206: * indices.
0207: *
0208: * @param vertexCount
0209: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
0210: * for a description of this parameter.
0211: *
0212: * @param vertexFormat
0213: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
0214: * for a description of this parameter.
0215: *
0216: * @param texCoordSetMap
0217: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
0218: * for a description of this parameter.
0219: *
0220: * @param vertexAttrCount
0221: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
0222: * for a description of this parameter.
0223: *
0224: * @param vertexAttrSizes
0225: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
0226: * for a description of this parameter.
0227: *
0228: * @param indexCount the number of indices in this object. This
0229: * count is the maximum number of vertices that will be rendered.
0230: *
0231: * @exception IllegalArgumentException if <code>indexCount < 0</code>
0232: * ;<br>
0233: * See {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
0234: * for more exceptions that can be thrown
0235: *
0236: * @since Java 3D 1.4
0237: */
0238: public IndexedGeometryArray(int vertexCount, int vertexFormat,
0239: int texCoordSetCount, int[] texCoordSetMap,
0240: int vertexAttrCount, int[] vertexAttrSizes, int indexCount) {
0241:
0242: super (vertexCount, vertexFormat, texCoordSetCount,
0243: texCoordSetMap, vertexAttrCount, vertexAttrSizes);
0244:
0245: // set default read capabilities
0246: setDefaultReadCapabilities(readCapabilities);
0247:
0248: ((IndexedGeometryArrayRetained) this .retained)
0249: .createIndexedGeometryArrayData(indexCount);
0250: }
0251:
0252: /**
0253: * Gets number of indices for this IndexedGeometryArray.
0254: * @return indexCount the number of indices
0255: */
0256: public int getIndexCount() {
0257: if (isLiveOrCompiled())
0258: if (!this .getCapability(GeometryArray.ALLOW_COUNT_READ))
0259: throw new CapabilityNotSetException(J3dI18N
0260: .getString("IndexedGeometryArray0"));
0261:
0262: return ((IndexedGeometryArrayRetained) this .retained)
0263: .getIndexCount();
0264: }
0265:
0266: /**
0267: * Sets the valid index count for this IndexedGeometryArray object.
0268: * This count specifies the number of indexed vertices actually used
0269: * in rendering or other operations such as picking and collision.
0270: * This attribute is initialized to <code>indexCount</code>.
0271: *
0272: * @param validIndexCount the new valid index count.
0273: *
0274: * @exception CapabilityNotSetException if the appropriate capability is
0275: * not set and this object is part of a live or compiled scene graph
0276: *
0277: * @exception IllegalArgumentException if either of the following is true:
0278: * <ul>
0279: * <code>validIndexCount < 0</code>, or<br>
0280: * <code>initialIndexIndex + validIndexCount > indexCount</code><br>
0281: * </ul>
0282: *
0283: * @exception ArrayIndexOutOfBoundsException if any element in the range
0284: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0285: * in the index array associated with any of the enabled vertex
0286: * components (coord, color, normal, texcoord) is out of range.
0287: * An element is out of range if it is less than 0 or is greater
0288: * than or equal to the number of vertices actually defined for
0289: * the particular component's array.
0290: *
0291: * @exception ArrayIndexOutOfBoundsException if the data mode for this geometry
0292: * array object is <code>BY_REFERENCE_INDICES</code> and
0293: * <code>coordIndices.length < (initialIndexIndex + validIndexCount)</code>.
0294: *
0295: * @since Java 3D 1.3
0296: */
0297: public void setValidIndexCount(int validIndexCount) {
0298: if (isLiveOrCompiled())
0299: if (!this .getCapability(ALLOW_COUNT_WRITE))
0300: throw new CapabilityNotSetException(J3dI18N
0301: .getString("IndexedGeometryArray16"));
0302:
0303: ((IndexedGeometryArrayRetained) this .retained)
0304: .setValidIndexCount(validIndexCount);
0305: }
0306:
0307: /**
0308: * Gets the valid index count for this IndexedGeometryArray
0309: * object. For geometry strip primitives (subclasses of
0310: * IndexedGeometryStripArray), the valid index count is defined
0311: * to be the sum of the stripIndexCounts array.
0312: *
0313: * @return the current valid index count
0314: *
0315: * @exception CapabilityNotSetException if the appropriate capability is
0316: * not set and this object is part of a live or compiled scene graph
0317: *
0318: * @since Java 3D 1.3
0319: */
0320: public int getValidIndexCount() {
0321: if (isLiveOrCompiled())
0322: if (!this .getCapability(ALLOW_COUNT_READ))
0323: throw new CapabilityNotSetException(J3dI18N
0324: .getString("IndexedGeometryArray17"));
0325:
0326: return ((IndexedGeometryArrayRetained) this .retained)
0327: .getValidIndexCount();
0328: }
0329:
0330: /**
0331: * Sets the initial index index for this IndexedGeometryArray object.
0332: * This index specifies the first index within this indexed geometry
0333: * array that is actually used in rendering or other operations
0334: * such as picking and collision. This attribute is initialized
0335: * to 0.
0336: *
0337: * @param initialIndexIndex the new initial index index.
0338: * @exception CapabilityNotSetException if the appropriate capability is
0339: * not set and this object is part of a live or compiled scene graph
0340: * @exception IllegalArgumentException if either of the following is true:
0341: * <ul>
0342: * <code>initialIndexIndex < 0</code>, or<br>
0343: * <code>initialIndexIndex + validIndexCount > indexCount</code><br>
0344: * </ul>
0345: *
0346: * @exception ArrayIndexOutOfBoundsException if any element in the range
0347: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0348: * in the index array associated with any of the enabled vertex
0349: * components (coord, color, normal, texcoord) is out of range.
0350: * An element is out of range if it is less than 0 or is greater
0351: * than or equal to the number of vertices actually defined for
0352: * the particular component's array.
0353: *
0354: * @exception ArrayIndexOutOfBoundsException if the data mode for this geometry
0355: * array object is <code>BY_REFERENCE_INDICES</code> and
0356: * <code>coordIndices.length < (initialIndexIndex + validIndexCount)</code>.
0357: *
0358: * @since Java 3D 1.3
0359: */
0360: public void setInitialIndexIndex(int initialIndexIndex) {
0361: if (isLiveOrCompiled())
0362: if (!this .getCapability(ALLOW_COUNT_WRITE))
0363: throw new CapabilityNotSetException(J3dI18N
0364: .getString("IndexedGeometryArray18"));
0365:
0366: if (initialIndexIndex < 0)
0367: throw new IllegalArgumentException(J3dI18N
0368: .getString("IndexedGeometryArray20"));
0369:
0370: ((IndexedGeometryArrayRetained) this .retained)
0371: .setInitialIndexIndex(initialIndexIndex);
0372: }
0373:
0374: /**
0375: * Gets the initial index index for this IndexedGeometryArray object.
0376: * @return the current initial index index
0377: * @exception CapabilityNotSetException if the appropriate capability is
0378: * not set and this object is part of a live or compiled scene graph
0379: *
0380: * @since Java 3D 1.3
0381: */
0382: public int getInitialIndexIndex() {
0383: if (isLiveOrCompiled())
0384: if (!this .getCapability(ALLOW_COUNT_READ))
0385: throw new CapabilityNotSetException(J3dI18N
0386: .getString("IndexedGeometryArray19"));
0387:
0388: return ((IndexedGeometryArrayRetained) this .retained)
0389: .getInitialIndexIndex();
0390:
0391: }
0392:
0393: /**
0394: * This method is not supported for indexed geometry arrays.
0395: * Indexed primitives use an array of indices to determine how
0396: * to access the vertex array.
0397: * The initialIndexIndex attribute can be used to set the starting
0398: * index within the index arrays.
0399: *
0400: * @exception UnsupportedOperationException this method is not supported
0401: *
0402: * @since Java 3D 1.3
0403: */
0404: public void setInitialVertexIndex(int initialVertexIndex) {
0405: throw new UnsupportedOperationException();
0406: }
0407:
0408: /**
0409: * This method is not supported for indexed geometry arrays.
0410: * Indexed primitives use an array of indices to determine how
0411: * to access the vertex array.
0412: *
0413: * @exception UnsupportedOperationException this method is not supported
0414: *
0415: * @since Java 3D 1.3
0416: */
0417: public void setInitialCoordIndex(int initialCoordIndex) {
0418: throw new UnsupportedOperationException();
0419: }
0420:
0421: /**
0422: * This method is not supported for indexed geometry arrays.
0423: * Indexed primitives use an array of indices to determine how
0424: * to access the vertex array.
0425: *
0426: * @exception UnsupportedOperationException this method is not supported
0427: *
0428: * @since Java 3D 1.3
0429: */
0430: public void setInitialColorIndex(int initialColorIndex) {
0431: throw new UnsupportedOperationException();
0432: }
0433:
0434: /**
0435: * This method is not supported for indexed geometry arrays.
0436: * Indexed primitives use an array of indices to determine how
0437: * to access the vertex array.
0438: *
0439: * @exception UnsupportedOperationException this method is not supported
0440: *
0441: * @since Java 3D 1.3
0442: */
0443: public void setInitialNormalIndex(int initialNormalIndex) {
0444: throw new UnsupportedOperationException();
0445: }
0446:
0447: /**
0448: * This method is not supported for indexed geometry arrays.
0449: * Indexed primitives use an array of indices to determine how
0450: * to access the vertex array.
0451: *
0452: * @exception UnsupportedOperationException this method is not supported
0453: *
0454: * @since Java 3D 1.3
0455: */
0456: public void setInitialTexCoordIndex(int texCoordSet,
0457: int initialTexCoordIndex) {
0458: throw new UnsupportedOperationException();
0459: }
0460:
0461: /**
0462: * This method is not supported for indexed geometry arrays.
0463: * Indexed primitives use an array of indices to determine how
0464: * to access the vertex array.
0465: *
0466: * @exception UnsupportedOperationException this method is not supported
0467: *
0468: * @since Java 3D 1.4
0469: */
0470: public void setInitialVertexAttrIndex(int vertexAttrNum,
0471: int initialVertexAttrIndex) {
0472: throw new UnsupportedOperationException();
0473: }
0474:
0475: /**
0476: * This method is not supported for indexed geometry arrays.
0477: * Indexed primitives use an array of indices to determine how
0478: * to access the vertex array.
0479: * The validIndexCount attribute can be used to set the number of
0480: * valid indexed vertices rendered.
0481: *
0482: * @exception UnsupportedOperationException this method is not supported
0483: *
0484: * @since Java 3D 1.3
0485: */
0486: public void setValidVertexCount(int validVertexCount) {
0487: throw new UnsupportedOperationException();
0488: }
0489:
0490: //NVaidya
0491: /**
0492: * Sets the coordinate index associated with the vertex at
0493: * the specified index for this object.
0494: * @param index the vertex index
0495: * @param coordinateIndex the new coordinate index
0496: *
0497: * @exception CapabilityNotSetException if appropriate capability is
0498: * not set and this object is part of live or compiled scene graph
0499: *
0500: * @exception ArrayIndexOutOfBoundsException if index is less than 0
0501: * or is greater than or equal to indexCount
0502: *
0503: * @exception ArrayIndexOutOfBoundsException if index is in the range
0504: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0505: * and the specified coordinateIndex is out of range. The
0506: * coordinateIndex is out of range if it is less than 0 or is
0507: * greater than or equal to the number of vertices actually
0508: * defined for the coordinate array.
0509: *
0510: * @exception IllegalStateException if the data mode for this geometry
0511: * array object is <code>BY_REFERENCE_INDICES</code>.
0512: */
0513: public void setCoordinateIndex(int index, int coordinateIndex) {
0514: if (isLiveOrCompiled())
0515: if (!this .getCapability(ALLOW_COORDINATE_INDEX_WRITE))
0516: throw new CapabilityNotSetException(J3dI18N
0517: .getString("IndexedGeometryArray1"));
0518:
0519: //NVaidya
0520: int format = ((IndexedGeometryArrayRetained) this .retained).vertexFormat;
0521: if ((format & BY_REFERENCE_INDICES) != 0)
0522: throw new IllegalStateException(J3dI18N
0523: .getString("IndexedGeometryArray31"));
0524:
0525: ((IndexedGeometryArrayRetained) this .retained)
0526: .setCoordinateIndex(index, coordinateIndex);
0527: }
0528:
0529: //NVaidya
0530: /**
0531: * Sets the coordinate indices associated with the vertices starting at
0532: * the specified index for this object.
0533: * @param index the vertex index
0534: * @param coordinateIndices an array of coordinate indices
0535: *
0536: * @exception CapabilityNotSetException if appropriate capability is
0537: * not set and this object is part of live or compiled scene graph
0538: *
0539: * @exception ArrayIndexOutOfBoundsException if index is less than 0
0540: * or is greater than or equal to indexCount
0541: *
0542: * @exception ArrayIndexOutOfBoundsException if any element of the
0543: * coordinateIndices array whose destination position is in the range
0544: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0545: * is out of range. An element is out of range if it is less than 0
0546: * or is greater than or equal to the number of vertices actually
0547: * defined for the coordinate array.
0548: *
0549: * @exception IllegalStateException if the data mode for this geometry
0550: * array object is <code>BY_REFERENCE_INDICES</code>.
0551: */
0552: public void setCoordinateIndices(int index, int coordinateIndices[]) {
0553: if (isLiveOrCompiled())
0554: if (!this .getCapability(ALLOW_COORDINATE_INDEX_WRITE))
0555: throw new CapabilityNotSetException(J3dI18N
0556: .getString("IndexedGeometryArray1"));
0557:
0558: //NVaidya
0559: int format = ((IndexedGeometryArrayRetained) this .retained).vertexFormat;
0560: if ((format & BY_REFERENCE_INDICES) != 0)
0561: throw new IllegalStateException(J3dI18N
0562: .getString("IndexedGeometryArray31"));
0563:
0564: ((IndexedGeometryArrayRetained) this .retained)
0565: .setCoordinateIndices(index, coordinateIndices);
0566: }
0567:
0568: //NVaidya
0569: /**
0570: * Sets the coordinate indices array reference to the specified array.
0571: * If the coordinate indices array reference is null, the entire
0572: * geometry array object is treated as if it were null--any
0573: * Shape3D or Morph node that uses this geometry array will not be drawn.
0574: *
0575: * @param coordIndices an array of indices to which a reference
0576: * will be set.
0577: *
0578: * @exception CapabilityNotSetException if appropriate capability is
0579: * not set and this object is part of live or compiled scene graph
0580: *
0581: * @exception IllegalStateException if the data mode for this geometry
0582: * array object is not <code>BY_REFERENCE_INDICES</code>.
0583: *
0584: * @exception ArrayIndexOutOfBoundsException if any element of the
0585: * coordIndices array whose destination position is in the range
0586: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0587: * is out of range. An element is out of range if it is less than 0
0588: * or is greater than or equal to the number of vertices actually
0589: * defined for the coordinate array.
0590: *
0591: * @exception ArrayIndexOutOfBoundsException if
0592: * <code>coordIndices.length < (initialIndexIndex + validIndexCount)</code>.
0593: *
0594: * @since Java 3D 1.5
0595: */
0596: public void setCoordIndicesRef(int coordIndices[]) {
0597: if (isLiveOrCompiled())
0598: if (!this .getCapability(ALLOW_REF_DATA_WRITE))
0599: throw new CapabilityNotSetException(J3dI18N
0600: .getString("GeometryArray86"));
0601:
0602: //NVaidya
0603: int format = ((IndexedGeometryArrayRetained) this .retained).vertexFormat;
0604: if ((format & BY_REFERENCE_INDICES) == 0)
0605: throw new IllegalStateException(J3dI18N
0606: .getString("IndexedGeometryArray32"));
0607:
0608: ((IndexedGeometryArrayRetained) this .retained)
0609: .setCoordIndicesRef(coordIndices);
0610: }
0611:
0612: /**
0613: * Sets the color index associated with the vertex at
0614: * the specified index for this object.
0615: * @param index the vertex index
0616: * @param colorIndex the new color index
0617: *
0618: * @exception CapabilityNotSetException if appropriate capability is
0619: * not set and this object is part of live or compiled scene graph
0620: *
0621: * @exception ArrayIndexOutOfBoundsException if index is less than 0
0622: * or is greater than or equal to indexCount
0623: *
0624: * @exception ArrayIndexOutOfBoundsException if index is in the range
0625: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0626: * and the specified colorIndex is out of range. The
0627: * colorIndex is out of range if it is less than 0 or is
0628: * greater than or equal to the number of vertices actually
0629: * defined for the color array.
0630: *
0631: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0632: * bit is set in <code>vertexFormat</code>.
0633: */
0634: public void setColorIndex(int index, int colorIndex) {
0635: if (isLiveOrCompiled())
0636: if (!this .getCapability(ALLOW_COLOR_INDEX_WRITE))
0637: throw new CapabilityNotSetException(J3dI18N
0638: .getString("IndexedGeometryArray3"));
0639:
0640: ((IndexedGeometryArrayRetained) this .retained).setColorIndex(
0641: index, colorIndex);
0642: }
0643:
0644: /**
0645: * Sets the color indices associated with the vertices starting at
0646: * the specified index for this object.
0647: * @param index the vertex index
0648: * @param colorIndices an array of color indices
0649: *
0650: * @exception CapabilityNotSetException if appropriate capability is
0651: * not set and this object is part of live or compiled scene graph
0652: *
0653: * @exception ArrayIndexOutOfBoundsException if index is less than 0
0654: * or is greater than or equal to indexCount
0655: *
0656: * @exception ArrayIndexOutOfBoundsException if any element of the
0657: * colorIndices array whose destination position is in the range
0658: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0659: * is out of range. An element is out of range if it is less than 0
0660: * or is greater than or equal to the number of vertices actually
0661: * defined for the color array.
0662: *
0663: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0664: * bit is set in <code>vertexFormat</code>.
0665: */
0666: public void setColorIndices(int index, int colorIndices[]) {
0667: if (isLiveOrCompiled())
0668: if (!this .getCapability(ALLOW_COLOR_INDEX_WRITE))
0669: throw new CapabilityNotSetException(J3dI18N
0670: .getString("IndexedGeometryArray3"));
0671:
0672: ((IndexedGeometryArrayRetained) this .retained).setColorIndices(
0673: index, colorIndices);
0674: }
0675:
0676: /**
0677: * Sets the normal index associated with the vertex at
0678: * the specified index for this object.
0679: * @param index the vertex index
0680: * @param normalIndex the new normal index
0681: *
0682: * @exception CapabilityNotSetException if appropriate capability is
0683: * not set and this object is part of live or compiled scene graph
0684: *
0685: * @exception ArrayIndexOutOfBoundsException if index is less than 0
0686: * or is greater than or equal to indexCount
0687: *
0688: * @exception ArrayIndexOutOfBoundsException if index is in the range
0689: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0690: * and the specified normalIndex is out of range. The
0691: * normalIndex is out of range if it is less than 0 or is
0692: * greater than or equal to the number of vertices actually
0693: * defined for the normal array.
0694: *
0695: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0696: * bit is set in <code>vertexFormat</code>.
0697: */
0698: public void setNormalIndex(int index, int normalIndex) {
0699: if (isLiveOrCompiled())
0700: if (!this .getCapability(ALLOW_NORMAL_INDEX_WRITE))
0701: throw new CapabilityNotSetException(J3dI18N
0702: .getString("IndexedGeometryArray5"));
0703:
0704: ((IndexedGeometryArrayRetained) this .retained).setNormalIndex(
0705: index, normalIndex);
0706: }
0707:
0708: /**
0709: * Sets the normal indices associated with the vertices starting at
0710: * the specified index for this object.
0711: * @param index the vertex index
0712: * @param normalIndices an array of normal indices
0713: *
0714: * @exception CapabilityNotSetException if appropriate capability is
0715: * not set and this object is part of live or compiled scene graph
0716: *
0717: * @exception ArrayIndexOutOfBoundsException if index is less than 0
0718: * or is greater than or equal to indexCount
0719: *
0720: * @exception ArrayIndexOutOfBoundsException if any element of the
0721: * normalIndices array whose destination position is in the range
0722: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0723: * is out of range. An element is out of range if it is less than 0
0724: * or is greater than or equal to the number of vertices actually
0725: * defined for the normal array.
0726: *
0727: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0728: * bit is set in <code>vertexFormat</code>.
0729: */
0730: public void setNormalIndices(int index, int normalIndices[]) {
0731: if (isLiveOrCompiled())
0732: if (!this .getCapability(ALLOW_NORMAL_INDEX_WRITE))
0733: throw new CapabilityNotSetException(J3dI18N
0734: .getString("IndexedGeometryArray5"));
0735:
0736: ((IndexedGeometryArrayRetained) this .retained)
0737: .setNormalIndices(index, normalIndices);
0738: }
0739:
0740: /**
0741: * @deprecated As of Java 3D version 1.2, replaced by
0742: * <code>setTextureCoordinateIndex(int texCoordSet, ...)</code>
0743: */
0744: public void setTextureCoordinateIndex(int index, int texCoordIndex) {
0745: setTextureCoordinateIndex(0, index, texCoordIndex);
0746: }
0747:
0748: /**
0749: * Sets the texture coordinate index associated with the vertex at
0750: * the specified index in the specified texture coordinate set
0751: * for this object.
0752: *
0753: * @param texCoordSet texture coordinate set in this geometry array
0754: * @param index the vertex index
0755: * @param texCoordIndex the new texture coordinate index
0756: *
0757: * @exception CapabilityNotSetException if appropriate capability is
0758: * not set and this object is part of live or compiled scene graph
0759: *
0760: * @exception ArrayIndexOutOfBoundsException if neither of the
0761: * <code>TEXTURE_COORDINATE</code> bits are set in the
0762: * <code>vertexFormat</code> or if the index or
0763: * texCoordSet is out of range.
0764: *
0765: * @exception ArrayIndexOutOfBoundsException if index is in the range
0766: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0767: * and the specified texCoordIndex is out of range. The
0768: * texCoordIndex is out of range if it is less than 0 or is
0769: * greater than or equal to the number of vertices actually
0770: * defined for the texture coordinate array.
0771: *
0772: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0773: * bit is set in <code>vertexFormat</code>.
0774: *
0775: * @since Java 3D 1.2
0776: */
0777: public void setTextureCoordinateIndex(int texCoordSet, int index,
0778: int texCoordIndex) {
0779: if (isLiveOrCompiled())
0780: if (!this .getCapability(ALLOW_TEXCOORD_INDEX_WRITE))
0781: throw new CapabilityNotSetException(J3dI18N
0782: .getString("IndexedGeometryArray7"));
0783:
0784: ((IndexedGeometryArrayRetained) this .retained)
0785: .setTextureCoordinateIndex(texCoordSet, index,
0786: texCoordIndex);
0787: }
0788:
0789: /**
0790: * @deprecated As of Java 3D version 1.2, replaced by
0791: * <code>setTextureCoordinateIndices(int texCoordSet, ...)</code>
0792: */
0793: public void setTextureCoordinateIndices(int index,
0794: int texCoordIndices[]) {
0795: setTextureCoordinateIndices(0, index, texCoordIndices);
0796: }
0797:
0798: /**
0799: * Sets the texture coordinate indices associated with the vertices
0800: * starting at the specified index in the specified texture coordinate set
0801: * for this object.
0802: *
0803: * @param texCoordSet texture coordinate set in this geometry array
0804: * @param index the vertex index
0805: * @param texCoordIndices an array of texture coordinate indices
0806: *
0807: * @exception CapabilityNotSetException if appropriate capability is
0808: * not set and this object is part of live or compiled scene graph
0809: *
0810: * @exception ArrayIndexOutOfBoundsException if neither of the
0811: * <code>TEXTURE_COORDINATE</code> bits are set in the
0812: * <code>vertexFormat</code> or if the index or
0813: * texCoordSet is out of range.
0814: *
0815: * @exception ArrayIndexOutOfBoundsException if any element of the
0816: * texCoordIndices array whose destination position is in the range
0817: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0818: * is out of range. An element is out of range if it is less than 0
0819: * or is greater than or equal to the number of vertices actually
0820: * defined for the texture coordinate array.
0821: *
0822: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0823: * bit is set in <code>vertexFormat</code>.
0824: *
0825: * @since Java 3D 1.2
0826: */
0827: public void setTextureCoordinateIndices(int texCoordSet, int index,
0828: int texCoordIndices[]) {
0829: if (isLiveOrCompiled())
0830: if (!this .getCapability(ALLOW_TEXCOORD_INDEX_WRITE))
0831: throw new CapabilityNotSetException(J3dI18N
0832: .getString("IndexedGeometryArray7"));
0833:
0834: ((IndexedGeometryArrayRetained) this .retained)
0835: .setTextureCoordinateIndices(texCoordSet, index,
0836: texCoordIndices);
0837: }
0838:
0839: /**
0840: * Sets the vertex attribute index associated with the vertex at
0841: * the specified index for the specified vertex attribute number
0842: * for this object.
0843: *
0844: * @param vertexAttrNum vertex attribute number in this geometry array
0845: * @param index the vertex index
0846: * @param vertexAttrIndex the new vertex attribute index
0847: *
0848: * @exception CapabilityNotSetException if appropriate capability is
0849: * not set and this object is part of live or compiled scene graph
0850: *
0851: * @exception ArrayIndexOutOfBoundsException if the index or
0852: * vertexAttrNum is out of range.
0853: *
0854: * @exception ArrayIndexOutOfBoundsException if index is in the range
0855: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0856: * and the specified vertexAttrIndex is out of range. The
0857: * vertexAttrIndex is out of range if it is less than 0 or is
0858: * greater than or equal to the number of vertices actually
0859: * defined for the vertex attribute array.
0860: *
0861: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0862: * bit is set in <code>vertexFormat</code>.
0863: *
0864: * @since Java 3D 1.4
0865: */
0866: public void setVertexAttrIndex(int vertexAttrNum, int index,
0867: int vertexAttrIndex) {
0868: if (isLiveOrCompiled()) {
0869: if (!this .getCapability(ALLOW_VERTEX_ATTR_INDEX_WRITE)) {
0870: throw new CapabilityNotSetException(J3dI18N
0871: .getString("IndexedGeometryArray28"));
0872: }
0873: }
0874:
0875: ((IndexedGeometryArrayRetained) this .retained)
0876: .setVertexAttrIndex(vertexAttrNum, index,
0877: vertexAttrIndex);
0878: }
0879:
0880: /**
0881: * Sets the vertex attribute indices associated with the vertices
0882: * starting at the specified index for the specified vertex attribute number
0883: * for this object.
0884: *
0885: * @param vertexAttrNum vertex attribute number in this geometry array
0886: * @param index the vertex index
0887: * @param vertexAttrIndices an array of vertex attribute indices
0888: *
0889: * @exception CapabilityNotSetException if appropriate capability is
0890: * not set and this object is part of live or compiled scene graph
0891: *
0892: * @exception ArrayIndexOutOfBoundsException if the index or
0893: * vertexAttrNum is out of range.
0894: *
0895: * @exception ArrayIndexOutOfBoundsException if any element of the
0896: * vertexAttrIndices array whose destination position is in the range
0897: * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code>
0898: * is out of range. An element is out of range if it is less than 0
0899: * or is greater than or equal to the number of vertices actually
0900: * defined for the vertex attribute array.
0901: *
0902: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
0903: * bit is set in <code>vertexFormat</code>.
0904: *
0905: * @since Java 3D 1.4
0906: */
0907: public void setVertexAttrIndices(int vertexAttrNum, int index,
0908: int[] vertexAttrIndices) {
0909: if (isLiveOrCompiled()) {
0910: if (!this .getCapability(ALLOW_VERTEX_ATTR_INDEX_WRITE)) {
0911: throw new CapabilityNotSetException(J3dI18N
0912: .getString("IndexedGeometryArray28"));
0913: }
0914: }
0915:
0916: ((IndexedGeometryArrayRetained) this .retained)
0917: .setVertexAttrIndices(vertexAttrNum, index,
0918: vertexAttrIndices);
0919: }
0920:
0921: //NVaidya
0922: /**
0923: * Retrieves the coordinate index associated with the vertex at
0924: * the specified index for this object.
0925: * @param index the vertex index
0926: * @return the coordinate index
0927: * @exception CapabilityNotSetException if appropriate capability is
0928: * not set and this object is part of live or compiled scene graph
0929: *
0930: * @exception IllegalStateException if the data mode for this geometry
0931: * array object is <code>BY_REFERENCE_INDICES</code>.
0932: */
0933: public int getCoordinateIndex(int index) {
0934: if (isLiveOrCompiled())
0935: if (!this .getCapability(ALLOW_COORDINATE_INDEX_READ))
0936: throw new CapabilityNotSetException(J3dI18N
0937: .getString("IndexedGeometryArray9"));
0938:
0939: //NVaidya
0940: int format = ((IndexedGeometryArrayRetained) this .retained).vertexFormat;
0941: if ((format & BY_REFERENCE_INDICES) != 0)
0942: throw new IllegalStateException(J3dI18N
0943: .getString("IndexedGeometryArray31"));
0944:
0945: return ((IndexedGeometryArrayRetained) this .retained)
0946: .getCoordinateIndex(index);
0947: }
0948:
0949: //NVaidya
0950: /**
0951: * Retrieves the coordinate indices associated with the vertices starting at
0952: * the specified index for this object.
0953: * @param index the vertex index
0954: * @param coordinateIndices array that will receive the coordinate indices
0955: * @exception CapabilityNotSetException if appropriate capability is
0956: * not set and this object is part of live or compiled scene graph
0957: *
0958: * @exception IllegalStateException if the data mode for this geometry
0959: * array object is <code>BY_REFERENCE_INDICES</code>.
0960: */
0961: public void getCoordinateIndices(int index, int coordinateIndices[]) {
0962: if (isLiveOrCompiled())
0963: if (!this .getCapability(ALLOW_COORDINATE_INDEX_READ))
0964: throw new CapabilityNotSetException(J3dI18N
0965: .getString("IndexedGeometryArray9"));
0966:
0967: //NVaidya
0968: int format = ((IndexedGeometryArrayRetained) this .retained).vertexFormat;
0969: if ((format & BY_REFERENCE_INDICES) != 0)
0970: throw new IllegalStateException(J3dI18N
0971: .getString("IndexedGeometryArray31"));
0972:
0973: ((IndexedGeometryArrayRetained) this .retained)
0974: .getCoordinateIndices(index, coordinateIndices);
0975: }
0976:
0977: //NVaidya
0978: /**
0979: * Returns a reference to the coordinate indices associated with
0980: * the vertices
0981: * @return the coordinate indices array
0982: * @exception CapabilityNotSetException if appropriate capability is
0983: * not set and this object is part of live or compiled scene graph
0984: *
0985: * @exception IllegalStateException if the data mode for this geometry
0986: * array object is not <code>BY_REFERENCE_INDICES</code>.
0987: *
0988: * @since Java 3D 1.5
0989: */
0990: public int[] getCoordIndicesRef() {
0991: if (isLiveOrCompiled())
0992: if (!this .getCapability(ALLOW_REF_DATA_READ))
0993: throw new CapabilityNotSetException(J3dI18N
0994: .getString("GeometryArray87"));
0995:
0996: int format = ((IndexedGeometryArrayRetained) this .retained).vertexFormat;
0997: if ((format & BY_REFERENCE_INDICES) == 0)
0998: throw new IllegalStateException(J3dI18N
0999: .getString("IndexedGeometryArray32"));
1000:
1001: return ((IndexedGeometryArrayRetained) this .retained)
1002: .getCoordIndicesRef();
1003: }
1004:
1005: /**
1006: * Retrieves the color index associated with the vertex at
1007: * the specified index for this object.
1008: * @param index the vertex index
1009: * @return the color index
1010: * @exception CapabilityNotSetException if appropriate capability is
1011: * not set and this object is part of live or compiled scene graph
1012: *
1013: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1014: * bit is set in <code>vertexFormat</code>.
1015: */
1016: public int getColorIndex(int index) {
1017: if (isLiveOrCompiled())
1018: if (!this .getCapability(ALLOW_COLOR_INDEX_READ))
1019: throw new CapabilityNotSetException(J3dI18N
1020: .getString("IndexedGeometryArray11"));
1021:
1022: return ((IndexedGeometryArrayRetained) this .retained)
1023: .getColorIndex(index);
1024: }
1025:
1026: /**
1027: * Retrieves the color indices associated with the vertices starting at
1028: * the specified index for this object. The color indicies are
1029: * copied into the specified array. The array must be large enough
1030: * to hold all of the indices.
1031: * @param index the vertex index
1032: * @param colorIndices array that will receive the color indices
1033: * @exception CapabilityNotSetException if appropriate capability is
1034: * not set and this object is part of live or compiled scene graph
1035: *
1036: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1037: * bit is set in <code>vertexFormat</code>.
1038: */
1039: public void getColorIndices(int index, int colorIndices[]) {
1040: if (isLiveOrCompiled())
1041: if (!this .getCapability(ALLOW_COLOR_INDEX_READ))
1042: throw new CapabilityNotSetException(J3dI18N
1043: .getString("IndexedGeometryArray11"));
1044:
1045: ((IndexedGeometryArrayRetained) this .retained).getColorIndices(
1046: index, colorIndices);
1047: }
1048:
1049: /**
1050: * Retrieves the normal index associated with the vertex at
1051: * the specified index for this object.
1052: * @param index the vertex index
1053: * @return the normal index
1054: * @exception CapabilityNotSetException if appropriate capability is
1055: * not set and this object is part of live or compiled scene graph
1056: *
1057: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1058: * bit is set in <code>vertexFormat</code>.
1059: */
1060: public int getNormalIndex(int index) {
1061: if (isLiveOrCompiled())
1062: if (!this .getCapability(ALLOW_NORMAL_INDEX_READ))
1063: throw new CapabilityNotSetException(J3dI18N
1064: .getString("IndexedGeometryArray13"));
1065:
1066: return ((IndexedGeometryArrayRetained) this .retained)
1067: .getNormalIndex(index);
1068: }
1069:
1070: /**
1071: * Retrieves the normal indices associated with the vertices starting at
1072: * the specified index for this object. The normal indicies are
1073: * copied into the specified array. The array must be large enough
1074: * to hold all of the normal indicies.
1075: *
1076: * @param index the vertex index
1077: * @param normalIndices array that will receive the normal indices
1078: * @exception CapabilityNotSetException if appropriate capability is
1079: * not set and this object is part of live or compiled scene graph
1080: *
1081: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1082: * bit is set in <code>vertexFormat</code>.
1083: */
1084: public void getNormalIndices(int index, int normalIndices[]) {
1085: if (isLiveOrCompiled())
1086: if (!this .getCapability(ALLOW_NORMAL_INDEX_READ))
1087: throw new CapabilityNotSetException(J3dI18N
1088: .getString("IndexedGeometryArray13"));
1089:
1090: ((IndexedGeometryArrayRetained) this .retained)
1091: .getNormalIndices(index, normalIndices);
1092: }
1093:
1094: /**
1095: * @deprecated As of Java 3D version 1.2, replaced by
1096: * <code>getTextureCoordinateIndex(int texCoordSet, ...)</code>
1097: */
1098: public int getTextureCoordinateIndex(int index) {
1099: return (getTextureCoordinateIndex(0, index));
1100: }
1101:
1102: /**
1103: * Retrieves the texture coordinate index associated with the vertex at
1104: * the specified index in the specified texture coordinate set
1105: * for this object.
1106: *
1107: * @param texCoordSet texture coordinate set in this geometry array
1108: * @param index the vertex index
1109: *
1110: * @return the texture coordinate index
1111: *
1112: * @exception CapabilityNotSetException if appropriate capability is
1113: * not set and this object is part of live or compiled scene graph
1114: *
1115: * @exception ArrayIndexOutOfBoundsException if neither of the
1116: * <code>TEXTURE_COORDINATE</code> bits are set in the
1117: * <code>vertexFormat</code> or if the index or
1118: * texCoordSet is out of range.
1119: *
1120: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1121: * bit is set in <code>vertexFormat</code>.
1122: *
1123: * @since Java 3D 1.2
1124: */
1125: public int getTextureCoordinateIndex(int texCoordSet, int index) {
1126: if (isLiveOrCompiled())
1127: if (!this .getCapability(ALLOW_COORDINATE_INDEX_READ))
1128: throw new CapabilityNotSetException(J3dI18N
1129: .getString("IndexedGeometryArray15"));
1130:
1131: return ((IndexedGeometryArrayRetained) this .retained)
1132: .getTextureCoordinateIndex(texCoordSet, index);
1133: }
1134:
1135: /**
1136: * @deprecated As of Java 3D version 1.2, replaced by
1137: * <code>getTextureCoordinateIndices(int texCoordSet, ...)</code>
1138: */
1139: public void getTextureCoordinateIndices(int index,
1140: int texCoordIndices[]) {
1141: getTextureCoordinateIndices(0, index, texCoordIndices);
1142: }
1143:
1144: /**
1145: * Retrieves the texture coordinate indices associated with the vertices
1146: * starting at the specified index in the specified texture coordinate set
1147: * for this object. The texture
1148: * coordinate indices are copied into the specified array. The array
1149: * must be large enough to hold all of the indices.
1150: *
1151: * @param texCoordSet texture coordinate set in this geometry array
1152: * @param index the vertex index
1153: * @param texCoordIndices array that will receive the texture coordinate
1154: * indices
1155: *
1156: * @exception CapabilityNotSetException if appropriate capability is
1157: * not set and this object is part of live or compiled scene graph
1158: *
1159: * @exception ArrayIndexOutOfBoundsException if neither of the
1160: * <code>TEXTURE_COORDINATE</code> bits are set in the
1161: * <code>vertexFormat</code> or if the index or
1162: * texCoordSet is out of range.
1163: *
1164: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1165: * bit is set in <code>vertexFormat</code>.
1166: *
1167: * @since Java 3D 1.2
1168: */
1169: public void getTextureCoordinateIndices(int texCoordSet, int index,
1170: int texCoordIndices[]) {
1171: if (isLiveOrCompiled())
1172: if (!this .getCapability(ALLOW_COORDINATE_INDEX_READ))
1173: throw new CapabilityNotSetException(J3dI18N
1174: .getString("IndexedGeometryArray15"));
1175:
1176: ((IndexedGeometryArrayRetained) this .retained)
1177: .getTextureCoordinateIndices(texCoordSet, index,
1178: texCoordIndices);
1179: }
1180:
1181: /**
1182: * Retrieves the vertex attribute index associated with the vertex at
1183: * the specified index for the specified vertex attribute number
1184: * for this object.
1185: *
1186: * @param vertexAttrNum vertex attribute number in this geometry array
1187: * @param index the vertex index
1188: *
1189: * @return the vertex attribute index
1190: *
1191: * @exception CapabilityNotSetException if appropriate capability is
1192: * not set and this object is part of live or compiled scene graph
1193: *
1194: * @exception ArrayIndexOutOfBoundsException if the index or
1195: * vertexAttrNum is out of range.
1196: *
1197: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1198: * bit is set in <code>vertexFormat</code>.
1199: *
1200: * @since Java 3D 1.4
1201: */
1202: public int getVertexAttrIndex(int vertexAttrNum, int index) {
1203: if (isLiveOrCompiled()) {
1204: if (!this .getCapability(ALLOW_VERTEX_ATTR_INDEX_READ)) {
1205: throw new CapabilityNotSetException(J3dI18N
1206: .getString("IndexedGeometryArray29"));
1207: }
1208: }
1209:
1210: return ((IndexedGeometryArrayRetained) this .retained)
1211: .getVertexAttrIndex(vertexAttrNum, index);
1212: }
1213:
1214: /**
1215: * Retrieves the vertex attribute indices associated with the vertices
1216: * starting at the specified index for the specified vertex attribute number
1217: * for this object. The vertex attribute indices
1218: * are copied into the specified array. The array
1219: * must be large enough to hold all of the indices.
1220: *
1221: * @param vertexAttrNum vertex attribute number in this geometry array
1222: * @param index the vertex index
1223: * @param vertexAttrIndices array that will receive the vertex attribute indices
1224: *
1225: * @exception CapabilityNotSetException if appropriate capability is
1226: * not set and this object is part of live or compiled scene graph
1227: *
1228: * @exception ArrayIndexOutOfBoundsException if the index or
1229: * vertexAttrNum is out of range.
1230: *
1231: * @exception NullPointerException if the <code>USE_COORD_INDEX_ONLY</code>
1232: * bit is set in <code>vertexFormat</code>.
1233: *
1234: * @since Java 3D 1.4
1235: */
1236: public void getVertexAttrIndices(int vertexAttrNum, int index,
1237: int[] vertexAttrIndices) {
1238: if (isLiveOrCompiled()) {
1239: if (!this .getCapability(ALLOW_VERTEX_ATTR_INDEX_READ)) {
1240: throw new CapabilityNotSetException(J3dI18N
1241: .getString("IndexedGeometryArray29"));
1242: }
1243: }
1244:
1245: ((IndexedGeometryArrayRetained) this .retained)
1246: .getVertexAttrIndices(vertexAttrNum, index,
1247: vertexAttrIndices);
1248: }
1249:
1250: /**
1251: * Copies all node information from <code>originalNodeComponent</code> into
1252: * the current node. This method is called from the
1253: * <code>duplicateNode</code> method. This routine does
1254: * the actual duplication of all "local data" (any data defined in
1255: * this object).
1256: *
1257: * @param originalNodeComponent the original node to duplicate.
1258: * @param forceDuplicate when set to <code>true</code>, causes the
1259: * <code>duplicateOnCloneTree</code> flag to be ignored. When
1260: * <code>false</code>, the value of each node's
1261: * <code>duplicateOnCloneTree</code> variable determines whether
1262: * NodeComponent data is duplicated or copied.
1263: *
1264: * @see Node#cloneTree
1265: * @see NodeComponent#setDuplicateOnCloneTree
1266: */
1267: void duplicateAttributes(NodeComponent originalNodeComponent,
1268: boolean forceDuplicate) {
1269: super
1270: .duplicateAttributes(originalNodeComponent,
1271: forceDuplicate);
1272: // vertexFormat, vertexCount and indexCount are copied in
1273: // subclass when constructor
1274: // public IndexedGeometryArray(int vertexCount, int vertexFormat,
1275: // int indexCount)
1276: // is used in cloneNodeComponent()
1277: IndexedGeometryArrayRetained ga = (IndexedGeometryArrayRetained) originalNodeComponent.retained;
1278: IndexedGeometryArrayRetained rt = (IndexedGeometryArrayRetained) retained;
1279:
1280: int vformat = ga.getVertexFormat();
1281: int buffer[] = new int[ga.getIndexCount()];
1282:
1283: if ((vformat & COORDINATES) != 0) {
1284: ga.getCoordinateIndices(0, buffer);
1285: rt.setCoordinateIndices(0, buffer);
1286: }
1287:
1288: if ((vformat & USE_COORD_INDEX_ONLY) == 0) {
1289: if ((vformat & NORMALS) != 0) {
1290: ga.getNormalIndices(0, buffer);
1291: rt.setNormalIndices(0, buffer);
1292: }
1293:
1294: if ((vformat & COLOR) != 0) {
1295: ga.getColorIndices(0, buffer);
1296: rt.setColorIndices(0, buffer);
1297: }
1298:
1299: if ((vformat & VERTEX_ATTRIBUTES) != 0) {
1300: for (int i = 0; i < ga.vertexAttrCount; i++) {
1301: ga.getVertexAttrIndices(i, 0, buffer);
1302: rt.setVertexAttrIndices(i, 0, buffer);
1303: }
1304: }
1305:
1306: if ((vformat & TEXTURE_COORDINATE) != 0) {
1307: for (int i = 0; i < ga.texCoordSetCount; i++) {
1308: ga.getTextureCoordinateIndices(i, 0, buffer);
1309: rt.setTextureCoordinateIndices(i, 0, buffer);
1310: }
1311: }
1312: }
1313: }
1314:
1315: }
|