From 7a2e20caac9db6f789a7b3fab344b9758af45335 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sun, 19 Apr 2015 21:02:06 -0700 Subject: j3dcore: flatten the directory structure a bit Signed-off-by: Harvey Harrison --- src/javax/media/j3d/GeometryArray.java | 7467 ++++++++++++++++++++++++++++++++ 1 file changed, 7467 insertions(+) create mode 100644 src/javax/media/j3d/GeometryArray.java (limited to 'src/javax/media/j3d/GeometryArray.java') diff --git a/src/javax/media/j3d/GeometryArray.java b/src/javax/media/j3d/GeometryArray.java new file mode 100644 index 0000000..f830acc --- /dev/null +++ b/src/javax/media/j3d/GeometryArray.java @@ -0,0 +1,7467 @@ +/* + * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + */ + +package javax.media.j3d; + +import javax.vecmath.Color3b; +import javax.vecmath.Color3f; +import javax.vecmath.Color4b; +import javax.vecmath.Color4f; +import javax.vecmath.Point2f; +import javax.vecmath.Point3d; +import javax.vecmath.Point3f; +import javax.vecmath.Point4f; +import javax.vecmath.TexCoord2f; +import javax.vecmath.TexCoord3f; +import javax.vecmath.TexCoord4f; +import javax.vecmath.Vector3f; + + +/** + * The GeometryArray object contains separate arrays of positional + * coordinates, colors, normals, texture coordinates, and vertex + * attributes that + * describe point, line, or polygon geometry. This class is extended + * to create the various primitive types (such as lines, + * triangle strips, etc.). + * Vertex data may be passed to this geometry array in one of two + * ways: by copying the data into the array using the existing + * methods, or by passing a reference to the data. + *

+ *

+ *

+ * All colors used in the geometry array object must be in the range [0.0,1.0]. + * Values outside this range will cause undefined results. + * All normals used in the geometry array object must be unit length + * vectors. That is their geometric length must be 1.0. Normals that + * are not unit length vectors will cause undefined results. + *

+ * Note that the term coordinate, as used in the method names + * and method descriptions, actually refers to a set of x, + * y, and z coordinates representing the position of a + * single vertex. The term coordinates (plural) is used to + * indicate sets of x, y, and z coordinates for + * multiple vertices. This is somewhat at odds with the mathematical + * definition of a coordinate, but is used as a convenient shorthand. + * Similarly, the term texture coordinate is used to indicate a + * set of texture coordinates for a single vertex, while the term + * texture coordinates (plural) is used to indicate sets of + * texture coordinates for multiple vertices. + */ + +public abstract class GeometryArray extends Geometry { + + /** + * Specifies that this GeometryArray allows reading the array of + * coordinates. + */ + public static final int + ALLOW_COORDINATE_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COORDINATE_READ; + + /** + * Specifies that this GeometryArray allows writing the array of + * coordinates. + */ + public static final int + ALLOW_COORDINATE_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COORDINATE_WRITE; + + /** + * Specifies that this GeometryArray allows reading the array of + * colors. + */ + public static final int + ALLOW_COLOR_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COLOR_READ; + + /** + * Specifies that this GeometryArray allows writing the array of + * colors. + */ + public static final int + ALLOW_COLOR_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COLOR_WRITE; + + /** + * Specifies that this GeometryArray allows reading the array of + * normals. + */ + public static final int + ALLOW_NORMAL_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_NORMAL_READ; + + /** + * Specifies that this GeometryArray allows writing the array of + * normals. + */ + public static final int + ALLOW_NORMAL_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_NORMAL_WRITE; + + /** + * Specifies that this GeometryArray allows reading the array of + * texture coordinates. + */ + public static final int + ALLOW_TEXCOORD_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_TEXCOORD_READ; + + /** + * Specifies that this GeometryArray allows writing the array of + * texture coordinates. + */ + public static final int + ALLOW_TEXCOORD_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_TEXCOORD_WRITE; + + /** + * Specifies that this GeometryArray allows reading the array of + * vertex attributes. + * + * @since Java 3D 1.4 + */ + public static final int + ALLOW_VERTEX_ATTR_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_READ; + + /** + * Specifies that this GeometryArray allows writing the array of + * vertex attributes. + * + * @since Java 3D 1.4 + */ + public static final int + ALLOW_VERTEX_ATTR_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_WRITE; + + /** + * Specifies that this GeometryArray allows reading the count or + * initial index information for this object. + */ + public static final int + ALLOW_COUNT_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COUNT_READ; + + /** + * Specifies that this GeometryArray allows writing the count or + * initial index information for this object. + * + * @since Java 3D 1.2 + */ + public static final int + ALLOW_COUNT_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COUNT_WRITE; + + /** + * Specifies that this GeometryArray allows reading the vertex format + * information for this object. + */ + public static final int + ALLOW_FORMAT_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_FORMAT_READ; + + /** + * Specifies that this GeometryArray allows reading the geometry + * data reference information for this object. This is only used in + * by-reference geometry mode. + * + * @since Java 3D 1.2 + */ + public static final int + ALLOW_REF_DATA_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_REF_DATA_READ; + + private static final int J3D_1_2_ALLOW_REF_DATA_READ = + CapabilityBits.J3D_1_2_GEOMETRY_ARRAY_ALLOW_REF_DATA_READ; + + /** + * Specifies that this GeometryArray allows writing the geometry + * data reference information for this object. It also enables + * writing the referenced data itself, via the GeometryUpdater + * interface. This is only used in by-reference geometry mode. + * + * @since Java 3D 1.2 + */ + public static final int + ALLOW_REF_DATA_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_REF_DATA_WRITE; + + /** + * Specifies that this GeometryArray contains an array of coordinates. + * This bit must be set. + */ + public static final int COORDINATES = 0x01; + + /** + * Specifies that this GeometryArray contains an array of normals. + */ + public static final int NORMALS = 0x02; + + /** + * Specifies that this GeometryArray contains an array of colors. + */ + static final int COLOR = 0x04; + + /** + * Specifies that this GeometryArray's colors contain alpha. + */ + static final int WITH_ALPHA = 0x08; + + /** + * Specifies that this GeometryArray contains an array of colors without alpha. + */ + public static final int COLOR_3 = COLOR; + + /** + * Specifies that this GeometryArray contains an array of colors with alpha. + * This takes precedence over COLOR_3. + */ + public static final int COLOR_4 = COLOR | WITH_ALPHA; + + /** + * Specifies that this GeometryArray contains one or more arrays of + * 2D texture coordinates. + */ + public static final int TEXTURE_COORDINATE_2 = 0x20; + + /** + * Specifies that this GeometryArray contains one or more arrays of + * 3D texture coordinates. + * This takes precedence over TEXTURE_COORDINATE_2. + */ + public static final int TEXTURE_COORDINATE_3 = 0x40; + + + /** + * Specifies that this GeometryArray contains one or more arrays of + * 4D texture coordinates. + * This takes precedence over TEXTURE_COORDINATE_2 and TEXTURE_COORDINATE_3. + * + * @since Java 3D 1.3 + */ + public static final int TEXTURE_COORDINATE_4 = 0x400; + + + static final int TEXTURE_COORDINATE = TEXTURE_COORDINATE_2 | + TEXTURE_COORDINATE_3 | + TEXTURE_COORDINATE_4; + + /** + * Specifies that the position, color, normal, and texture coordinate + * data for this GeometryArray are accessed by reference. + * + * @since Java 3D 1.2 + */ + public static final int BY_REFERENCE = 0x80; + + + /** + * Specifies that the position, color, normal, and texture + * coordinate data for this GeometryArray are accessed via a single + * interleaved, floating-point array reference. All of the data + * values for each vertex are stored in consecutive memory + * locations. This flag is only valid in conjunction with the + * BY_REFERENCE flag. + * + * @since Java 3D 1.2 + */ + public static final int INTERLEAVED = 0x100; + + /** + * Specifies that geometry by-reference data for this + * GeometryArray, whether interleaved or non-interleaved, is + * accessed via J3DBuffer objects that wrap NIO Buffer objects, + * rather than float, double, byte, or TupleXX arrays. This flag + * is only valid in conjunction with the BY_REFERENCE + * flag. + * + * @see J3DBuffer + * @see #setCoordRefBuffer(J3DBuffer) + * @see #setColorRefBuffer(J3DBuffer) + * @see #setNormalRefBuffer(J3DBuffer) + * @see #setTexCoordRefBuffer(int,J3DBuffer) + * @see #setVertexAttrRefBuffer(int,J3DBuffer) + * @see #setInterleavedVertexBuffer(J3DBuffer) + * + * @since Java 3D 1.3 + */ + public static final int USE_NIO_BUFFER = 0x800; + + /** + * Specifies that only the coordinate indices are used for indexed + * geometry arrays. In this mode, the values from the coordinate + * index array are used as a single set of index values to access + * the vertex data for all five vertex components (coord, color, + * normal, texCoord, and vertexAttr). The color, normal, texCoord, + * and vertexAttr index arrays are neither allocated nor used. Any + * attempt to access the color, normal, texCoord, + * or vertexAttr index arrays will result in a NullPointerException. + * This flag is only valid for indexed geometry arrays + * (subclasses of IndexedGeometryArray). + * + * @since Java 3D 1.3 + */ + public static final int USE_COORD_INDEX_ONLY = 0x200; + + /** + * Specifies that this GeometryArray contains one or more arrays of + * vertex attributes. These attributes are used in programmable + * shading. + * + * @since Java 3D 1.4 + */ + public static final int VERTEX_ATTRIBUTES = 0x1000; + + //NVaidya + /** + * Specifies that the indices in this GeometryArray + * are accessed by reference. This flag is only valid for + * indexed geometry arrays (subclasses of IndexedGeometryArray) and only + * when used in conjunction with the BY_REFERENCE and + * USE_COORD_INDEX_ONLY flags. + * + * @since Java 3D 1.5 + */ + public static final int BY_REFERENCE_INDICES = 0x2000; + + // Used to keep track of the last bit (for adding new bits only) + private static final int LAST_FORMAT_BIT = 0x2000; + + // Scratch arrays for converting Point[234]f to TexCoord[234]f + private TexCoord2f [] texCoord2fArray = null; + private TexCoord3f [] texCoord3fArray = null; + private TexCoord4f [] texCoord4fArray = null; + private TexCoord2f texCoord2fScratch = null; + private TexCoord3f texCoord3fScratch = null; + + private static final int[] defTexCoordMap = { 0 }; + + // Array for setting default read capabilities + private static final int[] readCapabilities = { + ALLOW_COLOR_READ, + ALLOW_COORDINATE_READ, + ALLOW_COUNT_READ, + ALLOW_FORMAT_READ, + ALLOW_NORMAL_READ, + ALLOW_REF_DATA_READ, + ALLOW_TEXCOORD_READ, + ALLOW_VERTEX_ATTR_READ + }; + + + // non-public, no parameter constructor + GeometryArray() { + // set default read capabilities + setDefaultReadCapabilities(readCapabilities); + } + + //NVaidya + /** + * Constructs an empty GeometryArray object with the specified + * number of vertices and vertex format. Defaults are used + * for all other parameters. The default values are as follows: + *

+ * + * @param vertexCount the number of vertex elements in this GeometryArray + * @param vertexFormat a mask indicating which components are + * present in each vertex. This is specified as one or more + * individual flags that are bitwise "OR"ed together to describe + * the per-vertex data. + * The flags include: COORDINATES, to signal the inclusion of + * vertex positions--always present; NORMALS, to signal + * the inclusion of per vertex normals; one of COLOR_3 or + * COLOR_4, to signal the inclusion of per vertex + * colors (without or with alpha information); one of + * TEXTURE_COORDINATE_2, TEXTURE_COORDINATE_3 + * or TEXTURE_COORDINATE_4, + * to signal the + * inclusion of per-vertex texture coordinates (2D, 3D or 4D); + * BY_REFERENCE, to indicate that the data is passed + * by reference + * rather than by copying; INTERLEAVED, to indicate + * that the referenced + * data is interleaved in a single array; + * USE_NIO_BUFFER, to indicate that the referenced data + * is accessed via a J3DBuffer object that wraps an NIO buffer; + * USE_COORD_INDEX_ONLY, + * to indicate that only the coordinate indices are used for indexed + * geometry arrays; + * BY_REFERENCE_INDICES, to indicate + * that the indices are accessed by reference in indexed + * geometry arrays.

+ * + * @exception IllegalArgumentException if vertexCount < 0 + * + * @exception IllegalArgumentException if vertexFormat does not + * include COORDINATES + * + * @exception IllegalArgumentException if the USE_COORD_INDEX_ONLY + * bit or the BY_REFERENCE_INDICES bit is set for + * non-indexed geometry arrays (that is, GeometryArray objects + * that are not a subclass of IndexedGeometryArray) + * + * @exception IllegalArgumentException if the INTERLEAVED + * bit is set without the BY_REFERENCE bit being set + * + * @exception IllegalArgumentException if the USE_NIO_BUFFER + * bit is set without the BY_REFERENCE bit being set + * + * @exception IllegalArgumentException if the INTERLEAVED + * bit and the VERTEX_ATTRIBUTES bit are both set + * + * @exception IllegalArgumentException if the + * BY_REFERENCE_INDICES + * bit is set without the BY_REFERENCE and + * USE_COORD_INDEX_ONLY bits being set + */ + public GeometryArray(int vertexCount, int vertexFormat) { + this(vertexCount, vertexFormat, + ((vertexFormat & TEXTURE_COORDINATE) != 0 ? 1 : 0), + ((vertexFormat & TEXTURE_COORDINATE) != 0 ? defTexCoordMap : null)); + } + + + //NVaidya + /** + * Constructs an empty GeometryArray object with the specified + * number of vertices, vertex format, number of texture coordinate + * sets, and texture coordinate mapping array. Defaults are used + * for all other parameters. + * + * @param vertexCount the number of vertex elements in this + * GeometryArray

+ * + * @param vertexFormat a mask indicating which components are + * present in each vertex. This is specified as one or more + * individual flags that are bitwise "OR"ed together to describe + * the per-vertex data. + * The flags include: COORDINATES, to signal the inclusion of + * vertex positions--always present; NORMALS, to signal + * the inclusion of per vertex normals; one of COLOR_3 or + * COLOR_4, to signal the inclusion of per vertex + * colors (without or with alpha information); one of + * TEXTURE_COORDINATE_2 or TEXTURE_COORDINATE_3 + * or TEXTURE_COORDINATE_4, + * to signal the + * inclusion of per-vertex texture coordinates (2D , 3D or 4D); + * BY_REFERENCE, to indicate that the data is passed + * by reference + * rather than by copying; INTERLEAVED, to indicate + * that the referenced + * data is interleaved in a single array; + * USE_NIO_BUFFER, to indicate that the referenced data + * is accessed via a J3DBuffer object that wraps an NIO buffer; + * USE_COORD_INDEX_ONLY, + * to indicate that only the coordinate indices are used for indexed + * geometry arrays; + * BY_REFERENCE_INDICES, to indicate + * that the indices are accessed by reference in indexed + * geometry arrays.

+ * + * @param texCoordSetCount the number of texture coordinate sets + * in this GeometryArray object. If vertexFormat + * does not include one of TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3, the + * texCoordSetCount parameter is not used.

+ * + * + * @param texCoordSetMap an array that maps texture coordinate + * sets to texture units. The array is indexed by texture unit + * number for each texture unit in the associated Appearance + * object. The values in the array specify the texture coordinate + * set within this GeometryArray object that maps to the + * corresponding texture + * unit. All elements within the array must be less than + * texCoordSetCount. A negative value specifies that + * no texture coordinate set maps to the texture unit + * corresponding to the index. If there are more texture units in + * any associated Appearance object than elements in the mapping + * array, the extra elements are assumed to be -1. The same + * texture coordinate set may be used for more than one texture + * unit. Each texture unit in every associated Appearance must + * have a valid source of texture coordinates: either a + * non-negative texture coordinate set must be specified in the + * mapping array or texture coordinate generation must be enabled. + * Texture coordinate generation will take precedence for those + * texture units for which a texture coordinate set is specified + * and texture coordinate generation is enabled. If + * vertexFormat does not include one of + * TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3 or + * TEXTURE_COORDINATE_4, the + * texCoordSetMap array is not used. The following example + * illustrates the use of the texCoordSetMap array. + * + *

+ *

+ *

+ * + * @exception IllegalArgumentException if vertexCount < 0 + * + * @exception IllegalArgumentException if vertexFormat does not + * include COORDINATES + * + * @exception IllegalArgumentException if the USE_COORD_INDEX_ONLY + * bit or the BY_REFERENCE_INDICES bit is set for + * non-indexed geometry arrays (that is, GeometryArray objects + * that are not a subclass of IndexedGeometryArray) + * + * @exception IllegalArgumentException if the INTERLEAVED + * bit is set without the BY_REFERENCE bit being set + * + * @exception IllegalArgumentException if the USE_NIO_BUFFER + * bit is set without the BY_REFERENCE bit being set + * + * @exception IllegalArgumentException if the INTERLEAVED + * bit and the VERTEX_ATTRIBUTES bit are both set + * + * @exception IllegalArgumentException if the + * BY_REFERENCE_INDICES + * bit is set without the BY_REFERENCE and + * USE_COORD_INDEX_ONLY bits being set + * + * @exception IllegalArgumentException if + * texCoordSetCount < 0 + * + * @exception IllegalArgumentException if any element in + * texCoordSetMap[] >= texCoordSetCount. + * + * @since Java 3D 1.2 + */ + public GeometryArray(int vertexCount, + int vertexFormat, + int texCoordSetCount, + int[] texCoordSetMap) { + this(vertexCount, vertexFormat, texCoordSetCount, texCoordSetMap, 0, null); + } + + + //NVaidya + /** + * Constructs an empty GeometryArray object with the specified + * number of vertices, vertex format, number of texture coordinate + * sets, texture coordinate mapping array, vertex attribute count, + * and vertex attribute sizes array. + * + * @param vertexCount the number of vertex elements in this + * GeometryArray

+ * + * @param vertexFormat a mask indicating which components are + * present in each vertex. This is specified as one or more + * individual flags that are bitwise "OR"ed together to describe + * the per-vertex data. + * The flags include: COORDINATES, to signal the inclusion of + * vertex positions--always present; NORMALS, to signal + * the inclusion of per vertex normals; one of COLOR_3 or + * COLOR_4, to signal the inclusion of per vertex + * colors (without or with alpha information); one of + * TEXTURE_COORDINATE_2 or TEXTURE_COORDINATE_3 + * or TEXTURE_COORDINATE_4, + * to signal the + * inclusion of per-vertex texture coordinates (2D , 3D or 4D); + * VERTEX_ATTRIBUTES, to signal + * the inclusion of one or more arrays of vertex attributes; + * BY_REFERENCE, to indicate that the data is passed + * by reference + * rather than by copying; INTERLEAVED, to indicate + * that the referenced + * data is interleaved in a single array; + * USE_NIO_BUFFER, to indicate that the referenced data + * is accessed via a J3DBuffer object that wraps an NIO buffer; + * USE_COORD_INDEX_ONLY, + * to indicate that only the coordinate indices are used for indexed + * geometry arrays; + * BY_REFERENCE_INDICES, to indicate + * that the indices are accessed by reference in indexed + * geometry arrays.

+ * + * @param texCoordSetCount the number of texture coordinate sets + * in this GeometryArray object. If vertexFormat + * does not include one of TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3, the + * texCoordSetCount parameter is not used.

+ * + * + * @param texCoordSetMap an array that maps texture coordinate + * sets to texture units. The array is indexed by texture unit + * number for each texture unit in the associated Appearance + * object. The values in the array specify the texture coordinate + * set within this GeometryArray object that maps to the + * corresponding texture + * unit. All elements within the array must be less than + * texCoordSetCount. A negative value specifies that + * no texture coordinate set maps to the texture unit + * corresponding to the index. If there are more texture units in + * any associated Appearance object than elements in the mapping + * array, the extra elements are assumed to be -1. The same + * texture coordinate set may be used for more than one texture + * unit. Each texture unit in every associated Appearance must + * have a valid source of texture coordinates: either a + * non-negative texture coordinate set must be specified in the + * mapping array or texture coordinate generation must be enabled. + * Texture coordinate generation will take precedence for those + * texture units for which a texture coordinate set is specified + * and texture coordinate generation is enabled. If + * vertexFormat does not include one of + * TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3 or + * TEXTURE_COORDINATE_4, the + * texCoordSetMap array is not used. The following example + * illustrates the use of the texCoordSetMap array. + * + *

+ *

+ *

+ * + * @param vertexAttrCount the number of vertex attributes + * in this GeometryArray object. If vertexFormat + * does not include VERTEX_ATTRIBUTES, the + * vertexAttrCount parameter must be 0.

+ * + * @param vertexAttrSizes is an array that specifes the size of + * each vertex attribute. Each element in the array specifies the + * number of components in the attribute, from 1 to 4. The length + * of the array must be equal to vertexAttrCount.

+ * + * @exception IllegalArgumentException if vertexCount < 0 + * + * @exception IllegalArgumentException if vertexFormat does not + * include COORDINATES + * + * @exception IllegalArgumentException if the USE_COORD_INDEX_ONLY + * bit or the BY_REFERENCE_INDICES bit is set for + * non-indexed geometry arrays (that is, GeometryArray objects + * that are not a subclass of IndexedGeometryArray) + * + * @exception IllegalArgumentException if the INTERLEAVED + * bit is set without the BY_REFERENCE bit being set + * + * @exception IllegalArgumentException if the USE_NIO_BUFFER + * bit is set without the BY_REFERENCE bit being set + * + * @exception IllegalArgumentException if the INTERLEAVED + * bit and the VERTEX_ATTRIBUTES bit are both set + * + * @exception IllegalArgumentException if the + * BY_REFERENCE_INDICES + * bit is set without the BY_REFERENCE and + * USE_COORD_INDEX_ONLY bits being set + * + * @exception IllegalArgumentException if + * texCoordSetCount < 0 + * + * @exception IllegalArgumentException if any element in + * texCoordSetMap[] >= texCoordSetCount. + * + * @exception IllegalArgumentException if + * vertexAttrCount > 0 and the + * VERTEX_ATTRIBUTES bit is not set + * + * @exception IllegalArgumentException if + * vertexAttrCount < 0 + * + * @exception IllegalArgumentException if + * vertexAttrSizes.length != vertexAttrCount + * + * @exception IllegalArgumentException if any element in + * vertexAttrSizes[] is < 1 or + * > 4. + * + * @since Java 3D 1.4 + */ + public GeometryArray(int vertexCount, + int vertexFormat, + int texCoordSetCount, + int[] texCoordSetMap, + int vertexAttrCount, + int[] vertexAttrSizes) { + + if (vertexCount < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray96")); + + if (texCoordSetCount < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray124")); + + if (vertexAttrCount < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray125")); + + if ((vertexFormat & COORDINATES) == 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray0")); + + if ((vertexFormat & INTERLEAVED) != 0 && + (vertexFormat & BY_REFERENCE) == 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray80")); + + if ((vertexFormat & INTERLEAVED) != 0 && + (vertexFormat & VERTEX_ATTRIBUTES) != 0) { + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray128")); + } + + if ((vertexFormat & USE_COORD_INDEX_ONLY) != 0 && + !(this instanceof IndexedGeometryArray)) { + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray135")); + } + + //NVaidya + if ((vertexFormat & BY_REFERENCE_INDICES) != 0) { + if (!(this instanceof IndexedGeometryArray)) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray136")); + if ((vertexFormat & BY_REFERENCE) == 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray137")); + if ((vertexFormat & USE_COORD_INDEX_ONLY) == 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray138")); + } + + if ((vertexFormat & USE_NIO_BUFFER) != 0 && + (vertexFormat & BY_REFERENCE) == 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray117")); + + if ((vertexFormat & TEXTURE_COORDINATE) != 0) { + if (texCoordSetMap == null) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray106")); + + if (texCoordSetCount == 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray107")); + + for (int i = 0; i < texCoordSetMap.length; i++) { + if (texCoordSetMap[i] >= texCoordSetCount) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray108")); + } + + if ((vertexFormat & TEXTURE_COORDINATE_2) != 0) { + texCoord2fArray = new TexCoord2f[1]; + texCoord2fScratch = new TexCoord2f(); + } + else if ((vertexFormat & TEXTURE_COORDINATE_3) != 0) { + texCoord3fArray = new TexCoord3f[1]; + texCoord3fScratch = new TexCoord3f(); + } + else if ((vertexFormat & TEXTURE_COORDINATE_4) != 0) { + texCoord4fArray = new TexCoord4f[1]; + } + } + + if ((vertexFormat & VERTEX_ATTRIBUTES) != 0) { + if (vertexAttrCount > 0) { + if (vertexAttrCount != vertexAttrSizes.length) { + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray132")); + } + + for (int i = 0; i < vertexAttrSizes.length; i++) { + if (vertexAttrSizes[i] < 1 || vertexAttrSizes[i] > 4) { + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray133")); + } + } + } else { + if (vertexAttrSizes != null && vertexAttrSizes.length != 0) { + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray132")); + } + } + } else { + if (vertexAttrCount > 0) { + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray131")); + } + } + + // set default read capabilities + setDefaultReadCapabilities(readCapabilities); + + ((GeometryArrayRetained)this.retained).createGeometryArrayData( + vertexCount, vertexFormat, + texCoordSetCount, texCoordSetMap, + vertexAttrCount, vertexAttrSizes); + + } + + + //------------------------------------------------------------------ + // Common methods + //------------------------------------------------------------------ + + /** + * Retrieves the number of vertices in this GeometryArray + * @return number of vertices in this GeometryArray + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + */ + public int getVertexCount() { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray1")); + + return ((GeometryArrayRetained)this.retained).getVertexCount(); + } + + /** + * Retrieves the vertexFormat of this GeometryArray + * @return format of vertices in this GeometryArray + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + */ + public int getVertexFormat() { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_FORMAT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray2")); + + return ((GeometryArrayRetained)this.retained).getVertexFormat(); + } + + + /** + * Retrieves the number of texture coordinate sets in this + * GeometryArray object. + * + * @return the number of texture coordinate sets + * in this GeometryArray object + * + * @since Java 3D 1.2 + */ + public int getTexCoordSetCount() { + return ((GeometryArrayRetained)this.retained).getTexCoordSetCount(); + } + + + /** + * Retrieves the length of the texture coordinate set mapping + * array of this GeometryArray object. + * + * @return the length of the texture coordinate set mapping + * array of this GeometryArray object + * + * @since Java 3D 1.2 + */ + public int getTexCoordSetMapLength() { + return ((GeometryArrayRetained)this.retained).getTexCoordSetMapLength(); + } + + + /** + * Retrieves the texture coordinate set mapping + * array from this GeometryArray object. + * + * @param texCoordSetMap an array that will receive a copy of the + * texture coordinate set mapping array. The array must be large + * enough to hold all entries of the texture coordinate set + * mapping array. + * + * @since Java 3D 1.2 + */ + public void getTexCoordSetMap(int[] texCoordSetMap) { + ((GeometryArrayRetained)this.retained).getTexCoordSetMap(texCoordSetMap); + } + + + /** + * Retrieves the number of vertex attributes in this GeometryArray + * object. + * + * @return the number of vertex attributes in this GeometryArray + * object + * + * @since Java 3D 1.4 + */ + public int getVertexAttrCount() { + return ((GeometryArrayRetained)this.retained).getVertexAttrCount(); + } + + + /** + * Retrieves the vertex attribute sizes array from this + * GeometryArray object. + * + * @param vertexAttrSizes an array that will receive a copy of + * the vertex attribute sizes array. The array must hold at least + * vertexAttrCount elements. + * + * @since Java 3D 1.4 + */ + public void getVertexAttrSizes(int[] vertexAttrSizes) { + ((GeometryArrayRetained)this.retained).getVertexAttrSizes(vertexAttrSizes); + } + + + /** + * Updates geometry array data that is accessed by reference. + * This method calls the updateData method of the specified + * GeometryUpdater object to synchronize updates to vertex + * data that is referenced by this GeometryArray object. + * Applications that wish to modify such data must perform all + * updates via this method. + *

+ * This method may also be used to atomically set multiple + * references (for example, to coordinate and color arrays) + * or to atomically + * change multiple data values through the geometry data copying + * methods. + * + * @param updater object whose updateData callback method will be + * called to update the data referenced by this GeometryArray. + * @exception CapabilityNotSetException if the appropriate capability + * is not set, the vertex data mode is BY_REFERENCE, and this + * object is part of a live or compiled scene graph + * + * @since Java 3D 1.2 + */ + public void updateData(GeometryUpdater updater) { + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0 && + isLiveOrCompiled() && + !this.getCapability(ALLOW_REF_DATA_WRITE)) { + + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray81")); + } + + ((GeometryArrayRetained)this.retained).updateData(updater); + } + + + /** + * Sets the valid vertex count for this GeometryArray object. + * This count specifies the number of vertices actually used in + * rendering or other operations such as picking and collision. + * This attribute is initialized to vertexCount. + * + * @param validVertexCount the new valid vertex count. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + *

+ * @exception IllegalArgumentException if any of the following are + * true: + *

    + * validVertexCount < 0,
    + * initialVertexIndex + validVertexCount > vertexCount,
    + * initialCoordIndex + validVertexCount > vertexCount,
    + * initialColorIndex + validVertexCount > vertexCount,
    + * initialNormalIndex + validVertexCount > vertexCount,
    + * initialTexCoordIndex + validVertexCount > vertexCount,
    + * initialVertexAttrIndex + validVertexCount > vertexCount + *
+ *

+ * @exception ArrayIndexOutOfBoundsException if the geometry data format + * is BY_REFERENCE and any the following + * are true for non-null array references: + *

    + * CoordRef.length < num_words * + * (initialCoordIndex + validVertexCount),
    + * ColorRef.length < num_words * + * (initialColorIndex + validVertexCount),
    + * NormalRef.length < num_words * + * (initialNormalIndex + validVertexCount),
    + * TexCoordRef.length < num_words * + * (initialTexCoordIndex + validVertexCount),
    + * VertexAttrRef.length < num_words * + * (initialVertexAttrIndex + validVertexCount),
    + * InterleavedVertices.length < words_per_vertex * + * (initialVertexIndex + validVertexCount)
    + *
+ * where num_words depends on which variant of + * setArrayRef is used, and + * words_per_vertex depends on which vertex formats are enabled + * for interleaved arrays. + * + * @since Java 3D 1.2 + */ + public void setValidVertexCount(int validVertexCount) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray88")); + + if (validVertexCount < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray96")); + + ((GeometryArrayRetained)this.retained).setValidVertexCount(validVertexCount); + // NOTE: the checks for initial*Index + validVertexCount > + // vertexCount need to be done in the retained method + } + + + /** + * Gets the valid vertex count for this GeometryArray object. + * For geometry strip primitives (subclasses of GeometryStripArray), + * the valid vertex count is defined to be the sum of the + * stripVertexCounts array. + * @return the current valid vertex count + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @since Java 3D 1.2 + */ + public int getValidVertexCount() { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray89")); + + return ((GeometryArrayRetained)this.retained).getValidVertexCount(); + } + + + /** + * Copies all node information from originalNodeComponent + * into the current node. This method is called from the + * duplicateNode method. This routine does + * the actual duplication of all "local data" (any data defined in + * this object). + * + * @param originalNodeComponent the original node to duplicate. + * @param forceDuplicate when set to true, causes the + * duplicateOnCloneTree flag to be ignored. When + * false, the value of each node's + * duplicateOnCloneTree variable determines whether + * NodeComponent data is duplicated or copied. + * + * @see Node#cloneTree + * @see NodeComponent#setDuplicateOnCloneTree + */ + @Override + void duplicateAttributes(NodeComponent originalNodeComponent, + boolean forceDuplicate) { + + super.duplicateAttributes(originalNodeComponent, forceDuplicate); + // vertexFormat and vertexCount are copied in subclass when constructor + // public GeometryArray(int vertexCount, int vertexFormat) is used + // in cloneNodeComponent() + GeometryArrayRetained src = (GeometryArrayRetained) originalNodeComponent.retained; + GeometryArrayRetained dst = (GeometryArrayRetained) retained; + int format = src.getVertexFormat(); + if ((format & BY_REFERENCE) == 0) { + System.arraycopy(src.vertexData, 0, dst.vertexData, 0, + src.vertexData.length); + dst.setInitialVertexIndex(src.getInitialVertexIndex()); + + } else { + dst.setInitialCoordIndex(src.getInitialCoordIndex()); + dst.setInitialColorIndex(src.getInitialColorIndex()); + dst.setInitialNormalIndex(src.getInitialNormalIndex()); + int setCount = src.getTexCoordSetCount(); + int vAttrCount = src.getVertexAttrCount(); + for (int i=0; i < setCount; i++) { + dst.setInitialTexCoordIndex(i, src.getInitialTexCoordIndex(i)); + } + if ((format & INTERLEAVED) == 0) { + if ((format & USE_NIO_BUFFER) == 0) { + // Java arrays + dst.setCoordRefFloat(src.getCoordRefFloat()); + dst.setCoordRefDouble(src.getCoordRefDouble()); + dst.setCoordRef3f(src.getCoordRef3f()); + dst.setCoordRef3d(src.getCoordRef3d()); + dst.setColorRefFloat(src.getColorRefFloat()); + dst.setColorRefByte(src.getColorRefByte()); + if ((format & WITH_ALPHA) == 0) { + dst.setColorRef3f(src.getColorRef3f()); + dst.setColorRef3b(src.getColorRef3b()); + } else { + dst.setColorRef4f(src.getColorRef4f()); + dst.setColorRef4b(src.getColorRef4b()); + } + dst.setNormalRefFloat(src.getNormalRefFloat()); + dst.setNormalRef3f(src.getNormalRef3f()); + + switch (src.getVertexAttrType()) { + case GeometryArrayRetained.AF: + for (int i=0; i < vAttrCount; i++) { + dst.setVertexAttrRefFloat(i, src.getVertexAttrRefFloat(i)); + } + break; + } + + switch (src.getTexCoordType()) { + case GeometryArrayRetained.TF: + for (int i=0; i < setCount; i++) { + dst.setTexCoordRefFloat(i, src.getTexCoordRefFloat(i)); + } + break; + case GeometryArrayRetained.T2F: + for (int i=0; i < setCount; i++) { + dst.setTexCoordRef2f(i, src.getTexCoordRef2f(i)); + } + break; + case GeometryArrayRetained.T3F: + for (int i=0; i < setCount; i++) { + dst.setTexCoordRef3f(i, src.getTexCoordRef3f(i)); + } + break; + } + } else { + // NIO buffer + dst.setCoordRefBuffer(src.getCoordRefBuffer()); + dst.setColorRefBuffer(src.getColorRefBuffer()); + dst.setNormalRefBuffer(src.getNormalRefBuffer()); + + switch (src.getVertexAttrType()) { + case GeometryArrayRetained.AF: + for (int i=0; i < vAttrCount; i++) { + dst.setVertexAttrRefBuffer(i, src.getVertexAttrRefBuffer(i)); + } + break; + } + + switch (src.getTexCoordType()) { + case GeometryArrayRetained.TF: + for (int i=0; i < setCount; i++) { + dst.setTexCoordRefBuffer(i, src.getTexCoordRefBuffer(i)); + } + break; + } + } + } else { + dst.setInterleavedVertices(src.getInterleavedVertices()); + } + } + } + + + //------------------------------------------------------------------ + // By-copying methods + //------------------------------------------------------------------ + + /** + * Sets the initial vertex index for this GeometryArray object. + * This index specifies the first vertex within this geometry + * array that is actually used in rendering or other operations + * such as picking and collision. This attribute is initialized + * to 0. + * This attribute is only used when the data mode for this + * geometry array object is not BY_REFERENCE + * or when the data mode is INTERLEAVED. + * + * @param initialVertexIndex the new initial vertex index. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalArgumentException if either of the following are + * true: + *
    + * initialVertexIndex < 0 or
    + * initialVertexIndex + validVertexCount > vertexCount
    + *
+ * + * @exception ArrayIndexOutOfBoundsException if the geometry data format + * is INTERLEAVED, the InterleavedVertices array is + * non-null, and: + *
    + * InterleavedVertices.length < num_words * + * (initialVertexIndex + validVertexCount)
    + *
+ * where num_words depends on which vertex formats are enabled. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE and is not + * INTERLEAVED. + * + * @since Java 3D 1.2 + */ + public void setInitialVertexIndex(int initialVertexIndex) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); + + if (initialVertexIndex < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0 && (format & INTERLEAVED) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray105")); + + ((GeometryArrayRetained)this.retained).setInitialVertexIndex(initialVertexIndex); + // NOTE: the check for initialVertexIndex + validVertexCount > + // vertexCount is done in the retained method + } + + + /** + * Gets the initial vertex index for this GeometryArray object. + * This attribute is only used when the data mode for this + * geometry array object is not BY_REFERENCE + * or when the data mode is INTERLEAVED. + * @return the current initial vertex index for this GeometryArray object. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @since Java 3D 1.2 + */ + public int getInitialVertexIndex() { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); + + return ((GeometryArrayRetained)this.retained).getInitialVertexIndex(); + } + + + /** + * Sets the coordinate associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param coordinate source array of 3 values containing the new coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinate(int index, float coordinate[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); + } + + /** + * Sets the coordinate associated with the vertex at + * the specified index. + * @param index destination vertex index in this geometry array + * @param coordinate source array of 3 values containing the new coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinate(int index, double coordinate[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); + } + + /** + * Sets the coordinate associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param coordinate a point containing the new coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinate(int index, Point3f coordinate) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); + } + + /** + * Sets the coordinate associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param coordinate a point containing the new coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinate(int index, Point3d coordinate) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of 3*n values containing n new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, float coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of 3*n values containing n new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, double coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of points containing new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, Point3f coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of points containing new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, Point3d coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object using coordinate data starting + * from vertex index start for length vertices. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of 3*n values containing n new coordinates + * @param start starting source vertex index in coordinates array. + * @param length number of vertices to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, float coordinates[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, + start, length); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object using coordinate data starting + * from vertex index start for length vertices. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of 3*n values containing n new coordinates + * @param start starting source vertex index in coordinates array. + * @param length number of vertices to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, double coordinates[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, + start, length); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object using coordinate data starting + * from vertex index start for length vertices. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of points containing new coordinates + * @param start starting source vertex index in coordinates array. + * @param length number of vertices to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, Point3f coordinates[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, + start, length); + } + + /** + * Sets the coordinates associated with the vertices starting at + * the specified index for this object using coordinate data starting + * from vertex index start for length vertices. + * @param index starting destination vertex index in this geometry array + * @param coordinates source array of points containing new coordinates + * @param start starting source vertex index in coordinates array. + * @param length number of vertices to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setCoordinates(int index, Point3d coordinates[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, + start, length); + } + + /** + * Sets the color associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param color source array of 3 or 4 values containing the new color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setColor(int index, float color[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).setColor(index, color); + } + + /** + * Sets the color associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param color source array of 3 or 4 values containing the new color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setColor(int index, byte color[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).setColor(index, color); + } + + /** + * Sets the color associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param color a Color3f containing the new color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in the vertex + * format + */ + public void setColor(int index, Color3f color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColor(index, color); + } + + /** + * Sets the color associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param color a Color4f containing the new color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in the vertex + * format + */ + public void setColor(int index, Color4f color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColor(index, color); + } + + /** + * Sets the color associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param color a Color3b containing the new color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in the vertex + * format + */ + public void setColor(int index, Color3b color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColor(index, color); + } + + /** + * Sets the color associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param color a Color4b containing the new color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in the vertex + * format + */ + public void setColor(int index, Color4b color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColor(index, color); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param colors source array of 3*n or 4*n values containing n new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setColors(int index, float colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param colors source array of 3*n or 4*n values containing n new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setColors(int index, byte colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color3f objects containing new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in vertex format + */ + public void setColors(int index, Color3f colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color4f objects containing new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in vertex format + */ + public void setColors(int index, Color4f colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color3b objects containing new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in vertex format + */ + public void setColors(int index, Color3b colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color4b objects containing new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in vertex format + */ + public void setColors(int index, Color4b colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object using data in colors + * starting at index start for length colors. + * @param index starting destination vertex index in this geometry array + * @param colors source array of 3*n or 4*n values containing n new colors + * @param start starting source vertex index in colors array. + * @param length number of colors to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setColors(int index, float colors[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors, start, + length); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object using data in colors + * starting at index start for length colors. + * @param index starting destination vertex index in this geometry array + * @param colors source array of 3*n or 4*n values containing n new colors + * @param start starting source vertex index in colors array. + * @param length number of colors to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setColors(int index, byte colors[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors, start, + length); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object using data in colors + * starting at index start for length colors. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color3f objects containing new colors + * @param start starting source vertex index in colors array. + * @param length number of colors to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in vertex format + */ + public void setColors(int index, Color3f colors[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors, start, + length); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object using data in colors + * starting at index start for length colors. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color4f objects containing new colors + * @param start starting source vertex index in colors array. + * @param length number of colors to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in vertex format + */ + public void setColors(int index, Color4f colors[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors, start, + length); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object using data in colors + * starting at index start for length colors. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color3b objects containing new colors + * @param start starting source vertex index in colors array. + * @param length number of colors to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in vertex format + */ + public void setColors(int index, Color3b colors[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors, start, + length); + } + + /** + * Sets the colors associated with the vertices starting at + * the specified index for this object using data in colors + * starting at index start for length colors. + * @param index starting destination vertex index in this geometry array + * @param colors source array of Color4b objects containing new colors + * @param start starting source vertex index in colors array. + * @param length number of colors to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in vertex format + */ + public void setColors(int index, Color4b colors[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColors(index, colors, start, + length); + } + + /** + * Sets the normal associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param normal source array of 3 values containing the new normal + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setNormal(int index, float normal[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray33")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).setNormal(index, normal); + } + + /** + * Sets the normal associated with the vertex at + * the specified index for this object. + * @param index destination vertex index in this geometry array + * @param normal the vector containing the new normal + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setNormal(int index, Vector3f normal) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray33")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).setNormal(index, normal); + } + + /** + * Sets the normals associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param normals source array of 3*n values containing n new normals + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setNormals(int index, float normals[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).setNormals(index, normals); + } + + /** + * Sets the normals associated with the vertices starting at + * the specified index for this object. The entire source array is + * copied to this geometry array. + * @param index starting destination vertex index in this geometry array + * @param normals source array of vectors containing new normals + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setNormals(int index, Vector3f normals[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).setNormals(index, normals); + } + + /** + * Sets the normals associated with the vertices starting at + * the specified index for this object using data in normals + * starting at index start and ending at index start+length. + * @param index starting destination vertex index in this geometry array + * @param normals source array of 3*n values containing n new normals + * @param start starting source vertex index in normals array. + * @param length number of normals to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setNormals(int index, float normals[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).setNormals(index, normals, start, length); + } + + /** + * Sets the normals associated with the vertices starting at + * the specified index for this object using data in normals + * starting at index start and ending at index start+length. + * @param index starting destination vertex index in this geometry array + * @param normals source array of vectors containing new normals + * @param start starting source vertex index in normals array. + * @param length number of normals to be copied. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in + * constructor vertexFormat or array index for element is out of bounds. + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void setNormals(int index, Vector3f normals[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).setNormals(index, normals, start, length); + } + + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinate(int texCoordSet, ...) + */ + public void setTextureCoordinate(int index, float texCoord[]) { + setTextureCoordinate(0, index, texCoord); + } + + /** + * Sets the texture coordinate associated with the vertex at the + * specified index in the specified texture coordinate set for + * this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index destination vertex index in this geometry array + * @param texCoord source array of 2, 3 or 4 values containing the new + * texture coordinate + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinate(int texCoordSet, + int index, float texCoord[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoord, 0, 1); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinate(int texCoordSet, TexCoord2f texCoord) + */ + public void setTextureCoordinate(int index, Point2f texCoord) { + texCoord2fScratch.set(texCoord); + setTextureCoordinate(0, index, texCoord2fScratch); + } + + /** + * Sets the texture coordinate associated with the vertex at + * the specified index in the specified texture coordinate set + * for this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index destination vertex index in this geometry array + * @param texCoord the TexCoord2f containing the new texture coordinate + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_3 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinate(int texCoordSet, + int index, TexCoord2f texCoord) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); + + texCoord2fArray[0] = texCoord; + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoord2fArray, 0, 1); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinate(int texCoordSet, TexCoord3f texCoord) + */ + public void setTextureCoordinate(int index, Point3f texCoord) { + texCoord3fScratch.set(texCoord); + setTextureCoordinate(0, index, texCoord3fScratch); + } + + /** + * Sets the texture coordinate associated with the vertex at + * the specified index in the specified texture coordinate set + * for this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index destination vertex index in this geometry array + * @param texCoord the TexCoord3f containing the new texture coordinate + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinate(int texCoordSet, + int index, TexCoord3f texCoord) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); + + texCoord3fArray[0] = texCoord; + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoord3fArray, 0, 1); + } + + /** + * Sets the texture coordinate associated with the vertex at + * the specified index in the specified texture coordinate set + * for this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index destination vertex index in this geometry array + * @param texCoord the TexCoord4f containing the new texture coordinate + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3 is specified in vertex format + * + * @since Java 3D 1.3 + */ + public void setTextureCoordinate(int texCoordSet, + int index, TexCoord4f texCoord) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); + + texCoord4fArray[0] = texCoord; + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoord4fArray, 0, 1); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinates(int texCoordSet, ...) + */ + public void setTextureCoordinates(int index, float texCoords[]) { + setTextureCoordinates(0, index, texCoords); + } + + /** + * Sets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The entire source array is + * copied to this geometry array. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of 2*n, 3*n or 4*n values containing n new + * texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinates(int texCoordSet, + int index, float texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & GeometryArray.TEXTURE_COORDINATE_2) != 0) + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, 0, texCoords.length / 2); + else if ((format & GeometryArray.TEXTURE_COORDINATE_3) != 0) + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, 0, texCoords.length / 3); + else + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, 0, texCoords.length / 4); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinates(int texCoordSet, TexCoord2f texCoords[]) + */ + public void setTextureCoordinates(int index, Point2f texCoords[]) { + + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + 0, index, texCoords, 0, texCoords.length); + } + + /** + * Sets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The entire source array is + * copied to this geometry array. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of TexCoord2f objects containing new + * texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_3 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinates(int texCoordSet, + int index, TexCoord2f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, 0, texCoords.length); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinates(int texCoordSet, TexCoord3f texCoords[]) + */ + public void setTextureCoordinates(int index, Point3f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + 0, index, texCoords, 0, texCoords.length); + } + + /** + * Sets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The entire source array is + * copied to this geometry array. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of TexCoord3f objects containing new + * texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinates(int texCoordSet, + int index, TexCoord3f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, 0, texCoords.length); + } + + /** + * Sets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The entire source array is + * copied to this geometry array. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of TexCoord4f objects containing new + * texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3 is specified in vertex format + * + * @since Java 3D 1.3 + */ + public void setTextureCoordinates(int texCoordSet, + int index, TexCoord4f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, 0, texCoords.length); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinates(int texCoordSet, ...) + */ + public void setTextureCoordinates(int index, float texCoords[], + int start, int length) { + setTextureCoordinates(0, index, texCoords, start, length); + } + + /** + * Sets the texture coordinates associated with the vertices + * starting at the specified index in the specified texture + * coordinate set for this object using data in + * texCoords starting at index start and + * ending at index start+length. + * + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of 2*n , 3*n or 4*n values containing + * n new texture coordinates + * @param start starting source vertex index in texCoords + * array. + * @param length number of texture Coordinates to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinates(int texCoordSet, + int index, float texCoords[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, start, length); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinates(int texCoordSet, TexCoord2f texCoords[], ...) + */ + public void setTextureCoordinates(int index, Point2f texCoords[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + 0, index, texCoords, start, length); + } + + /** + * Sets the texture coordinates associated with the vertices + * starting at the specified index in the specified texture + * coordinate set for this object using data in + * texCoords starting at index start and + * ending at index start+length. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of TexCoord2f objects containing new + * texture coordinates + * @param start starting source vertex index in texCoords + * array. + * @param length number of texture Coordinates to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_3 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinates(int texCoordSet, + int index, TexCoord2f texCoords[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, start, length); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * setTextureCoordinates(int texCoordSet, TexCoord3f texCoords[], ...) + */ + public void setTextureCoordinates(int index, Point3f texCoords[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + 0, index, texCoords, start, length); + } + + /** + * Sets the texture coordinates associated with the vertices + * starting at the specified index in the specified texture + * coordinate set for this object. starting at index + * start and ending at index start+length. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of TexCoord3f objects containing new + * texture coordinates + * @param start starting source vertex index in texCoords + * array. + * @param length number of texture Coordinates to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void setTextureCoordinates(int texCoordSet, + int index, TexCoord3f texCoords[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, start, length); + } + + /** + * Sets the texture coordinates associated with the vertices + * starting at the specified index in the specified texture + * coordinate set for this object. starting at index + * start and ending at index start+length. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting destination vertex index in this geometry array + * @param texCoords source array of TexCoord4f objects containing new + * texture coordinates + * @param start starting source vertex index in texCoords + * array. + * @param length number of texture Coordinates to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3 is specified in vertex format + * + * @since Java 3D 1.3 + */ + public void setTextureCoordinates(int texCoordSet, + int index, TexCoord4f texCoords[], + int start, int length) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); + + ((GeometryArrayRetained)this.retained).setTextureCoordinates( + texCoordSet, index, texCoords, start, length); + } + + + /** + * Sets the vertex attribute associated with the vertex at the + * specified index in the specified vertex attribute number for + * this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index destination vertex index in this geometry array + * @param vertexAttr source array of 1, 2, 3 or 4 values containing + * the new vertex attribute + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range, or if the vertexAttr array is + * too small. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.4 + */ + public void setVertexAttr(int vertexAttrNum, int index, + float[] vertexAttr) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttr, 0, 1); + } + + /** + * Sets the vertex attribute associated with the vertex at the + * specified index in the specified vertex attribute number for + * this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index destination vertex index in this geometry array + * @param vertexAttr the Point2f containing the new vertex attribute + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 2. + * + * @since Java 3D 1.4 + */ + public void setVertexAttr(int vertexAttrNum, int index, + Point2f vertexAttr) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 2) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttr( + vertexAttrNum, index, vertexAttr); + } + + /** + * Sets the vertex attribute associated with the vertex at the + * specified index in the specified vertex attribute number for + * this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index destination vertex index in this geometry array + * @param vertexAttr the Point3f containing the new vertex attribute + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 3. + * + * @since Java 3D 1.4 + */ + public void setVertexAttr(int vertexAttrNum, int index, + Point3f vertexAttr) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 3) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttr( + vertexAttrNum, index, vertexAttr); + } + + /** + * Sets the vertex attribute associated with the vertex at the + * specified index in the specified vertex attribute number for + * this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index destination vertex index in this geometry array + * @param vertexAttr the Point4f containing the new vertex attribute + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 4. + * + * @since Java 3D 1.4 + */ + public void setVertexAttr(int vertexAttrNum, int index, + Point4f vertexAttr) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 4) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttr( + vertexAttrNum, index, vertexAttr); + } + + /** + * Sets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The entire source array is copied to this + * geometry array. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of 1*n, 2*n, 3*n, or 4*n values + * containing n new vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range, or if the vertexAttr array is + * too large. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + float[] vertexAttrs) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length / size); + } + + /** + * Sets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The entire source array is copied to this + * geometry array. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of Point2f objects containing new + * vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range, or if the vertexAttr array is + * too large. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 2. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + Point2f[] vertexAttrs) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 2) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length); + } + + /** + * Sets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The entire source array is copied to this + * geometry array. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of Point3f objects containing new + * vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range, or if the vertexAttr array is + * too large. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 3. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + Point3f[] vertexAttrs) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 3) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length); + } + + /** + * Sets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The entire source array is copied to this + * geometry array. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of Point4f objects containing new + * vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range, or if the vertexAttr array is + * too large. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 4. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + Point4f[] vertexAttrs) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 4) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length); + } + + /** + * Sets the vertex attributes associated with the vertices + * starting at the specified index in the specified vertex + * attribute number for this object using data in + * vertexAttrs starting at index start and + * ending at index start+length. + * + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of 1*n, 2*n, 3*n, or 4*n values + * containing n new vertex attributes + * @param start starting source vertex index in vertexAttrs + * array. + * @param length number of vertex attributes to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if any of index, + * (index+length), or vertexAttrNum are out of range, or if + * vertexAttrs is too small. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + float[] vertexAttrs, + int start, int length) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, start, length); + } + + /** + * Sets the vertex attributes associated with the vertices + * starting at the specified index in the specified vertex + * attribute number for this object using data in + * vertexAttrs starting at index start and + * ending at index start+length. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of Point2f objects containing new + * vertex attributes + * @param start starting source vertex index in vertexAttrs + * array. + * @param length number of vertex attributes to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if any of index, + * (index+length), or vertexAttrNum are out of range, or if + * vertexAttrs is too small. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 2. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + Point2f[] vertexAttrs, + int start, int length) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 2) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, start, length); + } + + /** + * Sets the vertex attributes associated with the vertices + * starting at the specified index in the specified vertex + * attribute number for this object using data in + * vertexAttrs starting at index start and + * ending at index start+length. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of Point3f objects containing new + * vertex attributes + * @param start starting source vertex index in vertexAttrs + * array. + * @param length number of vertex attributes to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if any of index, + * (index+length), or vertexAttrNum are out of range, or if + * vertexAttrs is too small. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 3. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + Point3f[] vertexAttrs, + int start, int length) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 3) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, start, length); + } + + /** + * Sets the vertex attributes associated with the vertices + * starting at the specified index in the specified vertex + * attribute number for this object using data in + * vertexAttrs starting at index start and + * ending at index start+length. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting destination vertex index in this geometry array + * @param vertexAttrs source array of Point4f objects containing new + * vertex attributes + * @param start starting source vertex index in vertexAttrs + * array. + * @param length number of vertex attributes to be copied. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if any of index, + * (index+length), or vertexAttrNum are out of range, or if + * vertexAttrs is too small. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 4. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrs(int vertexAttrNum, int index, + Point4f[] vertexAttrs, + int start, int length) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 4) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrs( + vertexAttrNum, index, vertexAttrs, start, length); + } + + + /** + * Gets the coordinate associated with the vertex at + * the specified index for this object using data in texCoords + * @param index source vertex index in this geometry array + * @param coordinate destination array of 3 values that will receive the coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinate(int index, float coordinate[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); + } + + /** + * Gets the coordinate associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param coordinate destination array of 3 values that will receive the coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinate(int index, double coordinate[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); + } + + /** + * Gets the coordinate associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param coordinate a vector that will receive the coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinate(int index, Point3f coordinate) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); + } + + /** + * Gets the coordinate associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param coordinate a vector that will receive the coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinate(int index, Point3d coordinate) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); + } + + /** + * Gets the coordinates associated with the vertices starting at + * the specified index for this object. The length of the destination + * array determines the number of vertices copied. + * A maximum of vertexCount-index coordinates + * are copied. If the destination array is larger than is needed + * to hold the coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the coordinates, only as + * many coordinates as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param coordinates destination array of 3*n values that will receive new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinates(int index, float coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); + } + + /** + * Gets the coordinates associated with the vertices starting at + * the specified index for this object. The length of the destination + * array determines the number of vertices copied. + * A maximum of vertexCount-index coordinates + * are copied. If the destination array is larger than is needed + * to hold the coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the coordinates, only as + * many coordinates as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param coordinates destination array of 3*n values that will receive new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinates(int index, double coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); + } + + /** + * Gets the coordinates associated with the vertices starting at + * the specified index for this object. The length of the destination + * array determines the number of vertices copied. + * A maximum of vertexCount-index coordinates + * are copied. If the destination array is larger than is needed + * to hold the coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the coordinates, only as + * many coordinates as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param coordinates destination array of points that will receive new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinates(int index, Point3f coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); + } + + /** + * Gets the coordinates associated with the vertices starting at + * the specified index for this object. The length of the destination + * array determines the number of vertices copied. + * A maximum of vertexCount-index coordinates + * are copied. If the destination array is larger than is needed + * to hold the coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the coordinates, only as + * many coordinates as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param coordinates destination array of points that will receive new coordinates + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getCoordinates(int index, Point3d coordinates[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COORDINATE_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); + } + + /** + * Gets the color associated with the vertex at + * the specified index for this object. The color is copied into the + * specified array. The array must be large enough to hold all + * of the colors. + * @param index source vertex index in this geometry array + * @param color destination array of 3 or 4 values that will receive the color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getColor(int index, float color[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).getColor(index, color); + } + + /** + * Gets the color associated with the vertex at + * the specified index for this object. The color is copied into the + * specified array. The array must be large enough to hold all of + * the colors. + * @param index source vertex index in this geometry array + * @param color destination array of 3 or 4 values that will receive the color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getColor(int index, byte color[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).getColor(index, color); + } + + /** + * Gets the color associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param color a vector that will receive the color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in the vertex + * format + */ + public void getColor(int index, Color3f color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).getColor(index, color); + } + + /** + * Gets the color associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param color a vector that will receive the color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in the vertex + * format + */ + public void getColor(int index, Color4f color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).getColor(index, color); + } + + /** + * Gets the color associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param color a vector that will receive the color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in the vertex + * format + */ + public void getColor(int index, Color3b color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).getColor(index, color); + } + + /** + * Gets the color associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param color a vector that will receive the color + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in the vertex + * format + */ + public void getColor(int index, Color4b color) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).getColor(index, color); + } + + /** + * Gets the colors associated with the vertices starting at + * the specified index for this object. The color is copied into the + * specified array. The length of the destination + * array determines the number of colors copied. + * A maximum of vertexCount-index colors + * are copied. If the destination array is larger than is needed + * to hold the colors, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the colors, only as + * many colors as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param colors destination array of 3*n or 4*n values that will + * receive n new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getColors(int index, float colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).getColors(index, colors); + } + + /** + * Gets the colors associated with the vertices starting at + * the specified index for this object. The color is copied into the + * specified array. The length of the destination + * array determines the number of colors copied. + * A maximum of vertexCount-index colors + * are copied. If the destination array is larger than is needed + * to hold the colors, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the colors, only as + * many colors as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param colors destination array of 3*n or 4*n values that will + * receive new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getColors(int index, byte colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + ((GeometryArrayRetained)this.retained).getColors(index, colors); + } + + /** + * Gets the colors associated with the vertices starting at + * the specified index for this object. The color is copied into the + * specified array. The length of the destination + * array determines the number of colors copied. + * A maximum of vertexCount-index colors + * are copied. If the destination array is larger than is needed + * to hold the colors, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the colors, only as + * many colors as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param colors destination array of Color3f objects that will receive new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in the vertex + * format + */ + public void getColors(int index, Color3f colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).getColors(index, colors); + } + + /** + * Gets the colors associated with the vertices starting at + * the specified index for this object. The color is copied into the + * specified array. The length of the destination + * array determines the number of colors copied. + * A maximum of vertexCount-index colors + * are copied. If the destination array is larger than is needed + * to hold the colors, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the colors, only as + * many colors as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param colors destination array of Color4f objects that will receive new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in the vertex + * format + */ + public void getColors(int index, Color4f colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).getColors(index, colors); + } + + /** + * Gets the colors associated with the vertices starting at + * the specified index for this object. The color is copied into the + * specified array. The length of the destination + * array determines the number of colors copied. + * A maximum of vertexCount-index colors + * are copied. If the destination array is larger than is needed + * to hold the colors, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the colors, only as + * many colors as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param colors destination array of Color3b objects that will receive new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_4 is specified in the vertex + * format + */ + public void getColors(int index, Color3b colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).getColors(index, colors); + } + + /** + * Gets the colors associated with the vertices starting at + * the specified index for this object. The color is copied into the + * specified array. The length of the destination + * array determines the number of colors copied. + * A maximum of vertexCount-index colors + * are copied. If the destination array is larger than is needed + * to hold the colors, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the colors, only as + * many colors as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param colors destination array of Color4b objects that will receive new colors + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * @exception IllegalStateException if COLOR_3 is specified in the vertex + * format + */ + public void getColors(int index, Color4b colors[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COLOR_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & COLOR ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).getColors(index, colors); + } + + /** + * Gets the normal associated with the vertex at + * the specified index for this object. The normal is copied into + * the specified array. + * @param index source vertex index in this geometry array + * @param normal destination array of 3 values that will receive the normal + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getNormal(int index, float normal[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray68")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).getNormal(index, normal); + } + + /** + * Gets the normal associated with the vertex at + * the specified index for this object. + * @param index source vertex index in this geometry array + * @param normal the vector that will receive the normal + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getNormal(int index, Vector3f normal) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray68")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).getNormal(index, normal); + } + + /** + * Gets the normals associated with the vertices starting at + * the specified index for this object. The length of the destination + * array determines the number of normals copied. + * A maximum of vertexCount-index normals + * are copied. If the destination array is larger than is needed + * to hold the normals, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the normals, only as + * many normals as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param normals destination array of 3*n values that will receive the normal + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getNormals(int index, float normals[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray70")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).getNormals(index, normals); + } + + /** + * Gets the normals associated with the vertices starting at + * the specified index for this object. The length of the destination + * array determines the number of normals copied. + * A maximum of vertexCount-index normals + * are copied. If the destination array is larger than is needed + * to hold the normals, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the normals, only as + * many normals as the array will hold are copied. + * + * @param index starting source vertex index in this geometry array + * @param normals destination array of vectors that will receive the normals + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + */ + public void getNormals(int index, Vector3f normals[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_NORMAL_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray70")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & NORMALS ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); + + ((GeometryArrayRetained)this.retained).getNormals(index, normals); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * getTextureCoordinate(int texCoordSet, ...) + */ + public void getTextureCoordinate(int index, float texCoord[]) { + getTextureCoordinate(0, index, texCoord); + } + + /** + * Gets the texture coordinate associated with the vertex at + * the specified index in the specified texture coordinate set + * for this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index source vertex index in this geometry array + * @param texCoord array of 2, 3 or 4 values that will receive the + * texture coordinate + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.2 + */ + public void getTextureCoordinate(int texCoordSet, + int index, float texCoord[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + ((GeometryArrayRetained)this.retained).getTextureCoordinate( + texCoordSet, index, texCoord); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * getTextureCoordinate(int texCoordSet, TexCoord2f texCoord) + */ + public void getTextureCoordinate(int index, Point2f texCoord) { + getTextureCoordinate(0, index, texCoord2fArray[0]); + texCoord.set(texCoord2fArray[0]); + } + + /** + * Gets the texture coordinate associated with the vertex at + * the specified index in the specified texture coordinate set + * for this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index source vertex index in this geometry array + * @param texCoord the vector that will receive the texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_3 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void getTextureCoordinate(int texCoordSet, + int index, TexCoord2f texCoord) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); + + ((GeometryArrayRetained)this.retained).getTextureCoordinate( + texCoordSet, index, texCoord); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * getTextureCoordinate(int texCoordSet, TexCoord3f texCoord) + */ + public void getTextureCoordinate(int index, Point3f texCoord) { + getTextureCoordinate(0, index, texCoord3fArray[0]); + texCoord.set(texCoord3fArray[0]); + } + + /** + * Gets the texture coordinate associated with the vertex at + * the specified index in the specified texture coordinate set + * for this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index source vertex index in this geometry array + * @param texCoord the vector that will receive the texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void getTextureCoordinate(int texCoordSet, + int index, TexCoord3f texCoord) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); + ((GeometryArrayRetained)this.retained).getTextureCoordinate( + texCoordSet, index, texCoord); + } + + /** + * Gets the texture coordinate associated with the vertex at + * the specified index in the specified texture coordinate set + * for this object. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index source vertex index in this geometry array + * @param texCoord the vector that will receive the texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3 is specified in vertex format + * + * @since Java 3D 1.3 + */ + public void getTextureCoordinate(int texCoordSet, + int index, TexCoord4f texCoord) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); + ((GeometryArrayRetained)this.retained).getTextureCoordinate( + texCoordSet, index, texCoord); + } + + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * getTextureCoordinates(int texCoordSet, ...) + */ + public void getTextureCoordinates(int index, float texCoords[]) { + getTextureCoordinates(0, index, texCoords); + } + + /** + * Gets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The length of the destination + * array determines the number of texture coordinates copied. + * A maximum of vertexCount-index texture coordinates + * are copied. If the destination array is larger than is needed + * to hold the texture coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the texture coordinates, only as + * many texture coordinates as the array will hold are copied. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting source vertex index in this geometry array + * @param texCoords destination array of 2*n , 3*n or 4*n values that + * will receive n new texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.2 + */ + public void getTextureCoordinates(int texCoordSet, + int index, float texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + ((GeometryArrayRetained)this.retained).getTextureCoordinates( + texCoordSet, index, texCoords); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * getTextureCoordinates(int texCoordSet, TexCoord2f texCoords[]) + */ + public void getTextureCoordinates(int index, Point2f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + ((GeometryArrayRetained)this.retained).getTextureCoordinates( + 0, index, texCoords); + } + + /** + * Gets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The length of the destination + * array determines the number of texture coordinates copied. + * A maximum of vertexCount-index texture coordinates + * are copied. If the destination array is larger than is needed + * to hold the texture coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the texture coordinates, only as + * many texture coordinates as the array will hold are copied. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting source vertex index in this geometry array + * @param texCoords destination array of TexCoord2f objects that will + * receive the texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_3 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void getTextureCoordinates(int texCoordSet, + int index, TexCoord2f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); + ((GeometryArrayRetained)this.retained).getTextureCoordinates( + texCoordSet, index, texCoords); + } + + /** + * @deprecated As of Java 3D version 1.2, replaced by + * getTextureCoordinates(int texCoordSet, TexCoord3f texCoords[]) + */ + public void getTextureCoordinates(int index, Point3f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + ((GeometryArrayRetained)this.retained).getTextureCoordinates( + 0, index, texCoords); + } + + /** + * Gets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The length of the destination + * array determines the number of texture coordinates copied. + * A maximum of vertexCount-index texture coordinates + * are copied. If the destination array is larger than is needed + * to hold the texture coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the texture coordinates, only as + * many texture coordinates as the array will hold are copied. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting source vertex index in this geometry array + * @param texCoords destination array of TexCoord3f objects that will + * receive the texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_4 is specified in vertex format + * + * @since Java 3D 1.2 + */ + public void getTextureCoordinates(int texCoordSet, + int index, TexCoord3f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); + ((GeometryArrayRetained)this.retained).getTextureCoordinates( + texCoordSet, index, texCoords); + } + + + /** + * Gets the texture coordinates associated with the vertices starting at + * the specified index in the specified texture coordinate set + * for this object. The length of the destination + * array determines the number of texture coordinates copied. + * A maximum of vertexCount-index texture coordinates + * are copied. If the destination array is larger than is needed + * to hold the texture coordinates, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the texture coordinates, only as + * many texture coordinates as the array will hold are copied. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param index starting source vertex index in this geometry array + * @param texCoords destination array of TexCoord4f objects that will + * receive the texture coordinates + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if the index or + * texCoordSet is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if TEXTURE_COORDINATE_2 or + * TEXTURE_COORDINATE_3 is specified in vertex format + * + * @since Java 3D 1.3 + */ + public void getTextureCoordinates(int texCoordSet, + int index, TexCoord4f texCoords[]) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_TEXCOORD_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + + if ((format & TEXTURE_COORDINATE ) == 0) + throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); + + if (((((GeometryArrayRetained)this.retained).vertexFormat) & + (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); + + ((GeometryArrayRetained)this.retained).getTextureCoordinates( + texCoordSet, index, texCoords); + } + + /** + * Gets the vertex attribute associated with the vertex at + * the specified index in the specified vertex attribute number + * for this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index source vertex index in this geometry array + * @param vertexAttr array of 1, 2, 3 or 4 values that will receive the + * vertex attribute + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range, or if the vertexAttr array is + * too small. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.4 + */ + public void getVertexAttr(int vertexAttrNum, int index, + float[] vertexAttr) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttr( + vertexAttrNum, index, vertexAttr); + } + + /** + * Gets the vertex attribute associated with the vertex at + * the specified index in the specified vertex attribute number + * for this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index source vertex index in this geometry array + * @param vertexAttr the vector that will receive the vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 2. + * + * @since Java 3D 1.4 + */ + public void getVertexAttr(int vertexAttrNum, int index, + Point2f vertexAttr) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 2) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttr( + vertexAttrNum, index, vertexAttr); + } + + /** + * Gets the vertex attribute associated with the vertex at + * the specified index in the specified vertex attribute number + * for this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index source vertex index in this geometry array + * @param vertexAttr the vector that will receive the vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 3. + * + * @since Java 3D 1.4 + */ + public void getVertexAttr(int vertexAttrNum, int index, + Point3f vertexAttr) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 3) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttr( + vertexAttrNum, index, vertexAttr); + } + + /** + * Gets the vertex attribute associated with the vertex at + * the specified index in the specified vertex attribute number + * for this object. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index source vertex index in this geometry array + * @param vertexAttr the vector that will receive the vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 4. + * + * @since Java 3D 1.4 + */ + public void getVertexAttr(int vertexAttrNum, int index, + Point4f vertexAttr) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 4) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttr( + vertexAttrNum, index, vertexAttr); + } + + /** + * Gets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The length of the destination + * array determines the number of vertex attributes copied. + * A maximum of vertexCount-index vertex attributes + * are copied. If the destination array is larger than is needed + * to hold the vertex attributes, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the vertex attributes, only as + * many vertex attributes as the array will hold are copied. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting source vertex index in this geometry array + * @param vertexAttrs destination array of 1*n, 2*n, 3*n, or 4*n values + * that will receive n new vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @since Java 3D 1.4 + */ + public void getVertexAttrs(int vertexAttrNum, int index, + float[] vertexAttrs) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttrs( + vertexAttrNum, index, vertexAttrs); + } + + /** + * Gets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The length of the destination + * array determines the number of vertex attributes copied. + * A maximum of vertexCount-index vertex attributes + * are copied. If the destination array is larger than is needed + * to hold the vertex attributes, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the vertex attributes, only as + * many vertex attributes as the array will hold are copied. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting source vertex index in this geometry array + * @param vertexAttrs destination array of Point2f objects that will + * receive the vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 2. + * + * @since Java 3D 1.4 + */ + public void getVertexAttrs(int vertexAttrNum, int index, + Point2f[] vertexAttrs) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 2) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttrs( + vertexAttrNum, index, vertexAttrs); + } + + /** + * Gets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The length of the destination + * array determines the number of vertex attributes copied. + * A maximum of vertexCount-index vertex attributes + * are copied. If the destination array is larger than is needed + * to hold the vertex attributes, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the vertex attributes, only as + * many vertex attributes as the array will hold are copied. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting source vertex index in this geometry array + * @param vertexAttrs destination array of Point3f objects that will + * receive the vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 3. + * + * @since Java 3D 1.4 + */ + public void getVertexAttrs(int vertexAttrNum, int index, + Point3f[] vertexAttrs) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 3) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttrs( + vertexAttrNum, index, vertexAttrs); + } + + /** + * Gets the vertex attributes associated with the vertices starting at + * the specified index in the specified vertex attribute number + * for this object. The length of the destination + * array determines the number of vertex attributes copied. + * A maximum of vertexCount-index vertex attributes + * are copied. If the destination array is larger than is needed + * to hold the vertex attributes, the excess locations in the + * array are not modified. If the destination array is smaller + * than is needed to hold the vertex attributes, only as + * many vertex attributes as the array will hold are copied. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param index starting source vertex index in this geometry array + * @param vertexAttrs destination array of Point4f objects that will + * receive the vertex attributes + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception ArrayIndexOutOfBoundsException if the index or + * vertexAttrNum is out of range. + * + * @exception IllegalStateException if the data mode for this geometry + * array object is BY_REFERENCE. + * + * @exception IllegalStateException if the size of the specified + * vertex attribute number is not 4. + * + * @since Java 3D 1.4 + */ + public void getVertexAttrs(int vertexAttrNum, int index, + Point4f[] vertexAttrs) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); + } + + int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; + if (size != 4) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); + } + + ((GeometryArrayRetained)this.retained).getVertexAttrs( + vertexAttrNum, index, vertexAttrs); + } + + + //------------------------------------------------------------------ + // By-reference methods + //------------------------------------------------------------------ + + /** + * Sets the initial coordinate index for this GeometryArray object. + * This index specifies the first coordinate within the array of + * coordinates referenced by this geometry + * array that is actually used in rendering or other operations + * such as picking and collision. This attribute is initialized + * to 0. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * + * @param initialCoordIndex the new initial coordinate index. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + *

+ * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE or if the data mode + * is INTERLEAVED. + *

+ * @exception IllegalArgumentException if either of the following are + * true: + *

    + * initialCoordIndex < 0 or
    + * initialCoordIndex + validVertexCount > vertexCount
    + *
+ *

+ * @exception ArrayIndexOutOfBoundsException if + * the CoordRef array is non-null and: + *

    + * CoordRef.length < num_words * + * (initialCoordIndex + validVertexCount)
    + *
+ * where num_words depends on which variant of + * setCoordRef is used. + * + * @since Java 3D 1.2 + */ + public void setInitialCoordIndex(int initialCoordIndex) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if (initialCoordIndex < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setInitialCoordIndex(initialCoordIndex); + // NOTE: the check for initialCoordIndex + validVertexCount > + // vertexCount needs to be done in the retained method + } + + + /** + * Gets the initial coordinate index for this GeometryArray object. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * @return the current initial coordinate index for this + * GeometryArray object. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @since Java 3D 1.2 + */ + public int getInitialCoordIndex() { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); + + return ((GeometryArrayRetained)this.retained).getInitialCoordIndex(); + } + + + /** + * Sets the initial color index for this GeometryArray object. + * This index specifies the first color within the array of + * colors referenced by this geometry + * array that is actually used in rendering or other operations + * such as picking and collision. This attribute is initialized + * to 0. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * + * @param initialColorIndex the new initial color index. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + *

+ * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE or if the data mode + * is INTERLEAVED. + *

+ * @exception IllegalArgumentException if either of the following are + * true: + *

    + * initialColorIndex < 0 or
    + * initialColorIndex + validVertexCount > vertexCount
    + *
+ *

+ * @exception ArrayIndexOutOfBoundsException if + * the ColorRef array is non-null and: + *

    + * ColorRef.length < num_words * + * (initialColorIndex + validVertexCount)
    + *
+ * where num_words depends on which variant of + * setColorRef is used. + * + * @since Java 3D 1.2 + */ + public void setInitialColorIndex(int initialColorIndex) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); + + if (initialColorIndex < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setInitialColorIndex(initialColorIndex); + // NOTE: the check for initialColorIndex + validVertexCount > + // vertexCount needs to be done in the retained method + } + + + /** + * Gets the initial color index for this GeometryArray object. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * @return the current initial color index for this + * GeometryArray object. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @since Java 3D 1.2 + */ + public int getInitialColorIndex() { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); + + return ((GeometryArrayRetained)this.retained).getInitialColorIndex(); + } + + + /** + * Sets the initial normal index for this GeometryArray object. + * This index specifies the first normal within the array of + * normals referenced by this geometry + * array that is actually used in rendering or other operations + * such as picking and collision. This attribute is initialized + * to 0. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * + * @param initialNormalIndex the new initial normal index. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + *

+ * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE or if the data mode + * is INTERLEAVED. + *

+ * @exception IllegalArgumentException if either of the following are + * true: + *

    + * initialNormalIndex < 0 or
    + * initialNormalIndex + validVertexCount > vertexCount
    + *
+ *

+ * @exception ArrayIndexOutOfBoundsException if normals + * the NormalRef array is non-null and: + *

    + * NormalRef.length < num_words * + * (initialNormalIndex + validVertexCount)
    + *
+ * where num_words depends on which variant of + * setNormalRef is used. + * + * @since Java 3D 1.2 + */ + public void setInitialNormalIndex(int initialNormalIndex) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); + + if (initialNormalIndex < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setInitialNormalIndex(initialNormalIndex); + // NOTE: the check for initialNormalIndex + validVertexCount > + // vertexCount needs to be done in the retained method + } + + + /** + * Gets the initial normal index for this GeometryArray object. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * @return the current initial normal index for this + * GeometryArray object. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @since Java 3D 1.2 + */ + public int getInitialNormalIndex() { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); + + return ((GeometryArrayRetained)this.retained).getInitialNormalIndex(); + } + + + /** + * Sets the initial texture coordinate index for the specified + * texture coordinate set for this GeometryArray object. This + * index specifies the first texture coordinate within the array + * of texture coordinates referenced by this geometry array that + * is actually used in rendering or other operations such as + * picking and collision. This attribute is initialized to 0. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param initialTexCoordIndex the new initial texture coordinate index. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + *

+ * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE or if the data mode + * is INTERLEAVED. + *

+ * @exception IllegalArgumentException if either of the following are + * true: + *

    + * initialTexCoordIndex < 0 or
    + * initialTexCoordIndex + validVertexCount > vertexCount
    + *
+ *

+ * @exception ArrayIndexOutOfBoundsException if + * the TexCoordRef array is non-null and: + *

    + * TexCoordRef.length < num_words * + * (initialTexCoordIndex + validVertexCount)
    + *
+ * where num_words depends on which variant of + * setTexCoordRef is used. + *

+ * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if texCoordSet is out of range. + * + * @since Java 3D 1.2 + */ + public void setInitialTexCoordIndex(int texCoordSet, + int initialTexCoordIndex) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); + + if (initialTexCoordIndex < 0) + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setInitialTexCoordIndex( + texCoordSet, initialTexCoordIndex); + + // NOTE: the check for initialTexCoordIndex + validVertexCount > + // vertexCount needs to be done in the retained method + } + + + /** + * Gets the initial texture coordinate index for the specified + * texture coordinate set for this GeometryArray object. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * + * @param texCoordSet texture coordinate set in this geometry array + * + * @return the current initial texture coordinate index for the specified + * texture coordinate set + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or if texCoordSet is out of range. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @since Java 3D 1.2 + */ + public int getInitialTexCoordIndex(int texCoordSet) { + if (isLiveOrCompiled()) + if(!this.getCapability(ALLOW_COUNT_READ)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); + + return ((GeometryArrayRetained)this.retained).getInitialTexCoordIndex( + texCoordSet); + } + + + /** + * Sets the initial vertex attribute index for the specified + * vertex attribute number for this GeometryArray object. This + * index specifies the first vertex attribute within the array + * of vertex attributes referenced by this geometry array that + * is actually used in rendering or other operations such as + * picking and collision. This attribute is initialized to 0. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * @param initialVertexAttrIndex the new initial vertex attribute index. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + *

+ * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE or if the data mode + * is INTERLEAVED. + *

+ * @exception IllegalArgumentException if either of the following are + * true: + *

    + * initialVertexAttrIndex < 0 or
    + * initialVertexAttrIndex + validVertexCount > vertexCount
    + *
+ *

+ * @exception ArrayIndexOutOfBoundsException if + * the VertexAttrRef array is non-null and: + *

    + * VertexAttrRef.length < num_words * + * (initialVertexAttrIndex + validVertexCount)
    + *
+ * where num_words is the size of the specified + * vertexAttrNum (1, 2, 3, or 4). + *

+ * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is + * out of range. + * + * @since Java 3D 1.4 + */ + public void setInitialVertexAttrIndex(int vertexAttrNum, + int initialVertexAttrIndex) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_COUNT_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); + } + } + + if (initialVertexAttrIndex < 0) { + throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + } + + if ((format & INTERLEAVED) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + } + + ((GeometryArrayRetained)this.retained).setInitialVertexAttrIndex( + vertexAttrNum, initialVertexAttrIndex); + + // NOTE: the check for initialVertexAttrIndex + validVertexCount > + // vertexCount needs to be done in the retained method + } + + + /** + * Gets the initial vertex attribute index for the specified + * vertex attribute number for this GeometryArray object. + * This attribute is only used when the data mode for this + * geometry array object is BY_REFERENCE + * and is not INTERLEAVED. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * + * @return the current initial vertex attribute index for the specified + * vertex attribute number + * + * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is + * out of range. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @since Java 3D 1.4 + */ + public int getInitialVertexAttrIndex(int vertexAttrNum) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_COUNT_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); + } + } + + return ((GeometryArrayRetained)this.retained).getInitialVertexAttrIndex( + vertexAttrNum); + } + + + /** + * Sets the coordinate buffer reference to the specified + * buffer object. The buffer contains either a java.nio.FloatBuffer + * or java.nio.DoubleBuffer object containing single or double + * precision floating-point x, y, + * and z values for each vertex (for a total of 3*n + * values, where n is the number of vertices). + * If the coordinate buffer + * reference is null, the entire geometry array object is + * treated as if it were null--any Shape3D or Morph node that uses + * this geometry array will not be drawn. + * + * @param coords a J3DBuffer object to which a reference will be set. + * The buffer contains an NIO buffer of 3*n float or + * double values. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception IllegalArgumentException if the java.nio.Buffer + * contained in the specified J3DBuffer is not a + * java.nio.FloatBuffer or a java.nio.DoubleBuffer object. + * + * @exception ArrayIndexOutOfBoundsException if + * coords.getBuffer().limit() < + * 3 * (initialCoordIndex + validVertexCount). + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the coordinate index array is greater than or equal to the + * number of vertices defined by the coords object, + * coords.getBuffer().limit() / 3. + * + * @since Java 3D 1.3 + */ + public void setCoordRefBuffer(J3DBuffer coords) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setCoordRefBuffer(coords); + } + + + /** + * Gets the coordinate array buffer reference. + * @return the current coordinate array buffer reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.3 + */ + public J3DBuffer getCoordRefBuffer() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getCoordRefBuffer(); + } + + + /** + * Sets the float coordinate array reference to the specified + * array. The array contains floating-point x, y, + * and z values for each vertex (for a total of 3*n + * values, where n is the number of vertices). Only one of + * coordRefFloat, coordRefDouble, + * coordRef3f, or coordRef3d may be + * non-null (or they may all be null). An attempt to set more + * than one of these attributes to a non-null reference will + * result in an exception being thrown. If all coordinate array + * references are null, the entire geometry array object is + * treated as if it were null--any Shape3D or Morph node that uses + * this geometry array will not be drawn. + * + * @param coords an array of 3*n values to which a + * reference will be set. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * @exception IllegalArgumentException if the specified array is + * non-null and any other coordinate reference is also non-null. + * @exception ArrayIndexOutOfBoundsException if + * coords.length < 3 * (initialCoordIndex + validVertexCount). + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the coordinate index array is greater than or equal to the + * number of vertices defined by the coords array, + * coords.length / 3. + * + * @since Java 3D 1.2 + */ + public void setCoordRefFloat(float[] coords) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setCoordRefFloat(coords); + + } + + + /** + * Gets the float coordinate array reference. + * @return the current float coordinate array reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.2 + */ + public float[] getCoordRefFloat() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getCoordRefFloat(); + } + + + /** + * Sets the double coordinate array reference to the specified + * array. The array contains double-precision + * floating-point x, y, + * and z values for each vertex (for a total of 3*n + * values, where n is the number of vertices). Only one of + * coordRefFloat, coordRefDouble, + * coordRef3f, or coordRef3d may be + * non-null (or they may all be null). An attempt to set more + * than one of these attributes to a non-null reference will + * result in an exception being thrown. If all coordinate array + * references are null, the entire geometry array object is + * treated as if it were null--any Shape3D or Morph node that uses + * this geometry array will not be drawn. + * + * @param coords an array of 3*n values to which a + * reference will be set. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * @exception IllegalArgumentException if the specified array is + * non-null and any other coordinate reference is also non-null. + * @exception ArrayIndexOutOfBoundsException if + * coords.length < 3 * (initialCoordIndex + validVertexCount). + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the coordinate index array is greater than or equal to the + * number of vertices defined by the coords array, + * coords.length / 3. + * + * @since Java 3D 1.2 + */ + public void setCoordRefDouble(double[] coords) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setCoordRefDouble(coords); + + } + + + /** + * Gets the double coordinate array reference. + * @return the current double coordinate array reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.2 + */ + public double[] getCoordRefDouble() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getCoordRefDouble(); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Point3f arrays + * + * @since Java 3D 1.2 + */ + public void setCoordRef3f(Point3f[] coords) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setCoordRef3f(coords); + + + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Point3f arrays + * + * @since Java 3D 1.2 + */ + public Point3f[] getCoordRef3f() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getCoordRef3f(); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Point3d arrays + * + * @since Java 3D 1.2 + */ + public void setCoordRef3d(Point3d[] coords) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setCoordRef3d(coords); + + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Point3d arrays + * + * @since Java 3D 1.2 + */ + public Point3d[] getCoordRef3d() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getCoordRef3d(); + } + + + /** + * Sets the color buffer reference to the specified + * buffer object. The buffer contains either a java.nio.FloatBuffer + * or java.nio.ByteBuffer object containing floating-point + * or byte red, green, + * blue, and, optionally, alpha values for each + * vertex (for a total of 3*n or 4*n values, where + * n is the number of vertices). + * If the color buffer reference is null and colors are enabled + * (that is, the vertexFormat includes either COLOR_3 or + * COLOR_4), the entire geometry array object is + * treated as if it were null--any Shape3D or Morph node that uses + * this geometry array will not be drawn. + * + * @param colors a J3DBuffer object to which a reference will be set. + * The buffer contains an NIO buffer of 3*n or 4*n + * float or byte values. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception IllegalArgumentException if the java.nio.Buffer + * contained in the specified J3DBuffer is not a + * java.nio.FloatBuffer or a java.nio.ByteBuffer object. + * + * @exception ArrayIndexOutOfBoundsException if none of the + * COLOR bits are set in the + * vertexFormat, or if + * colors.getBuffer().limit() < num_words * + * (initialColorIndex + validVertexCount), + * where num_words is 3 or 4 depending on the vertex color format. + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the color index array is greater than or equal to the + * number of vertices defined by the colors object, + * colors.getBuffer().limit() / num_words. + * + * @since Java 3D 1.3 + */ + public void setColorRefBuffer(J3DBuffer colors) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setColorRefBuffer(colors); + + } + + + /** + * Gets the color array buffer reference. + * @return the current color array buffer reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.3 + */ + public J3DBuffer getColorRefBuffer() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getColorRefBuffer(); + } + + + /** + * Sets the float color array reference to the specified array. + * The array contains floating-point red, green, + * blue, and, optionally, alpha values for each + * vertex (for a total of 3*n or 4*n values, where + * n is the number of vertices). Only one of + * colorRefFloat, colorRefByte, + * colorRef3f, colorRef4f, + * colorRef3b, or colorRef4b may be + * non-null (or they may all be null). An attempt to set more + * than one of these attributes to a non-null reference will + * result in an exception being thrown. If all color array + * references are null and colors are enabled (that is, the + * vertexFormat includes either COLOR_3 or + * COLOR_4), the entire geometry array object is + * treated as if it were null--any Shape3D or Morph node that uses + * this geometry array will not be drawn. + * + * @param colors an array of 3*n or 4*n values to which a + * reference will be set. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * @exception IllegalArgumentException if the specified array is + * non-null and any other color reference is also non-null. + * + * @exception ArrayIndexOutOfBoundsException if none of the + * COLOR bits are set in the + * vertexFormat, or if + * colors.length < num_words * + * (initialColorIndex + validVertexCount), + * where num_words is 3 or 4 depending on the vertex color format. + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the color index array is greater than or equal to the + * number of vertices defined by the colors array, + * colors.length / num_words. + * + * @since Java 3D 1.2 + */ + public void setColorRefFloat(float[] colors) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setColorRefFloat(colors); + + } + + + /** + * Gets the float color array reference. + * @return the current float color array reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.2 + */ + public float[] getColorRefFloat() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getColorRefFloat(); + } + + + /** + * Sets the byte color array reference to the specified array. + * The array contains red, green, + * blue, and, optionally, alpha values for each + * vertex (for a total of 3*n or 4*n values, where + * n is the number of vertices). Only one of + * colorRefFloat, colorRefByte, + * colorRef3f, colorRef4f, + * colorRef3b, or colorRef4b may be + * non-null (or they may all be null). An attempt to set more + * than one of these attributes to a non-null reference will + * result in an exception being thrown. If all color array + * references are null and colors are enabled (that is, the + * vertexFormat includes either COLOR_3 or + * COLOR_4), the entire geometry array object is + * treated as if it were null--any Shape3D or Morph node that uses + * this geometry array will not be drawn. + * + * @param colors an array of 3*n or 4*n values to which a + * reference will be set. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * @exception IllegalArgumentException if the specified array is + * non-null and any other color reference is also non-null. + * + * @exception ArrayIndexOutOfBoundsException if none of the + * COLOR bits are set in the + * vertexFormat, or if + * colors.length < num_words * + * (initialColorIndex + validVertexCount), + * where num_words is 3 or 4 depending on the vertex color format. + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the color index array is greater than or equal to the + * number of vertices defined by the colors array, + * colors.length / num_words. + * + * @since Java 3D 1.2 + */ + public void setColorRefByte(byte[] colors) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setColorRefByte(colors); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * Gets the byte color array reference. + * @return the current byte color array reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.2 + */ + public byte[] getColorRefByte() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getColorRefByte(); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color3f arrays + * + * @since Java 3D 1.2 + */ + public void setColorRef3f(Color3f[] colors) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColorRef3f(colors); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color3f arrays + * + * @since Java 3D 1.2 + */ + public Color3f[] getColorRef3f() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getColorRef3f(); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color4f arrays + * + * @since Java 3D 1.2 + */ + public void setColorRef4f(Color4f[] colors) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColorRef4f(colors); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color4f arrays + * + * @since Java 3D 1.2 + */ + public Color4f[] getColorRef4f() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getColorRef4f(); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color3b arrays + * + * @since Java 3D 1.2 + */ + public void setColorRef3b(Color3b[] colors) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + if ((format & WITH_ALPHA) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); + + ((GeometryArrayRetained)this.retained).setColorRef3b(colors); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color3b arrays + * + * @since Java 3D 1.2 + */ + public Color3b[] getColorRef3b() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getColorRef3b(); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color4b arrays + * + * @since Java 3D 1.2 + */ + public void setColorRef4b(Color4b[] colors) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + if ((format & WITH_ALPHA) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); + + ((GeometryArrayRetained)this.retained).setColorRef4b(colors); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Color4b arrays + * + * @since Java 3D 1.2 + */ + public Color4b[] getColorRef4b() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getColorRef4b(); + } + + + /** + * Sets the normal buffer reference to the specified + * buffer object. The buffer contains a java.nio.FloatBuffer + * object containing nx, ny, + * and nz values for each vertex (for a total of 3*n + * values, where n is the number of vertices). + * If the normal buffer reference is null and normals are enabled + * (that is, the vertexFormat includes NORMAL), the + * entire geometry array object is treated as if it were null--any + * Shape3D or Morph node that uses this geometry array will not be + * drawn. + * + * @param normals a J3DBuffer object to which a reference will be set. + * The buffer contains an NIO buffer of 3*n float values. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception IllegalArgumentException if the java.nio.Buffer + * contained in the specified J3DBuffer is not a + * java.nio.FloatBuffer object. + * + * @exception ArrayIndexOutOfBoundsException if + * NORMALS bit is not set in the + * vertexFormat, or if + * normals.getBuffer().limit() < + * 3 * (initialNormalIndex + validVertexCount). + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the normal index array is greater than or equal to the + * number of vertices defined by the normals object, + * normals.getBuffer().limit() / 3. + * + * @since Java 3D 1.3 + */ + public void setNormalRefBuffer(J3DBuffer normals) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setNormalRefBuffer(normals); + } + + + /** + * Gets the normal array buffer reference. + * @return the current normal array buffer reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.3 + */ + public J3DBuffer getNormalRefBuffer() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getNormalRefBuffer(); + } + + + /** + * Sets the float normal array reference to the specified + * array. The array contains floating-point nx, ny, + * and nz values for each vertex (for a total of 3*n + * values, where n is the number of vertices). Only one of + * normalRefFloat or normalRef3f may be + * non-null (or they may all be null). An attempt to set more + * than one of these attributes to a non-null reference will + * result in an exception being thrown. If all normal array + * references are null and normals are enabled (that is, the + * vertexFormat includes + * NORMAL), the entire geometry array object is + * treated as if it were null--any Shape3D or Morph node that uses + * this geometry array will not be drawn. + * + * @param normals an array of 3*n values to which a + * reference will be set. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * @exception IllegalArgumentException if the specified array is + * non-null and any other normal reference is also non-null. + * @exception ArrayIndexOutOfBoundsException if + * NORMALS bit is not set in the + * vertexFormat, or if + * normals.length < 3 * (initialNormalIndex + validVertexCount). + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the normal index array is greater than or equal to the + * number of vertices defined by the normals array, + * normals.length / 3. + * + * @since Java 3D 1.2 + */ + public void setNormalRefFloat(float[] normals) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setNormalRefFloat(normals); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * Gets the float normal array reference. + * @return the current float normal array reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @since Java 3D 1.2 + */ + public float[] getNormalRefFloat() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getNormalRefFloat(); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Vector3f arrays + * + * @since Java 3D 1.2 + */ + public void setNormalRef3f(Vector3f[] normals) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setNormalRef3f(normals); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for Vector3f arrays + * + * @since Java 3D 1.2 + */ + public Vector3f[] getNormalRef3f() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getNormalRef3f(); + } + + + /** + * Sets the texture coordinate buffer reference for the specified + * texture coordinate set to the + * specified buffer object. The buffer contains a java.nio.FloatBuffer + * object containing s, + * t, and, optionally, r and q values for each + * vertex (for + * a total of 2*n , 3*n or 4*n values, + * where n is + * the number of vertices). + * If the texCoord buffer reference is null and texture + * coordinates are enabled (that is, the vertexFormat includes + * TEXTURE_COORDINATE_2, + * TEXTURE_COORDINATE_3, or + * TEXTURE_COORDINATE_4), the entire geometry + * array object is treated as if it were null--any Shape3D or + * Morph node that uses this geometry array will not be drawn. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param texCoords a J3DBuffer object to which a reference will be set. + * The buffer contains an NIO buffer of 2*n, 3*n or + * 4*n float values. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception IllegalArgumentException if the java.nio.Buffer + * contained in the specified J3DBuffer is not a + * java.nio.FloatBuffer object. + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat, or if texCoordSet is out of range, + * or if + * texCoords.getBuffer().limit() < num_words + * * (initialTexCoordIndex + validVertexCount), + * where num_words is 2, 3, or 4 depending on the vertex + * texture coordinate format. + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the texture coordinate index array is greater than or equal to the + * number of vertices defined by the texCoords object, + * texCoords.getBuffer().limit() / num_words. + * + * @since Java 3D 1.3 + */ + public void setTexCoordRefBuffer(int texCoordSet, J3DBuffer texCoords) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setTexCoordRefBuffer( + texCoordSet, texCoords); + + } + + + /** + * Gets the texture coordinate array buffer reference for the specified + * texture coordinate set. + * + * @param texCoordSet texture coordinate set in this geometry array + * + * @return the current texture coordinate array buffer reference + * for the specified texture coordinate set + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or texCoordSet is out of range. + * + * @since Java 3D 1.3 + */ + public J3DBuffer getTexCoordRefBuffer(int texCoordSet) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getTexCoordRefBuffer(texCoordSet); + } + + + /** + * Sets the float texture coordinate array reference for the specified + * texture coordinate set to the + * specified array. The array contains floating-point s, + * t, and, optionally, r and q values for each + * vertex (for + * a total of 2*n , 3*n or 4*n values, + * where n is + * the number of vertices). Only one of + * texCoordRefFloat, texCoordRef2f, or + * texCoordRef3f may be non-null (or they may all be + * null). An attempt to set more than one of these attributes to + * a non-null reference will result in an exception being thrown. + * If all texCoord array references are null and texture + * coordinates are enabled (that is, the vertexFormat includes + * TEXTURE_COORDINATE_2, + * TEXTURE_COORDINATE_3, or + * TEXTURE_COORDINATE_4), the entire geometry + * array object is treated as if it were null--any Shape3D or + * Morph node that uses this geometry array will not be drawn. + * + * @param texCoordSet texture coordinate set in this geometry array + * @param texCoords an array of 2*n, 3*n or + * 4*n values to + * which a reference will be set. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * @exception IllegalArgumentException if the specified array is + * non-null and any other texCoord reference is also non-null. + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat, or if texCoordSet is out of range, + * or if + * texCoords.length < num_words * + * (initialTexCoordIndex + validVertexCount), + * where num_words is 2, 3, or 4 depending on the vertex + * texture coordinate format. + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the texture coordinate index array is greater than or equal to the + * number of vertices defined by the texCoords array, + * texCoords.length / num_words. + * + * @since Java 3D 1.2 + */ + public void setTexCoordRefFloat(int texCoordSet, float[] texCoords) { + + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + ((GeometryArrayRetained)this.retained).setTexCoordRefFloat( + texCoordSet, texCoords); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * Gets the float texture coordinate array reference for the specified + * texture coordinate set. + * + * @param texCoordSet texture coordinate set in this geometry array + * + * @return the current float texture coordinate array reference + * for the specified texture coordinate set + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception ArrayIndexOutOfBoundsException if none of the + * TEXTURE_COORDINATE bits are set in the + * vertexFormat or texCoordSet is out of range. + * + * @since Java 3D 1.2 + */ + public float[] getTexCoordRefFloat(int texCoordSet) { + + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getTexCoordRefFloat( + texCoordSet); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for TexCoord2f arrays + * + * @since Java 3D 1.2 + */ + public void setTexCoordRef2f(int texCoordSet, TexCoord2f[] texCoords) { + + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + if ((format & (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); + + ((GeometryArrayRetained)this.retained).setTexCoordRef2f( + texCoordSet, texCoords); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for TexCoord2f arrays + * + * @since Java 3D 1.2 + */ + public TexCoord2f[] getTexCoordRef2f(int texCoordSet) { + + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getTexCoordRef2f( + texCoordSet); + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for TexCoord3f arrays + * + * @since Java 3D 1.2 + */ + public void setTexCoordRef3f(int texCoordSet, TexCoord3f[] texCoords) { + + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + if ((format & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); + + ((GeometryArrayRetained)this.retained).setTexCoordRef3f( + texCoordSet, texCoords); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * @deprecated As of Java 3D version 1.3, use geometry by-copy + * for TexCoord3f arrays + * + * @since Java 3D 1.2 + */ + public TexCoord3f[] getTexCoordRef3f(int texCoordSet) { + + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + if ((format & INTERLEAVED) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + + return ((GeometryArrayRetained)this.retained).getTexCoordRef3f( + texCoordSet); + } + + + /** + * Sets the vertex attribute buffer reference for the specified + * vertex attribute number to the specified buffer object. The + * buffer contains a java.nio.FloatBuffer object containing 1, 2, + * 3, or 4 values for each vertex (for a total of 1*n, + * 2*n, 3*n, or 4*n values, where n is + * the number of vertices). + * If the vertexAttr buffer reference is null and vertex + * attributes are enabled (that is, the vertexFormat includes + * VERTEX_ATTRIBUTES), the entire geometry array + * object is treated as if it were null--any Shape3D node that + * uses this geometry array will not be drawn. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * + * @param vertexAttrs a J3DBuffer object to which a reference will + * be set. The buffer contains an NIO buffer of 1*n, + * 2*n, 3*n, or 4*n float values. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception IllegalArgumentException if the java.nio.Buffer + * contained in the specified J3DBuffer is not a + * java.nio.FloatBuffer object. + * + * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is out of + * range, or if + * vertexAttrs.getBuffer().limit() < num_words + * * (initialVertexAttrIndex + validVertexCount), + * where num_words is the size of the specified + * vertexAttrNum (1, 2, 3, or 4). + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the vertex attribute index array is greater than or equal to the + * number of vertices defined by the vertexAttrs object, + * vertexAttrs.getBuffer().limit() / num_words. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrRefBuffer(int vertexAttrNum, J3DBuffer vertexAttrs) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + } + + if ((format & INTERLEAVED) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrRefBuffer( + vertexAttrNum, vertexAttrs); + } + + + /** + * Gets the vertex attribute array buffer reference for the specified + * vertex attribute number. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * + * @return the current vertex attribute array buffer reference + * for the specified vertex attribute number + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is not USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is out + * of range. + * + * @since Java 3D 1.4 + */ + public J3DBuffer getVertexAttrRefBuffer(int vertexAttrNum) { + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + + if ((format & USE_NIO_BUFFER) == 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + } + + if ((format & INTERLEAVED) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + } + + return ((GeometryArrayRetained)this.retained).getVertexAttrRefBuffer(vertexAttrNum); + } + + + /* + * XXXX: add the following to the javadoc if we ever add double-precision + * methods for vertex attribtues. + * + *----------------------------------------------------------------- + * Only one of vertexAttrRefFloat, or + * vertexAttrRefDouble may be non-null (or they may + * all be null). An attempt to set more than one of these + * attributes to a non-null reference will result in an exception + * being thrown. + * + * If all vertexAttr array references are null and vertex + * ... + * @exception IllegalArgumentException if the specified array is + * non-null and any other vertexAttr reference is also non-null. + * ... + *----------------------------------------------------------------- + */ + + /** + * Sets the float vertex attribute array reference for the + * specified vertex attribute number to the specified array. The + * array contains 1, 2, 3, or 4 floating-point values for each + * vertex (for a total of 1*n, 2*n, 3*n, or + * 4*n values, where n is the number of vertices). + * + * If the vertexAttr array reference is null and vertex + * attributes are enabled (that is, the vertexFormat includes + * VERTEX_ATTRIBUTES), the entire geometry array + * object is treated as if it were null--any Shape3D node that + * uses this geometry array will not be drawn. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * + * @param vertexAttrs an array of 1*n, 2*n, + * 3*n, or 4*n values to which a reference will be + * set. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is + * out of range, or if + * vertexAttrs.length < num_words * + * (initialVertexAttrIndex + validVertexCount), + * where num_words is the size of the specified + * vertexAttrNum (1, 2, 3, or 4). + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the vertex attribute index array is greater than or equal to the + * number of vertices defined by the vertexAttrs array, + * vertexAttrs.length / num_words. + * + * @since Java 3D 1.4 + */ + public void setVertexAttrRefFloat(int vertexAttrNum, float[] vertexAttrs) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + } + + if ((format & USE_NIO_BUFFER) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + } + + if ((format & INTERLEAVED) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + } + + ((GeometryArrayRetained)this.retained).setVertexAttrRefFloat( + vertexAttrNum, vertexAttrs); + + // NOTE: the checks for multiple non-null references, and the + // array length check need to be done in the retained method + } + + + /** + * Gets the float vertex attribute array reference for the specified + * vertex attribute number. + * + * @param vertexAttrNum vertex attribute number in this geometry array + * + * @return the current float vertex attribute array reference + * for the specified vertex attribute number + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not BY_REFERENCE, + * is USE_NIO_BUFFER, or is INTERLEAVED. + * + * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is + * out of range. + * + * @since Java 3D 1.4 + */ + public float[] getVertexAttrRefFloat(int vertexAttrNum) { + + if (isLiveOrCompiled()) { + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & BY_REFERENCE) == 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); + } + + if ((format & USE_NIO_BUFFER) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + } + + if ((format & INTERLEAVED) != 0) { + throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); + } + + return ((GeometryArrayRetained)this.retained).getVertexAttrRefFloat( + vertexAttrNum); + } + + + /** + * Sets the interleaved vertex array reference to the specified + * array. The vertex components must be stored in a predetermined + * order in the array. The order is: texture coordinates, colors, + * normals, and positional coordinates. + * Vertex attributes are not supported in interleaved mode. + * In the case of texture + * coordinates, the values for each texture coordinate set + * are stored in order from 0 through texCoordSetCount-1. Only those + * components that are enabled appear in the vertex. The number + * of words per vertex depends on which vertex components are + * enabled. Texture coordinates, if enabled, use 2 words per + * texture coordinate set per vertex for + * TEXTURE_COORDINATE_2, 3 words per texture + * coordinate set per vertex for + * TEXTURE_COORDINATE_3 or 4 words per texture + * coordinate set per vertex for + * TEXTURE_COORDINATE_4. Colors, if enabled, use 3 + * words per vertex for COLOR_3 or 4 words per vertex + * for COLOR_4. Normals, if enabled, use 3 words per + * vertex. Positional coordinates, which are always enabled, use + * 3 words per vertex. For example, the format of interleaved + * data for a GeometryArray object whose vertexFormat includes + * COORDINATES, COLOR_3, and + * NORMALS would be: red, green, + * blue, Nx, Ny, Nz, x, + * y, z. All components of a vertex are stored in + * adjacent memory locations. The first component of vertex 0 is + * stored beginning at index 0 in the array. The first component + * of vertex 1 is stored beginning at index + * words_per_vertex in the array. The total number of + * words needed to store n vertices is + * words_per_vertex*n. + * + * @param vertexData an array of vertex values to which a + * reference will be set. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not INTERLEAVED + * or is USE_NIO_BUFFER. + * + * @exception ArrayIndexOutOfBoundsException if + * vertexData.length < words_per_vertex * + * (initialVertexIndex + validVertexCount), + * where words_per_vertex depends on which formats are enabled. + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the index array associated with any of the enabled vertex + * components (coord, color, normal, texcoord) is greater than or + * equal to the number of vertices defined by the vertexData + * array, + * vertexData.length / words_per_vertex. + * + * @since Java 3D 1.2 + */ + public void setInterleavedVertices(float[] vertexData) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & INTERLEAVED) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + ((GeometryArrayRetained)this.retained).setInterleavedVertices(vertexData); + + // NOTE: the array length check needs to be done in the retained method + } + + + /** + * Gets the interleaved vertices array reference. + * @return the current interleaved vertices array reference. + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * @exception IllegalStateException if the data mode for this geometry + * array object is not INTERLEAVED + * or is USE_NIO_BUFFER. + * + * @since Java 3D 1.2 + */ + public float[] getInterleavedVertices() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & INTERLEAVED) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); + + + if ((format & USE_NIO_BUFFER) != 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); + + return ((GeometryArrayRetained)this.retained).getInterleavedVertices(); + } + + /** + * Sets the interleaved vertex buffer reference to the specified + * buffer object. The buffer must contain a java.nio.FloatBuffer object. + * The vertex components must be stored in a predetermined + * order in the buffer. The order is: texture coordinates, colors, + * normals, and positional coordinates. + * Vertex attributes are not supported in interleaved mode. + * In the case of texture + * coordinates, the values for each texture coordinate set + * are stored in order from 0 through texCoordSetCount-1. Only those + * components that are enabled appear in the vertex. The number + * of words per vertex depends on which vertex components are + * enabled. Texture coordinates, if enabled, use 2 words per + * texture coordinate set per vertex for + * TEXTURE_COORDINATE_2, 3 words per texture + * coordinate set per vertex for + * TEXTURE_COORDINATE_3 or 4 words per texture + * coordinate set per vertex for + * TEXTURE_COORDINATE_4. Colors, if enabled, use 3 + * words per vertex for COLOR_3 or 4 words per vertex + * for COLOR_4. Normals, if enabled, use 3 words per + * vertex. Positional coordinates, which are always enabled, use + * 3 words per vertex. For example, the format of interleaved + * data for a GeometryArray object whose vertexFormat includes + * COORDINATES, COLOR_3, and + * NORMALS would be: red, green, + * blue, Nx, Ny, Nz, x, + * y, z. All components of a vertex are stored in + * adjacent memory locations. The first component of vertex 0 is + * stored beginning at index 0 in the buffer. The first component + * of vertex 1 is stored beginning at index + * words_per_vertex in the buffer. The total number of + * words needed to store n vertices is + * words_per_vertex*n. + * + * @param vertexData a J3DBuffer object to which a reference will be set. + * The buffer contains an NIO float buffer of + * words_per_vertex*n values. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not INTERLEAVED + * or is not USE_NIO_BUFFER. + * + * @exception IllegalArgumentException if the java.nio.Buffer + * contained in the specified J3DBuffer is not a + * java.nio.FloatBuffer object. + * + * @exception ArrayIndexOutOfBoundsException if + * vertexData.getBuffer().limit() < words_per_vertex * + * (initialVertexIndex + validVertexCount), + * where words_per_vertex depends on which formats are enabled. + * + * @exception ArrayIndexOutOfBoundsException if this GeometryArray + * object is a subclass of IndexedGeometryArray, and any element + * in the range + * [initialIndexIndex, initialIndexIndex+validIndexCount-1] + * in the index array associated with any of the enabled vertex + * components (coord, color, normal, texcoord) is greater than or + * equal to the number of vertices defined by the vertexData + * object, + * vertexData.getBuffer().limit() / words_per_vertex. + * + * @since Java 3D 1.3 + */ + public void setInterleavedVertexBuffer(J3DBuffer vertexData) { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_WRITE)) + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & INTERLEAVED) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); + + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + ((GeometryArrayRetained)this.retained).setInterleavedVertexBuffer(vertexData); + + } + + + /** + * Gets the interleaved vertex array buffer reference. + * @return the current interleaved vertex array buffer reference. + * + * @exception CapabilityNotSetException if the appropriate capability is + * not set and this object is part of a live or compiled scene graph + * + * @exception IllegalStateException if the data mode for this geometry + * array object is not INTERLEAVED + * or is not USE_NIO_BUFFER. + * + * @since Java 3D 1.3 + */ + public J3DBuffer getInterleavedVertexBuffer() { + if (isLiveOrCompiled()) + if (!this.getCapability(ALLOW_REF_DATA_READ) && + !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { + throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); + } + + int format = ((GeometryArrayRetained)this.retained).vertexFormat; + if ((format & INTERLEAVED) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); + + if ((format & USE_NIO_BUFFER) == 0) + throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); + + return ((GeometryArrayRetained)this.retained).getInterleavedVertexBuffer(); + + } +} -- cgit v1.2.3