1 /* 2 * $RCSfile: GeometryArray.java,v $ 3 * 4 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 * 7 * This code is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 only, as 9 * published by the Free Software Foundation. Sun designates this 10 * particular file as subject to the "Classpath" exception as provided 11 * by Sun in the LICENSE file that accompanied this code. 12 * 13 * This code is distributed in the hope that it will be useful, but WITHOUT 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 * version 2 for more details (a copy is included in the LICENSE file that 17 * accompanied this code). 18 * 19 * You should have received a copy of the GNU General Public License version 20 * 2 along with this work; if not, write to the Free Software Foundation, 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22 * 23 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 24 * CA 95054 USA or visit www.sun.com if you need additional information or 25 * have any questions. 26 * 27 * $Revision: 1.7 $ 28 * $Date: 2008/02/28 20:17:21 $ 29 * $State: Exp $ 30 */ 31 32 package javax.media.j3d; 33 34 import javax.vecmath.*; 35 36 37 /** 38 * The GeometryArray object contains separate arrays of positional 39 * coordinates, colors, normals, texture coordinates, and vertex 40 * attributes that 41 * describe point, line, or polygon geometry. This class is extended 42 * to create the various primitive types (such as lines, 43 * triangle strips, etc.). 44 * Vertex data may be passed to this geometry array in one of two 45 * ways: by copying the data into the array using the existing 46 * methods, or by passing a reference to the data. 47 * <p> 48 * <ul> 49 * <li> 50 * <b>By Copying:</b> 51 * The existing methods for setting positional coordinates, colors, 52 * normals, texture coordinates, and vertex attributes 53 * (such as <code>setCoordinate</code>, 54 * <code>setColors</code>, etc.) copy the data into this 55 * GeometryArray. This is appropriate for many applications and 56 * offers an application much flexibility in organizing its data. 57 * This is the default mode. 58 * </li> 59 * <li><b>By Reference:</b> 60 * A new set of methods in Java 3D version 1.2 allows data to be 61 * accessed by reference, directly from the user's arrays. To use 62 * this feature, set the <code>BY_REFERENCE</code> bit in the 63 * <code>vertexFormat</code> field of the constructor for this 64 * GeometryArray. In this mode, the various set methods for 65 * coordinates, normals, colors, texture coordinates, and vertex attributes 66 * are not used. 67 * Instead, new methods are used to set a reference to user-supplied 68 * coordinate, color, normal, texture coordinate, and vertex attribute 69 * arrays (such as 70 * <code>setCoordRefFloat</code>, <code>setColorRefFloat</code>, 71 * etc.). Data in any array that is referenced by a live or compiled 72 * GeometryArray object may only be modified via the 73 * <code>updateData</code> method (subject to the 74 * <code>ALLOW_REF_DATA_WRITE</code> capability bit). Applications 75 * must exercise care not to violate this rule. If any referenced 76 * geometry data is modified outside of the <code>updateData</code> 77 * method, the results are undefined. 78 * </li> 79 * </ul> 80 * <p> 81 * All colors used in the geometry array object must be in the range [0.0,1.0]. 82 * Values outside this range will cause undefined results. 83 * All normals used in the geometry array object must be unit length 84 * vectors. That is their geometric length must be 1.0. Normals that 85 * are not unit length vectors will cause undefined results. 86 * <p> 87 * Note that the term <i>coordinate</i>, as used in the method names 88 * and method descriptions, actually refers to a set of <i>x</i>, 89 * <i>y</i>, and <i>z</i> coordinates representing the position of a 90 * single vertex. The term <i>coordinates</i> (plural) is used to 91 * indicate sets of <i>x</i>, <i>y</i>, and <i>z</i> coordinates for 92 * multiple vertices. This is somewhat at odds with the mathematical 93 * definition of a coordinate, but is used as a convenient shorthand. 94 * Similarly, the term <i>texture coordinate</i> is used to indicate a 95 * set of texture coordinates for a single vertex, while the term 96 * <i>texture coordinates</i> (plural) is used to indicate sets of 97 * texture coordinates for multiple vertices. 98 */ 99 100 public abstract class GeometryArray extends Geometry { 101 102 /** 103 * Specifies that this GeometryArray allows reading the array of 104 * coordinates. 105 */ 106 public static final int 107 ALLOW_COORDINATE_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COORDINATE_READ; 108 109 /** 110 * Specifies that this GeometryArray allows writing the array of 111 * coordinates. 112 */ 113 public static final int 114 ALLOW_COORDINATE_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COORDINATE_WRITE; 115 116 /** 117 * Specifies that this GeometryArray allows reading the array of 118 * colors. 119 */ 120 public static final int 121 ALLOW_COLOR_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COLOR_READ; 122 123 /** 124 * Specifies that this GeometryArray allows writing the array of 125 * colors. 126 */ 127 public static final int 128 ALLOW_COLOR_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COLOR_WRITE; 129 130 /** 131 * Specifies that this GeometryArray allows reading the array of 132 * normals. 133 */ 134 public static final int 135 ALLOW_NORMAL_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_NORMAL_READ; 136 137 /** 138 * Specifies that this GeometryArray allows writing the array of 139 * normals. 140 */ 141 public static final int 142 ALLOW_NORMAL_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_NORMAL_WRITE; 143 144 /** 145 * Specifies that this GeometryArray allows reading the array of 146 * texture coordinates. 147 */ 148 public static final int 149 ALLOW_TEXCOORD_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_TEXCOORD_READ; 150 151 /** 152 * Specifies that this GeometryArray allows writing the array of 153 * texture coordinates. 154 */ 155 public static final int 156 ALLOW_TEXCOORD_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_TEXCOORD_WRITE; 157 158 /** 159 * Specifies that this GeometryArray allows reading the array of 160 * vertex attributes. 161 * 162 * @since Java 3D 1.4 163 */ 164 public static final int 165 ALLOW_VERTEX_ATTR_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_READ; 166 167 /** 168 * Specifies that this GeometryArray allows writing the array of 169 * vertex attributes. 170 * 171 * @since Java 3D 1.4 172 */ 173 public static final int 174 ALLOW_VERTEX_ATTR_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_VERTEX_ATTR_WRITE; 175 176 /** 177 * Specifies that this GeometryArray allows reading the count or 178 * initial index information for this object. 179 */ 180 public static final int 181 ALLOW_COUNT_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COUNT_READ; 182 183 /** 184 * Specifies that this GeometryArray allows writing the count or 185 * initial index information for this object. 186 * 187 * @since Java 3D 1.2 188 */ 189 public static final int 190 ALLOW_COUNT_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_COUNT_WRITE; 191 192 /** 193 * Specifies that this GeometryArray allows reading the vertex format 194 * information for this object. 195 */ 196 public static final int 197 ALLOW_FORMAT_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_FORMAT_READ; 198 199 /** 200 * Specifies that this GeometryArray allows reading the geometry 201 * data reference information for this object. This is only used in 202 * by-reference geometry mode. 203 * 204 * @since Java 3D 1.2 205 */ 206 public static final int 207 ALLOW_REF_DATA_READ = CapabilityBits.GEOMETRY_ARRAY_ALLOW_REF_DATA_READ; 208 209 private static final int J3D_1_2_ALLOW_REF_DATA_READ = 210 CapabilityBits.J3D_1_2_GEOMETRY_ARRAY_ALLOW_REF_DATA_READ; 211 212 /** 213 * Specifies that this GeometryArray allows writing the geometry 214 * data reference information for this object. It also enables 215 * writing the referenced data itself, via the GeometryUpdater 216 * interface. This is only used in by-reference geometry mode. 217 * 218 * @since Java 3D 1.2 219 */ 220 public static final int 221 ALLOW_REF_DATA_WRITE = CapabilityBits.GEOMETRY_ARRAY_ALLOW_REF_DATA_WRITE; 222 223 /** 224 * Specifies that this GeometryArray contains an array of coordinates. 225 * This bit must be set. 226 */ 227 public static final int COORDINATES = 0x01; 228 229 /** 230 * Specifies that this GeometryArray contains an array of normals. 231 */ 232 public static final int NORMALS = 0x02; 233 234 /** 235 * Specifies that this GeometryArray contains an array of colors. 236 */ 237 static final int COLOR = 0x04; 238 239 /** 240 * Specifies that this GeometryArray's colors contain alpha. 241 */ 242 static final int WITH_ALPHA = 0x08; 243 244 /** 245 * Specifies that this GeometryArray contains an array of colors without alpha. 246 */ 247 public static final int COLOR_3 = COLOR; 248 249 /** 250 * Specifies that this GeometryArray contains an array of colors with alpha. 251 * This takes precedence over COLOR_3. 252 */ 253 public static final int COLOR_4 = COLOR | WITH_ALPHA; 254 255 /** 256 * Specifies that this GeometryArray contains one or more arrays of 257 * 2D texture coordinates. 258 */ 259 public static final int TEXTURE_COORDINATE_2 = 0x20; 260 261 /** 262 * Specifies that this GeometryArray contains one or more arrays of 263 * 3D texture coordinates. 264 * This takes precedence over TEXTURE_COORDINATE_2. 265 */ 266 public static final int TEXTURE_COORDINATE_3 = 0x40; 267 268 269 /** 270 * Specifies that this GeometryArray contains one or more arrays of 271 * 4D texture coordinates. 272 * This takes precedence over TEXTURE_COORDINATE_2 and TEXTURE_COORDINATE_3. 273 * 274 * @since Java 3D 1.3 275 */ 276 public static final int TEXTURE_COORDINATE_4 = 0x400; 277 278 279 static final int TEXTURE_COORDINATE = TEXTURE_COORDINATE_2 | 280 TEXTURE_COORDINATE_3 | 281 TEXTURE_COORDINATE_4; 282 283 /** 284 * Specifies that the position, color, normal, and texture coordinate 285 * data for this GeometryArray are accessed by reference. 286 * 287 * @since Java 3D 1.2 288 */ 289 public static final int BY_REFERENCE = 0x80; 290 291 292 /** 293 * Specifies that the position, color, normal, and texture 294 * coordinate data for this GeometryArray are accessed via a single 295 * interleaved, floating-point array reference. All of the data 296 * values for each vertex are stored in consecutive memory 297 * locations. This flag is only valid in conjunction with the 298 * <code>BY_REFERENCE</code> flag. 299 * 300 * @since Java 3D 1.2 301 */ 302 public static final int INTERLEAVED = 0x100; 303 304 /** 305 * Specifies that geometry by-reference data for this 306 * GeometryArray, whether interleaved or non-interleaved, is 307 * accessed via J3DBuffer objects that wrap NIO Buffer objects, 308 * rather than float, double, byte, or TupleXX arrays. This flag 309 * is only valid in conjunction with the <code>BY_REFERENCE</code> 310 * flag. 311 * 312 * @see J3DBuffer 313 * @see #setCoordRefBuffer(J3DBuffer) 314 * @see #setColorRefBuffer(J3DBuffer) 315 * @see #setNormalRefBuffer(J3DBuffer) 316 * @see #setTexCoordRefBuffer(int,J3DBuffer) 317 * @see #setVertexAttrRefBuffer(int,J3DBuffer) 318 * @see #setInterleavedVertexBuffer(J3DBuffer) 319 * 320 * @since Java 3D 1.3 321 */ 322 public static final int USE_NIO_BUFFER = 0x800; 323 324 /** 325 * Specifies that only the coordinate indices are used for indexed 326 * geometry arrays. In this mode, the values from the coordinate 327 * index array are used as a single set of index values to access 328 * the vertex data for all five vertex components (coord, color, 329 * normal, texCoord, and vertexAttr). The color, normal, texCoord, 330 * and vertexAttr index arrays are neither allocated nor used. Any 331 * attempt to access the color, normal, texCoord, 332 * or vertexAttr index arrays will result in a NullPointerException. 333 * This flag is only valid for indexed geometry arrays 334 * (subclasses of IndexedGeometryArray). 335 * 336 * @since Java 3D 1.3 337 */ 338 public static final int USE_COORD_INDEX_ONLY = 0x200; 339 340 /** 341 * Specifies that this GeometryArray contains one or more arrays of 342 * vertex attributes. These attributes are used in programmable 343 * shading. 344 * 345 * @since Java 3D 1.4 346 */ 347 public static final int VERTEX_ATTRIBUTES = 0x1000; 348 349 //NVaidya 350 /** 351 * Specifies that the indices in this GeometryArray 352 * are accessed by reference. This flag is only valid for 353 * indexed geometry arrays (subclasses of IndexedGeometryArray) and only 354 * when used in conjunction with the <code>BY_REFERENCE</code> and 355 * <code>USE_COORD_INDEX_ONLY</code> flags. 356 * 357 * @since Java 3D 1.5 358 */ 359 public static final int BY_REFERENCE_INDICES = 0x2000; 360 361 // Used to keep track of the last bit (for adding new bits only) 362 private static final int LAST_FORMAT_BIT = 0x2000; 363 364 // Scratch arrays for converting Point[234]f to TexCoord[234]f 365 private TexCoord2f [] texCoord2fArray = null; 366 private TexCoord3f [] texCoord3fArray = null; 367 private TexCoord4f [] texCoord4fArray = null; 368 private TexCoord2f texCoord2fScratch = null; 369 private TexCoord3f texCoord3fScratch = null; 370 371 private static final int[] defTexCoordMap = { 0 }; 372 373 // Array for setting default read capabilities 374 private static final int[] readCapabilities = { 375 ALLOW_COLOR_READ, 376 ALLOW_COORDINATE_READ, 377 ALLOW_COUNT_READ, 378 ALLOW_FORMAT_READ, 379 ALLOW_NORMAL_READ, 380 ALLOW_REF_DATA_READ, 381 ALLOW_TEXCOORD_READ, 382 ALLOW_VERTEX_ATTR_READ 383 }; 384 385 386 // non-public, no parameter constructor GeometryArray()387 GeometryArray() { 388 // set default read capabilities 389 setDefaultReadCapabilities(readCapabilities); 390 } 391 392 //NVaidya 393 /** 394 * Constructs an empty GeometryArray object with the specified 395 * number of vertices and vertex format. Defaults are used 396 * for all other parameters. The default values are as follows: 397 * <ul> 398 * texCoordSetCount : 1<br> 399 * texCoordSetMap : { 0 }<br> 400 * vertexAttrCount : 0<br> 401 * vertexAttrSizes : null<br> 402 * validVertexCount : vertexCount<br> 403 * initialVertexIndex : 0<br> 404 * initialCoordIndex : 0<br> 405 * initialColorIndex : 0<br> 406 * initialNormalIndex : 0<br> 407 * initialTexCoordIndex : 0<br> 408 * initialVertexAttrIndex : 0<br> 409 * all data array values : 0.0<br> 410 * all data array references : null<br> 411 * </ul> 412 * 413 * @param vertexCount the number of vertex elements in this GeometryArray 414 * @param vertexFormat a mask indicating which components are 415 * present in each vertex. This is specified as one or more 416 * individual flags that are bitwise "OR"ed together to describe 417 * the per-vertex data. 418 * The flags include: <code>COORDINATES</code>, to signal the inclusion of 419 * vertex positions--always present; <code>NORMALS</code>, to signal 420 * the inclusion of per vertex normals; one of <code>COLOR_3</code> or 421 * <code>COLOR_4</code>, to signal the inclusion of per vertex 422 * colors (without or with alpha information); one of 423 * <code>TEXTURE_COORDINATE_2</code>, <code>TEXTURE_COORDINATE_3</code> 424 * or <code>TEXTURE_COORDINATE_4</code>, 425 * to signal the 426 * inclusion of per-vertex texture coordinates (2D, 3D or 4D); 427 * <code>BY_REFERENCE</code>, to indicate that the data is passed 428 * by reference 429 * rather than by copying; <code>INTERLEAVED</code>, to indicate 430 * that the referenced 431 * data is interleaved in a single array; 432 * <code>USE_NIO_BUFFER</code>, to indicate that the referenced data 433 * is accessed via a J3DBuffer object that wraps an NIO buffer; 434 * <code>USE_COORD_INDEX_ONLY</code>, 435 * to indicate that only the coordinate indices are used for indexed 436 * geometry arrays; 437 * <code>BY_REFERENCE_INDICES</code>, to indicate 438 * that the indices are accessed by reference in indexed 439 * geometry arrays.<p> 440 * 441 * @exception IllegalArgumentException if vertexCount < 0 442 * 443 * @exception IllegalArgumentException if vertexFormat does <b>not</b> 444 * include <code>COORDINATES</code> 445 * 446 * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> 447 * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for 448 * non-indexed geometry arrays (that is, GeometryArray objects 449 * that are not a subclass of IndexedGeometryArray) 450 * 451 * @exception IllegalArgumentException if the <code>INTERLEAVED</code> 452 * bit is set without the <code>BY_REFERENCE</code> bit being set 453 * 454 * @exception IllegalArgumentException if the <code>USE_NIO_BUFFER</code> 455 * bit is set without the <code>BY_REFERENCE</code> bit being set 456 * 457 * @exception IllegalArgumentException if the <code>INTERLEAVED</code> 458 * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set 459 * 460 * @exception IllegalArgumentException if the 461 * <code>BY_REFERENCE_INDICES</code> 462 * bit is set without the <code>BY_REFERENCE</code> and 463 * <code>USE_COORD_INDEX_ONLY</code> bits being set 464 */ GeometryArray(int vertexCount, int vertexFormat)465 public GeometryArray(int vertexCount, int vertexFormat) { 466 this(vertexCount, vertexFormat, 467 ((vertexFormat & TEXTURE_COORDINATE) != 0 ? 1 : 0), 468 ((vertexFormat & TEXTURE_COORDINATE) != 0 ? defTexCoordMap : null)); 469 } 470 471 472 //NVaidya 473 /** 474 * Constructs an empty GeometryArray object with the specified 475 * number of vertices, vertex format, number of texture coordinate 476 * sets, and texture coordinate mapping array. Defaults are used 477 * for all other parameters. 478 * 479 * @param vertexCount the number of vertex elements in this 480 * GeometryArray<p> 481 * 482 * @param vertexFormat a mask indicating which components are 483 * present in each vertex. This is specified as one or more 484 * individual flags that are bitwise "OR"ed together to describe 485 * the per-vertex data. 486 * The flags include: <code>COORDINATES</code>, to signal the inclusion of 487 * vertex positions--always present; <code>NORMALS</code>, to signal 488 * the inclusion of per vertex normals; one of <code>COLOR_3</code> or 489 * <code>COLOR_4</code>, to signal the inclusion of per vertex 490 * colors (without or with alpha information); one of 491 * <code>TEXTURE_COORDINATE_2</code> or <code>TEXTURE_COORDINATE_3</code> 492 * or <code>TEXTURE_COORDINATE_4</code>, 493 * to signal the 494 * inclusion of per-vertex texture coordinates (2D , 3D or 4D); 495 * <code>BY_REFERENCE</code>, to indicate that the data is passed 496 * by reference 497 * rather than by copying; <code>INTERLEAVED</code>, to indicate 498 * that the referenced 499 * data is interleaved in a single array; 500 * <code>USE_NIO_BUFFER</code>, to indicate that the referenced data 501 * is accessed via a J3DBuffer object that wraps an NIO buffer; 502 * <code>USE_COORD_INDEX_ONLY</code>, 503 * to indicate that only the coordinate indices are used for indexed 504 * geometry arrays; 505 * <code>BY_REFERENCE_INDICES</code>, to indicate 506 * that the indices are accessed by reference in indexed 507 * geometry arrays.<p> 508 * 509 * @param texCoordSetCount the number of texture coordinate sets 510 * in this GeometryArray object. If <code>vertexFormat</code> 511 * does not include one of <code>TEXTURE_COORDINATE_2</code> or 512 * <code>TEXTURE_COORDINATE_3</code>, the 513 * <code>texCoordSetCount</code> parameter is not used.<p> 514 * 515 * <a name="texCoordSetMap"> 516 * @param texCoordSetMap an array that maps texture coordinate 517 * sets to texture units. The array is indexed by texture unit 518 * number for each texture unit in the associated Appearance 519 * object. The values in the array specify the texture coordinate 520 * set within this GeometryArray object that maps to the 521 * corresponding texture 522 * unit. All elements within the array must be less than 523 * <code>texCoordSetCount</code>. A negative value specifies that 524 * no texture coordinate set maps to the texture unit 525 * corresponding to the index. If there are more texture units in 526 * any associated Appearance object than elements in the mapping 527 * array, the extra elements are assumed to be -1. The same 528 * texture coordinate set may be used for more than one texture 529 * unit. Each texture unit in every associated Appearance must 530 * have a valid source of texture coordinates: either a 531 * non-negative texture coordinate set must be specified in the 532 * mapping array or texture coordinate generation must be enabled. 533 * Texture coordinate generation will take precedence for those 534 * texture units for which a texture coordinate set is specified 535 * and texture coordinate generation is enabled. If 536 * <code>vertexFormat</code> does not include one of 537 * <code>TEXTURE_COORDINATE_2</code> or 538 * <code>TEXTURE_COORDINATE_3</code> or 539 * <code>TEXTURE_COORDINATE_4</code>, the 540 * <code>texCoordSetMap</code> array is not used. The following example 541 * illustrates the use of the <code>texCoordSetMap</code> array. 542 * 543 * <p> 544 * <ul> 545 * <table BORDER=1 CELLSPACING=2 CELLPADDING=2> 546 * <tr> 547 * <td><center><b>Index</b></center></td> 548 * <td><center><b>Element</b></center></td> 549 * <td><b>Description</b></td> 550 * </tr> 551 * <tr> 552 * <td><center>0</center></td> 553 * <td><center>1</center></td> 554 * <td>Use tex coord set 1 for tex unit 0</td> 555 * </tr> 556 * <tr> 557 * <td><center>1</center></td> 558 * <td><center>-1</center></td> 559 * <td>Use no tex coord set for tex unit 1</td> 560 * </tr> 561 * <tr> 562 * <td><center>2</center></td> 563 * <td><center>0</center></td> 564 * <td>Use tex coord set 0 for tex unit 2</td> 565 * </tr> 566 * <tr> 567 * <td><center>3</center></td> 568 * <td><center>1</center></td> 569 * <td>Reuse tex coord set 1 for tex unit 3</td> 570 * </tr> 571 * </table> 572 * </ul> 573 * <p> 574 * 575 * @exception IllegalArgumentException if vertexCount < 0 576 * 577 * @exception IllegalArgumentException if vertexFormat does <b>not</b> 578 * include <code>COORDINATES</code> 579 * 580 * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> 581 * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for 582 * non-indexed geometry arrays (that is, GeometryArray objects 583 * that are not a subclass of IndexedGeometryArray) 584 * 585 * @exception IllegalArgumentException if the <code>INTERLEAVED</code> 586 * bit is set without the <code>BY_REFERENCE</code> bit being set 587 * 588 * @exception IllegalArgumentException if the <code>USE_NIO_BUFFER</code> 589 * bit is set without the <code>BY_REFERENCE</code> bit being set 590 * 591 * @exception IllegalArgumentException if the <code>INTERLEAVED</code> 592 * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set 593 * 594 * @exception IllegalArgumentException if the 595 * <code>BY_REFERENCE_INDICES</code> 596 * bit is set without the <code>BY_REFERENCE</code> and 597 * <code>USE_COORD_INDEX_ONLY</code> bits being set 598 * 599 * @exception IllegalArgumentException if 600 * <code>texCoordSetCount < 0</code> 601 * 602 * @exception IllegalArgumentException if any element in 603 * <code>texCoordSetMap[] >= texCoordSetCount</code>. 604 * 605 * @since Java 3D 1.2 606 */ GeometryArray(int vertexCount, int vertexFormat, int texCoordSetCount, int[] texCoordSetMap)607 public GeometryArray(int vertexCount, 608 int vertexFormat, 609 int texCoordSetCount, 610 int[] texCoordSetMap) { 611 this(vertexCount, vertexFormat, texCoordSetCount, texCoordSetMap, 0, null); 612 } 613 614 615 //NVaidya 616 /** 617 * Constructs an empty GeometryArray object with the specified 618 * number of vertices, vertex format, number of texture coordinate 619 * sets, texture coordinate mapping array, vertex attribute count, 620 * and vertex attribute sizes array. 621 * 622 * @param vertexCount the number of vertex elements in this 623 * GeometryArray<p> 624 * 625 * @param vertexFormat a mask indicating which components are 626 * present in each vertex. This is specified as one or more 627 * individual flags that are bitwise "OR"ed together to describe 628 * the per-vertex data. 629 * The flags include: <code>COORDINATES</code>, to signal the inclusion of 630 * vertex positions--always present; <code>NORMALS</code>, to signal 631 * the inclusion of per vertex normals; one of <code>COLOR_3</code> or 632 * <code>COLOR_4</code>, to signal the inclusion of per vertex 633 * colors (without or with alpha information); one of 634 * <code>TEXTURE_COORDINATE_2</code> or <code>TEXTURE_COORDINATE_3</code> 635 * or <code>TEXTURE_COORDINATE_4</code>, 636 * to signal the 637 * inclusion of per-vertex texture coordinates (2D , 3D or 4D); 638 * <code>VERTEX_ATTRIBUTES</code>, to signal 639 * the inclusion of one or more arrays of vertex attributes; 640 * <code>BY_REFERENCE</code>, to indicate that the data is passed 641 * by reference 642 * rather than by copying; <code>INTERLEAVED</code>, to indicate 643 * that the referenced 644 * data is interleaved in a single array; 645 * <code>USE_NIO_BUFFER</code>, to indicate that the referenced data 646 * is accessed via a J3DBuffer object that wraps an NIO buffer; 647 * <code>USE_COORD_INDEX_ONLY</code>, 648 * to indicate that only the coordinate indices are used for indexed 649 * geometry arrays; 650 * <code>BY_REFERENCE_INDICES</code>, to indicate 651 * that the indices are accessed by reference in indexed 652 * geometry arrays.<p> 653 * 654 * @param texCoordSetCount the number of texture coordinate sets 655 * in this GeometryArray object. If <code>vertexFormat</code> 656 * does not include one of <code>TEXTURE_COORDINATE_2</code> or 657 * <code>TEXTURE_COORDINATE_3</code>, the 658 * <code>texCoordSetCount</code> parameter is not used.<p> 659 * 660 * <a name="texCoordSetMap"> 661 * @param texCoordSetMap an array that maps texture coordinate 662 * sets to texture units. The array is indexed by texture unit 663 * number for each texture unit in the associated Appearance 664 * object. The values in the array specify the texture coordinate 665 * set within this GeometryArray object that maps to the 666 * corresponding texture 667 * unit. All elements within the array must be less than 668 * <code>texCoordSetCount</code>. A negative value specifies that 669 * no texture coordinate set maps to the texture unit 670 * corresponding to the index. If there are more texture units in 671 * any associated Appearance object than elements in the mapping 672 * array, the extra elements are assumed to be -1. The same 673 * texture coordinate set may be used for more than one texture 674 * unit. Each texture unit in every associated Appearance must 675 * have a valid source of texture coordinates: either a 676 * non-negative texture coordinate set must be specified in the 677 * mapping array or texture coordinate generation must be enabled. 678 * Texture coordinate generation will take precedence for those 679 * texture units for which a texture coordinate set is specified 680 * and texture coordinate generation is enabled. If 681 * <code>vertexFormat</code> does not include one of 682 * <code>TEXTURE_COORDINATE_2</code> or 683 * <code>TEXTURE_COORDINATE_3</code> or 684 * <code>TEXTURE_COORDINATE_4</code>, the 685 * <code>texCoordSetMap</code> array is not used. The following example 686 * illustrates the use of the <code>texCoordSetMap</code> array. 687 * 688 * <p> 689 * <ul> 690 * <table BORDER=1 CELLSPACING=2 CELLPADDING=2> 691 * <tr> 692 * <td><center><b>Index</b></center></td> 693 * <td><center><b>Element</b></center></td> 694 * <td><b>Description</b></td> 695 * </tr> 696 * <tr> 697 * <td><center>0</center></td> 698 * <td><center>1</center></td> 699 * <td>Use tex coord set 1 for tex unit 0</td> 700 * </tr> 701 * <tr> 702 * <td><center>1</center></td> 703 * <td><center>-1</center></td> 704 * <td>Use no tex coord set for tex unit 1</td> 705 * </tr> 706 * <tr> 707 * <td><center>2</center></td> 708 * <td><center>0</center></td> 709 * <td>Use tex coord set 0 for tex unit 2</td> 710 * </tr> 711 * <tr> 712 * <td><center>3</center></td> 713 * <td><center>1</center></td> 714 * <td>Reuse tex coord set 1 for tex unit 3</td> 715 * </tr> 716 * </table> 717 * </ul> 718 * <p> 719 * 720 * @param vertexAttrCount the number of vertex attributes 721 * in this GeometryArray object. If <code>vertexFormat</code> 722 * does not include <code>VERTEX_ATTRIBUTES</code>, the 723 * <code>vertexAttrCount</code> parameter must be 0.<p> 724 * 725 * @param vertexAttrSizes is an array that specifes the size of 726 * each vertex attribute. Each element in the array specifies the 727 * number of components in the attribute, from 1 to 4. The length 728 * of the array must be equal to <code>vertexAttrCount</code>.<p> 729 * 730 * @exception IllegalArgumentException if vertexCount < 0 731 * 732 * @exception IllegalArgumentException if vertexFormat does <b>not</b> 733 * include <code>COORDINATES</code> 734 * 735 * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> 736 * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for 737 * non-indexed geometry arrays (that is, GeometryArray objects 738 * that are not a subclass of IndexedGeometryArray) 739 * 740 * @exception IllegalArgumentException if the <code>INTERLEAVED</code> 741 * bit is set without the <code>BY_REFERENCE</code> bit being set 742 * 743 * @exception IllegalArgumentException if the <code>USE_NIO_BUFFER</code> 744 * bit is set without the <code>BY_REFERENCE</code> bit being set 745 * 746 * @exception IllegalArgumentException if the <code>INTERLEAVED</code> 747 * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set 748 * 749 * @exception IllegalArgumentException if the 750 * <code>BY_REFERENCE_INDICES</code> 751 * bit is set without the <code>BY_REFERENCE</code> and 752 * <code>USE_COORD_INDEX_ONLY</code> bits being set 753 * 754 * @exception IllegalArgumentException if 755 * <code>texCoordSetCount < 0</code> 756 * 757 * @exception IllegalArgumentException if any element in 758 * <code>texCoordSetMap[] >= texCoordSetCount</code>. 759 * 760 * @exception IllegalArgumentException if 761 * <code>vertexAttrCount > 0</code> and the 762 * <code>VERTEX_ATTRIBUTES</code> bit is not set 763 * 764 * @exception IllegalArgumentException if 765 * <code>vertexAttrCount < 0</code> 766 * 767 * @exception IllegalArgumentException if 768 * <code>vertexAttrSizes.length != vertexAttrCount</code> 769 * 770 * @exception IllegalArgumentException if any element in 771 * <code>vertexAttrSizes[]</code> is <code>< 1</code> or 772 * <code>> 4</code>. 773 * 774 * @since Java 3D 1.4 775 */ GeometryArray(int vertexCount, int vertexFormat, int texCoordSetCount, int[] texCoordSetMap, int vertexAttrCount, int[] vertexAttrSizes)776 public GeometryArray(int vertexCount, 777 int vertexFormat, 778 int texCoordSetCount, 779 int[] texCoordSetMap, 780 int vertexAttrCount, 781 int[] vertexAttrSizes) { 782 783 if (vertexCount < 0) 784 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray96")); 785 786 if (texCoordSetCount < 0) 787 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray124")); 788 789 if (vertexAttrCount < 0) 790 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray125")); 791 792 if ((vertexFormat & COORDINATES) == 0) 793 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray0")); 794 795 if ((vertexFormat & INTERLEAVED) != 0 && 796 (vertexFormat & BY_REFERENCE) == 0) 797 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray80")); 798 799 if ((vertexFormat & INTERLEAVED) != 0 && 800 (vertexFormat & VERTEX_ATTRIBUTES) != 0) { 801 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray128")); 802 } 803 804 if ((vertexFormat & USE_COORD_INDEX_ONLY) != 0 && 805 !(this instanceof IndexedGeometryArray)) { 806 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray135")); 807 } 808 809 //NVaidya 810 if ((vertexFormat & BY_REFERENCE_INDICES) != 0) { 811 if (!(this instanceof IndexedGeometryArray)) 812 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray136")); 813 if ((vertexFormat & BY_REFERENCE) == 0) 814 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray137")); 815 if ((vertexFormat & USE_COORD_INDEX_ONLY) == 0) 816 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray138")); 817 } 818 819 if ((vertexFormat & USE_NIO_BUFFER) != 0 && 820 (vertexFormat & BY_REFERENCE) == 0) 821 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray117")); 822 823 if ((vertexFormat & TEXTURE_COORDINATE) != 0) { 824 if (texCoordSetMap == null) 825 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray106")); 826 827 if (texCoordSetCount == 0) 828 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray107")); 829 830 for (int i = 0; i < texCoordSetMap.length; i++) { 831 if (texCoordSetMap[i] >= texCoordSetCount) 832 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray108")); 833 } 834 835 if ((vertexFormat & TEXTURE_COORDINATE_2) != 0) { 836 texCoord2fArray = new TexCoord2f[1]; 837 texCoord2fScratch = new TexCoord2f(); 838 } 839 else if ((vertexFormat & TEXTURE_COORDINATE_3) != 0) { 840 texCoord3fArray = new TexCoord3f[1]; 841 texCoord3fScratch = new TexCoord3f(); 842 } 843 else if ((vertexFormat & TEXTURE_COORDINATE_4) != 0) { 844 texCoord4fArray = new TexCoord4f[1]; 845 } 846 } 847 848 if ((vertexFormat & VERTEX_ATTRIBUTES) != 0) { 849 if (vertexAttrCount > 0) { 850 if (vertexAttrCount != vertexAttrSizes.length) { 851 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray132")); 852 } 853 854 for (int i = 0; i < vertexAttrSizes.length; i++) { 855 if (vertexAttrSizes[i] < 1 || vertexAttrSizes[i] > 4) { 856 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray133")); 857 } 858 } 859 } else { 860 if (vertexAttrSizes != null && vertexAttrSizes.length != 0) { 861 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray132")); 862 } 863 } 864 } else { 865 if (vertexAttrCount > 0) { 866 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray131")); 867 } 868 } 869 870 // set default read capabilities 871 setDefaultReadCapabilities(readCapabilities); 872 873 ((GeometryArrayRetained)this.retained).createGeometryArrayData( 874 vertexCount, vertexFormat, 875 texCoordSetCount, texCoordSetMap, 876 vertexAttrCount, vertexAttrSizes); 877 878 } 879 880 881 //------------------------------------------------------------------ 882 // Common methods 883 //------------------------------------------------------------------ 884 885 /** 886 * Retrieves the number of vertices in this GeometryArray 887 * @return number of vertices in this GeometryArray 888 * @exception CapabilityNotSetException if the appropriate capability is 889 * not set and this object is part of a live or compiled scene graph 890 */ getVertexCount()891 public int getVertexCount() { 892 if (isLiveOrCompiled()) 893 if(!this.getCapability(ALLOW_COUNT_READ)) 894 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray1")); 895 896 return ((GeometryArrayRetained)this.retained).getVertexCount(); 897 } 898 899 /** 900 * Retrieves the vertexFormat of this GeometryArray 901 * @return format of vertices in this GeometryArray 902 * @exception CapabilityNotSetException if the appropriate capability is 903 * not set and this object is part of a live or compiled scene graph 904 */ getVertexFormat()905 public int getVertexFormat() { 906 if (isLiveOrCompiled()) 907 if(!this.getCapability(ALLOW_FORMAT_READ)) 908 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray2")); 909 910 return ((GeometryArrayRetained)this.retained).getVertexFormat(); 911 } 912 913 914 /** 915 * Retrieves the number of texture coordinate sets in this 916 * GeometryArray object. 917 * 918 * @return the number of texture coordinate sets 919 * in this GeometryArray object 920 * 921 * @since Java 3D 1.2 922 */ getTexCoordSetCount()923 public int getTexCoordSetCount() { 924 return ((GeometryArrayRetained)this.retained).getTexCoordSetCount(); 925 } 926 927 928 /** 929 * Retrieves the length of the texture coordinate set mapping 930 * array of this GeometryArray object. 931 * 932 * @return the length of the texture coordinate set mapping 933 * array of this GeometryArray object 934 * 935 * @since Java 3D 1.2 936 */ getTexCoordSetMapLength()937 public int getTexCoordSetMapLength() { 938 return ((GeometryArrayRetained)this.retained).getTexCoordSetMapLength(); 939 } 940 941 942 /** 943 * Retrieves the texture coordinate set mapping 944 * array from this GeometryArray object. 945 * 946 * @param texCoordSetMap an array that will receive a copy of the 947 * texture coordinate set mapping array. The array must be large 948 * enough to hold all entries of the texture coordinate set 949 * mapping array. 950 * 951 * @since Java 3D 1.2 952 */ getTexCoordSetMap(int[] texCoordSetMap)953 public void getTexCoordSetMap(int[] texCoordSetMap) { 954 ((GeometryArrayRetained)this.retained).getTexCoordSetMap(texCoordSetMap); 955 } 956 957 958 /** 959 * Retrieves the number of vertex attributes in this GeometryArray 960 * object. 961 * 962 * @return the number of vertex attributes in this GeometryArray 963 * object 964 * 965 * @since Java 3D 1.4 966 */ getVertexAttrCount()967 public int getVertexAttrCount() { 968 return ((GeometryArrayRetained)this.retained).getVertexAttrCount(); 969 } 970 971 972 /** 973 * Retrieves the vertex attribute sizes array from this 974 * GeometryArray object. 975 * 976 * @param vertexAttrSizes an array that will receive a copy of 977 * the vertex attribute sizes array. The array must hold at least 978 * <code>vertexAttrCount</code> elements. 979 * 980 * @since Java 3D 1.4 981 */ getVertexAttrSizes(int[] vertexAttrSizes)982 public void getVertexAttrSizes(int[] vertexAttrSizes) { 983 ((GeometryArrayRetained)this.retained).getVertexAttrSizes(vertexAttrSizes); 984 } 985 986 987 /** 988 * Updates geometry array data that is accessed by reference. 989 * This method calls the updateData method of the specified 990 * GeometryUpdater object to synchronize updates to vertex 991 * data that is referenced by this GeometryArray object. 992 * Applications that wish to modify such data must perform all 993 * updates via this method. 994 * <p> 995 * This method may also be used to atomically set multiple 996 * references (for example, to coordinate and color arrays) 997 * or to atomically 998 * change multiple data values through the geometry data copying 999 * methods. 1000 * 1001 * @param updater object whose updateData callback method will be 1002 * called to update the data referenced by this GeometryArray. 1003 * @exception CapabilityNotSetException if the appropriate capability 1004 * is not set, the vertex data mode is <code>BY_REFERENCE</code>, and this 1005 * object is part of a live or compiled scene graph 1006 * 1007 * @since Java 3D 1.2 1008 */ updateData(GeometryUpdater updater)1009 public void updateData(GeometryUpdater updater) { 1010 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1011 if ((format & BY_REFERENCE) != 0 && 1012 isLiveOrCompiled() && 1013 !this.getCapability(ALLOW_REF_DATA_WRITE)) { 1014 1015 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray81")); 1016 } 1017 1018 ((GeometryArrayRetained)this.retained).updateData(updater); 1019 } 1020 1021 1022 /** 1023 * Sets the valid vertex count for this GeometryArray object. 1024 * This count specifies the number of vertices actually used in 1025 * rendering or other operations such as picking and collision. 1026 * This attribute is initialized to <code>vertexCount</code>. 1027 * 1028 * @param validVertexCount the new valid vertex count. 1029 * @exception CapabilityNotSetException if the appropriate capability is 1030 * not set and this object is part of a live or compiled scene graph 1031 * <p> 1032 * @exception IllegalArgumentException if any of the following are 1033 * true: 1034 * <ul> 1035 * <code>validVertexCount < 0</code>,<br> 1036 * <code>initialVertexIndex + validVertexCount > vertexCount</code>,<br> 1037 * <code>initialCoordIndex + validVertexCount > vertexCount</code>,<br> 1038 * <code>initialColorIndex + validVertexCount > vertexCount</code>,<br> 1039 * <code>initialNormalIndex + validVertexCount > vertexCount</code>,<br> 1040 * <code>initialTexCoordIndex + validVertexCount > vertexCount</code>,<br> 1041 * <code>initialVertexAttrIndex + validVertexCount > vertexCount</code> 1042 * </ul> 1043 * <p> 1044 * @exception ArrayIndexOutOfBoundsException if the geometry data format 1045 * is <code>BY_REFERENCE</code> and any the following 1046 * are true for non-null array references: 1047 * <ul> 1048 * <code>CoordRef.length</code> < <i>num_words</i> * 1049 * (<code>initialCoordIndex + validVertexCount</code>),<br> 1050 * <code>ColorRef.length</code> < <i>num_words</i> * 1051 * (<code>initialColorIndex + validVertexCount</code>),<br> 1052 * <code>NormalRef.length</code> < <i>num_words</i> * 1053 * (<code>initialNormalIndex + validVertexCount</code>),<br> 1054 * <code>TexCoordRef.length</code> < <i>num_words</i> * 1055 * (<code>initialTexCoordIndex + validVertexCount</code>),<br> 1056 * <code>VertexAttrRef.length</code> < <i>num_words</i> * 1057 * (<code>initialVertexAttrIndex + validVertexCount</code>),<br> 1058 * <code>InterleavedVertices.length</code> < <i>words_per_vertex</i> * 1059 * (<code>initialVertexIndex + validVertexCount</code>)<br> 1060 * </ul> 1061 * where <i>num_words</i> depends on which variant of 1062 * <code>set</code><i>Array</i><code>Ref</code> is used, and 1063 * <i>words_per_vertex</i> depends on which vertex formats are enabled 1064 * for interleaved arrays. 1065 * 1066 * @since Java 3D 1.2 1067 */ setValidVertexCount(int validVertexCount)1068 public void setValidVertexCount(int validVertexCount) { 1069 if (isLiveOrCompiled()) 1070 if(!this.getCapability(ALLOW_COUNT_WRITE)) 1071 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray88")); 1072 1073 if (validVertexCount < 0) 1074 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray96")); 1075 1076 ((GeometryArrayRetained)this.retained).setValidVertexCount(validVertexCount); 1077 // NOTE: the checks for initial*Index + validVertexCount > 1078 // vertexCount need to be done in the retained method 1079 } 1080 1081 1082 /** 1083 * Gets the valid vertex count for this GeometryArray object. 1084 * For geometry strip primitives (subclasses of GeometryStripArray), 1085 * the valid vertex count is defined to be the sum of the 1086 * stripVertexCounts array. 1087 * @return the current valid vertex count 1088 * @exception CapabilityNotSetException if the appropriate capability is 1089 * not set and this object is part of a live or compiled scene graph 1090 * 1091 * @since Java 3D 1.2 1092 */ getValidVertexCount()1093 public int getValidVertexCount() { 1094 if (isLiveOrCompiled()) 1095 if(!this.getCapability(ALLOW_COUNT_READ)) 1096 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray89")); 1097 1098 return ((GeometryArrayRetained)this.retained).getValidVertexCount(); 1099 } 1100 1101 1102 /** 1103 * Copies all node information from <code>originalNodeComponent</code> 1104 * into the current node. This method is called from the 1105 * <code>duplicateNode</code> method. This routine does 1106 * the actual duplication of all "local data" (any data defined in 1107 * this object). 1108 * 1109 * @param originalNodeComponent the original node to duplicate. 1110 * @param forceDuplicate when set to <code>true</code>, causes the 1111 * <code>duplicateOnCloneTree</code> flag to be ignored. When 1112 * <code>false</code>, the value of each node's 1113 * <code>duplicateOnCloneTree</code> variable determines whether 1114 * NodeComponent data is duplicated or copied. 1115 * 1116 * @see Node#cloneTree 1117 * @see NodeComponent#setDuplicateOnCloneTree 1118 */ duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate)1119 void duplicateAttributes(NodeComponent originalNodeComponent, 1120 boolean forceDuplicate) { 1121 1122 super.duplicateAttributes(originalNodeComponent, forceDuplicate); 1123 // vertexFormat and vertexCount are copied in subclass when constructor 1124 // public GeometryArray(int vertexCount, int vertexFormat) is used 1125 // in cloneNodeComponent() 1126 GeometryArrayRetained src = (GeometryArrayRetained) originalNodeComponent.retained; 1127 GeometryArrayRetained dst = (GeometryArrayRetained) retained; 1128 int format = src.getVertexFormat(); 1129 if ((format & BY_REFERENCE) == 0) { 1130 System.arraycopy(src.vertexData, 0, dst.vertexData, 0, 1131 src.vertexData.length); 1132 dst.setInitialVertexIndex(src.getInitialVertexIndex()); 1133 1134 } else { 1135 dst.setInitialCoordIndex(src.getInitialCoordIndex()); 1136 dst.setInitialColorIndex(src.getInitialColorIndex()); 1137 dst.setInitialNormalIndex(src.getInitialNormalIndex()); 1138 int setCount = src.getTexCoordSetCount(); 1139 int vAttrCount = src.getVertexAttrCount(); 1140 for (int i=0; i < setCount; i++) { 1141 dst.setInitialTexCoordIndex(i, src.getInitialTexCoordIndex(i)); 1142 } 1143 if ((format & INTERLEAVED) == 0) { 1144 if ((format & USE_NIO_BUFFER) == 0) { 1145 // Java arrays 1146 dst.setCoordRefFloat(src.getCoordRefFloat()); 1147 dst.setCoordRefDouble(src.getCoordRefDouble()); 1148 dst.setCoordRef3f(src.getCoordRef3f()); 1149 dst.setCoordRef3d(src.getCoordRef3d()); 1150 dst.setColorRefFloat(src.getColorRefFloat()); 1151 dst.setColorRefByte(src.getColorRefByte()); 1152 if ((format & WITH_ALPHA) == 0) { 1153 dst.setColorRef3f(src.getColorRef3f()); 1154 dst.setColorRef3b(src.getColorRef3b()); 1155 } else { 1156 dst.setColorRef4f(src.getColorRef4f()); 1157 dst.setColorRef4b(src.getColorRef4b()); 1158 } 1159 dst.setNormalRefFloat(src.getNormalRefFloat()); 1160 dst.setNormalRef3f(src.getNormalRef3f()); 1161 1162 switch (src.getVertexAttrType()) { 1163 case GeometryArrayRetained.AF: 1164 for (int i=0; i < vAttrCount; i++) { 1165 dst.setVertexAttrRefFloat(i, src.getVertexAttrRefFloat(i)); 1166 } 1167 break; 1168 } 1169 1170 switch (src.getTexCoordType()) { 1171 case GeometryArrayRetained.TF: 1172 for (int i=0; i < setCount; i++) { 1173 dst.setTexCoordRefFloat(i, src.getTexCoordRefFloat(i)); 1174 } 1175 break; 1176 case GeometryArrayRetained.T2F: 1177 for (int i=0; i < setCount; i++) { 1178 dst.setTexCoordRef2f(i, src.getTexCoordRef2f(i)); 1179 } 1180 break; 1181 case GeometryArrayRetained.T3F: 1182 for (int i=0; i < setCount; i++) { 1183 dst.setTexCoordRef3f(i, src.getTexCoordRef3f(i)); 1184 } 1185 break; 1186 } 1187 } else { 1188 // NIO buffer 1189 dst.setCoordRefBuffer(src.getCoordRefBuffer()); 1190 dst.setColorRefBuffer(src.getColorRefBuffer()); 1191 dst.setNormalRefBuffer(src.getNormalRefBuffer()); 1192 1193 switch (src.getVertexAttrType()) { 1194 case GeometryArrayRetained.AF: 1195 for (int i=0; i < vAttrCount; i++) { 1196 dst.setVertexAttrRefBuffer(i, src.getVertexAttrRefBuffer(i)); 1197 } 1198 break; 1199 } 1200 1201 switch (src.getTexCoordType()) { 1202 case GeometryArrayRetained.TF: 1203 for (int i=0; i < setCount; i++) { 1204 dst.setTexCoordRefBuffer(i, src.getTexCoordRefBuffer(i)); 1205 } 1206 break; 1207 } 1208 } 1209 } else { 1210 dst.setInterleavedVertices(src.getInterleavedVertices()); 1211 } 1212 } 1213 } 1214 1215 1216 //------------------------------------------------------------------ 1217 // By-copying methods 1218 //------------------------------------------------------------------ 1219 1220 /** 1221 * Sets the initial vertex index for this GeometryArray object. 1222 * This index specifies the first vertex within this geometry 1223 * array that is actually used in rendering or other operations 1224 * such as picking and collision. This attribute is initialized 1225 * to 0. 1226 * This attribute is only used when the data mode for this 1227 * geometry array object is not <code>BY_REFERENCE</code> 1228 * or when the data mode is <code>INTERLEAVED</code>. 1229 * 1230 * @param initialVertexIndex the new initial vertex index. 1231 * @exception CapabilityNotSetException if the appropriate capability is 1232 * not set and this object is part of a live or compiled scene graph 1233 * @exception IllegalArgumentException if either of the following are 1234 * true: 1235 * <ul> 1236 * <code>initialVertexIndex < 0</code> or<br> 1237 * <code>initialVertexIndex + validVertexCount > vertexCount</code><br> 1238 * </ul> 1239 * 1240 * @exception ArrayIndexOutOfBoundsException if the geometry data format 1241 * is <code>INTERLEAVED</code>, the InterleavedVertices array is 1242 * non-null, and: 1243 * <ul> 1244 * <code>InterleavedVertices.length</code> < <i>num_words</i> * 1245 * (<code>initialVertexIndex + validVertexCount</code>)<br> 1246 * </ul> 1247 * where <i>num_words</i> depends on which vertex formats are enabled. 1248 * 1249 * @exception IllegalStateException if the data mode for this geometry 1250 * array object is <code>BY_REFERENCE</code> and is <i>not</i> 1251 * <code>INTERLEAVED</code>. 1252 * 1253 * @since Java 3D 1.2 1254 */ setInitialVertexIndex(int initialVertexIndex)1255 public void setInitialVertexIndex(int initialVertexIndex) { 1256 if (isLiveOrCompiled()) 1257 if(!this.getCapability(ALLOW_COUNT_WRITE)) 1258 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); 1259 1260 if (initialVertexIndex < 0) 1261 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); 1262 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1263 if ((format & BY_REFERENCE) != 0 && (format & INTERLEAVED) == 0) 1264 throw new IllegalStateException(J3dI18N.getString("GeometryArray105")); 1265 1266 ((GeometryArrayRetained)this.retained).setInitialVertexIndex(initialVertexIndex); 1267 // NOTE: the check for initialVertexIndex + validVertexCount > 1268 // vertexCount is done in the retained method 1269 } 1270 1271 1272 /** 1273 * Gets the initial vertex index for this GeometryArray object. 1274 * This attribute is only used when the data mode for this 1275 * geometry array object is <i>not</i> <code>BY_REFERENCE</code> 1276 * or when the data mode is <code>INTERLEAVED</code>. 1277 * @return the current initial vertex index for this GeometryArray object. 1278 * @exception CapabilityNotSetException if the appropriate capability is 1279 * not set and this object is part of a live or compiled scene graph 1280 * 1281 * @since Java 3D 1.2 1282 */ getInitialVertexIndex()1283 public int getInitialVertexIndex() { 1284 if (isLiveOrCompiled()) 1285 if(!this.getCapability(ALLOW_COUNT_READ)) 1286 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); 1287 1288 return ((GeometryArrayRetained)this.retained).getInitialVertexIndex(); 1289 } 1290 1291 1292 /** 1293 * Sets the coordinate associated with the vertex at 1294 * the specified index for this object. 1295 * @param index destination vertex index in this geometry array 1296 * @param coordinate source array of 3 values containing the new coordinate 1297 * @exception CapabilityNotSetException if the appropriate capability is 1298 * not set and this object is part of a live or compiled scene graph 1299 * @exception IllegalStateException if the data mode for this geometry 1300 * array object is <code>BY_REFERENCE</code>. 1301 */ setCoordinate(int index, float coordinate[])1302 public void setCoordinate(int index, float coordinate[]) { 1303 if (isLiveOrCompiled()) 1304 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1305 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); 1306 1307 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1308 if ((format & BY_REFERENCE) != 0) 1309 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1310 1311 ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); 1312 } 1313 1314 /** 1315 * Sets the coordinate associated with the vertex at 1316 * the specified index. 1317 * @param index destination vertex index in this geometry array 1318 * @param coordinate source array of 3 values containing the new coordinate 1319 * @exception CapabilityNotSetException if the appropriate capability is 1320 * not set and this object is part of a live or compiled scene graph 1321 * @exception IllegalStateException if the data mode for this geometry 1322 * array object is <code>BY_REFERENCE</code>. 1323 */ setCoordinate(int index, double coordinate[])1324 public void setCoordinate(int index, double coordinate[]) { 1325 if (isLiveOrCompiled()) 1326 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1327 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); 1328 1329 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1330 if ((format & BY_REFERENCE) != 0) 1331 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1332 1333 ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); 1334 } 1335 1336 /** 1337 * Sets the coordinate associated with the vertex at 1338 * the specified index for this object. 1339 * @param index destination vertex index in this geometry array 1340 * @param coordinate a point containing the new coordinate 1341 * @exception CapabilityNotSetException if the appropriate capability is 1342 * not set and this object is part of a live or compiled scene graph 1343 * @exception IllegalStateException if the data mode for this geometry 1344 * array object is <code>BY_REFERENCE</code>. 1345 */ setCoordinate(int index, Point3f coordinate)1346 public void setCoordinate(int index, Point3f coordinate) { 1347 if (isLiveOrCompiled()) 1348 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1349 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); 1350 1351 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1352 if ((format & BY_REFERENCE) != 0) 1353 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1354 1355 ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); 1356 } 1357 1358 /** 1359 * Sets the coordinate associated with the vertex at 1360 * the specified index for this object. 1361 * @param index destination vertex index in this geometry array 1362 * @param coordinate a point containing the new coordinate 1363 * @exception CapabilityNotSetException if the appropriate capability is 1364 * not set and this object is part of a live or compiled scene graph 1365 * @exception IllegalStateException if the data mode for this geometry 1366 * array object is <code>BY_REFERENCE</code>. 1367 */ setCoordinate(int index, Point3d coordinate)1368 public void setCoordinate(int index, Point3d coordinate) { 1369 if (isLiveOrCompiled()) 1370 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1371 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray3")); 1372 1373 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1374 if ((format & BY_REFERENCE) != 0) 1375 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1376 1377 ((GeometryArrayRetained)this.retained).setCoordinate(index, coordinate); 1378 } 1379 1380 /** 1381 * Sets the coordinates associated with the vertices starting at 1382 * the specified index for this object. The entire source array is 1383 * copied to this geometry array. 1384 * @param index starting destination vertex index in this geometry array 1385 * @param coordinates source array of 3*n values containing n new coordinates 1386 * @exception CapabilityNotSetException if the appropriate capability is 1387 * not set and this object is part of a live or compiled scene graph 1388 * @exception IllegalStateException if the data mode for this geometry 1389 * array object is <code>BY_REFERENCE</code>. 1390 */ setCoordinates(int index, float coordinates[])1391 public void setCoordinates(int index, float coordinates[]) { 1392 if (isLiveOrCompiled()) 1393 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1394 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1395 1396 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1397 if ((format & BY_REFERENCE) != 0) 1398 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1399 1400 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); 1401 } 1402 1403 /** 1404 * Sets the coordinates associated with the vertices starting at 1405 * the specified index for this object. The entire source array is 1406 * copied to this geometry array. 1407 * @param index starting destination vertex index in this geometry array 1408 * @param coordinates source array of 3*n values containing n new coordinates 1409 * @exception CapabilityNotSetException if the appropriate capability is 1410 * not set and this object is part of a live or compiled scene graph 1411 * @exception IllegalStateException if the data mode for this geometry 1412 * array object is <code>BY_REFERENCE</code>. 1413 */ setCoordinates(int index, double coordinates[])1414 public void setCoordinates(int index, double coordinates[]) { 1415 if (isLiveOrCompiled()) 1416 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1417 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1418 1419 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1420 if ((format & BY_REFERENCE) != 0) 1421 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1422 1423 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); 1424 } 1425 1426 /** 1427 * Sets the coordinates associated with the vertices starting at 1428 * the specified index for this object. The entire source array is 1429 * copied to this geometry array. 1430 * @param index starting destination vertex index in this geometry array 1431 * @param coordinates source array of points containing new coordinates 1432 * @exception CapabilityNotSetException if the appropriate capability is 1433 * not set and this object is part of a live or compiled scene graph 1434 * @exception IllegalStateException if the data mode for this geometry 1435 * array object is <code>BY_REFERENCE</code>. 1436 */ setCoordinates(int index, Point3f coordinates[])1437 public void setCoordinates(int index, Point3f coordinates[]) { 1438 if (isLiveOrCompiled()) 1439 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1440 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1441 1442 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1443 if ((format & BY_REFERENCE) != 0) 1444 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1445 1446 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); 1447 } 1448 1449 /** 1450 * Sets the coordinates associated with the vertices starting at 1451 * the specified index for this object. The entire source array is 1452 * copied to this geometry array. 1453 * @param index starting destination vertex index in this geometry array 1454 * @param coordinates source array of points containing new coordinates 1455 * @exception CapabilityNotSetException if the appropriate capability is 1456 * not set and this object is part of a live or compiled scene graph 1457 * @exception IllegalStateException if the data mode for this geometry 1458 * array object is <code>BY_REFERENCE</code>. 1459 */ setCoordinates(int index, Point3d coordinates[])1460 public void setCoordinates(int index, Point3d coordinates[]) { 1461 if (isLiveOrCompiled()) 1462 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1463 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1464 1465 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1466 if ((format & BY_REFERENCE) != 0) 1467 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1468 1469 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates); 1470 } 1471 1472 /** 1473 * Sets the coordinates associated with the vertices starting at 1474 * the specified index for this object using coordinate data starting 1475 * from vertex index <code>start</code> for <code>length</code> vertices. 1476 * @param index starting destination vertex index in this geometry array 1477 * @param coordinates source array of 3*n values containing n new coordinates 1478 * @param start starting source vertex index in <code>coordinates</code> array. 1479 * @param length number of vertices to be copied. 1480 * @exception CapabilityNotSetException if the appropriate capability is 1481 * not set and this object is part of a live or compiled scene graph 1482 * @exception IllegalStateException if the data mode for this geometry 1483 * array object is <code>BY_REFERENCE</code>. 1484 */ setCoordinates(int index, float coordinates[], int start, int length)1485 public void setCoordinates(int index, float coordinates[], 1486 int start, int length) { 1487 if (isLiveOrCompiled()) 1488 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1489 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1490 1491 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1492 if ((format & BY_REFERENCE) != 0) 1493 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1494 1495 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, 1496 start, length); 1497 } 1498 1499 /** 1500 * Sets the coordinates associated with the vertices starting at 1501 * the specified index for this object using coordinate data starting 1502 * from vertex index <code>start</code> for <code>length</code> vertices. 1503 * @param index starting destination vertex index in this geometry array 1504 * @param coordinates source array of 3*n values containing n new coordinates 1505 * @param start starting source vertex index in <code>coordinates</code> array. 1506 * @param length number of vertices to be copied. 1507 * @exception CapabilityNotSetException if the appropriate capability is 1508 * not set and this object is part of a live or compiled scene graph 1509 * @exception IllegalStateException if the data mode for this geometry 1510 * array object is <code>BY_REFERENCE</code>. 1511 */ setCoordinates(int index, double coordinates[], int start, int length)1512 public void setCoordinates(int index, double coordinates[], 1513 int start, int length) { 1514 if (isLiveOrCompiled()) 1515 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1516 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1517 1518 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1519 if ((format & BY_REFERENCE) != 0) 1520 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1521 1522 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, 1523 start, length); 1524 } 1525 1526 /** 1527 * Sets the coordinates associated with the vertices starting at 1528 * the specified index for this object using coordinate data starting 1529 * from vertex index <code>start</code> for <code>length</code> vertices. 1530 * @param index starting destination vertex index in this geometry array 1531 * @param coordinates source array of points containing new coordinates 1532 * @param start starting source vertex index in <code>coordinates</code> array. 1533 * @param length number of vertices to be copied. 1534 * @exception CapabilityNotSetException if the appropriate capability is 1535 * not set and this object is part of a live or compiled scene graph 1536 * @exception IllegalStateException if the data mode for this geometry 1537 * array object is <code>BY_REFERENCE</code>. 1538 */ setCoordinates(int index, Point3f coordinates[], int start, int length)1539 public void setCoordinates(int index, Point3f coordinates[], 1540 int start, int length) { 1541 if (isLiveOrCompiled()) 1542 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1543 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1544 1545 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1546 if ((format & BY_REFERENCE) != 0) 1547 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1548 1549 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, 1550 start, length); 1551 } 1552 1553 /** 1554 * Sets the coordinates associated with the vertices starting at 1555 * the specified index for this object using coordinate data starting 1556 * from vertex index <code>start</code> for <code>length</code> vertices. 1557 * @param index starting destination vertex index in this geometry array 1558 * @param coordinates source array of points containing new coordinates 1559 * @param start starting source vertex index in <code>coordinates</code> array. 1560 * @param length number of vertices to be copied. 1561 * @exception CapabilityNotSetException if the appropriate capability is 1562 * not set and this object is part of a live or compiled scene graph 1563 * @exception IllegalStateException if the data mode for this geometry 1564 * array object is <code>BY_REFERENCE</code>. 1565 */ setCoordinates(int index, Point3d coordinates[], int start, int length)1566 public void setCoordinates(int index, Point3d coordinates[], 1567 int start, int length) { 1568 if (isLiveOrCompiled()) 1569 if(!this.getCapability(ALLOW_COORDINATE_WRITE)) 1570 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray7")); 1571 1572 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1573 if ((format & BY_REFERENCE) != 0) 1574 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1575 1576 ((GeometryArrayRetained)this.retained).setCoordinates(index, coordinates, 1577 start, length); 1578 } 1579 1580 /** 1581 * Sets the color associated with the vertex at 1582 * the specified index for this object. 1583 * @param index destination vertex index in this geometry array 1584 * @param color source array of 3 or 4 values containing the new color 1585 * @exception CapabilityNotSetException if the appropriate capability is 1586 * not set and this object is part of a live or compiled scene graph 1587 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1588 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1589 * @exception IllegalStateException if the data mode for this geometry 1590 * array object is <code>BY_REFERENCE</code>. 1591 */ setColor(int index, float color[])1592 public void setColor(int index, float color[]) { 1593 if (isLiveOrCompiled()) 1594 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1595 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); 1596 1597 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1598 if ((format & BY_REFERENCE) != 0) 1599 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1600 1601 if ((format & COLOR) == 0) 1602 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1603 1604 ((GeometryArrayRetained)this.retained).setColor(index, color); 1605 } 1606 1607 /** 1608 * Sets the color associated with the vertex at 1609 * the specified index for this object. 1610 * @param index destination vertex index in this geometry array 1611 * @param color source array of 3 or 4 values containing the new color 1612 * @exception CapabilityNotSetException if the appropriate capability is 1613 * not set and this object is part of a live or compiled scene graph 1614 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1615 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1616 * @exception IllegalStateException if the data mode for this geometry 1617 * array object is <code>BY_REFERENCE</code>. 1618 */ setColor(int index, byte color[])1619 public void setColor(int index, byte color[]) { 1620 if (isLiveOrCompiled()) 1621 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1622 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); 1623 1624 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1625 if ((format & BY_REFERENCE) != 0) 1626 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1627 1628 if ((format & COLOR ) == 0) 1629 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1630 1631 ((GeometryArrayRetained)this.retained).setColor(index, color); 1632 } 1633 1634 /** 1635 * Sets the color associated with the vertex at 1636 * the specified index for this object. 1637 * @param index destination vertex index in this geometry array 1638 * @param color a Color3f containing the new color 1639 * @exception CapabilityNotSetException if the appropriate capability is 1640 * not set and this object is part of a live or compiled scene graph 1641 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1642 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1643 * @exception IllegalStateException if the data mode for this geometry 1644 * array object is <code>BY_REFERENCE</code>. 1645 * @exception IllegalStateException if COLOR_4 is specified in the vertex 1646 * format 1647 */ setColor(int index, Color3f color)1648 public void setColor(int index, Color3f color) { 1649 if (isLiveOrCompiled()) 1650 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1651 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); 1652 1653 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1654 if ((format & BY_REFERENCE) != 0) 1655 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1656 1657 if ((format & COLOR ) == 0) 1658 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1659 1660 if ((format & WITH_ALPHA) != 0) 1661 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 1662 1663 ((GeometryArrayRetained)this.retained).setColor(index, color); 1664 } 1665 1666 /** 1667 * Sets the color associated with the vertex at 1668 * the specified index for this object. 1669 * @param index destination vertex index in this geometry array 1670 * @param color a Color4f containing the new color 1671 * @exception CapabilityNotSetException if the appropriate capability is 1672 * not set and this object is part of a live or compiled scene graph 1673 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1674 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1675 * @exception IllegalStateException if the data mode for this geometry 1676 * array object is <code>BY_REFERENCE</code>. 1677 * @exception IllegalStateException if COLOR_3 is specified in the vertex 1678 * format 1679 */ setColor(int index, Color4f color)1680 public void setColor(int index, Color4f color) { 1681 if (isLiveOrCompiled()) 1682 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1683 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); 1684 1685 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1686 if ((format & BY_REFERENCE) != 0) 1687 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1688 1689 if ((format & COLOR ) == 0) 1690 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1691 1692 if ((format & WITH_ALPHA) == 0) 1693 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 1694 1695 ((GeometryArrayRetained)this.retained).setColor(index, color); 1696 } 1697 1698 /** 1699 * Sets the color associated with the vertex at 1700 * the specified index for this object. 1701 * @param index destination vertex index in this geometry array 1702 * @param color a Color3b containing the new color 1703 * @exception CapabilityNotSetException if the appropriate capability is 1704 * not set and this object is part of a live or compiled scene graph 1705 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1706 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1707 * @exception IllegalStateException if the data mode for this geometry 1708 * array object is <code>BY_REFERENCE</code>. 1709 * @exception IllegalStateException if COLOR_4 is specified in the vertex 1710 * format 1711 */ setColor(int index, Color3b color)1712 public void setColor(int index, Color3b color) { 1713 if (isLiveOrCompiled()) 1714 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1715 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); 1716 1717 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1718 if ((format & BY_REFERENCE) != 0) 1719 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1720 1721 if ((format & COLOR ) == 0) 1722 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1723 1724 if ((format & WITH_ALPHA) != 0) 1725 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 1726 1727 ((GeometryArrayRetained)this.retained).setColor(index, color); 1728 } 1729 1730 /** 1731 * Sets the color associated with the vertex at 1732 * the specified index for this object. 1733 * @param index destination vertex index in this geometry array 1734 * @param color a Color4b containing the new color 1735 * @exception CapabilityNotSetException if the appropriate capability is 1736 * not set and this object is part of a live or compiled scene graph 1737 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1738 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1739 * @exception IllegalStateException if the data mode for this geometry 1740 * array object is <code>BY_REFERENCE</code>. 1741 * @exception IllegalStateException if COLOR_3 is specified in the vertex 1742 * format 1743 */ setColor(int index, Color4b color)1744 public void setColor(int index, Color4b color) { 1745 if (isLiveOrCompiled()) 1746 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1747 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray15")); 1748 1749 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1750 if ((format & BY_REFERENCE) != 0) 1751 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1752 1753 if ((format & COLOR ) == 0) 1754 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1755 1756 if ((format & WITH_ALPHA) == 0) 1757 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 1758 1759 ((GeometryArrayRetained)this.retained).setColor(index, color); 1760 } 1761 1762 /** 1763 * Sets the colors associated with the vertices starting at 1764 * the specified index for this object. The entire source array is 1765 * copied to this geometry array. 1766 * @param index starting destination vertex index in this geometry array 1767 * @param colors source array of 3*n or 4*n values containing n new colors 1768 * @exception CapabilityNotSetException if the appropriate capability is 1769 * not set and this object is part of a live or compiled scene graph 1770 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1771 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1772 * @exception IllegalStateException if the data mode for this geometry 1773 * array object is <code>BY_REFERENCE</code>. 1774 */ setColors(int index, float colors[])1775 public void setColors(int index, float colors[]) { 1776 if (isLiveOrCompiled()) 1777 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1778 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1779 1780 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1781 if ((format & BY_REFERENCE) != 0) 1782 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1783 1784 if ((format & COLOR ) == 0) 1785 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1786 1787 ((GeometryArrayRetained)this.retained).setColors(index, colors); 1788 } 1789 1790 /** 1791 * Sets the colors associated with the vertices starting at 1792 * the specified index for this object. The entire source array is 1793 * copied to this geometry array. 1794 * @param index starting destination vertex index in this geometry array 1795 * @param colors source array of 3*n or 4*n values containing n new colors 1796 * @exception CapabilityNotSetException if the appropriate capability is 1797 * not set and this object is part of a live or compiled scene graph 1798 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1799 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1800 * @exception IllegalStateException if the data mode for this geometry 1801 * array object is <code>BY_REFERENCE</code>. 1802 */ setColors(int index, byte colors[])1803 public void setColors(int index, byte colors[]) { 1804 if (isLiveOrCompiled()) 1805 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1806 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1807 1808 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1809 if ((format & BY_REFERENCE) != 0) 1810 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1811 1812 if ((format & COLOR ) == 0) 1813 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1814 1815 ((GeometryArrayRetained)this.retained).setColors(index, colors); 1816 } 1817 1818 /** 1819 * Sets the colors associated with the vertices starting at 1820 * the specified index for this object. The entire source array is 1821 * copied to this geometry array. 1822 * @param index starting destination vertex index in this geometry array 1823 * @param colors source array of Color3f objects containing new colors 1824 * @exception CapabilityNotSetException if the appropriate capability is 1825 * not set and this object is part of a live or compiled scene graph 1826 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1827 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1828 * @exception IllegalStateException if the data mode for this geometry 1829 * array object is <code>BY_REFERENCE</code>. 1830 * @exception IllegalStateException if COLOR_4 is specified in vertex format 1831 */ setColors(int index, Color3f colors[])1832 public void setColors(int index, Color3f colors[]) { 1833 if (isLiveOrCompiled()) 1834 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1835 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1836 1837 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1838 if ((format & BY_REFERENCE) != 0) 1839 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1840 1841 if ((format & COLOR ) == 0) 1842 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1843 1844 if ((format & WITH_ALPHA) != 0) 1845 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 1846 1847 ((GeometryArrayRetained)this.retained).setColors(index, colors); 1848 } 1849 1850 /** 1851 * Sets the colors associated with the vertices starting at 1852 * the specified index for this object. The entire source array is 1853 * copied to this geometry array. 1854 * @param index starting destination vertex index in this geometry array 1855 * @param colors source array of Color4f objects containing new colors 1856 * @exception CapabilityNotSetException if the appropriate capability is 1857 * not set and this object is part of a live or compiled scene graph 1858 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1859 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1860 * @exception IllegalStateException if the data mode for this geometry 1861 * array object is <code>BY_REFERENCE</code>. 1862 * @exception IllegalStateException if COLOR_3 is specified in vertex format 1863 */ setColors(int index, Color4f colors[])1864 public void setColors(int index, Color4f colors[]) { 1865 if (isLiveOrCompiled()) 1866 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1867 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1868 1869 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1870 if ((format & BY_REFERENCE) != 0) 1871 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1872 1873 if ((format & COLOR ) == 0) 1874 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1875 1876 if ((format & WITH_ALPHA) == 0) 1877 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 1878 1879 ((GeometryArrayRetained)this.retained).setColors(index, colors); 1880 } 1881 1882 /** 1883 * Sets the colors associated with the vertices starting at 1884 * the specified index for this object. The entire source array is 1885 * copied to this geometry array. 1886 * @param index starting destination vertex index in this geometry array 1887 * @param colors source array of Color3b objects containing new colors 1888 * @exception CapabilityNotSetException if the appropriate capability is 1889 * not set and this object is part of a live or compiled scene graph 1890 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1891 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1892 * @exception IllegalStateException if the data mode for this geometry 1893 * array object is <code>BY_REFERENCE</code>. 1894 * @exception IllegalStateException if COLOR_4 is specified in vertex format 1895 */ setColors(int index, Color3b colors[])1896 public void setColors(int index, Color3b colors[]) { 1897 if (isLiveOrCompiled()) 1898 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1899 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1900 1901 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1902 if ((format & BY_REFERENCE) != 0) 1903 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1904 1905 if ((format & COLOR ) == 0) 1906 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1907 1908 if ((format & WITH_ALPHA) != 0) 1909 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 1910 1911 ((GeometryArrayRetained)this.retained).setColors(index, colors); 1912 } 1913 1914 /** 1915 * Sets the colors associated with the vertices starting at 1916 * the specified index for this object. The entire source array is 1917 * copied to this geometry array. 1918 * @param index starting destination vertex index in this geometry array 1919 * @param colors source array of Color4b objects containing new colors 1920 * @exception CapabilityNotSetException if the appropriate capability is 1921 * not set and this object is part of a live or compiled scene graph 1922 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1923 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1924 * @exception IllegalStateException if the data mode for this geometry 1925 * array object is <code>BY_REFERENCE</code>. 1926 * @exception IllegalStateException if COLOR_3 is specified in vertex format 1927 */ setColors(int index, Color4b colors[])1928 public void setColors(int index, Color4b colors[]) { 1929 if (isLiveOrCompiled()) 1930 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1931 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1932 1933 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1934 if ((format & BY_REFERENCE) != 0) 1935 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1936 1937 if ((format & COLOR ) == 0) 1938 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1939 1940 if ((format & WITH_ALPHA) == 0) 1941 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 1942 1943 ((GeometryArrayRetained)this.retained).setColors(index, colors); 1944 } 1945 1946 /** 1947 * Sets the colors associated with the vertices starting at 1948 * the specified index for this object using data in <code>colors</code> 1949 * starting at index <code>start</code> for <code>length</code> colors. 1950 * @param index starting destination vertex index in this geometry array 1951 * @param colors source array of 3*n or 4*n values containing n new colors 1952 * @param start starting source vertex index in <code>colors</code> array. 1953 * @param length number of colors to be copied. 1954 * @exception CapabilityNotSetException if the appropriate capability is 1955 * not set and this object is part of a live or compiled scene graph 1956 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1957 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1958 * @exception IllegalStateException if the data mode for this geometry 1959 * array object is <code>BY_REFERENCE</code>. 1960 */ setColors(int index, float colors[], int start, int length)1961 public void setColors(int index, float colors[], 1962 int start, int length) { 1963 if (isLiveOrCompiled()) 1964 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1965 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1966 1967 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 1968 if ((format & BY_REFERENCE) != 0) 1969 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 1970 1971 if ((format & COLOR ) == 0) 1972 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 1973 1974 ((GeometryArrayRetained)this.retained).setColors(index, colors, start, 1975 length); 1976 } 1977 1978 /** 1979 * Sets the colors associated with the vertices starting at 1980 * the specified index for this object using data in <code>colors</code> 1981 * starting at index <code>start</code> for <code>length</code> colors. 1982 * @param index starting destination vertex index in this geometry array 1983 * @param colors source array of 3*n or 4*n values containing n new colors 1984 * @param start starting source vertex index in <code>colors</code> array. 1985 * @param length number of colors to be copied. 1986 * @exception CapabilityNotSetException if the appropriate capability is 1987 * not set and this object is part of a live or compiled scene graph 1988 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 1989 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 1990 * @exception IllegalStateException if the data mode for this geometry 1991 * array object is <code>BY_REFERENCE</code>. 1992 */ setColors(int index, byte colors[], int start, int length)1993 public void setColors(int index, byte colors[], 1994 int start, int length) { 1995 if (isLiveOrCompiled()) 1996 if(!this.getCapability(ALLOW_COLOR_WRITE)) 1997 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 1998 1999 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2000 if ((format & BY_REFERENCE) != 0) 2001 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2002 2003 if ((format & COLOR ) == 0) 2004 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 2005 2006 ((GeometryArrayRetained)this.retained).setColors(index, colors, start, 2007 length); 2008 } 2009 2010 /** 2011 * Sets the colors associated with the vertices starting at 2012 * the specified index for this object using data in <code>colors</code> 2013 * starting at index <code>start</code> for <code>length</code> colors. 2014 * @param index starting destination vertex index in this geometry array 2015 * @param colors source array of Color3f objects containing new colors 2016 * @param start starting source vertex index in <code>colors</code> array. 2017 * @param length number of colors to be copied. 2018 * @exception CapabilityNotSetException if the appropriate capability is 2019 * not set and this object is part of a live or compiled scene graph 2020 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 2021 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2022 * @exception IllegalStateException if the data mode for this geometry 2023 * array object is <code>BY_REFERENCE</code>. 2024 * @exception IllegalStateException if COLOR_4 is specified in vertex format 2025 */ setColors(int index, Color3f colors[], int start, int length)2026 public void setColors(int index, Color3f colors[], 2027 int start, int length) { 2028 if (isLiveOrCompiled()) 2029 if(!this.getCapability(ALLOW_COLOR_WRITE)) 2030 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 2031 2032 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2033 if ((format & BY_REFERENCE) != 0) 2034 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2035 2036 if ((format & COLOR ) == 0) 2037 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 2038 2039 if ((format & WITH_ALPHA) != 0) 2040 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 2041 2042 ((GeometryArrayRetained)this.retained).setColors(index, colors, start, 2043 length); 2044 } 2045 2046 /** 2047 * Sets the colors associated with the vertices starting at 2048 * the specified index for this object using data in <code>colors</code> 2049 * starting at index <code>start</code> for <code>length</code> colors. 2050 * @param index starting destination vertex index in this geometry array 2051 * @param colors source array of Color4f objects containing new colors 2052 * @param start starting source vertex index in <code>colors</code> array. 2053 * @param length number of colors to be copied. 2054 * @exception CapabilityNotSetException if the appropriate capability is 2055 * not set and this object is part of a live or compiled scene graph 2056 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 2057 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2058 * @exception IllegalStateException if the data mode for this geometry 2059 * array object is <code>BY_REFERENCE</code>. 2060 * @exception IllegalStateException if COLOR_3 is specified in vertex format 2061 */ setColors(int index, Color4f colors[], int start, int length)2062 public void setColors(int index, Color4f colors[], 2063 int start, int length) { 2064 if (isLiveOrCompiled()) 2065 if(!this.getCapability(ALLOW_COLOR_WRITE)) 2066 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 2067 2068 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2069 if ((format & BY_REFERENCE) != 0) 2070 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2071 2072 if ((format & COLOR ) == 0) 2073 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 2074 2075 if ((format & WITH_ALPHA) == 0) 2076 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 2077 2078 ((GeometryArrayRetained)this.retained).setColors(index, colors, start, 2079 length); 2080 } 2081 2082 /** 2083 * Sets the colors associated with the vertices starting at 2084 * the specified index for this object using data in <code>colors</code> 2085 * starting at index <code>start</code> for <code>length</code> colors. 2086 * @param index starting destination vertex index in this geometry array 2087 * @param colors source array of Color3b objects containing new colors 2088 * @param start starting source vertex index in <code>colors</code> array. 2089 * @param length number of colors to be copied. 2090 * @exception CapabilityNotSetException if the appropriate capability is 2091 * not set and this object is part of a live or compiled scene graph 2092 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 2093 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2094 * @exception IllegalStateException if the data mode for this geometry 2095 * array object is <code>BY_REFERENCE</code>. 2096 * @exception IllegalStateException if COLOR_4 is specified in vertex format 2097 */ setColors(int index, Color3b colors[], int start, int length)2098 public void setColors(int index, Color3b colors[], 2099 int start, int length) { 2100 if (isLiveOrCompiled()) 2101 if(!this.getCapability(ALLOW_COLOR_WRITE)) 2102 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 2103 2104 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2105 if ((format & BY_REFERENCE) != 0) 2106 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2107 2108 if ((format & COLOR ) == 0) 2109 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 2110 2111 if ((format & WITH_ALPHA) != 0) 2112 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 2113 2114 ((GeometryArrayRetained)this.retained).setColors(index, colors, start, 2115 length); 2116 } 2117 2118 /** 2119 * Sets the colors associated with the vertices starting at 2120 * the specified index for this object using data in <code>colors</code> 2121 * starting at index <code>start</code> for <code>length</code> colors. 2122 * @param index starting destination vertex index in this geometry array 2123 * @param colors source array of Color4b objects containing new colors 2124 * @param start starting source vertex index in <code>colors</code> array. 2125 * @param length number of colors to be copied. 2126 * @exception CapabilityNotSetException if the appropriate capability is 2127 * not set and this object is part of a live or compiled scene graph 2128 * @exception ArrayIndexOutOfBoundsException if COLOR bit NOT set in 2129 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2130 * @exception IllegalStateException if the data mode for this geometry 2131 * array object is <code>BY_REFERENCE</code>. 2132 * @exception IllegalStateException if COLOR_3 is specified in vertex format 2133 */ setColors(int index, Color4b colors[], int start, int length)2134 public void setColors(int index, Color4b colors[], 2135 int start, int length) { 2136 if (isLiveOrCompiled()) 2137 if(!this.getCapability(ALLOW_COLOR_WRITE)) 2138 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray21")); 2139 2140 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2141 if ((format & BY_REFERENCE) != 0) 2142 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2143 2144 if ((format & COLOR ) == 0) 2145 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 2146 2147 if ((format & WITH_ALPHA) == 0) 2148 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 2149 2150 ((GeometryArrayRetained)this.retained).setColors(index, colors, start, 2151 length); 2152 } 2153 2154 /** 2155 * Sets the normal associated with the vertex at 2156 * the specified index for this object. 2157 * @param index destination vertex index in this geometry array 2158 * @param normal source array of 3 values containing the new normal 2159 * @exception CapabilityNotSetException if the appropriate capability is 2160 * not set and this object is part of a live or compiled scene graph 2161 * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in 2162 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2163 * @exception IllegalStateException if the data mode for this geometry 2164 * array object is <code>BY_REFERENCE</code>. 2165 */ setNormal(int index, float normal[])2166 public void setNormal(int index, float normal[]) { 2167 if (isLiveOrCompiled()) 2168 if(!this.getCapability(ALLOW_NORMAL_WRITE)) 2169 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray33")); 2170 2171 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2172 if ((format & BY_REFERENCE) != 0) 2173 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2174 2175 if ((format & NORMALS ) == 0) 2176 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 2177 2178 ((GeometryArrayRetained)this.retained).setNormal(index, normal); 2179 } 2180 2181 /** 2182 * Sets the normal associated with the vertex at 2183 * the specified index for this object. 2184 * @param index destination vertex index in this geometry array 2185 * @param normal the vector containing the new normal 2186 * @exception CapabilityNotSetException if the appropriate capability is 2187 * not set and this object is part of a live or compiled scene graph 2188 * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in 2189 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2190 * @exception IllegalStateException if the data mode for this geometry 2191 * array object is <code>BY_REFERENCE</code>. 2192 */ setNormal(int index, Vector3f normal)2193 public void setNormal(int index, Vector3f normal) { 2194 if (isLiveOrCompiled()) 2195 if(!this.getCapability(ALLOW_NORMAL_WRITE)) 2196 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray33")); 2197 2198 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2199 if ((format & BY_REFERENCE) != 0) 2200 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2201 2202 if ((format & NORMALS ) == 0) 2203 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 2204 2205 ((GeometryArrayRetained)this.retained).setNormal(index, normal); 2206 } 2207 2208 /** 2209 * Sets the normals associated with the vertices starting at 2210 * the specified index for this object. The entire source array is 2211 * copied to this geometry array. 2212 * @param index starting destination vertex index in this geometry array 2213 * @param normals source array of 3*n values containing n new normals 2214 * @exception CapabilityNotSetException if the appropriate capability is 2215 * not set and this object is part of a live or compiled scene graph 2216 * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in 2217 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2218 * @exception IllegalStateException if the data mode for this geometry 2219 * array object is <code>BY_REFERENCE</code>. 2220 */ setNormals(int index, float normals[])2221 public void setNormals(int index, float normals[]) { 2222 if (isLiveOrCompiled()) 2223 if(!this.getCapability(ALLOW_NORMAL_WRITE)) 2224 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); 2225 2226 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2227 if ((format & BY_REFERENCE) != 0) 2228 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2229 2230 if ((format & NORMALS ) == 0) 2231 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 2232 2233 ((GeometryArrayRetained)this.retained).setNormals(index, normals); 2234 } 2235 2236 /** 2237 * Sets the normals associated with the vertices starting at 2238 * the specified index for this object. The entire source array is 2239 * copied to this geometry array. 2240 * @param index starting destination vertex index in this geometry array 2241 * @param normals source array of vectors containing new normals 2242 * @exception CapabilityNotSetException if the appropriate capability is 2243 * not set and this object is part of a live or compiled scene graph 2244 * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in 2245 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2246 * @exception IllegalStateException if the data mode for this geometry 2247 * array object is <code>BY_REFERENCE</code>. 2248 */ setNormals(int index, Vector3f normals[])2249 public void setNormals(int index, Vector3f normals[]) { 2250 if (isLiveOrCompiled()) 2251 if(!this.getCapability(ALLOW_NORMAL_WRITE)) 2252 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); 2253 2254 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2255 if ((format & BY_REFERENCE) != 0) 2256 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2257 2258 if ((format & NORMALS ) == 0) 2259 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 2260 2261 ((GeometryArrayRetained)this.retained).setNormals(index, normals); 2262 } 2263 2264 /** 2265 * Sets the normals associated with the vertices starting at 2266 * the specified index for this object using data in <code>normals</code> 2267 * starting at index <code>start</code> and ending at index <code>start+length</code>. 2268 * @param index starting destination vertex index in this geometry array 2269 * @param normals source array of 3*n values containing n new normals 2270 * @param start starting source vertex index in <code>normals</code> array. 2271 * @param length number of normals to be copied. 2272 * @exception CapabilityNotSetException if the appropriate capability is 2273 * not set and this object is part of a live or compiled scene graph 2274 * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in 2275 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2276 * @exception IllegalStateException if the data mode for this geometry 2277 * array object is <code>BY_REFERENCE</code>. 2278 */ setNormals(int index, float normals[], int start, int length)2279 public void setNormals(int index, float normals[], 2280 int start, int length) { 2281 if (isLiveOrCompiled()) 2282 if(!this.getCapability(ALLOW_NORMAL_WRITE)) 2283 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); 2284 2285 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2286 if ((format & BY_REFERENCE) != 0) 2287 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2288 2289 if ((format & NORMALS ) == 0) 2290 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 2291 2292 ((GeometryArrayRetained)this.retained).setNormals(index, normals, start, length); 2293 } 2294 2295 /** 2296 * Sets the normals associated with the vertices starting at 2297 * the specified index for this object using data in <code>normals</code> 2298 * starting at index <code>start</code> and ending at index <code>start+length</code>. 2299 * @param index starting destination vertex index in this geometry array 2300 * @param normals source array of vectors containing new normals 2301 * @param start starting source vertex index in <code>normals</code> array. 2302 * @param length number of normals to be copied. 2303 * @exception CapabilityNotSetException if the appropriate capability is 2304 * not set and this object is part of a live or compiled scene graph 2305 * @exception ArrayIndexOutOfBoundsException if NORMALS bit NOT set in 2306 * constructor <code>vertexFormat</code> or array index for element is out of bounds. 2307 * @exception IllegalStateException if the data mode for this geometry 2308 * array object is <code>BY_REFERENCE</code>. 2309 */ setNormals(int index, Vector3f normals[], int start, int length)2310 public void setNormals(int index, Vector3f normals[], 2311 int start, int length) { 2312 if (isLiveOrCompiled()) 2313 if(!this.getCapability(ALLOW_NORMAL_WRITE)) 2314 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray35")); 2315 2316 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2317 if ((format & BY_REFERENCE) != 0) 2318 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2319 2320 if ((format & NORMALS ) == 0) 2321 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 2322 2323 ((GeometryArrayRetained)this.retained).setNormals(index, normals, start, length); 2324 } 2325 2326 2327 /** 2328 * @deprecated As of Java 3D version 1.2, replaced by 2329 * <code>setTextureCoordinate(int texCoordSet, ...)</code> 2330 */ setTextureCoordinate(int index, float texCoord[])2331 public void setTextureCoordinate(int index, float texCoord[]) { 2332 setTextureCoordinate(0, index, texCoord); 2333 } 2334 2335 /** 2336 * Sets the texture coordinate associated with the vertex at the 2337 * specified index in the specified texture coordinate set for 2338 * this object. 2339 * 2340 * @param texCoordSet texture coordinate set in this geometry array 2341 * @param index destination vertex index in this geometry array 2342 * @param texCoord source array of 2, 3 or 4 values containing the new 2343 * texture coordinate 2344 * 2345 * @exception CapabilityNotSetException if the appropriate capability is 2346 * not set and this object is part of a live or compiled scene graph 2347 * 2348 * @exception ArrayIndexOutOfBoundsException if none of the 2349 * <code>TEXTURE_COORDINATE</code> bits are set in the 2350 * <code>vertexFormat</code> or if the index or 2351 * texCoordSet is out of range. 2352 * 2353 * @exception IllegalStateException if the data mode for this geometry 2354 * array object is <code>BY_REFERENCE</code>. 2355 * 2356 * @since Java 3D 1.2 2357 */ setTextureCoordinate(int texCoordSet, int index, float texCoord[])2358 public void setTextureCoordinate(int texCoordSet, 2359 int index, float texCoord[]) { 2360 if (isLiveOrCompiled()) 2361 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2362 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); 2363 2364 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2365 texCoordSet, index, texCoord, 0, 1); 2366 } 2367 2368 /** 2369 * @deprecated As of Java 3D version 1.2, replaced by 2370 * <code>setTextureCoordinate(int texCoordSet, TexCoord2f texCoord)</code> 2371 */ setTextureCoordinate(int index, Point2f texCoord)2372 public void setTextureCoordinate(int index, Point2f texCoord) { 2373 texCoord2fScratch.set(texCoord); 2374 setTextureCoordinate(0, index, texCoord2fScratch); 2375 } 2376 2377 /** 2378 * Sets the texture coordinate associated with the vertex at 2379 * the specified index in the specified texture coordinate set 2380 * for this object. 2381 * 2382 * @param texCoordSet texture coordinate set in this geometry array 2383 * @param index destination vertex index in this geometry array 2384 * @param texCoord the TexCoord2f containing the new texture coordinate 2385 * 2386 * @exception CapabilityNotSetException if the appropriate capability is 2387 * not set and this object is part of a live or compiled scene graph 2388 * 2389 * @exception ArrayIndexOutOfBoundsException if none of the 2390 * <code>TEXTURE_COORDINATE</code> bits are set in the 2391 * <code>vertexFormat</code> or if the index or 2392 * texCoordSet is out of range. 2393 * 2394 * @exception IllegalStateException if the data mode for this geometry 2395 * array object is <code>BY_REFERENCE</code>. 2396 * 2397 * @exception IllegalStateException if TEXTURE_COORDINATE_3 or 2398 * TEXTURE_COORDINATE_4 is specified in vertex format 2399 * 2400 * @since Java 3D 1.2 2401 */ setTextureCoordinate(int texCoordSet, int index, TexCoord2f texCoord)2402 public void setTextureCoordinate(int texCoordSet, 2403 int index, TexCoord2f texCoord) { 2404 if (isLiveOrCompiled()) 2405 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2406 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); 2407 2408 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2409 (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) 2410 throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); 2411 2412 texCoord2fArray[0] = texCoord; 2413 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2414 texCoordSet, index, texCoord2fArray, 0, 1); 2415 } 2416 2417 /** 2418 * @deprecated As of Java 3D version 1.2, replaced by 2419 * <code>setTextureCoordinate(int texCoordSet, TexCoord3f texCoord)</code> 2420 */ setTextureCoordinate(int index, Point3f texCoord)2421 public void setTextureCoordinate(int index, Point3f texCoord) { 2422 texCoord3fScratch.set(texCoord); 2423 setTextureCoordinate(0, index, texCoord3fScratch); 2424 } 2425 2426 /** 2427 * Sets the texture coordinate associated with the vertex at 2428 * the specified index in the specified texture coordinate set 2429 * for this object. 2430 * 2431 * @param texCoordSet texture coordinate set in this geometry array 2432 * @param index destination vertex index in this geometry array 2433 * @param texCoord the TexCoord3f containing the new texture coordinate 2434 * 2435 * @exception CapabilityNotSetException if the appropriate capability is 2436 * not set and this object is part of a live or compiled scene graph 2437 * 2438 * @exception ArrayIndexOutOfBoundsException if none of the 2439 * <code>TEXTURE_COORDINATE</code> bits are set in the 2440 * <code>vertexFormat</code> or if the index or 2441 * texCoordSet is out of range. 2442 * 2443 * @exception IllegalStateException if the data mode for this geometry 2444 * array object is <code>BY_REFERENCE</code>. 2445 * 2446 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 2447 * TEXTURE_COORDINATE_4 is specified in vertex format 2448 * 2449 * @since Java 3D 1.2 2450 */ setTextureCoordinate(int texCoordSet, int index, TexCoord3f texCoord)2451 public void setTextureCoordinate(int texCoordSet, 2452 int index, TexCoord3f texCoord) { 2453 if (isLiveOrCompiled()) 2454 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2455 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); 2456 2457 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2458 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) 2459 throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); 2460 2461 texCoord3fArray[0] = texCoord; 2462 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2463 texCoordSet, index, texCoord3fArray, 0, 1); 2464 } 2465 2466 /** 2467 * Sets the texture coordinate associated with the vertex at 2468 * the specified index in the specified texture coordinate set 2469 * for this object. 2470 * 2471 * @param texCoordSet texture coordinate set in this geometry array 2472 * @param index destination vertex index in this geometry array 2473 * @param texCoord the TexCoord4f containing the new texture coordinate 2474 * 2475 * @exception CapabilityNotSetException if the appropriate capability is 2476 * not set and this object is part of a live or compiled scene graph 2477 * 2478 * @exception ArrayIndexOutOfBoundsException if none of the 2479 * <code>TEXTURE_COORDINATE</code> bits are set in the 2480 * <code>vertexFormat</code> or if the index or 2481 * texCoordSet is out of range. 2482 * 2483 * @exception IllegalStateException if the data mode for this geometry 2484 * array object is <code>BY_REFERENCE</code>. 2485 * 2486 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 2487 * TEXTURE_COORDINATE_3 is specified in vertex format 2488 * 2489 * @since Java 3D 1.3 2490 */ setTextureCoordinate(int texCoordSet, int index, TexCoord4f texCoord)2491 public void setTextureCoordinate(int texCoordSet, 2492 int index, TexCoord4f texCoord) { 2493 if (isLiveOrCompiled()) 2494 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2495 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray39")); 2496 2497 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2498 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) 2499 throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); 2500 2501 texCoord4fArray[0] = texCoord; 2502 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2503 texCoordSet, index, texCoord4fArray, 0, 1); 2504 } 2505 2506 /** 2507 * @deprecated As of Java 3D version 1.2, replaced by 2508 * <code>setTextureCoordinates(int texCoordSet, ...)</code> 2509 */ setTextureCoordinates(int index, float texCoords[])2510 public void setTextureCoordinates(int index, float texCoords[]) { 2511 setTextureCoordinates(0, index, texCoords); 2512 } 2513 2514 /** 2515 * Sets the texture coordinates associated with the vertices starting at 2516 * the specified index in the specified texture coordinate set 2517 * for this object. The entire source array is 2518 * copied to this geometry array. 2519 * 2520 * @param texCoordSet texture coordinate set in this geometry array 2521 * @param index starting destination vertex index in this geometry array 2522 * @param texCoords source array of 2*n, 3*n or 4*n values containing n new 2523 * texture coordinates 2524 * 2525 * @exception CapabilityNotSetException if the appropriate capability is 2526 * not set and this object is part of a live or compiled scene graph 2527 * 2528 * @exception ArrayIndexOutOfBoundsException if none of the 2529 * <code>TEXTURE_COORDINATE</code> bits are set in the 2530 * <code>vertexFormat</code> or if the index or 2531 * texCoordSet is out of range. 2532 * 2533 * @exception IllegalStateException if the data mode for this geometry 2534 * array object is <code>BY_REFERENCE</code>. 2535 * 2536 * @since Java 3D 1.2 2537 */ setTextureCoordinates(int texCoordSet, int index, float texCoords[])2538 public void setTextureCoordinates(int texCoordSet, 2539 int index, float texCoords[]) { 2540 if (isLiveOrCompiled()) 2541 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2542 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2543 2544 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2545 if ((format & GeometryArray.TEXTURE_COORDINATE_2) != 0) 2546 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2547 texCoordSet, index, texCoords, 0, texCoords.length / 2); 2548 else if ((format & GeometryArray.TEXTURE_COORDINATE_3) != 0) 2549 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2550 texCoordSet, index, texCoords, 0, texCoords.length / 3); 2551 else 2552 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2553 texCoordSet, index, texCoords, 0, texCoords.length / 4); 2554 } 2555 2556 /** 2557 * @deprecated As of Java 3D version 1.2, replaced by 2558 * <code>setTextureCoordinates(int texCoordSet, TexCoord2f texCoords[])</code> 2559 */ setTextureCoordinates(int index, Point2f texCoords[])2560 public void setTextureCoordinates(int index, Point2f texCoords[]) { 2561 2562 if (isLiveOrCompiled()) 2563 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2564 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2565 2566 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2567 0, index, texCoords, 0, texCoords.length); 2568 } 2569 2570 /** 2571 * Sets the texture coordinates associated with the vertices starting at 2572 * the specified index in the specified texture coordinate set 2573 * for this object. The entire source array is 2574 * copied to this geometry array. 2575 * 2576 * @param texCoordSet texture coordinate set in this geometry array 2577 * @param index starting destination vertex index in this geometry array 2578 * @param texCoords source array of TexCoord2f objects containing new 2579 * texture coordinates 2580 * 2581 * @exception CapabilityNotSetException if the appropriate capability is 2582 * not set and this object is part of a live or compiled scene graph 2583 * 2584 * @exception ArrayIndexOutOfBoundsException if none of the 2585 * <code>TEXTURE_COORDINATE</code> bits are set in the 2586 * <code>vertexFormat</code> or if the index or 2587 * texCoordSet is out of range. 2588 * 2589 * @exception IllegalStateException if the data mode for this geometry 2590 * array object is <code>BY_REFERENCE</code>. 2591 * 2592 * @exception IllegalStateException if TEXTURE_COORDINATE_3 or 2593 * TEXTURE_COORDINATE_4 is specified in vertex format 2594 * 2595 * @since Java 3D 1.2 2596 */ setTextureCoordinates(int texCoordSet, int index, TexCoord2f texCoords[])2597 public void setTextureCoordinates(int texCoordSet, 2598 int index, TexCoord2f texCoords[]) { 2599 if (isLiveOrCompiled()) 2600 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2601 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2602 2603 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2604 (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) 2605 throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); 2606 2607 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2608 texCoordSet, index, texCoords, 0, texCoords.length); 2609 } 2610 2611 /** 2612 * @deprecated As of Java 3D version 1.2, replaced by 2613 * <code>setTextureCoordinates(int texCoordSet, TexCoord3f texCoords[])</code> 2614 */ setTextureCoordinates(int index, Point3f texCoords[])2615 public void setTextureCoordinates(int index, Point3f texCoords[]) { 2616 if (isLiveOrCompiled()) 2617 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2618 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2619 2620 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2621 0, index, texCoords, 0, texCoords.length); 2622 } 2623 2624 /** 2625 * Sets the texture coordinates associated with the vertices starting at 2626 * the specified index in the specified texture coordinate set 2627 * for this object. The entire source array is 2628 * copied to this geometry array. 2629 * 2630 * @param texCoordSet texture coordinate set in this geometry array 2631 * @param index starting destination vertex index in this geometry array 2632 * @param texCoords source array of TexCoord3f objects containing new 2633 * texture coordinates 2634 * 2635 * @exception CapabilityNotSetException if the appropriate capability is 2636 * not set and this object is part of a live or compiled scene graph 2637 * 2638 * @exception ArrayIndexOutOfBoundsException if none of the 2639 * <code>TEXTURE_COORDINATE</code> bits are set in the 2640 * <code>vertexFormat</code> or if the index or 2641 * texCoordSet is out of range. 2642 * 2643 * @exception IllegalStateException if the data mode for this geometry 2644 * array object is <code>BY_REFERENCE</code>. 2645 * 2646 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 2647 * TEXTURE_COORDINATE_4 is specified in vertex format 2648 * 2649 * @since Java 3D 1.2 2650 */ setTextureCoordinates(int texCoordSet, int index, TexCoord3f texCoords[])2651 public void setTextureCoordinates(int texCoordSet, 2652 int index, TexCoord3f texCoords[]) { 2653 if (isLiveOrCompiled()) 2654 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2655 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2656 2657 2658 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2659 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) 2660 throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); 2661 2662 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2663 texCoordSet, index, texCoords, 0, texCoords.length); 2664 } 2665 2666 /** 2667 * Sets the texture coordinates associated with the vertices starting at 2668 * the specified index in the specified texture coordinate set 2669 * for this object. The entire source array is 2670 * copied to this geometry array. 2671 * 2672 * @param texCoordSet texture coordinate set in this geometry array 2673 * @param index starting destination vertex index in this geometry array 2674 * @param texCoords source array of TexCoord4f objects containing new 2675 * texture coordinates 2676 * 2677 * @exception CapabilityNotSetException if the appropriate capability is 2678 * not set and this object is part of a live or compiled scene graph 2679 * 2680 * @exception ArrayIndexOutOfBoundsException if none of the 2681 * <code>TEXTURE_COORDINATE</code> bits are set in the 2682 * <code>vertexFormat</code> or if the index or 2683 * texCoordSet is out of range. 2684 * 2685 * @exception IllegalStateException if the data mode for this geometry 2686 * array object is <code>BY_REFERENCE</code>. 2687 * 2688 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 2689 * TEXTURE_COORDINATE_3 is specified in vertex format 2690 * 2691 * @since Java 3D 1.3 2692 */ setTextureCoordinates(int texCoordSet, int index, TexCoord4f texCoords[])2693 public void setTextureCoordinates(int texCoordSet, 2694 int index, TexCoord4f texCoords[]) { 2695 if (isLiveOrCompiled()) 2696 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2697 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2698 2699 2700 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2701 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) 2702 throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); 2703 2704 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2705 texCoordSet, index, texCoords, 0, texCoords.length); 2706 } 2707 2708 /** 2709 * @deprecated As of Java 3D version 1.2, replaced by 2710 * <code>setTextureCoordinates(int texCoordSet, ...)</code> 2711 */ setTextureCoordinates(int index, float texCoords[], int start, int length)2712 public void setTextureCoordinates(int index, float texCoords[], 2713 int start, int length) { 2714 setTextureCoordinates(0, index, texCoords, start, length); 2715 } 2716 2717 /** 2718 * Sets the texture coordinates associated with the vertices 2719 * starting at the specified index in the specified texture 2720 * coordinate set for this object using data in 2721 * <code>texCoords</code> starting at index <code>start</code> and 2722 * ending at index <code>start+length</code>. 2723 * 2724 * @param index starting destination vertex index in this geometry array 2725 * @param texCoords source array of 2*n , 3*n or 4*n values containing 2726 * n new texture coordinates 2727 * @param start starting source vertex index in <code>texCoords</code> 2728 * array. 2729 * @param length number of texture Coordinates to be copied. 2730 * 2731 * @exception CapabilityNotSetException if the appropriate capability is 2732 * not set and this object is part of a live or compiled scene graph 2733 * 2734 * @exception ArrayIndexOutOfBoundsException if none of the 2735 * <code>TEXTURE_COORDINATE</code> bits are set in the 2736 * <code>vertexFormat</code> or if the index or 2737 * texCoordSet is out of range. 2738 * 2739 * @exception IllegalStateException if the data mode for this geometry 2740 * array object is <code>BY_REFERENCE</code>. 2741 * 2742 * @since Java 3D 1.2 2743 */ setTextureCoordinates(int texCoordSet, int index, float texCoords[], int start, int length)2744 public void setTextureCoordinates(int texCoordSet, 2745 int index, float texCoords[], 2746 int start, int length) { 2747 if (isLiveOrCompiled()) 2748 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2749 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2750 2751 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2752 texCoordSet, index, texCoords, start, length); 2753 } 2754 2755 /** 2756 * @deprecated As of Java 3D version 1.2, replaced by 2757 * <code>setTextureCoordinates(int texCoordSet, TexCoord2f texCoords[], ...)</code> 2758 */ setTextureCoordinates(int index, Point2f texCoords[], int start, int length)2759 public void setTextureCoordinates(int index, Point2f texCoords[], 2760 int start, int length) { 2761 if (isLiveOrCompiled()) 2762 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2763 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2764 2765 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2766 0, index, texCoords, start, length); 2767 } 2768 2769 /** 2770 * Sets the texture coordinates associated with the vertices 2771 * starting at the specified index in the specified texture 2772 * coordinate set for this object using data in 2773 * <code>texCoords</code> starting at index <code>start</code> and 2774 * ending at index <code>start+length</code>. 2775 * 2776 * @param texCoordSet texture coordinate set in this geometry array 2777 * @param index starting destination vertex index in this geometry array 2778 * @param texCoords source array of TexCoord2f objects containing new 2779 * texture coordinates 2780 * @param start starting source vertex index in <code>texCoords</code> 2781 * array. 2782 * @param length number of texture Coordinates to be copied. 2783 * 2784 * @exception CapabilityNotSetException if the appropriate capability is 2785 * not set and this object is part of a live or compiled scene graph 2786 * 2787 * @exception ArrayIndexOutOfBoundsException if none of the 2788 * <code>TEXTURE_COORDINATE</code> bits are set in the 2789 * <code>vertexFormat</code> or if the index or 2790 * texCoordSet is out of range. 2791 * 2792 * @exception IllegalStateException if the data mode for this geometry 2793 * array object is <code>BY_REFERENCE</code>. 2794 * 2795 * @exception IllegalStateException if TEXTURE_COORDINATE_3 or 2796 * TEXTURE_COORDINATE_4 is specified in vertex format 2797 * 2798 * @since Java 3D 1.2 2799 */ setTextureCoordinates(int texCoordSet, int index, TexCoord2f texCoords[], int start, int length)2800 public void setTextureCoordinates(int texCoordSet, 2801 int index, TexCoord2f texCoords[], 2802 int start, int length) { 2803 if (isLiveOrCompiled()) 2804 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2805 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2806 2807 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2808 (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) 2809 throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); 2810 2811 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2812 texCoordSet, index, texCoords, start, length); 2813 } 2814 2815 /** 2816 * @deprecated As of Java 3D version 1.2, replaced by 2817 * <code>setTextureCoordinates(int texCoordSet, TexCoord3f texCoords[], ...)</code> 2818 */ setTextureCoordinates(int index, Point3f texCoords[], int start, int length)2819 public void setTextureCoordinates(int index, Point3f texCoords[], 2820 int start, int length) { 2821 if (isLiveOrCompiled()) 2822 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2823 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2824 2825 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2826 0, index, texCoords, start, length); 2827 } 2828 2829 /** 2830 * Sets the texture coordinates associated with the vertices 2831 * starting at the specified index in the specified texture 2832 * coordinate set for this object. starting at index 2833 * <code>start</code> and ending at index <code>start+length</code>. 2834 * 2835 * @param texCoordSet texture coordinate set in this geometry array 2836 * @param index starting destination vertex index in this geometry array 2837 * @param texCoords source array of TexCoord3f objects containing new 2838 * texture coordinates 2839 * @param start starting source vertex index in <code>texCoords</code> 2840 * array. 2841 * @param length number of texture Coordinates to be copied. 2842 * 2843 * @exception CapabilityNotSetException if the appropriate capability is 2844 * not set and this object is part of a live or compiled scene graph 2845 * 2846 * @exception ArrayIndexOutOfBoundsException if none of the 2847 * <code>TEXTURE_COORDINATE</code> bits are set in the 2848 * <code>vertexFormat</code> or if the index or 2849 * texCoordSet is out of range. 2850 * 2851 * @exception IllegalStateException if the data mode for this geometry 2852 * array object is <code>BY_REFERENCE</code>. 2853 * 2854 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 2855 * TEXTURE_COORDINATE_4 is specified in vertex format 2856 * 2857 * @since Java 3D 1.2 2858 */ setTextureCoordinates(int texCoordSet, int index, TexCoord3f texCoords[], int start, int length)2859 public void setTextureCoordinates(int texCoordSet, 2860 int index, TexCoord3f texCoords[], 2861 int start, int length) { 2862 if (isLiveOrCompiled()) 2863 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2864 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2865 2866 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2867 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) 2868 throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); 2869 2870 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2871 texCoordSet, index, texCoords, start, length); 2872 } 2873 2874 /** 2875 * Sets the texture coordinates associated with the vertices 2876 * starting at the specified index in the specified texture 2877 * coordinate set for this object. starting at index 2878 * <code>start</code> and ending at index <code>start+length</code>. 2879 * 2880 * @param texCoordSet texture coordinate set in this geometry array 2881 * @param index starting destination vertex index in this geometry array 2882 * @param texCoords source array of TexCoord4f objects containing new 2883 * texture coordinates 2884 * @param start starting source vertex index in <code>texCoords</code> 2885 * array. 2886 * @param length number of texture Coordinates to be copied. 2887 * 2888 * @exception CapabilityNotSetException if the appropriate capability is 2889 * not set and this object is part of a live or compiled scene graph 2890 * 2891 * @exception ArrayIndexOutOfBoundsException if none of the 2892 * <code>TEXTURE_COORDINATE</code> bits are set in the 2893 * <code>vertexFormat</code> or if the index or 2894 * texCoordSet is out of range. 2895 * 2896 * @exception IllegalStateException if the data mode for this geometry 2897 * array object is <code>BY_REFERENCE</code>. 2898 * 2899 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 2900 * TEXTURE_COORDINATE_3 is specified in vertex format 2901 * 2902 * @since Java 3D 1.3 2903 */ setTextureCoordinates(int texCoordSet, int index, TexCoord4f texCoords[], int start, int length)2904 public void setTextureCoordinates(int texCoordSet, 2905 int index, TexCoord4f texCoords[], 2906 int start, int length) { 2907 if (isLiveOrCompiled()) 2908 if(!this.getCapability(ALLOW_TEXCOORD_WRITE)) 2909 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray42")); 2910 2911 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 2912 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) 2913 throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); 2914 2915 ((GeometryArrayRetained)this.retained).setTextureCoordinates( 2916 texCoordSet, index, texCoords, start, length); 2917 } 2918 2919 2920 /** 2921 * Sets the vertex attribute associated with the vertex at the 2922 * specified index in the specified vertex attribute number for 2923 * this object. 2924 * 2925 * @param vertexAttrNum vertex attribute number in this geometry array 2926 * @param index destination vertex index in this geometry array 2927 * @param vertexAttr source array of 1, 2, 3 or 4 values containing 2928 * the new vertex attribute 2929 * 2930 * @exception CapabilityNotSetException if the appropriate capability is 2931 * not set and this object is part of a live or compiled scene graph 2932 * 2933 * @exception ArrayIndexOutOfBoundsException if the index or 2934 * vertexAttrNum is out of range, or if the vertexAttr array is 2935 * too small. 2936 * 2937 * @exception IllegalStateException if the data mode for this geometry 2938 * array object is <code>BY_REFERENCE</code>. 2939 * 2940 * @since Java 3D 1.4 2941 */ setVertexAttr(int vertexAttrNum, int index, float[] vertexAttr)2942 public void setVertexAttr(int vertexAttrNum, int index, 2943 float[] vertexAttr) { 2944 2945 if (isLiveOrCompiled()) { 2946 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 2947 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 2948 } 2949 } 2950 2951 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2952 if ((format & BY_REFERENCE) != 0) { 2953 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2954 } 2955 2956 ((GeometryArrayRetained)this.retained).setVertexAttrs( 2957 vertexAttrNum, index, vertexAttr, 0, 1); 2958 } 2959 2960 /** 2961 * Sets the vertex attribute associated with the vertex at the 2962 * specified index in the specified vertex attribute number for 2963 * this object. 2964 * 2965 * @param vertexAttrNum vertex attribute number in this geometry array 2966 * @param index destination vertex index in this geometry array 2967 * @param vertexAttr the Point2f containing the new vertex attribute 2968 * 2969 * @exception CapabilityNotSetException if the appropriate capability is 2970 * not set and this object is part of a live or compiled scene graph 2971 * 2972 * @exception ArrayIndexOutOfBoundsException if the index or 2973 * vertexAttrNum is out of range. 2974 * 2975 * @exception IllegalStateException if the data mode for this geometry 2976 * array object is <code>BY_REFERENCE</code>. 2977 * 2978 * @exception IllegalStateException if the size of the specified 2979 * vertex attribute number is not 2. 2980 * 2981 * @since Java 3D 1.4 2982 */ setVertexAttr(int vertexAttrNum, int index, Point2f vertexAttr)2983 public void setVertexAttr(int vertexAttrNum, int index, 2984 Point2f vertexAttr) { 2985 2986 if (isLiveOrCompiled()) { 2987 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 2988 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 2989 } 2990 } 2991 2992 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 2993 if ((format & BY_REFERENCE) != 0) { 2994 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 2995 } 2996 2997 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 2998 if (size != 2) { 2999 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3000 } 3001 3002 ((GeometryArrayRetained)this.retained).setVertexAttr( 3003 vertexAttrNum, index, vertexAttr); 3004 } 3005 3006 /** 3007 * Sets the vertex attribute associated with the vertex at the 3008 * specified index in the specified vertex attribute number for 3009 * this object. 3010 * 3011 * @param vertexAttrNum vertex attribute number in this geometry array 3012 * @param index destination vertex index in this geometry array 3013 * @param vertexAttr the Point3f containing the new vertex attribute 3014 * 3015 * @exception CapabilityNotSetException if the appropriate capability is 3016 * not set and this object is part of a live or compiled scene graph 3017 * 3018 * @exception ArrayIndexOutOfBoundsException if the index or 3019 * vertexAttrNum is out of range. 3020 * 3021 * @exception IllegalStateException if the data mode for this geometry 3022 * array object is <code>BY_REFERENCE</code>. 3023 * 3024 * @exception IllegalStateException if the size of the specified 3025 * vertex attribute number is not 3. 3026 * 3027 * @since Java 3D 1.4 3028 */ setVertexAttr(int vertexAttrNum, int index, Point3f vertexAttr)3029 public void setVertexAttr(int vertexAttrNum, int index, 3030 Point3f vertexAttr) { 3031 3032 if (isLiveOrCompiled()) { 3033 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3034 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3035 } 3036 } 3037 3038 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3039 if ((format & BY_REFERENCE) != 0) { 3040 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3041 } 3042 3043 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3044 if (size != 3) { 3045 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3046 } 3047 3048 ((GeometryArrayRetained)this.retained).setVertexAttr( 3049 vertexAttrNum, index, vertexAttr); 3050 } 3051 3052 /** 3053 * Sets the vertex attribute associated with the vertex at the 3054 * specified index in the specified vertex attribute number for 3055 * this object. 3056 * 3057 * @param vertexAttrNum vertex attribute number in this geometry array 3058 * @param index destination vertex index in this geometry array 3059 * @param vertexAttr the Point4f containing the new vertex attribute 3060 * 3061 * @exception CapabilityNotSetException if the appropriate capability is 3062 * not set and this object is part of a live or compiled scene graph 3063 * 3064 * @exception ArrayIndexOutOfBoundsException if the index or 3065 * vertexAttrNum is out of range. 3066 * 3067 * @exception IllegalStateException if the data mode for this geometry 3068 * array object is <code>BY_REFERENCE</code>. 3069 * 3070 * @exception IllegalStateException if the size of the specified 3071 * vertex attribute number is not 4. 3072 * 3073 * @since Java 3D 1.4 3074 */ setVertexAttr(int vertexAttrNum, int index, Point4f vertexAttr)3075 public void setVertexAttr(int vertexAttrNum, int index, 3076 Point4f vertexAttr) { 3077 3078 if (isLiveOrCompiled()) { 3079 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3080 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3081 } 3082 } 3083 3084 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3085 if ((format & BY_REFERENCE) != 0) { 3086 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3087 } 3088 3089 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3090 if (size != 4) { 3091 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3092 } 3093 3094 ((GeometryArrayRetained)this.retained).setVertexAttr( 3095 vertexAttrNum, index, vertexAttr); 3096 } 3097 3098 /** 3099 * Sets the vertex attributes associated with the vertices starting at 3100 * the specified index in the specified vertex attribute number 3101 * for this object. The entire source array is copied to this 3102 * geometry array. 3103 * 3104 * @param vertexAttrNum vertex attribute number in this geometry array 3105 * @param index starting destination vertex index in this geometry array 3106 * @param vertexAttrs source array of 1*n, 2*n, 3*n, or 4*n values 3107 * containing n new vertex attributes 3108 * 3109 * @exception CapabilityNotSetException if the appropriate capability is 3110 * not set and this object is part of a live or compiled scene graph 3111 * 3112 * @exception ArrayIndexOutOfBoundsException if the index or 3113 * vertexAttrNum is out of range, or if the vertexAttr array is 3114 * too large. 3115 * 3116 * @exception IllegalStateException if the data mode for this geometry 3117 * array object is <code>BY_REFERENCE</code>. 3118 * 3119 * @since Java 3D 1.4 3120 */ setVertexAttrs(int vertexAttrNum, int index, float[] vertexAttrs)3121 public void setVertexAttrs(int vertexAttrNum, int index, 3122 float[] vertexAttrs) { 3123 if (isLiveOrCompiled()) { 3124 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3125 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3126 } 3127 } 3128 3129 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3130 if ((format & BY_REFERENCE) != 0) { 3131 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3132 } 3133 3134 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3135 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3136 vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length / size); 3137 } 3138 3139 /** 3140 * Sets the vertex attributes associated with the vertices starting at 3141 * the specified index in the specified vertex attribute number 3142 * for this object. The entire source array is copied to this 3143 * geometry array. 3144 * 3145 * @param vertexAttrNum vertex attribute number in this geometry array 3146 * @param index starting destination vertex index in this geometry array 3147 * @param vertexAttrs source array of Point2f objects containing new 3148 * vertex attributes 3149 * 3150 * @exception CapabilityNotSetException if the appropriate capability is 3151 * not set and this object is part of a live or compiled scene graph 3152 * 3153 * @exception ArrayIndexOutOfBoundsException if the index or 3154 * vertexAttrNum is out of range, or if the vertexAttr array is 3155 * too large. 3156 * 3157 * @exception IllegalStateException if the data mode for this geometry 3158 * array object is <code>BY_REFERENCE</code>. 3159 * 3160 * @exception IllegalStateException if the size of the specified 3161 * vertex attribute number is not 2. 3162 * 3163 * @since Java 3D 1.4 3164 */ setVertexAttrs(int vertexAttrNum, int index, Point2f[] vertexAttrs)3165 public void setVertexAttrs(int vertexAttrNum, int index, 3166 Point2f[] vertexAttrs) { 3167 3168 if (isLiveOrCompiled()) { 3169 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3170 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3171 } 3172 } 3173 3174 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3175 if ((format & BY_REFERENCE) != 0) { 3176 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3177 } 3178 3179 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3180 if (size != 2) { 3181 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3182 } 3183 3184 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3185 vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length); 3186 } 3187 3188 /** 3189 * Sets the vertex attributes associated with the vertices starting at 3190 * the specified index in the specified vertex attribute number 3191 * for this object. The entire source array is copied to this 3192 * geometry array. 3193 * 3194 * @param vertexAttrNum vertex attribute number in this geometry array 3195 * @param index starting destination vertex index in this geometry array 3196 * @param vertexAttrs source array of Point3f objects containing new 3197 * vertex attributes 3198 * 3199 * @exception CapabilityNotSetException if the appropriate capability is 3200 * not set and this object is part of a live or compiled scene graph 3201 * 3202 * @exception ArrayIndexOutOfBoundsException if the index or 3203 * vertexAttrNum is out of range, or if the vertexAttr array is 3204 * too large. 3205 * 3206 * @exception IllegalStateException if the data mode for this geometry 3207 * array object is <code>BY_REFERENCE</code>. 3208 * 3209 * @exception IllegalStateException if the size of the specified 3210 * vertex attribute number is not 3. 3211 * 3212 * @since Java 3D 1.4 3213 */ setVertexAttrs(int vertexAttrNum, int index, Point3f[] vertexAttrs)3214 public void setVertexAttrs(int vertexAttrNum, int index, 3215 Point3f[] vertexAttrs) { 3216 3217 if (isLiveOrCompiled()) { 3218 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3219 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3220 } 3221 } 3222 3223 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3224 if ((format & BY_REFERENCE) != 0) { 3225 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3226 } 3227 3228 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3229 if (size != 3) { 3230 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3231 } 3232 3233 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3234 vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length); 3235 } 3236 3237 /** 3238 * Sets the vertex attributes associated with the vertices starting at 3239 * the specified index in the specified vertex attribute number 3240 * for this object. The entire source array is copied to this 3241 * geometry array. 3242 * 3243 * @param vertexAttrNum vertex attribute number in this geometry array 3244 * @param index starting destination vertex index in this geometry array 3245 * @param vertexAttrs source array of Point4f objects containing new 3246 * vertex attributes 3247 * 3248 * @exception CapabilityNotSetException if the appropriate capability is 3249 * not set and this object is part of a live or compiled scene graph 3250 * 3251 * @exception ArrayIndexOutOfBoundsException if the index or 3252 * vertexAttrNum is out of range, or if the vertexAttr array is 3253 * too large. 3254 * 3255 * @exception IllegalStateException if the data mode for this geometry 3256 * array object is <code>BY_REFERENCE</code>. 3257 * 3258 * @exception IllegalStateException if the size of the specified 3259 * vertex attribute number is not 4. 3260 * 3261 * @since Java 3D 1.4 3262 */ setVertexAttrs(int vertexAttrNum, int index, Point4f[] vertexAttrs)3263 public void setVertexAttrs(int vertexAttrNum, int index, 3264 Point4f[] vertexAttrs) { 3265 3266 if (isLiveOrCompiled()) { 3267 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3268 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3269 } 3270 } 3271 3272 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3273 if ((format & BY_REFERENCE) != 0) { 3274 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3275 } 3276 3277 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3278 if (size != 4) { 3279 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3280 } 3281 3282 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3283 vertexAttrNum, index, vertexAttrs, 0, vertexAttrs.length); 3284 } 3285 3286 /** 3287 * Sets the vertex attributes associated with the vertices 3288 * starting at the specified index in the specified vertex 3289 * attribute number for this object using data in 3290 * <code>vertexAttrs</code> starting at index <code>start</code> and 3291 * ending at index <code>start+length</code>. 3292 * 3293 * @param index starting destination vertex index in this geometry array 3294 * @param vertexAttrs source array of 1*n, 2*n, 3*n, or 4*n values 3295 * containing n new vertex attributes 3296 * @param start starting source vertex index in <code>vertexAttrs</code> 3297 * array. 3298 * @param length number of vertex attributes to be copied. 3299 * 3300 * @exception CapabilityNotSetException if the appropriate capability is 3301 * not set and this object is part of a live or compiled scene graph 3302 * 3303 * @exception ArrayIndexOutOfBoundsException if any of index, 3304 * (index+length), or vertexAttrNum are out of range, or if 3305 * vertexAttrs is too small. 3306 * 3307 * @exception IllegalStateException if the data mode for this geometry 3308 * array object is <code>BY_REFERENCE</code>. 3309 * 3310 * @since Java 3D 1.4 3311 */ setVertexAttrs(int vertexAttrNum, int index, float[] vertexAttrs, int start, int length)3312 public void setVertexAttrs(int vertexAttrNum, int index, 3313 float[] vertexAttrs, 3314 int start, int length) { 3315 3316 if (isLiveOrCompiled()) { 3317 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3318 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3319 } 3320 } 3321 3322 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3323 if ((format & BY_REFERENCE) != 0) { 3324 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3325 } 3326 3327 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3328 vertexAttrNum, index, vertexAttrs, start, length); 3329 } 3330 3331 /** 3332 * Sets the vertex attributes associated with the vertices 3333 * starting at the specified index in the specified vertex 3334 * attribute number for this object using data in 3335 * <code>vertexAttrs</code> starting at index <code>start</code> and 3336 * ending at index <code>start+length</code>. 3337 * 3338 * @param vertexAttrNum vertex attribute number in this geometry array 3339 * @param index starting destination vertex index in this geometry array 3340 * @param vertexAttrs source array of Point2f objects containing new 3341 * vertex attributes 3342 * @param start starting source vertex index in <code>vertexAttrs</code> 3343 * array. 3344 * @param length number of vertex attributes to be copied. 3345 * 3346 * @exception CapabilityNotSetException if the appropriate capability is 3347 * not set and this object is part of a live or compiled scene graph 3348 * 3349 * @exception ArrayIndexOutOfBoundsException if any of index, 3350 * (index+length), or vertexAttrNum are out of range, or if 3351 * vertexAttrs is too small. 3352 * 3353 * @exception IllegalStateException if the data mode for this geometry 3354 * array object is <code>BY_REFERENCE</code>. 3355 * 3356 * @exception IllegalStateException if the size of the specified 3357 * vertex attribute number is not 2. 3358 * 3359 * @since Java 3D 1.4 3360 */ setVertexAttrs(int vertexAttrNum, int index, Point2f[] vertexAttrs, int start, int length)3361 public void setVertexAttrs(int vertexAttrNum, int index, 3362 Point2f[] vertexAttrs, 3363 int start, int length) { 3364 3365 if (isLiveOrCompiled()) { 3366 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3367 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3368 } 3369 } 3370 3371 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3372 if ((format & BY_REFERENCE) != 0) { 3373 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3374 } 3375 3376 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3377 if (size != 2) { 3378 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3379 } 3380 3381 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3382 vertexAttrNum, index, vertexAttrs, start, length); 3383 } 3384 3385 /** 3386 * Sets the vertex attributes associated with the vertices 3387 * starting at the specified index in the specified vertex 3388 * attribute number for this object using data in 3389 * <code>vertexAttrs</code> starting at index <code>start</code> and 3390 * ending at index <code>start+length</code>. 3391 * 3392 * @param vertexAttrNum vertex attribute number in this geometry array 3393 * @param index starting destination vertex index in this geometry array 3394 * @param vertexAttrs source array of Point3f objects containing new 3395 * vertex attributes 3396 * @param start starting source vertex index in <code>vertexAttrs</code> 3397 * array. 3398 * @param length number of vertex attributes to be copied. 3399 * 3400 * @exception CapabilityNotSetException if the appropriate capability is 3401 * not set and this object is part of a live or compiled scene graph 3402 * 3403 * @exception ArrayIndexOutOfBoundsException if any of index, 3404 * (index+length), or vertexAttrNum are out of range, or if 3405 * vertexAttrs is too small. 3406 * 3407 * @exception IllegalStateException if the data mode for this geometry 3408 * array object is <code>BY_REFERENCE</code>. 3409 * 3410 * @exception IllegalStateException if the size of the specified 3411 * vertex attribute number is not 3. 3412 * 3413 * @since Java 3D 1.4 3414 */ setVertexAttrs(int vertexAttrNum, int index, Point3f[] vertexAttrs, int start, int length)3415 public void setVertexAttrs(int vertexAttrNum, int index, 3416 Point3f[] vertexAttrs, 3417 int start, int length) { 3418 3419 if (isLiveOrCompiled()) { 3420 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3421 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3422 } 3423 } 3424 3425 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3426 if ((format & BY_REFERENCE) != 0) { 3427 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3428 } 3429 3430 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3431 if (size != 3) { 3432 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3433 } 3434 3435 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3436 vertexAttrNum, index, vertexAttrs, start, length); 3437 } 3438 3439 /** 3440 * Sets the vertex attributes associated with the vertices 3441 * starting at the specified index in the specified vertex 3442 * attribute number for this object using data in 3443 * <code>vertexAttrs</code> starting at index <code>start</code> and 3444 * ending at index <code>start+length</code>. 3445 * 3446 * @param vertexAttrNum vertex attribute number in this geometry array 3447 * @param index starting destination vertex index in this geometry array 3448 * @param vertexAttrs source array of Point4f objects containing new 3449 * vertex attributes 3450 * @param start starting source vertex index in <code>vertexAttrs</code> 3451 * array. 3452 * @param length number of vertex attributes to be copied. 3453 * 3454 * @exception CapabilityNotSetException if the appropriate capability is 3455 * not set and this object is part of a live or compiled scene graph 3456 * 3457 * @exception ArrayIndexOutOfBoundsException if any of index, 3458 * (index+length), or vertexAttrNum are out of range, or if 3459 * vertexAttrs is too small. 3460 * 3461 * @exception IllegalStateException if the data mode for this geometry 3462 * array object is <code>BY_REFERENCE</code>. 3463 * 3464 * @exception IllegalStateException if the size of the specified 3465 * vertex attribute number is not 4. 3466 * 3467 * @since Java 3D 1.4 3468 */ setVertexAttrs(int vertexAttrNum, int index, Point4f[] vertexAttrs, int start, int length)3469 public void setVertexAttrs(int vertexAttrNum, int index, 3470 Point4f[] vertexAttrs, 3471 int start, int length) { 3472 3473 if (isLiveOrCompiled()) { 3474 if (!this.getCapability(ALLOW_VERTEX_ATTR_WRITE)) { 3475 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray126")); 3476 } 3477 } 3478 3479 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3480 if ((format & BY_REFERENCE) != 0) { 3481 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3482 } 3483 3484 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 3485 if (size != 4) { 3486 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 3487 } 3488 3489 ((GeometryArrayRetained)this.retained).setVertexAttrs( 3490 vertexAttrNum, index, vertexAttrs, start, length); 3491 } 3492 3493 3494 /** 3495 * Gets the coordinate associated with the vertex at 3496 * the specified index for this object using data in <code>texCoords</code> 3497 * @param index source vertex index in this geometry array 3498 * @param coordinate destination array of 3 values that will receive the coordinate 3499 * @exception CapabilityNotSetException if the appropriate capability is 3500 * not set and this object is part of a live or compiled scene graph 3501 * @exception IllegalStateException if the data mode for this geometry 3502 * array object is <code>BY_REFERENCE</code>. 3503 */ getCoordinate(int index, float coordinate[])3504 public void getCoordinate(int index, float coordinate[]) { 3505 if (isLiveOrCompiled()) 3506 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3507 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); 3508 3509 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3510 if ((format & BY_REFERENCE) != 0) 3511 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3512 3513 ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); 3514 } 3515 3516 /** 3517 * Gets the coordinate associated with the vertex at 3518 * the specified index for this object. 3519 * @param index source vertex index in this geometry array 3520 * @param coordinate destination array of 3 values that will receive the coordinate 3521 * @exception CapabilityNotSetException if the appropriate capability is 3522 * not set and this object is part of a live or compiled scene graph 3523 * @exception IllegalStateException if the data mode for this geometry 3524 * array object is <code>BY_REFERENCE</code>. 3525 */ getCoordinate(int index, double coordinate[])3526 public void getCoordinate(int index, double coordinate[]) { 3527 if (isLiveOrCompiled()) 3528 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3529 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); 3530 3531 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3532 if ((format & BY_REFERENCE) != 0) 3533 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3534 3535 ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); 3536 } 3537 3538 /** 3539 * Gets the coordinate associated with the vertex at 3540 * the specified index for this object. 3541 * @param index source vertex index in this geometry array 3542 * @param coordinate a vector that will receive the coordinate 3543 * @exception CapabilityNotSetException if the appropriate capability is 3544 * not set and this object is part of a live or compiled scene graph 3545 * @exception IllegalStateException if the data mode for this geometry 3546 * array object is <code>BY_REFERENCE</code>. 3547 */ getCoordinate(int index, Point3f coordinate)3548 public void getCoordinate(int index, Point3f coordinate) { 3549 if (isLiveOrCompiled()) 3550 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3551 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); 3552 3553 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3554 if ((format & BY_REFERENCE) != 0) 3555 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3556 3557 ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); 3558 } 3559 3560 /** 3561 * Gets the coordinate associated with the vertex at 3562 * the specified index for this object. 3563 * @param index source vertex index in this geometry array 3564 * @param coordinate a vector that will receive the coordinate 3565 * @exception CapabilityNotSetException if the appropriate capability is 3566 * not set and this object is part of a live or compiled scene graph 3567 * @exception IllegalStateException if the data mode for this geometry 3568 * array object is <code>BY_REFERENCE</code>. 3569 */ getCoordinate(int index, Point3d coordinate)3570 public void getCoordinate(int index, Point3d coordinate) { 3571 if (isLiveOrCompiled()) 3572 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3573 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray48")); 3574 3575 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3576 if ((format & BY_REFERENCE) != 0) 3577 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3578 3579 ((GeometryArrayRetained)this.retained).getCoordinate(index, coordinate); 3580 } 3581 3582 /** 3583 * Gets the coordinates associated with the vertices starting at 3584 * the specified index for this object. The length of the destination 3585 * array determines the number of vertices copied. 3586 * A maximum of <code>vertexCount-index</code> coordinates 3587 * are copied. If the destination array is larger than is needed 3588 * to hold the coordinates, the excess locations in the 3589 * array are not modified. If the destination array is smaller 3590 * than is needed to hold the coordinates, only as 3591 * many coordinates as the array will hold are copied. 3592 * 3593 * @param index starting source vertex index in this geometry array 3594 * @param coordinates destination array of 3*n values that will receive new coordinates 3595 * @exception CapabilityNotSetException if the appropriate capability is 3596 * not set and this object is part of a live or compiled scene graph 3597 * @exception IllegalStateException if the data mode for this geometry 3598 * array object is <code>BY_REFERENCE</code>. 3599 */ getCoordinates(int index, float coordinates[])3600 public void getCoordinates(int index, float coordinates[]) { 3601 if (isLiveOrCompiled()) 3602 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3603 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); 3604 3605 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3606 if ((format & BY_REFERENCE) != 0) 3607 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3608 3609 ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); 3610 } 3611 3612 /** 3613 * Gets the coordinates associated with the vertices starting at 3614 * the specified index for this object. The length of the destination 3615 * array determines the number of vertices copied. 3616 * A maximum of <code>vertexCount-index</code> coordinates 3617 * are copied. If the destination array is larger than is needed 3618 * to hold the coordinates, the excess locations in the 3619 * array are not modified. If the destination array is smaller 3620 * than is needed to hold the coordinates, only as 3621 * many coordinates as the array will hold are copied. 3622 * 3623 * @param index starting source vertex index in this geometry array 3624 * @param coordinates destination array of 3*n values that will receive new coordinates 3625 * @exception CapabilityNotSetException if the appropriate capability is 3626 * not set and this object is part of a live or compiled scene graph 3627 * @exception IllegalStateException if the data mode for this geometry 3628 * array object is <code>BY_REFERENCE</code>. 3629 */ getCoordinates(int index, double coordinates[])3630 public void getCoordinates(int index, double coordinates[]) { 3631 if (isLiveOrCompiled()) 3632 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3633 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); 3634 3635 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3636 if ((format & BY_REFERENCE) != 0) 3637 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3638 3639 ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); 3640 } 3641 3642 /** 3643 * Gets the coordinates associated with the vertices starting at 3644 * the specified index for this object. The length of the destination 3645 * array determines the number of vertices copied. 3646 * A maximum of <code>vertexCount-index</code> coordinates 3647 * are copied. If the destination array is larger than is needed 3648 * to hold the coordinates, the excess locations in the 3649 * array are not modified. If the destination array is smaller 3650 * than is needed to hold the coordinates, only as 3651 * many coordinates as the array will hold are copied. 3652 * 3653 * @param index starting source vertex index in this geometry array 3654 * @param coordinates destination array of points that will receive new coordinates 3655 * @exception CapabilityNotSetException if the appropriate capability is 3656 * not set and this object is part of a live or compiled scene graph 3657 * @exception IllegalStateException if the data mode for this geometry 3658 * array object is <code>BY_REFERENCE</code>. 3659 */ getCoordinates(int index, Point3f coordinates[])3660 public void getCoordinates(int index, Point3f coordinates[]) { 3661 if (isLiveOrCompiled()) 3662 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3663 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); 3664 3665 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3666 if ((format & BY_REFERENCE) != 0) 3667 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3668 3669 ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); 3670 } 3671 3672 /** 3673 * Gets the coordinates associated with the vertices starting at 3674 * the specified index for this object. The length of the destination 3675 * array determines the number of vertices copied. 3676 * A maximum of <code>vertexCount-index</code> coordinates 3677 * are copied. If the destination array is larger than is needed 3678 * to hold the coordinates, the excess locations in the 3679 * array are not modified. If the destination array is smaller 3680 * than is needed to hold the coordinates, only as 3681 * many coordinates as the array will hold are copied. 3682 * 3683 * @param index starting source vertex index in this geometry array 3684 * @param coordinates destination array of points that will receive new coordinates 3685 * @exception CapabilityNotSetException if the appropriate capability is 3686 * not set and this object is part of a live or compiled scene graph 3687 * @exception IllegalStateException if the data mode for this geometry 3688 * array object is <code>BY_REFERENCE</code>. 3689 */ getCoordinates(int index, Point3d coordinates[])3690 public void getCoordinates(int index, Point3d coordinates[]) { 3691 if (isLiveOrCompiled()) 3692 if(!this.getCapability(ALLOW_COORDINATE_READ)) 3693 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray52")); 3694 3695 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3696 if ((format & BY_REFERENCE) != 0) 3697 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3698 3699 ((GeometryArrayRetained)this.retained).getCoordinates(index, coordinates); 3700 } 3701 3702 /** 3703 * Gets the color associated with the vertex at 3704 * the specified index for this object. The color is copied into the 3705 * specified array. The array must be large enough to hold all 3706 * of the colors. 3707 * @param index source vertex index in this geometry array 3708 * @param color destination array of 3 or 4 values that will receive the color 3709 * @exception CapabilityNotSetException if the appropriate capability is 3710 * not set and this object is part of a live or compiled scene graph 3711 * @exception IllegalStateException if the data mode for this geometry 3712 * array object is <code>BY_REFERENCE</code>. 3713 */ getColor(int index, float color[])3714 public void getColor(int index, float color[]) { 3715 if (isLiveOrCompiled()) 3716 if(!this.getCapability(ALLOW_COLOR_READ)) 3717 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); 3718 3719 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3720 if ((format & BY_REFERENCE) != 0) 3721 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3722 3723 if ((format & COLOR ) == 0) 3724 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3725 3726 ((GeometryArrayRetained)this.retained).getColor(index, color); 3727 } 3728 3729 /** 3730 * Gets the color associated with the vertex at 3731 * the specified index for this object. The color is copied into the 3732 * specified array. The array must be large enough to hold all of 3733 * the colors. 3734 * @param index source vertex index in this geometry array 3735 * @param color destination array of 3 or 4 values that will receive the color 3736 * @exception CapabilityNotSetException if the appropriate capability is 3737 * not set and this object is part of a live or compiled scene graph 3738 * @exception IllegalStateException if the data mode for this geometry 3739 * array object is <code>BY_REFERENCE</code>. 3740 */ getColor(int index, byte color[])3741 public void getColor(int index, byte color[]) { 3742 if (isLiveOrCompiled()) 3743 if(!this.getCapability(ALLOW_COLOR_READ)) 3744 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); 3745 3746 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3747 if ((format & BY_REFERENCE) != 0) 3748 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3749 3750 if ((format & COLOR ) == 0) 3751 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3752 3753 ((GeometryArrayRetained)this.retained).getColor(index, color); 3754 } 3755 3756 /** 3757 * Gets the color associated with the vertex at 3758 * the specified index for this object. 3759 * @param index source vertex index in this geometry array 3760 * @param color a vector that will receive the color 3761 * @exception CapabilityNotSetException if the appropriate capability is 3762 * not set and this object is part of a live or compiled scene graph 3763 * @exception IllegalStateException if the data mode for this geometry 3764 * array object is <code>BY_REFERENCE</code>. 3765 * @exception IllegalStateException if COLOR_4 is specified in the vertex 3766 * format 3767 */ getColor(int index, Color3f color)3768 public void getColor(int index, Color3f color) { 3769 if (isLiveOrCompiled()) 3770 if(!this.getCapability(ALLOW_COLOR_READ)) 3771 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); 3772 3773 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3774 if ((format & BY_REFERENCE) != 0) 3775 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3776 3777 if ((format & COLOR ) == 0) 3778 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3779 3780 if ((format & WITH_ALPHA) != 0) 3781 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 3782 3783 ((GeometryArrayRetained)this.retained).getColor(index, color); 3784 } 3785 3786 /** 3787 * Gets the color associated with the vertex at 3788 * the specified index for this object. 3789 * @param index source vertex index in this geometry array 3790 * @param color a vector that will receive the color 3791 * @exception CapabilityNotSetException if the appropriate capability is 3792 * not set and this object is part of a live or compiled scene graph 3793 * @exception IllegalStateException if the data mode for this geometry 3794 * array object is <code>BY_REFERENCE</code>. 3795 * @exception IllegalStateException if COLOR_3 is specified in the vertex 3796 * format 3797 */ getColor(int index, Color4f color)3798 public void getColor(int index, Color4f color) { 3799 if (isLiveOrCompiled()) 3800 if(!this.getCapability(ALLOW_COLOR_READ)) 3801 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); 3802 3803 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3804 if ((format & BY_REFERENCE) != 0) 3805 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3806 3807 if ((format & COLOR ) == 0) 3808 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3809 3810 if ((format & WITH_ALPHA) == 0) 3811 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 3812 3813 ((GeometryArrayRetained)this.retained).getColor(index, color); 3814 } 3815 3816 /** 3817 * Gets the color associated with the vertex at 3818 * the specified index for this object. 3819 * @param index source vertex index in this geometry array 3820 * @param color a vector that will receive the color 3821 * @exception CapabilityNotSetException if the appropriate capability is 3822 * not set and this object is part of a live or compiled scene graph 3823 * @exception IllegalStateException if the data mode for this geometry 3824 * array object is <code>BY_REFERENCE</code>. 3825 * @exception IllegalStateException if COLOR_4 is specified in the vertex 3826 * format 3827 */ getColor(int index, Color3b color)3828 public void getColor(int index, Color3b color) { 3829 if (isLiveOrCompiled()) 3830 if(!this.getCapability(ALLOW_COLOR_READ)) 3831 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); 3832 3833 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3834 if ((format & BY_REFERENCE) != 0) 3835 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3836 3837 if ((format & COLOR ) == 0) 3838 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3839 3840 if ((format & WITH_ALPHA) != 0) 3841 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 3842 3843 ((GeometryArrayRetained)this.retained).getColor(index, color); 3844 } 3845 3846 /** 3847 * Gets the color associated with the vertex at 3848 * the specified index for this object. 3849 * @param index source vertex index in this geometry array 3850 * @param color a vector that will receive the color 3851 * @exception CapabilityNotSetException if the appropriate capability is 3852 * not set and this object is part of a live or compiled scene graph 3853 * @exception IllegalStateException if the data mode for this geometry 3854 * array object is <code>BY_REFERENCE</code>. 3855 * @exception IllegalStateException if COLOR_3 is specified in the vertex 3856 * format 3857 */ getColor(int index, Color4b color)3858 public void getColor(int index, Color4b color) { 3859 if (isLiveOrCompiled()) 3860 if(!this.getCapability(ALLOW_COLOR_READ)) 3861 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray56")); 3862 3863 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3864 if ((format & BY_REFERENCE) != 0) 3865 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3866 3867 if ((format & COLOR ) == 0) 3868 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3869 3870 if ((format & WITH_ALPHA) == 0) 3871 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 3872 3873 ((GeometryArrayRetained)this.retained).getColor(index, color); 3874 } 3875 3876 /** 3877 * Gets the colors associated with the vertices starting at 3878 * the specified index for this object. The color is copied into the 3879 * specified array. The length of the destination 3880 * array determines the number of colors copied. 3881 * A maximum of <code>vertexCount-index</code> colors 3882 * are copied. If the destination array is larger than is needed 3883 * to hold the colors, the excess locations in the 3884 * array are not modified. If the destination array is smaller 3885 * than is needed to hold the colors, only as 3886 * many colors as the array will hold are copied. 3887 * 3888 * @param index starting source vertex index in this geometry array 3889 * @param colors destination array of 3*n or 4*n values that will 3890 * receive n new colors 3891 * @exception CapabilityNotSetException if the appropriate capability is 3892 * not set and this object is part of a live or compiled scene graph 3893 * @exception IllegalStateException if the data mode for this geometry 3894 * array object is <code>BY_REFERENCE</code>. 3895 */ getColors(int index, float colors[])3896 public void getColors(int index, float colors[]) { 3897 if (isLiveOrCompiled()) 3898 if(!this.getCapability(ALLOW_COLOR_READ)) 3899 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); 3900 3901 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3902 if ((format & BY_REFERENCE) != 0) 3903 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3904 3905 if ((format & COLOR ) == 0) 3906 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3907 3908 ((GeometryArrayRetained)this.retained).getColors(index, colors); 3909 } 3910 3911 /** 3912 * Gets the colors associated with the vertices starting at 3913 * the specified index for this object. The color is copied into the 3914 * specified array. The length of the destination 3915 * array determines the number of colors copied. 3916 * A maximum of <code>vertexCount-index</code> colors 3917 * are copied. If the destination array is larger than is needed 3918 * to hold the colors, the excess locations in the 3919 * array are not modified. If the destination array is smaller 3920 * than is needed to hold the colors, only as 3921 * many colors as the array will hold are copied. 3922 * 3923 * @param index starting source vertex index in this geometry array 3924 * @param colors destination array of 3*n or 4*n values that will 3925 * receive new colors 3926 * @exception CapabilityNotSetException if the appropriate capability is 3927 * not set and this object is part of a live or compiled scene graph 3928 * @exception IllegalStateException if the data mode for this geometry 3929 * array object is <code>BY_REFERENCE</code>. 3930 */ getColors(int index, byte colors[])3931 public void getColors(int index, byte colors[]) { 3932 if (isLiveOrCompiled()) 3933 if(!this.getCapability(ALLOW_COLOR_READ)) 3934 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); 3935 3936 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3937 if ((format & BY_REFERENCE) != 0) 3938 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3939 3940 if ((format & COLOR ) == 0) 3941 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3942 3943 ((GeometryArrayRetained)this.retained).getColors(index, colors); 3944 } 3945 3946 /** 3947 * Gets the colors associated with the vertices starting at 3948 * the specified index for this object. The color is copied into the 3949 * specified array. The length of the destination 3950 * array determines the number of colors copied. 3951 * A maximum of <code>vertexCount-index</code> colors 3952 * are copied. If the destination array is larger than is needed 3953 * to hold the colors, the excess locations in the 3954 * array are not modified. If the destination array is smaller 3955 * than is needed to hold the colors, only as 3956 * many colors as the array will hold are copied. 3957 * 3958 * @param index starting source vertex index in this geometry array 3959 * @param colors destination array of Color3f objects that will receive new colors 3960 * @exception CapabilityNotSetException if the appropriate capability is 3961 * not set and this object is part of a live or compiled scene graph 3962 * @exception IllegalStateException if the data mode for this geometry 3963 * array object is <code>BY_REFERENCE</code>. 3964 * @exception IllegalStateException if COLOR_4 is specified in the vertex 3965 * format 3966 */ getColors(int index, Color3f colors[])3967 public void getColors(int index, Color3f colors[]) { 3968 if (isLiveOrCompiled()) 3969 if(!this.getCapability(ALLOW_COLOR_READ)) 3970 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); 3971 3972 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 3973 if ((format & BY_REFERENCE) != 0) 3974 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 3975 3976 if ((format & COLOR ) == 0) 3977 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 3978 3979 if ((format & WITH_ALPHA) != 0) 3980 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 3981 3982 ((GeometryArrayRetained)this.retained).getColors(index, colors); 3983 } 3984 3985 /** 3986 * Gets the colors associated with the vertices starting at 3987 * the specified index for this object. The color is copied into the 3988 * specified array. The length of the destination 3989 * array determines the number of colors copied. 3990 * A maximum of <code>vertexCount-index</code> colors 3991 * are copied. If the destination array is larger than is needed 3992 * to hold the colors, the excess locations in the 3993 * array are not modified. If the destination array is smaller 3994 * than is needed to hold the colors, only as 3995 * many colors as the array will hold are copied. 3996 * 3997 * @param index starting source vertex index in this geometry array 3998 * @param colors destination array of Color4f objects that will receive new colors 3999 * @exception CapabilityNotSetException if the appropriate capability is 4000 * not set and this object is part of a live or compiled scene graph 4001 * @exception IllegalStateException if the data mode for this geometry 4002 * array object is <code>BY_REFERENCE</code>. 4003 * @exception IllegalStateException if COLOR_3 is specified in the vertex 4004 * format 4005 */ getColors(int index, Color4f colors[])4006 public void getColors(int index, Color4f colors[]) { 4007 if (isLiveOrCompiled()) 4008 if(!this.getCapability(ALLOW_COLOR_READ)) 4009 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); 4010 4011 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4012 if ((format & BY_REFERENCE) != 0) 4013 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4014 4015 if ((format & COLOR ) == 0) 4016 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 4017 4018 if ((format & WITH_ALPHA) == 0) 4019 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 4020 4021 ((GeometryArrayRetained)this.retained).getColors(index, colors); 4022 } 4023 4024 /** 4025 * Gets the colors associated with the vertices starting at 4026 * the specified index for this object. The color is copied into the 4027 * specified array. The length of the destination 4028 * array determines the number of colors copied. 4029 * A maximum of <code>vertexCount-index</code> colors 4030 * are copied. If the destination array is larger than is needed 4031 * to hold the colors, the excess locations in the 4032 * array are not modified. If the destination array is smaller 4033 * than is needed to hold the colors, only as 4034 * many colors as the array will hold are copied. 4035 * 4036 * @param index starting source vertex index in this geometry array 4037 * @param colors destination array of Color3b objects that will receive new colors 4038 * @exception CapabilityNotSetException if the appropriate capability is 4039 * not set and this object is part of a live or compiled scene graph 4040 * @exception IllegalStateException if the data mode for this geometry 4041 * array object is <code>BY_REFERENCE</code>. 4042 * @exception IllegalStateException if COLOR_4 is specified in the vertex 4043 * format 4044 */ getColors(int index, Color3b colors[])4045 public void getColors(int index, Color3b colors[]) { 4046 if (isLiveOrCompiled()) 4047 if(!this.getCapability(ALLOW_COLOR_READ)) 4048 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); 4049 4050 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4051 if ((format & BY_REFERENCE) != 0) 4052 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4053 4054 if ((format & COLOR ) == 0) 4055 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 4056 4057 if ((format & WITH_ALPHA) != 0) 4058 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 4059 4060 ((GeometryArrayRetained)this.retained).getColors(index, colors); 4061 } 4062 4063 /** 4064 * Gets the colors associated with the vertices starting at 4065 * the specified index for this object. The color is copied into the 4066 * specified array. The length of the destination 4067 * array determines the number of colors copied. 4068 * A maximum of <code>vertexCount-index</code> colors 4069 * are copied. If the destination array is larger than is needed 4070 * to hold the colors, the excess locations in the 4071 * array are not modified. If the destination array is smaller 4072 * than is needed to hold the colors, only as 4073 * many colors as the array will hold are copied. 4074 * 4075 * @param index starting source vertex index in this geometry array 4076 * @param colors destination array of Color4b objects that will receive new colors 4077 * @exception CapabilityNotSetException if the appropriate capability is 4078 * not set and this object is part of a live or compiled scene graph 4079 * @exception IllegalStateException if the data mode for this geometry 4080 * array object is <code>BY_REFERENCE</code>. 4081 * @exception IllegalStateException if COLOR_3 is specified in the vertex 4082 * format 4083 */ getColors(int index, Color4b colors[])4084 public void getColors(int index, Color4b colors[]) { 4085 if (isLiveOrCompiled()) 4086 if(!this.getCapability(ALLOW_COLOR_READ)) 4087 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray62")); 4088 4089 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4090 if ((format & BY_REFERENCE) != 0) 4091 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4092 4093 if ((format & COLOR ) == 0) 4094 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray76")); 4095 4096 if ((format & WITH_ALPHA) == 0) 4097 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 4098 4099 ((GeometryArrayRetained)this.retained).getColors(index, colors); 4100 } 4101 4102 /** 4103 * Gets the normal associated with the vertex at 4104 * the specified index for this object. The normal is copied into 4105 * the specified array. 4106 * @param index source vertex index in this geometry array 4107 * @param normal destination array of 3 values that will receive the normal 4108 * @exception CapabilityNotSetException if the appropriate capability is 4109 * not set and this object is part of a live or compiled scene graph 4110 * @exception IllegalStateException if the data mode for this geometry 4111 * array object is <code>BY_REFERENCE</code>. 4112 */ getNormal(int index, float normal[])4113 public void getNormal(int index, float normal[]) { 4114 if (isLiveOrCompiled()) 4115 if(!this.getCapability(ALLOW_NORMAL_READ)) 4116 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray68")); 4117 4118 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4119 if ((format & BY_REFERENCE) != 0) 4120 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4121 4122 if ((format & NORMALS ) == 0) 4123 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 4124 4125 ((GeometryArrayRetained)this.retained).getNormal(index, normal); 4126 } 4127 4128 /** 4129 * Gets the normal associated with the vertex at 4130 * the specified index for this object. 4131 * @param index source vertex index in this geometry array 4132 * @param normal the vector that will receive the normal 4133 * @exception CapabilityNotSetException if the appropriate capability is 4134 * not set and this object is part of a live or compiled scene graph 4135 * @exception IllegalStateException if the data mode for this geometry 4136 * array object is <code>BY_REFERENCE</code>. 4137 */ getNormal(int index, Vector3f normal)4138 public void getNormal(int index, Vector3f normal) { 4139 if (isLiveOrCompiled()) 4140 if(!this.getCapability(ALLOW_NORMAL_READ)) 4141 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray68")); 4142 4143 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4144 if ((format & BY_REFERENCE) != 0) 4145 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4146 4147 if ((format & NORMALS ) == 0) 4148 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 4149 4150 ((GeometryArrayRetained)this.retained).getNormal(index, normal); 4151 } 4152 4153 /** 4154 * Gets the normals associated with the vertices starting at 4155 * the specified index for this object. The length of the destination 4156 * array determines the number of normals copied. 4157 * A maximum of <code>vertexCount-index</code> normals 4158 * are copied. If the destination array is larger than is needed 4159 * to hold the normals, the excess locations in the 4160 * array are not modified. If the destination array is smaller 4161 * than is needed to hold the normals, only as 4162 * many normals as the array will hold are copied. 4163 * 4164 * @param index starting source vertex index in this geometry array 4165 * @param normals destination array of 3*n values that will receive the normal 4166 * @exception CapabilityNotSetException if the appropriate capability is 4167 * not set and this object is part of a live or compiled scene graph 4168 * @exception IllegalStateException if the data mode for this geometry 4169 * array object is <code>BY_REFERENCE</code>. 4170 */ getNormals(int index, float normals[])4171 public void getNormals(int index, float normals[]) { 4172 if (isLiveOrCompiled()) 4173 if(!this.getCapability(ALLOW_NORMAL_READ)) 4174 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray70")); 4175 4176 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4177 if ((format & BY_REFERENCE) != 0) 4178 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4179 4180 if ((format & NORMALS ) == 0) 4181 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 4182 4183 ((GeometryArrayRetained)this.retained).getNormals(index, normals); 4184 } 4185 4186 /** 4187 * Gets the normals associated with the vertices starting at 4188 * the specified index for this object. The length of the destination 4189 * array determines the number of normals copied. 4190 * A maximum of <code>vertexCount-index</code> normals 4191 * are copied. If the destination array is larger than is needed 4192 * to hold the normals, the excess locations in the 4193 * array are not modified. If the destination array is smaller 4194 * than is needed to hold the normals, only as 4195 * many normals as the array will hold are copied. 4196 * 4197 * @param index starting source vertex index in this geometry array 4198 * @param normals destination array of vectors that will receive the normals 4199 * @exception CapabilityNotSetException if the appropriate capability is 4200 * not set and this object is part of a live or compiled scene graph 4201 * @exception IllegalStateException if the data mode for this geometry 4202 * array object is <code>BY_REFERENCE</code>. 4203 */ getNormals(int index, Vector3f normals[])4204 public void getNormals(int index, Vector3f normals[]) { 4205 if (isLiveOrCompiled()) 4206 if(!this.getCapability(ALLOW_NORMAL_READ)) 4207 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray70")); 4208 4209 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4210 if ((format & BY_REFERENCE) != 0) 4211 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4212 4213 if ((format & NORMALS ) == 0) 4214 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray77")); 4215 4216 ((GeometryArrayRetained)this.retained).getNormals(index, normals); 4217 } 4218 4219 /** 4220 * @deprecated As of Java 3D version 1.2, replaced by 4221 * <code>getTextureCoordinate(int texCoordSet, ...)</code> 4222 */ getTextureCoordinate(int index, float texCoord[])4223 public void getTextureCoordinate(int index, float texCoord[]) { 4224 getTextureCoordinate(0, index, texCoord); 4225 } 4226 4227 /** 4228 * Gets the texture coordinate associated with the vertex at 4229 * the specified index in the specified texture coordinate set 4230 * for this object. 4231 * 4232 * @param texCoordSet texture coordinate set in this geometry array 4233 * @param index source vertex index in this geometry array 4234 * @param texCoord array of 2, 3 or 4 values that will receive the 4235 * texture coordinate 4236 * @exception CapabilityNotSetException if the appropriate capability is 4237 * not set and this object is part of a live or compiled scene graph 4238 * 4239 * @exception ArrayIndexOutOfBoundsException if none of the 4240 * <code>TEXTURE_COORDINATE</code> bits are set in the 4241 * <code>vertexFormat</code> or if the index or 4242 * texCoordSet is out of range. 4243 * 4244 * @exception IllegalStateException if the data mode for this geometry 4245 * array object is <code>BY_REFERENCE</code>. 4246 * 4247 * @since Java 3D 1.2 4248 */ getTextureCoordinate(int texCoordSet, int index, float texCoord[])4249 public void getTextureCoordinate(int texCoordSet, 4250 int index, float texCoord[]) { 4251 if (isLiveOrCompiled()) 4252 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4253 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); 4254 4255 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4256 if ((format & BY_REFERENCE) != 0) 4257 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4258 4259 if ((format & TEXTURE_COORDINATE ) == 0) 4260 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4261 4262 ((GeometryArrayRetained)this.retained).getTextureCoordinate( 4263 texCoordSet, index, texCoord); 4264 } 4265 4266 /** 4267 * @deprecated As of Java 3D version 1.2, replaced by 4268 * <code>getTextureCoordinate(int texCoordSet, TexCoord2f texCoord)</code> 4269 */ getTextureCoordinate(int index, Point2f texCoord)4270 public void getTextureCoordinate(int index, Point2f texCoord) { 4271 getTextureCoordinate(0, index, texCoord2fArray[0]); 4272 texCoord.set(texCoord2fArray[0]); 4273 } 4274 4275 /** 4276 * Gets the texture coordinate associated with the vertex at 4277 * the specified index in the specified texture coordinate set 4278 * for this object. 4279 * 4280 * @param texCoordSet texture coordinate set in this geometry array 4281 * @param index source vertex index in this geometry array 4282 * @param texCoord the vector that will receive the texture coordinates 4283 * 4284 * @exception CapabilityNotSetException if the appropriate capability is 4285 * not set and this object is part of a live or compiled scene graph 4286 * 4287 * @exception ArrayIndexOutOfBoundsException if none of the 4288 * <code>TEXTURE_COORDINATE</code> bits are set in the 4289 * <code>vertexFormat</code> or if the index or 4290 * texCoordSet is out of range. 4291 * 4292 * @exception IllegalStateException if the data mode for this geometry 4293 * array object is <code>BY_REFERENCE</code>. 4294 * 4295 * @exception IllegalStateException if TEXTURE_COORDINATE_3 or 4296 * TEXTURE_COORDINATE_4 is specified in vertex format 4297 * 4298 * @since Java 3D 1.2 4299 */ getTextureCoordinate(int texCoordSet, int index, TexCoord2f texCoord)4300 public void getTextureCoordinate(int texCoordSet, 4301 int index, TexCoord2f texCoord) { 4302 if (isLiveOrCompiled()) 4303 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4304 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); 4305 4306 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4307 if ((format & BY_REFERENCE) != 0) 4308 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4309 4310 if ((format & TEXTURE_COORDINATE ) == 0) 4311 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4312 4313 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 4314 (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) 4315 throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); 4316 4317 ((GeometryArrayRetained)this.retained).getTextureCoordinate( 4318 texCoordSet, index, texCoord); 4319 } 4320 4321 /** 4322 * @deprecated As of Java 3D version 1.2, replaced by 4323 * <code>getTextureCoordinate(int texCoordSet, TexCoord3f texCoord)</code> 4324 */ getTextureCoordinate(int index, Point3f texCoord)4325 public void getTextureCoordinate(int index, Point3f texCoord) { 4326 getTextureCoordinate(0, index, texCoord3fArray[0]); 4327 texCoord.set(texCoord3fArray[0]); 4328 } 4329 4330 /** 4331 * Gets the texture coordinate associated with the vertex at 4332 * the specified index in the specified texture coordinate set 4333 * for this object. 4334 * 4335 * @param texCoordSet texture coordinate set in this geometry array 4336 * @param index source vertex index in this geometry array 4337 * @param texCoord the vector that will receive the texture coordinates 4338 * 4339 * @exception CapabilityNotSetException if the appropriate capability is 4340 * not set and this object is part of a live or compiled scene graph 4341 * 4342 * @exception ArrayIndexOutOfBoundsException if none of the 4343 * <code>TEXTURE_COORDINATE</code> bits are set in the 4344 * <code>vertexFormat</code> or if the index or 4345 * texCoordSet is out of range. 4346 * 4347 * @exception IllegalStateException if the data mode for this geometry 4348 * array object is <code>BY_REFERENCE</code>. 4349 * 4350 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 4351 * TEXTURE_COORDINATE_4 is specified in vertex format 4352 * 4353 * @since Java 3D 1.2 4354 */ getTextureCoordinate(int texCoordSet, int index, TexCoord3f texCoord)4355 public void getTextureCoordinate(int texCoordSet, 4356 int index, TexCoord3f texCoord) { 4357 if (isLiveOrCompiled()) 4358 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4359 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); 4360 4361 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4362 if ((format & BY_REFERENCE) != 0) 4363 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4364 4365 if ((format & TEXTURE_COORDINATE ) == 0) 4366 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4367 4368 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 4369 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) 4370 throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); 4371 ((GeometryArrayRetained)this.retained).getTextureCoordinate( 4372 texCoordSet, index, texCoord); 4373 } 4374 4375 /** 4376 * Gets the texture coordinate associated with the vertex at 4377 * the specified index in the specified texture coordinate set 4378 * for this object. 4379 * 4380 * @param texCoordSet texture coordinate set in this geometry array 4381 * @param index source vertex index in this geometry array 4382 * @param texCoord the vector that will receive the texture coordinates 4383 * 4384 * @exception CapabilityNotSetException if the appropriate capability is 4385 * not set and this object is part of a live or compiled scene graph 4386 * 4387 * @exception ArrayIndexOutOfBoundsException if none of the 4388 * <code>TEXTURE_COORDINATE</code> bits are set in the 4389 * <code>vertexFormat</code> or if the index or 4390 * texCoordSet is out of range. 4391 * 4392 * @exception IllegalStateException if the data mode for this geometry 4393 * array object is <code>BY_REFERENCE</code>. 4394 * 4395 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 4396 * TEXTURE_COORDINATE_3 is specified in vertex format 4397 * 4398 * @since Java 3D 1.3 4399 */ getTextureCoordinate(int texCoordSet, int index, TexCoord4f texCoord)4400 public void getTextureCoordinate(int texCoordSet, 4401 int index, TexCoord4f texCoord) { 4402 if (isLiveOrCompiled()) 4403 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4404 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray72")); 4405 4406 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4407 if ((format & BY_REFERENCE) != 0) 4408 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4409 4410 if ((format & TEXTURE_COORDINATE ) == 0) 4411 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4412 4413 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 4414 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) 4415 throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); 4416 ((GeometryArrayRetained)this.retained).getTextureCoordinate( 4417 texCoordSet, index, texCoord); 4418 } 4419 4420 4421 /** 4422 * @deprecated As of Java 3D version 1.2, replaced by 4423 * <code>getTextureCoordinates(int texCoordSet, ...)</code> 4424 */ getTextureCoordinates(int index, float texCoords[])4425 public void getTextureCoordinates(int index, float texCoords[]) { 4426 getTextureCoordinates(0, index, texCoords); 4427 } 4428 4429 /** 4430 * Gets the texture coordinates associated with the vertices starting at 4431 * the specified index in the specified texture coordinate set 4432 * for this object. The length of the destination 4433 * array determines the number of texture coordinates copied. 4434 * A maximum of <code>vertexCount-index</code> texture coordinates 4435 * are copied. If the destination array is larger than is needed 4436 * to hold the texture coordinates, the excess locations in the 4437 * array are not modified. If the destination array is smaller 4438 * than is needed to hold the texture coordinates, only as 4439 * many texture coordinates as the array will hold are copied. 4440 * 4441 * @param texCoordSet texture coordinate set in this geometry array 4442 * @param index starting source vertex index in this geometry array 4443 * @param texCoords destination array of 2*n , 3*n or 4*n values that 4444 * will receive n new texture coordinates 4445 * 4446 * @exception CapabilityNotSetException if the appropriate capability is 4447 * not set and this object is part of a live or compiled scene graph 4448 * 4449 * @exception ArrayIndexOutOfBoundsException if none of the 4450 * <code>TEXTURE_COORDINATE</code> bits are set in the 4451 * <code>vertexFormat</code> or if the index or 4452 * texCoordSet is out of range. 4453 * 4454 * @exception IllegalStateException if the data mode for this geometry 4455 * array object is <code>BY_REFERENCE</code>. 4456 * 4457 * @since Java 3D 1.2 4458 */ getTextureCoordinates(int texCoordSet, int index, float texCoords[])4459 public void getTextureCoordinates(int texCoordSet, 4460 int index, float texCoords[]) { 4461 if (isLiveOrCompiled()) 4462 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4463 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); 4464 4465 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4466 if ((format & BY_REFERENCE) != 0) 4467 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4468 4469 if ((format & TEXTURE_COORDINATE ) == 0) 4470 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4471 4472 ((GeometryArrayRetained)this.retained).getTextureCoordinates( 4473 texCoordSet, index, texCoords); 4474 } 4475 4476 /** 4477 * @deprecated As of Java 3D version 1.2, replaced by 4478 * <code>getTextureCoordinates(int texCoordSet, TexCoord2f texCoords[])</code> 4479 */ getTextureCoordinates(int index, Point2f texCoords[])4480 public void getTextureCoordinates(int index, Point2f texCoords[]) { 4481 if (isLiveOrCompiled()) 4482 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4483 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); 4484 4485 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4486 if ((format & BY_REFERENCE) != 0) 4487 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4488 4489 if ((format & TEXTURE_COORDINATE ) == 0) 4490 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4491 4492 ((GeometryArrayRetained)this.retained).getTextureCoordinates( 4493 0, index, texCoords); 4494 } 4495 4496 /** 4497 * Gets the texture coordinates associated with the vertices starting at 4498 * the specified index in the specified texture coordinate set 4499 * for this object. The length of the destination 4500 * array determines the number of texture coordinates copied. 4501 * A maximum of <code>vertexCount-index</code> texture coordinates 4502 * are copied. If the destination array is larger than is needed 4503 * to hold the texture coordinates, the excess locations in the 4504 * array are not modified. If the destination array is smaller 4505 * than is needed to hold the texture coordinates, only as 4506 * many texture coordinates as the array will hold are copied. 4507 * 4508 * @param texCoordSet texture coordinate set in this geometry array 4509 * @param index starting source vertex index in this geometry array 4510 * @param texCoords destination array of TexCoord2f objects that will 4511 * receive the texture coordinates 4512 * 4513 * @exception CapabilityNotSetException if the appropriate capability is 4514 * not set and this object is part of a live or compiled scene graph 4515 * 4516 * @exception ArrayIndexOutOfBoundsException if none of the 4517 * <code>TEXTURE_COORDINATE</code> bits are set in the 4518 * <code>vertexFormat</code> or if the index or 4519 * texCoordSet is out of range. 4520 * 4521 * @exception IllegalStateException if the data mode for this geometry 4522 * array object is <code>BY_REFERENCE</code>. 4523 * 4524 * @exception IllegalStateException if TEXTURE_COORDINATE_3 or 4525 * TEXTURE_COORDINATE_4 is specified in vertex format 4526 * 4527 * @since Java 3D 1.2 4528 */ getTextureCoordinates(int texCoordSet, int index, TexCoord2f texCoords[])4529 public void getTextureCoordinates(int texCoordSet, 4530 int index, TexCoord2f texCoords[]) { 4531 if (isLiveOrCompiled()) 4532 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4533 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); 4534 4535 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4536 if ((format & BY_REFERENCE) != 0) 4537 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4538 4539 if ((format & TEXTURE_COORDINATE ) == 0) 4540 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4541 4542 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 4543 (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) 4544 throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); 4545 ((GeometryArrayRetained)this.retained).getTextureCoordinates( 4546 texCoordSet, index, texCoords); 4547 } 4548 4549 /** 4550 * @deprecated As of Java 3D version 1.2, replaced by 4551 * <code>getTextureCoordinates(int texCoordSet, TexCoord3f texCoords[])</code> 4552 */ getTextureCoordinates(int index, Point3f texCoords[])4553 public void getTextureCoordinates(int index, Point3f texCoords[]) { 4554 if (isLiveOrCompiled()) 4555 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4556 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); 4557 4558 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4559 if ((format & BY_REFERENCE) != 0) 4560 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4561 4562 if ((format & TEXTURE_COORDINATE ) == 0) 4563 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4564 4565 ((GeometryArrayRetained)this.retained).getTextureCoordinates( 4566 0, index, texCoords); 4567 } 4568 4569 /** 4570 * Gets the texture coordinates associated with the vertices starting at 4571 * the specified index in the specified texture coordinate set 4572 * for this object. The length of the destination 4573 * array determines the number of texture coordinates copied. 4574 * A maximum of <code>vertexCount-index</code> texture coordinates 4575 * are copied. If the destination array is larger than is needed 4576 * to hold the texture coordinates, the excess locations in the 4577 * array are not modified. If the destination array is smaller 4578 * than is needed to hold the texture coordinates, only as 4579 * many texture coordinates as the array will hold are copied. 4580 * 4581 * @param texCoordSet texture coordinate set in this geometry array 4582 * @param index starting source vertex index in this geometry array 4583 * @param texCoords destination array of TexCoord3f objects that will 4584 * receive the texture coordinates 4585 * 4586 * @exception CapabilityNotSetException if the appropriate capability is 4587 * not set and this object is part of a live or compiled scene graph 4588 * 4589 * @exception ArrayIndexOutOfBoundsException if none of the 4590 * <code>TEXTURE_COORDINATE</code> bits are set in the 4591 * <code>vertexFormat</code> or if the index or 4592 * texCoordSet is out of range. 4593 * 4594 * @exception IllegalStateException if the data mode for this geometry 4595 * array object is <code>BY_REFERENCE</code>. 4596 * 4597 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 4598 * TEXTURE_COORDINATE_4 is specified in vertex format 4599 * 4600 * @since Java 3D 1.2 4601 */ getTextureCoordinates(int texCoordSet, int index, TexCoord3f texCoords[])4602 public void getTextureCoordinates(int texCoordSet, 4603 int index, TexCoord3f texCoords[]) { 4604 if (isLiveOrCompiled()) 4605 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4606 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); 4607 4608 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4609 if ((format & BY_REFERENCE) != 0) 4610 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4611 4612 if ((format & TEXTURE_COORDINATE ) == 0) 4613 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4614 4615 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 4616 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) 4617 throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); 4618 ((GeometryArrayRetained)this.retained).getTextureCoordinates( 4619 texCoordSet, index, texCoords); 4620 } 4621 4622 4623 /** 4624 * Gets the texture coordinates associated with the vertices starting at 4625 * the specified index in the specified texture coordinate set 4626 * for this object. The length of the destination 4627 * array determines the number of texture coordinates copied. 4628 * A maximum of <code>vertexCount-index</code> texture coordinates 4629 * are copied. If the destination array is larger than is needed 4630 * to hold the texture coordinates, the excess locations in the 4631 * array are not modified. If the destination array is smaller 4632 * than is needed to hold the texture coordinates, only as 4633 * many texture coordinates as the array will hold are copied. 4634 * 4635 * @param texCoordSet texture coordinate set in this geometry array 4636 * @param index starting source vertex index in this geometry array 4637 * @param texCoords destination array of TexCoord4f objects that will 4638 * receive the texture coordinates 4639 * 4640 * @exception CapabilityNotSetException if the appropriate capability is 4641 * not set and this object is part of a live or compiled scene graph 4642 * 4643 * @exception ArrayIndexOutOfBoundsException if none of the 4644 * <code>TEXTURE_COORDINATE</code> bits are set in the 4645 * <code>vertexFormat</code> or if the index or 4646 * texCoordSet is out of range. 4647 * 4648 * @exception IllegalStateException if the data mode for this geometry 4649 * array object is <code>BY_REFERENCE</code>. 4650 * 4651 * @exception IllegalStateException if TEXTURE_COORDINATE_2 or 4652 * TEXTURE_COORDINATE_3 is specified in vertex format 4653 * 4654 * @since Java 3D 1.3 4655 */ getTextureCoordinates(int texCoordSet, int index, TexCoord4f texCoords[])4656 public void getTextureCoordinates(int texCoordSet, 4657 int index, TexCoord4f texCoords[]) { 4658 if (isLiveOrCompiled()) 4659 if(!this.getCapability(ALLOW_TEXCOORD_READ)) 4660 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray75")); 4661 4662 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4663 if ((format & BY_REFERENCE) != 0) 4664 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4665 4666 if ((format & TEXTURE_COORDINATE ) == 0) 4667 throw new ArrayIndexOutOfBoundsException(J3dI18N.getString("GeometryArray79")); 4668 4669 if (((((GeometryArrayRetained)this.retained).vertexFormat) & 4670 (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_3)) != 0) 4671 throw new IllegalStateException(J3dI18N.getString("GeometryArray109")); 4672 4673 ((GeometryArrayRetained)this.retained).getTextureCoordinates( 4674 texCoordSet, index, texCoords); 4675 } 4676 4677 /** 4678 * Gets the vertex attribute associated with the vertex at 4679 * the specified index in the specified vertex attribute number 4680 * for this object. 4681 * 4682 * @param vertexAttrNum vertex attribute number in this geometry array 4683 * @param index source vertex index in this geometry array 4684 * @param vertexAttr array of 1, 2, 3 or 4 values that will receive the 4685 * vertex attribute 4686 * @exception CapabilityNotSetException if the appropriate capability is 4687 * not set and this object is part of a live or compiled scene graph 4688 * 4689 * @exception ArrayIndexOutOfBoundsException if the index or 4690 * vertexAttrNum is out of range, or if the vertexAttr array is 4691 * too small. 4692 * 4693 * @exception IllegalStateException if the data mode for this geometry 4694 * array object is <code>BY_REFERENCE</code>. 4695 * 4696 * @since Java 3D 1.4 4697 */ getVertexAttr(int vertexAttrNum, int index, float[] vertexAttr)4698 public void getVertexAttr(int vertexAttrNum, int index, 4699 float[] vertexAttr) { 4700 if (isLiveOrCompiled()) { 4701 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 4702 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 4703 } 4704 } 4705 4706 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4707 if ((format & BY_REFERENCE) != 0) { 4708 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4709 } 4710 4711 ((GeometryArrayRetained)this.retained).getVertexAttr( 4712 vertexAttrNum, index, vertexAttr); 4713 } 4714 4715 /** 4716 * Gets the vertex attribute associated with the vertex at 4717 * the specified index in the specified vertex attribute number 4718 * for this object. 4719 * 4720 * @param vertexAttrNum vertex attribute number in this geometry array 4721 * @param index source vertex index in this geometry array 4722 * @param vertexAttr the vector that will receive the vertex attributes 4723 * 4724 * @exception CapabilityNotSetException if the appropriate capability is 4725 * not set and this object is part of a live or compiled scene graph 4726 * 4727 * @exception ArrayIndexOutOfBoundsException if the index or 4728 * vertexAttrNum is out of range. 4729 * 4730 * @exception IllegalStateException if the data mode for this geometry 4731 * array object is <code>BY_REFERENCE</code>. 4732 * 4733 * @exception IllegalStateException if the size of the specified 4734 * vertex attribute number is not 2. 4735 * 4736 * @since Java 3D 1.4 4737 */ getVertexAttr(int vertexAttrNum, int index, Point2f vertexAttr)4738 public void getVertexAttr(int vertexAttrNum, int index, 4739 Point2f vertexAttr) { 4740 if (isLiveOrCompiled()) { 4741 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 4742 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 4743 } 4744 } 4745 4746 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4747 if ((format & BY_REFERENCE) != 0) { 4748 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4749 } 4750 4751 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 4752 if (size != 2) { 4753 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 4754 } 4755 4756 ((GeometryArrayRetained)this.retained).getVertexAttr( 4757 vertexAttrNum, index, vertexAttr); 4758 } 4759 4760 /** 4761 * Gets the vertex attribute associated with the vertex at 4762 * the specified index in the specified vertex attribute number 4763 * for this object. 4764 * 4765 * @param vertexAttrNum vertex attribute number in this geometry array 4766 * @param index source vertex index in this geometry array 4767 * @param vertexAttr the vector that will receive the vertex attributes 4768 * 4769 * @exception CapabilityNotSetException if the appropriate capability is 4770 * not set and this object is part of a live or compiled scene graph 4771 * 4772 * @exception ArrayIndexOutOfBoundsException if the index or 4773 * vertexAttrNum is out of range. 4774 * 4775 * @exception IllegalStateException if the data mode for this geometry 4776 * array object is <code>BY_REFERENCE</code>. 4777 * 4778 * @exception IllegalStateException if the size of the specified 4779 * vertex attribute number is not 3. 4780 * 4781 * @since Java 3D 1.4 4782 */ getVertexAttr(int vertexAttrNum, int index, Point3f vertexAttr)4783 public void getVertexAttr(int vertexAttrNum, int index, 4784 Point3f vertexAttr) { 4785 if (isLiveOrCompiled()) { 4786 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 4787 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 4788 } 4789 } 4790 4791 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4792 if ((format & BY_REFERENCE) != 0) { 4793 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4794 } 4795 4796 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 4797 if (size != 3) { 4798 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 4799 } 4800 4801 ((GeometryArrayRetained)this.retained).getVertexAttr( 4802 vertexAttrNum, index, vertexAttr); 4803 } 4804 4805 /** 4806 * Gets the vertex attribute associated with the vertex at 4807 * the specified index in the specified vertex attribute number 4808 * for this object. 4809 * 4810 * @param vertexAttrNum vertex attribute number in this geometry array 4811 * @param index source vertex index in this geometry array 4812 * @param vertexAttr the vector that will receive the vertex attributes 4813 * 4814 * @exception CapabilityNotSetException if the appropriate capability is 4815 * not set and this object is part of a live or compiled scene graph 4816 * 4817 * @exception ArrayIndexOutOfBoundsException if the index or 4818 * vertexAttrNum is out of range. 4819 * 4820 * @exception IllegalStateException if the data mode for this geometry 4821 * array object is <code>BY_REFERENCE</code>. 4822 * 4823 * @exception IllegalStateException if the size of the specified 4824 * vertex attribute number is not 4. 4825 * 4826 * @since Java 3D 1.4 4827 */ getVertexAttr(int vertexAttrNum, int index, Point4f vertexAttr)4828 public void getVertexAttr(int vertexAttrNum, int index, 4829 Point4f vertexAttr) { 4830 if (isLiveOrCompiled()) { 4831 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 4832 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 4833 } 4834 } 4835 4836 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4837 if ((format & BY_REFERENCE) != 0) { 4838 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4839 } 4840 4841 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 4842 if (size != 4) { 4843 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 4844 } 4845 4846 ((GeometryArrayRetained)this.retained).getVertexAttr( 4847 vertexAttrNum, index, vertexAttr); 4848 } 4849 4850 /** 4851 * Gets the vertex attributes associated with the vertices starting at 4852 * the specified index in the specified vertex attribute number 4853 * for this object. The length of the destination 4854 * array determines the number of vertex attributes copied. 4855 * A maximum of <code>vertexCount-index</code> vertex attributes 4856 * are copied. If the destination array is larger than is needed 4857 * to hold the vertex attributes, the excess locations in the 4858 * array are not modified. If the destination array is smaller 4859 * than is needed to hold the vertex attributes, only as 4860 * many vertex attributes as the array will hold are copied. 4861 * 4862 * @param vertexAttrNum vertex attribute number in this geometry array 4863 * @param index starting source vertex index in this geometry array 4864 * @param vertexAttrs destination array of 1*n, 2*n, 3*n, or 4*n values 4865 * that will receive n new vertex attributes 4866 * 4867 * @exception CapabilityNotSetException if the appropriate capability is 4868 * not set and this object is part of a live or compiled scene graph 4869 * 4870 * @exception ArrayIndexOutOfBoundsException if the index or 4871 * vertexAttrNum is out of range. 4872 * 4873 * @exception IllegalStateException if the data mode for this geometry 4874 * array object is <code>BY_REFERENCE</code>. 4875 * 4876 * @since Java 3D 1.4 4877 */ getVertexAttrs(int vertexAttrNum, int index, float[] vertexAttrs)4878 public void getVertexAttrs(int vertexAttrNum, int index, 4879 float[] vertexAttrs) { 4880 4881 if (isLiveOrCompiled()) { 4882 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 4883 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 4884 } 4885 } 4886 4887 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4888 if ((format & BY_REFERENCE) != 0) { 4889 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4890 } 4891 4892 ((GeometryArrayRetained)this.retained).getVertexAttrs( 4893 vertexAttrNum, index, vertexAttrs); 4894 } 4895 4896 /** 4897 * Gets the vertex attributes associated with the vertices starting at 4898 * the specified index in the specified vertex attribute number 4899 * for this object. The length of the destination 4900 * array determines the number of vertex attributes copied. 4901 * A maximum of <code>vertexCount-index</code> vertex attributes 4902 * are copied. If the destination array is larger than is needed 4903 * to hold the vertex attributes, the excess locations in the 4904 * array are not modified. If the destination array is smaller 4905 * than is needed to hold the vertex attributes, only as 4906 * many vertex attributes as the array will hold are copied. 4907 * 4908 * @param vertexAttrNum vertex attribute number in this geometry array 4909 * @param index starting source vertex index in this geometry array 4910 * @param vertexAttrs destination array of Point2f objects that will 4911 * receive the vertex attributes 4912 * 4913 * @exception CapabilityNotSetException if the appropriate capability is 4914 * not set and this object is part of a live or compiled scene graph 4915 * 4916 * @exception ArrayIndexOutOfBoundsException if the index or 4917 * vertexAttrNum is out of range. 4918 * 4919 * @exception IllegalStateException if the data mode for this geometry 4920 * array object is <code>BY_REFERENCE</code>. 4921 * 4922 * @exception IllegalStateException if the size of the specified 4923 * vertex attribute number is not 2. 4924 * 4925 * @since Java 3D 1.4 4926 */ getVertexAttrs(int vertexAttrNum, int index, Point2f[] vertexAttrs)4927 public void getVertexAttrs(int vertexAttrNum, int index, 4928 Point2f[] vertexAttrs) { 4929 if (isLiveOrCompiled()) { 4930 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 4931 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 4932 } 4933 } 4934 4935 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4936 if ((format & BY_REFERENCE) != 0) { 4937 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4938 } 4939 4940 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 4941 if (size != 2) { 4942 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 4943 } 4944 4945 ((GeometryArrayRetained)this.retained).getVertexAttrs( 4946 vertexAttrNum, index, vertexAttrs); 4947 } 4948 4949 /** 4950 * Gets the vertex attributes associated with the vertices starting at 4951 * the specified index in the specified vertex attribute number 4952 * for this object. The length of the destination 4953 * array determines the number of vertex attributes copied. 4954 * A maximum of <code>vertexCount-index</code> vertex attributes 4955 * are copied. If the destination array is larger than is needed 4956 * to hold the vertex attributes, the excess locations in the 4957 * array are not modified. If the destination array is smaller 4958 * than is needed to hold the vertex attributes, only as 4959 * many vertex attributes as the array will hold are copied. 4960 * 4961 * @param vertexAttrNum vertex attribute number in this geometry array 4962 * @param index starting source vertex index in this geometry array 4963 * @param vertexAttrs destination array of Point3f objects that will 4964 * receive the vertex attributes 4965 * 4966 * @exception CapabilityNotSetException if the appropriate capability is 4967 * not set and this object is part of a live or compiled scene graph 4968 * 4969 * @exception ArrayIndexOutOfBoundsException if the index or 4970 * vertexAttrNum is out of range. 4971 * 4972 * @exception IllegalStateException if the data mode for this geometry 4973 * array object is <code>BY_REFERENCE</code>. 4974 * 4975 * @exception IllegalStateException if the size of the specified 4976 * vertex attribute number is not 3. 4977 * 4978 * @since Java 3D 1.4 4979 */ getVertexAttrs(int vertexAttrNum, int index, Point3f[] vertexAttrs)4980 public void getVertexAttrs(int vertexAttrNum, int index, 4981 Point3f[] vertexAttrs) { 4982 if (isLiveOrCompiled()) { 4983 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 4984 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 4985 } 4986 } 4987 4988 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 4989 if ((format & BY_REFERENCE) != 0) { 4990 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 4991 } 4992 4993 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 4994 if (size != 3) { 4995 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 4996 } 4997 4998 ((GeometryArrayRetained)this.retained).getVertexAttrs( 4999 vertexAttrNum, index, vertexAttrs); 5000 } 5001 5002 /** 5003 * Gets the vertex attributes associated with the vertices starting at 5004 * the specified index in the specified vertex attribute number 5005 * for this object. The length of the destination 5006 * array determines the number of vertex attributes copied. 5007 * A maximum of <code>vertexCount-index</code> vertex attributes 5008 * are copied. If the destination array is larger than is needed 5009 * to hold the vertex attributes, the excess locations in the 5010 * array are not modified. If the destination array is smaller 5011 * than is needed to hold the vertex attributes, only as 5012 * many vertex attributes as the array will hold are copied. 5013 * 5014 * @param vertexAttrNum vertex attribute number in this geometry array 5015 * @param index starting source vertex index in this geometry array 5016 * @param vertexAttrs destination array of Point4f objects that will 5017 * receive the vertex attributes 5018 * 5019 * @exception CapabilityNotSetException if the appropriate capability is 5020 * not set and this object is part of a live or compiled scene graph 5021 * 5022 * @exception ArrayIndexOutOfBoundsException if the index or 5023 * vertexAttrNum is out of range. 5024 * 5025 * @exception IllegalStateException if the data mode for this geometry 5026 * array object is <code>BY_REFERENCE</code>. 5027 * 5028 * @exception IllegalStateException if the size of the specified 5029 * vertex attribute number is not 4. 5030 * 5031 * @since Java 3D 1.4 5032 */ getVertexAttrs(int vertexAttrNum, int index, Point4f[] vertexAttrs)5033 public void getVertexAttrs(int vertexAttrNum, int index, 5034 Point4f[] vertexAttrs) { 5035 if (isLiveOrCompiled()) { 5036 if (!this.getCapability(ALLOW_VERTEX_ATTR_READ)) { 5037 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray127")); 5038 } 5039 } 5040 5041 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5042 if ((format & BY_REFERENCE) != 0) { 5043 throw new IllegalStateException(J3dI18N.getString("GeometryArray82")); 5044 } 5045 5046 int size = ((GeometryArrayRetained)this.retained).vertexAttrSizes[vertexAttrNum]; 5047 if (size != 4) { 5048 throw new IllegalStateException(J3dI18N.getString("GeometryArray134")); 5049 } 5050 5051 ((GeometryArrayRetained)this.retained).getVertexAttrs( 5052 vertexAttrNum, index, vertexAttrs); 5053 } 5054 5055 5056 //------------------------------------------------------------------ 5057 // By-reference methods 5058 //------------------------------------------------------------------ 5059 5060 /** 5061 * Sets the initial coordinate index for this GeometryArray object. 5062 * This index specifies the first coordinate within the array of 5063 * coordinates referenced by this geometry 5064 * array that is actually used in rendering or other operations 5065 * such as picking and collision. This attribute is initialized 5066 * to 0. 5067 * This attribute is only used when the data mode for this 5068 * geometry array object is <code>BY_REFERENCE</code> 5069 * and is <i>not</i> </code>INTERLEAVED</code>. 5070 * 5071 * @param initialCoordIndex the new initial coordinate index. 5072 * 5073 * @exception CapabilityNotSetException if the appropriate capability is 5074 * not set and this object is part of a live or compiled scene graph 5075 * <p> 5076 * @exception IllegalStateException if the data mode for this geometry 5077 * array object is not <code>BY_REFERENCE</code> or if the data mode 5078 * is <code>INTERLEAVED</code>. 5079 * <p> 5080 * @exception IllegalArgumentException if either of the following are 5081 * true: 5082 * <ul> 5083 * <code>initialCoordIndex < 0</code> or<br> 5084 * <code>initialCoordIndex + validVertexCount > vertexCount</code><br> 5085 * </ul> 5086 * <p> 5087 * @exception ArrayIndexOutOfBoundsException if 5088 * the CoordRef array is non-null and: 5089 * <ul> 5090 * <code>CoordRef.length</code> < <i>num_words</i> * 5091 * (<code>initialCoordIndex + validVertexCount</code>)<br> 5092 * </ul> 5093 * where <i>num_words</i> depends on which variant of 5094 * <code>setCoordRef</code> is used. 5095 * 5096 * @since Java 3D 1.2 5097 */ setInitialCoordIndex(int initialCoordIndex)5098 public void setInitialCoordIndex(int initialCoordIndex) { 5099 if (isLiveOrCompiled()) 5100 if(!this.getCapability(ALLOW_COUNT_WRITE)) 5101 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); 5102 5103 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5104 if (initialCoordIndex < 0) 5105 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); 5106 if ((format & BY_REFERENCE) == 0) 5107 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5108 5109 if ((format & INTERLEAVED) != 0) 5110 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5111 5112 ((GeometryArrayRetained)this.retained).setInitialCoordIndex(initialCoordIndex); 5113 // NOTE: the check for initialCoordIndex + validVertexCount > 5114 // vertexCount needs to be done in the retained method 5115 } 5116 5117 5118 /** 5119 * Gets the initial coordinate index for this GeometryArray object. 5120 * This attribute is only used when the data mode for this 5121 * geometry array object is <code>BY_REFERENCE</code> 5122 * and is <i>not</i> </code>INTERLEAVED</code>. 5123 * @return the current initial coordinate index for this 5124 * GeometryArray object. 5125 * @exception CapabilityNotSetException if the appropriate capability is 5126 * not set and this object is part of a live or compiled scene graph 5127 * 5128 * @since Java 3D 1.2 5129 */ getInitialCoordIndex()5130 public int getInitialCoordIndex() { 5131 if (isLiveOrCompiled()) 5132 if(!this.getCapability(ALLOW_COUNT_READ)) 5133 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); 5134 5135 return ((GeometryArrayRetained)this.retained).getInitialCoordIndex(); 5136 } 5137 5138 5139 /** 5140 * Sets the initial color index for this GeometryArray object. 5141 * This index specifies the first color within the array of 5142 * colors referenced by this geometry 5143 * array that is actually used in rendering or other operations 5144 * such as picking and collision. This attribute is initialized 5145 * to 0. 5146 * This attribute is only used when the data mode for this 5147 * geometry array object is <code>BY_REFERENCE</code> 5148 * and is <i>not</i> </code>INTERLEAVED</code>. 5149 * 5150 * @param initialColorIndex the new initial color index. 5151 * @exception CapabilityNotSetException if the appropriate capability is 5152 * not set and this object is part of a live or compiled scene graph 5153 * <p> 5154 * @exception IllegalStateException if the data mode for this geometry 5155 * array object is not <code>BY_REFERENCE</code> or if the data mode 5156 * is <code>INTERLEAVED</code>. 5157 * <p> 5158 * @exception IllegalArgumentException if either of the following are 5159 * true: 5160 * <ul> 5161 * <code>initialColorIndex < 0</code> or<br> 5162 * <code>initialColorIndex + validVertexCount > vertexCount</code><br> 5163 * </ul> 5164 * <p> 5165 * @exception ArrayIndexOutOfBoundsException if 5166 * the ColorRef array is non-null and: 5167 * <ul> 5168 * <code>ColorRef.length</code> < <i>num_words</i> * 5169 * (<code>initialColorIndex + validVertexCount</code>)<br> 5170 * </ul> 5171 * where <i>num_words</i> depends on which variant of 5172 * <code>setColorRef</code> is used. 5173 * 5174 * @since Java 3D 1.2 5175 */ setInitialColorIndex(int initialColorIndex)5176 public void setInitialColorIndex(int initialColorIndex) { 5177 if (isLiveOrCompiled()) 5178 if(!this.getCapability(ALLOW_COUNT_WRITE)) 5179 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); 5180 5181 if (initialColorIndex < 0) 5182 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); 5183 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5184 if ((format & BY_REFERENCE) == 0) 5185 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5186 5187 if ((format & INTERLEAVED) != 0) 5188 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5189 5190 ((GeometryArrayRetained)this.retained).setInitialColorIndex(initialColorIndex); 5191 // NOTE: the check for initialColorIndex + validVertexCount > 5192 // vertexCount needs to be done in the retained method 5193 } 5194 5195 5196 /** 5197 * Gets the initial color index for this GeometryArray object. 5198 * This attribute is only used when the data mode for this 5199 * geometry array object is <code>BY_REFERENCE</code> 5200 * and is <i>not</i> </code>INTERLEAVED</code>. 5201 * @return the current initial color index for this 5202 * GeometryArray object. 5203 * @exception CapabilityNotSetException if the appropriate capability is 5204 * not set and this object is part of a live or compiled scene graph 5205 * 5206 * @since Java 3D 1.2 5207 */ getInitialColorIndex()5208 public int getInitialColorIndex() { 5209 if (isLiveOrCompiled()) 5210 if(!this.getCapability(ALLOW_COUNT_READ)) 5211 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); 5212 5213 return ((GeometryArrayRetained)this.retained).getInitialColorIndex(); 5214 } 5215 5216 5217 /** 5218 * Sets the initial normal index for this GeometryArray object. 5219 * This index specifies the first normal within the array of 5220 * normals referenced by this geometry 5221 * array that is actually used in rendering or other operations 5222 * such as picking and collision. This attribute is initialized 5223 * to 0. 5224 * This attribute is only used when the data mode for this 5225 * geometry array object is <code>BY_REFERENCE</code> 5226 * and is <i>not</i> </code>INTERLEAVED</code>. 5227 * 5228 * @param initialNormalIndex the new initial normal index. 5229 * @exception CapabilityNotSetException if the appropriate capability is 5230 * not set and this object is part of a live or compiled scene graph 5231 * <p> 5232 * @exception IllegalStateException if the data mode for this geometry 5233 * array object is not <code>BY_REFERENCE</code> or if the data mode 5234 * is <code>INTERLEAVED</code>. 5235 * <p> 5236 * @exception IllegalArgumentException if either of the following are 5237 * true: 5238 * <ul> 5239 * <code>initialNormalIndex < 0</code> or<br> 5240 * <code>initialNormalIndex + validVertexCount > vertexCount</code><br> 5241 * </ul> 5242 * <p> 5243 * @exception ArrayIndexOutOfBoundsException if normals 5244 * the NormalRef array is non-null and: 5245 * <ul> 5246 * <code>NormalRef.length</code> < <i>num_words</i> * 5247 * (<code>initialNormalIndex + validVertexCount</code>)<br> 5248 * </ul> 5249 * where <i>num_words</i> depends on which variant of 5250 * <code>setNormalRef</code> is used. 5251 * 5252 * @since Java 3D 1.2 5253 */ setInitialNormalIndex(int initialNormalIndex)5254 public void setInitialNormalIndex(int initialNormalIndex) { 5255 if (isLiveOrCompiled()) 5256 if(!this.getCapability(ALLOW_COUNT_WRITE)) 5257 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); 5258 5259 if (initialNormalIndex < 0) 5260 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); 5261 5262 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5263 if ((format & BY_REFERENCE) == 0) 5264 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5265 5266 if ((format & INTERLEAVED) != 0) 5267 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5268 5269 ((GeometryArrayRetained)this.retained).setInitialNormalIndex(initialNormalIndex); 5270 // NOTE: the check for initialNormalIndex + validVertexCount > 5271 // vertexCount needs to be done in the retained method 5272 } 5273 5274 5275 /** 5276 * Gets the initial normal index for this GeometryArray object. 5277 * This attribute is only used when the data mode for this 5278 * geometry array object is <code>BY_REFERENCE</code> 5279 * and is <i>not</i> </code>INTERLEAVED</code>. 5280 * @return the current initial normal index for this 5281 * GeometryArray object. 5282 * @exception CapabilityNotSetException if the appropriate capability is 5283 * not set and this object is part of a live or compiled scene graph 5284 * 5285 * @since Java 3D 1.2 5286 */ getInitialNormalIndex()5287 public int getInitialNormalIndex() { 5288 if (isLiveOrCompiled()) 5289 if(!this.getCapability(ALLOW_COUNT_READ)) 5290 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); 5291 5292 return ((GeometryArrayRetained)this.retained).getInitialNormalIndex(); 5293 } 5294 5295 5296 /** 5297 * Sets the initial texture coordinate index for the specified 5298 * texture coordinate set for this GeometryArray object. This 5299 * index specifies the first texture coordinate within the array 5300 * of texture coordinates referenced by this geometry array that 5301 * is actually used in rendering or other operations such as 5302 * picking and collision. This attribute is initialized to 0. 5303 * This attribute is only used when the data mode for this 5304 * geometry array object is <code>BY_REFERENCE</code> 5305 * and is <i>not</i> </code>INTERLEAVED</code>. 5306 * 5307 * @param texCoordSet texture coordinate set in this geometry array 5308 * @param initialTexCoordIndex the new initial texture coordinate index. 5309 * 5310 * @exception CapabilityNotSetException if the appropriate capability is 5311 * not set and this object is part of a live or compiled scene graph 5312 * <p> 5313 * @exception IllegalStateException if the data mode for this geometry 5314 * array object is not <code>BY_REFERENCE</code> or if the data mode 5315 * is <code>INTERLEAVED</code>. 5316 * <p> 5317 * @exception IllegalArgumentException if either of the following are 5318 * true: 5319 * <ul> 5320 * <code>initialTexCoordIndex < 0</code> or<br> 5321 * <code>initialTexCoordIndex + validVertexCount > vertexCount</code><br> 5322 * </ul> 5323 * <p> 5324 * @exception ArrayIndexOutOfBoundsException if 5325 * the TexCoordRef array is non-null and: 5326 * <ul> 5327 * <code>TexCoordRef.length</code> < <i>num_words</i> * 5328 * (<code>initialTexCoordIndex + validVertexCount</code>)<br> 5329 * </ul> 5330 * where <i>num_words</i> depends on which variant of 5331 * <code>setTexCoordRef</code> is used. 5332 * <p> 5333 * @exception ArrayIndexOutOfBoundsException if none of the 5334 * <code>TEXTURE_COORDINATE</code> bits are set in the 5335 * <code>vertexFormat</code> or if texCoordSet is out of range. 5336 * 5337 * @since Java 3D 1.2 5338 */ setInitialTexCoordIndex(int texCoordSet, int initialTexCoordIndex)5339 public void setInitialTexCoordIndex(int texCoordSet, 5340 int initialTexCoordIndex) { 5341 if (isLiveOrCompiled()) 5342 if(!this.getCapability(ALLOW_COUNT_WRITE)) 5343 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); 5344 5345 if (initialTexCoordIndex < 0) 5346 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); 5347 5348 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5349 if ((format & BY_REFERENCE) == 0) 5350 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5351 5352 if ((format & INTERLEAVED) != 0) 5353 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5354 5355 ((GeometryArrayRetained)this.retained).setInitialTexCoordIndex( 5356 texCoordSet, initialTexCoordIndex); 5357 5358 // NOTE: the check for initialTexCoordIndex + validVertexCount > 5359 // vertexCount needs to be done in the retained method 5360 } 5361 5362 5363 /** 5364 * Gets the initial texture coordinate index for the specified 5365 * texture coordinate set for this GeometryArray object. 5366 * This attribute is only used when the data mode for this 5367 * geometry array object is <code>BY_REFERENCE</code> 5368 * and is <i>not</i> </code>INTERLEAVED</code>. 5369 * 5370 * @param texCoordSet texture coordinate set in this geometry array 5371 * 5372 * @return the current initial texture coordinate index for the specified 5373 * texture coordinate set 5374 * 5375 * @exception ArrayIndexOutOfBoundsException if none of the 5376 * <code>TEXTURE_COORDINATE</code> bits are set in the 5377 * <code>vertexFormat</code> or if texCoordSet is out of range. 5378 * 5379 * @exception CapabilityNotSetException if the appropriate capability is 5380 * not set and this object is part of a live or compiled scene graph 5381 * 5382 * @since Java 3D 1.2 5383 */ getInitialTexCoordIndex(int texCoordSet)5384 public int getInitialTexCoordIndex(int texCoordSet) { 5385 if (isLiveOrCompiled()) 5386 if(!this.getCapability(ALLOW_COUNT_READ)) 5387 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); 5388 5389 return ((GeometryArrayRetained)this.retained).getInitialTexCoordIndex( 5390 texCoordSet); 5391 } 5392 5393 5394 /** 5395 * Sets the initial vertex attribute index for the specified 5396 * vertex attribute number for this GeometryArray object. This 5397 * index specifies the first vertex attribute within the array 5398 * of vertex attributes referenced by this geometry array that 5399 * is actually used in rendering or other operations such as 5400 * picking and collision. This attribute is initialized to 0. 5401 * This attribute is only used when the data mode for this 5402 * geometry array object is <code>BY_REFERENCE</code> 5403 * and is <i>not</i> </code>INTERLEAVED</code>. 5404 * 5405 * @param vertexAttrNum vertex attribute number in this geometry array 5406 * @param initialVertexAttrIndex the new initial vertex attribute index. 5407 * 5408 * @exception CapabilityNotSetException if the appropriate capability is 5409 * not set and this object is part of a live or compiled scene graph 5410 * <p> 5411 * @exception IllegalStateException if the data mode for this geometry 5412 * array object is not <code>BY_REFERENCE</code> or if the data mode 5413 * is <code>INTERLEAVED</code>. 5414 * <p> 5415 * @exception IllegalArgumentException if either of the following are 5416 * true: 5417 * <ul> 5418 * <code>initialVertexAttrIndex < 0</code> or<br> 5419 * <code>initialVertexAttrIndex + validVertexCount > vertexCount</code><br> 5420 * </ul> 5421 * <p> 5422 * @exception ArrayIndexOutOfBoundsException if 5423 * the VertexAttrRef array is non-null and: 5424 * <ul> 5425 * <code>VertexAttrRef.length</code> < <i>num_words</i> * 5426 * (<code>initialVertexAttrIndex + validVertexCount</code>)<br> 5427 * </ul> 5428 * where <i>num_words</i> is the size of the specified 5429 * vertexAttrNum (1, 2, 3, or 4). 5430 * <p> 5431 * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is 5432 * out of range. 5433 * 5434 * @since Java 3D 1.4 5435 */ setInitialVertexAttrIndex(int vertexAttrNum, int initialVertexAttrIndex)5436 public void setInitialVertexAttrIndex(int vertexAttrNum, 5437 int initialVertexAttrIndex) { 5438 if (isLiveOrCompiled()) { 5439 if (!this.getCapability(ALLOW_COUNT_WRITE)) { 5440 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray90")); 5441 } 5442 } 5443 5444 if (initialVertexAttrIndex < 0) { 5445 throw new IllegalArgumentException(J3dI18N.getString("GeometryArray97")); 5446 } 5447 5448 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5449 if ((format & BY_REFERENCE) == 0) { 5450 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5451 } 5452 5453 if ((format & INTERLEAVED) != 0) { 5454 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5455 } 5456 5457 ((GeometryArrayRetained)this.retained).setInitialVertexAttrIndex( 5458 vertexAttrNum, initialVertexAttrIndex); 5459 5460 // NOTE: the check for initialVertexAttrIndex + validVertexCount > 5461 // vertexCount needs to be done in the retained method 5462 } 5463 5464 5465 /** 5466 * Gets the initial vertex attribute index for the specified 5467 * vertex attribute number for this GeometryArray object. 5468 * This attribute is only used when the data mode for this 5469 * geometry array object is <code>BY_REFERENCE</code> 5470 * and is <i>not</i> </code>INTERLEAVED</code>. 5471 * 5472 * @param vertexAttrNum vertex attribute number in this geometry array 5473 * 5474 * @return the current initial vertex attribute index for the specified 5475 * vertex attribute number 5476 * 5477 * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is 5478 * out of range. 5479 * 5480 * @exception CapabilityNotSetException if the appropriate capability is 5481 * not set and this object is part of a live or compiled scene graph 5482 * 5483 * @since Java 3D 1.4 5484 */ getInitialVertexAttrIndex(int vertexAttrNum)5485 public int getInitialVertexAttrIndex(int vertexAttrNum) { 5486 if (isLiveOrCompiled()) { 5487 if (!this.getCapability(ALLOW_COUNT_READ)) { 5488 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray91")); 5489 } 5490 } 5491 5492 return ((GeometryArrayRetained)this.retained).getInitialVertexAttrIndex( 5493 vertexAttrNum); 5494 } 5495 5496 5497 /** 5498 * Sets the coordinate buffer reference to the specified 5499 * buffer object. The buffer contains either a java.nio.FloatBuffer 5500 * or java.nio.DoubleBuffer object containing single or double 5501 * precision floating-point <i>x</i>, <i>y</i>, 5502 * and <i>z</i> values for each vertex (for a total of 3*<i>n</i> 5503 * values, where <i>n</i> is the number of vertices). 5504 * If the coordinate buffer 5505 * reference is null, the entire geometry array object is 5506 * treated as if it were null--any Shape3D or Morph node that uses 5507 * this geometry array will not be drawn. 5508 * 5509 * @param coords a J3DBuffer object to which a reference will be set. 5510 * The buffer contains an NIO buffer of 3*<i>n</i> float or 5511 * double values. 5512 * 5513 * @exception CapabilityNotSetException if the appropriate capability is 5514 * not set and this object is part of a live or compiled scene graph 5515 * 5516 * @exception IllegalStateException if the data mode for this geometry 5517 * array object is not <code>BY_REFERENCE</code>, 5518 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5519 * 5520 * @exception IllegalArgumentException if the java.nio.Buffer 5521 * contained in the specified J3DBuffer is not a 5522 * java.nio.FloatBuffer or a java.nio.DoubleBuffer object. 5523 * 5524 * @exception ArrayIndexOutOfBoundsException if 5525 * <code>coords.getBuffer().limit() < 5526 * 3 * (initialCoordIndex + validVertexCount)</code>. 5527 * 5528 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 5529 * object is a subclass of IndexedGeometryArray, and any element 5530 * in the range 5531 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 5532 * in the coordinate index array is greater than or equal to the 5533 * number of vertices defined by the coords object, 5534 * <code>coords.getBuffer().limit() / 3</code>. 5535 * 5536 * @since Java 3D 1.3 5537 */ setCoordRefBuffer(J3DBuffer coords)5538 public void setCoordRefBuffer(J3DBuffer coords) { 5539 if (isLiveOrCompiled()) 5540 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 5541 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 5542 5543 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5544 5545 if ((format & USE_NIO_BUFFER) == 0) 5546 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 5547 5548 if ((format & INTERLEAVED) != 0) 5549 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5550 5551 ((GeometryArrayRetained)this.retained).setCoordRefBuffer(coords); 5552 } 5553 5554 5555 /** 5556 * Gets the coordinate array buffer reference. 5557 * @return the current coordinate array buffer reference. 5558 * @exception CapabilityNotSetException if the appropriate capability is 5559 * not set and this object is part of a live or compiled scene graph 5560 * @exception IllegalStateException if the data mode for this geometry 5561 * array object is not <code>BY_REFERENCE</code>, 5562 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5563 * 5564 * @since Java 3D 1.3 5565 */ getCoordRefBuffer()5566 public J3DBuffer getCoordRefBuffer() { 5567 if (isLiveOrCompiled()) 5568 if (!this.getCapability(ALLOW_REF_DATA_READ) && 5569 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 5570 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 5571 } 5572 5573 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5574 if ((format & USE_NIO_BUFFER) == 0) 5575 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 5576 5577 if ((format & INTERLEAVED) != 0) 5578 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5579 5580 return ((GeometryArrayRetained)this.retained).getCoordRefBuffer(); 5581 } 5582 5583 5584 /** 5585 * Sets the float coordinate array reference to the specified 5586 * array. The array contains floating-point <i>x</i>, <i>y</i>, 5587 * and <i>z</i> values for each vertex (for a total of 3*<i>n</i> 5588 * values, where <i>n</i> is the number of vertices). Only one of 5589 * <code>coordRefFloat</code>, <code>coordRefDouble</code>, 5590 * <code>coordRef3f</code>, or <code>coordRef3d</code> may be 5591 * non-null (or they may all be null). An attempt to set more 5592 * than one of these attributes to a non-null reference will 5593 * result in an exception being thrown. If all coordinate array 5594 * references are null, the entire geometry array object is 5595 * treated as if it were null--any Shape3D or Morph node that uses 5596 * this geometry array will not be drawn. 5597 * 5598 * @param coords an array of 3*<i>n</i> values to which a 5599 * reference will be set. 5600 * @exception CapabilityNotSetException if the appropriate capability is 5601 * not set and this object is part of a live or compiled scene graph 5602 * @exception IllegalStateException if the data mode for this geometry 5603 * array object is not <code>BY_REFERENCE</code>, 5604 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5605 * @exception IllegalArgumentException if the specified array is 5606 * non-null and any other coordinate reference is also non-null. 5607 * @exception ArrayIndexOutOfBoundsException if 5608 * <code>coords.length < 3 * (initialCoordIndex + validVertexCount)</code>. 5609 * 5610 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 5611 * object is a subclass of IndexedGeometryArray, and any element 5612 * in the range 5613 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 5614 * in the coordinate index array is greater than or equal to the 5615 * number of vertices defined by the coords array, 5616 * <code>coords.length / 3</code>. 5617 * 5618 * @since Java 3D 1.2 5619 */ setCoordRefFloat(float[] coords)5620 public void setCoordRefFloat(float[] coords) { 5621 if (isLiveOrCompiled()) 5622 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 5623 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 5624 5625 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5626 if ((format & BY_REFERENCE) == 0) 5627 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5628 5629 if ((format & USE_NIO_BUFFER) != 0) 5630 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5631 5632 if ((format & INTERLEAVED) != 0) 5633 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5634 5635 ((GeometryArrayRetained)this.retained).setCoordRefFloat(coords); 5636 5637 } 5638 5639 5640 /** 5641 * Gets the float coordinate array reference. 5642 * @return the current float coordinate array reference. 5643 * @exception CapabilityNotSetException if the appropriate capability is 5644 * not set and this object is part of a live or compiled scene graph 5645 * @exception IllegalStateException if the data mode for this geometry 5646 * array object is not <code>BY_REFERENCE</code>, 5647 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5648 * 5649 * @since Java 3D 1.2 5650 */ getCoordRefFloat()5651 public float[] getCoordRefFloat() { 5652 if (isLiveOrCompiled()) 5653 if (!this.getCapability(ALLOW_REF_DATA_READ) && 5654 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 5655 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 5656 } 5657 5658 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5659 if ((format & BY_REFERENCE) == 0) 5660 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5661 5662 if ((format & USE_NIO_BUFFER) != 0) 5663 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5664 5665 if ((format & INTERLEAVED) != 0) 5666 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5667 5668 return ((GeometryArrayRetained)this.retained).getCoordRefFloat(); 5669 } 5670 5671 5672 /** 5673 * Sets the double coordinate array reference to the specified 5674 * array. The array contains double-precision 5675 * floating-point <i>x</i>, <i>y</i>, 5676 * and <i>z</i> values for each vertex (for a total of 3*<i>n</i> 5677 * values, where <i>n</i> is the number of vertices). Only one of 5678 * <code>coordRefFloat</code>, <code>coordRefDouble</code>, 5679 * <code>coordRef3f</code>, or <code>coordRef3d</code> may be 5680 * non-null (or they may all be null). An attempt to set more 5681 * than one of these attributes to a non-null reference will 5682 * result in an exception being thrown. If all coordinate array 5683 * references are null, the entire geometry array object is 5684 * treated as if it were null--any Shape3D or Morph node that uses 5685 * this geometry array will not be drawn. 5686 * 5687 * @param coords an array of 3*<i>n</i> values to which a 5688 * reference will be set. 5689 * @exception CapabilityNotSetException if the appropriate capability is 5690 * not set and this object is part of a live or compiled scene graph 5691 * @exception IllegalStateException if the data mode for this geometry 5692 * array object is not <code>BY_REFERENCE</code>, 5693 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5694 * @exception IllegalArgumentException if the specified array is 5695 * non-null and any other coordinate reference is also non-null. 5696 * @exception ArrayIndexOutOfBoundsException if 5697 * <code>coords.length < 3 * (initialCoordIndex + validVertexCount)</code>. 5698 * 5699 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 5700 * object is a subclass of IndexedGeometryArray, and any element 5701 * in the range 5702 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 5703 * in the coordinate index array is greater than or equal to the 5704 * number of vertices defined by the coords array, 5705 * <code>coords.length / 3</code>. 5706 * 5707 * @since Java 3D 1.2 5708 */ setCoordRefDouble(double[] coords)5709 public void setCoordRefDouble(double[] coords) { 5710 if (isLiveOrCompiled()) 5711 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 5712 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 5713 5714 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5715 if ((format & BY_REFERENCE) == 0) 5716 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5717 5718 if ((format & USE_NIO_BUFFER) != 0) 5719 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5720 5721 if ((format & INTERLEAVED) != 0) 5722 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5723 5724 ((GeometryArrayRetained)this.retained).setCoordRefDouble(coords); 5725 5726 } 5727 5728 5729 /** 5730 * Gets the double coordinate array reference. 5731 * @return the current double coordinate array reference. 5732 * @exception CapabilityNotSetException if the appropriate capability is 5733 * not set and this object is part of a live or compiled scene graph 5734 * @exception IllegalStateException if the data mode for this geometry 5735 * array object is not <code>BY_REFERENCE</code>, 5736 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5737 * 5738 * @since Java 3D 1.2 5739 */ getCoordRefDouble()5740 public double[] getCoordRefDouble() { 5741 if (isLiveOrCompiled()) 5742 if (!this.getCapability(ALLOW_REF_DATA_READ) && 5743 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 5744 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 5745 } 5746 5747 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5748 if ((format & BY_REFERENCE) == 0) 5749 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5750 5751 if ((format & USE_NIO_BUFFER) != 0) 5752 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5753 5754 if ((format & INTERLEAVED) != 0) 5755 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5756 5757 return ((GeometryArrayRetained)this.retained).getCoordRefDouble(); 5758 } 5759 5760 5761 /** 5762 * @deprecated As of Java 3D version 1.3, use geometry by-copy 5763 * for Point3f arrays 5764 * 5765 * @since Java 3D 1.2 5766 */ setCoordRef3f(Point3f[] coords)5767 public void setCoordRef3f(Point3f[] coords) { 5768 if (isLiveOrCompiled()) 5769 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 5770 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 5771 5772 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5773 if ((format & BY_REFERENCE) == 0) 5774 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5775 5776 if ((format & USE_NIO_BUFFER) != 0) 5777 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5778 5779 if ((format & INTERLEAVED) != 0) 5780 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5781 5782 ((GeometryArrayRetained)this.retained).setCoordRef3f(coords); 5783 5784 5785 } 5786 5787 5788 /** 5789 * @deprecated As of Java 3D version 1.3, use geometry by-copy 5790 * for Point3f arrays 5791 * 5792 * @since Java 3D 1.2 5793 */ getCoordRef3f()5794 public Point3f[] getCoordRef3f() { 5795 if (isLiveOrCompiled()) 5796 if (!this.getCapability(ALLOW_REF_DATA_READ) && 5797 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 5798 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 5799 } 5800 5801 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5802 if ((format & BY_REFERENCE) == 0) 5803 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5804 5805 if ((format & USE_NIO_BUFFER) != 0) 5806 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5807 5808 if ((format & INTERLEAVED) != 0) 5809 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5810 5811 return ((GeometryArrayRetained)this.retained).getCoordRef3f(); 5812 } 5813 5814 5815 /** 5816 * @deprecated As of Java 3D version 1.3, use geometry by-copy 5817 * for Point3d arrays 5818 * 5819 * @since Java 3D 1.2 5820 */ setCoordRef3d(Point3d[] coords)5821 public void setCoordRef3d(Point3d[] coords) { 5822 if (isLiveOrCompiled()) 5823 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 5824 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 5825 5826 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5827 if ((format & BY_REFERENCE) == 0) 5828 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5829 5830 if ((format & USE_NIO_BUFFER) != 0) 5831 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5832 5833 if ((format & INTERLEAVED) != 0) 5834 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5835 5836 ((GeometryArrayRetained)this.retained).setCoordRef3d(coords); 5837 5838 } 5839 5840 5841 /** 5842 * @deprecated As of Java 3D version 1.3, use geometry by-copy 5843 * for Point3d arrays 5844 * 5845 * @since Java 3D 1.2 5846 */ getCoordRef3d()5847 public Point3d[] getCoordRef3d() { 5848 if (isLiveOrCompiled()) 5849 if (!this.getCapability(ALLOW_REF_DATA_READ) && 5850 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 5851 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 5852 } 5853 5854 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5855 if ((format & BY_REFERENCE) == 0) 5856 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 5857 5858 if ((format & USE_NIO_BUFFER) != 0) 5859 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 5860 5861 if ((format & INTERLEAVED) != 0) 5862 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5863 5864 return ((GeometryArrayRetained)this.retained).getCoordRef3d(); 5865 } 5866 5867 5868 /** 5869 * Sets the color buffer reference to the specified 5870 * buffer object. The buffer contains either a java.nio.FloatBuffer 5871 * or java.nio.ByteBuffer object containing floating-point 5872 * or byte <i>red</i>, <i>green</i>, 5873 * <i>blue</i>, and, optionally, <i>alpha</i> values for each 5874 * vertex (for a total of 3*<i>n</i> or 4*<i>n</i> values, where 5875 * <i>n</i> is the number of vertices). 5876 * If the color buffer reference is null and colors are enabled 5877 * (that is, the vertexFormat includes either <code>COLOR_3</code> or 5878 * <code>COLOR_4</code>), the entire geometry array object is 5879 * treated as if it were null--any Shape3D or Morph node that uses 5880 * this geometry array will not be drawn. 5881 * 5882 * @param colors a J3DBuffer object to which a reference will be set. 5883 * The buffer contains an NIO buffer of 3*<i>n</i> or 4*<i>n</i> 5884 * float or byte values. 5885 * 5886 * @exception CapabilityNotSetException if the appropriate capability is 5887 * not set and this object is part of a live or compiled scene graph 5888 * 5889 * @exception IllegalStateException if the data mode for this geometry 5890 * array object is not <code>BY_REFERENCE</code>, 5891 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5892 * 5893 * @exception IllegalArgumentException if the java.nio.Buffer 5894 * contained in the specified J3DBuffer is not a 5895 * java.nio.FloatBuffer or a java.nio.ByteBuffer object. 5896 * 5897 * @exception ArrayIndexOutOfBoundsException if none of the 5898 * <code>COLOR</code> bits are set in the 5899 * <code>vertexFormat</code>, or if 5900 * <code>colors.getBuffer().limit() < </code> <i>num_words</i> <code> * 5901 * (initialColorIndex + validVertexCount)</code>, 5902 * where <i>num_words</i> is 3 or 4 depending on the vertex color format. 5903 * 5904 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 5905 * object is a subclass of IndexedGeometryArray, and any element 5906 * in the range 5907 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 5908 * in the color index array is greater than or equal to the 5909 * number of vertices defined by the colors object, 5910 * <code>colors.getBuffer().limit() / </code> <i>num_words</i>. 5911 * 5912 * @since Java 3D 1.3 5913 */ setColorRefBuffer(J3DBuffer colors)5914 public void setColorRefBuffer(J3DBuffer colors) { 5915 if (isLiveOrCompiled()) 5916 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 5917 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 5918 5919 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5920 5921 if ((format & USE_NIO_BUFFER) == 0) 5922 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 5923 5924 if ((format & INTERLEAVED) != 0) 5925 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5926 5927 ((GeometryArrayRetained)this.retained).setColorRefBuffer(colors); 5928 5929 } 5930 5931 5932 /** 5933 * Gets the color array buffer reference. 5934 * @return the current color array buffer reference. 5935 * @exception CapabilityNotSetException if the appropriate capability is 5936 * not set and this object is part of a live or compiled scene graph 5937 * @exception IllegalStateException if the data mode for this geometry 5938 * array object is not <code>BY_REFERENCE</code>, 5939 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5940 * 5941 * @since Java 3D 1.3 5942 */ getColorRefBuffer()5943 public J3DBuffer getColorRefBuffer() { 5944 if (isLiveOrCompiled()) 5945 if (!this.getCapability(ALLOW_REF_DATA_READ) && 5946 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 5947 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 5948 } 5949 5950 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 5951 5952 if ((format & USE_NIO_BUFFER) == 0) 5953 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 5954 5955 if ((format & INTERLEAVED) != 0) 5956 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 5957 5958 return ((GeometryArrayRetained)this.retained).getColorRefBuffer(); 5959 } 5960 5961 5962 /** 5963 * Sets the float color array reference to the specified array. 5964 * The array contains floating-point <i>red</i>, <i>green</i>, 5965 * <i>blue</i>, and, optionally, <i>alpha</i> values for each 5966 * vertex (for a total of 3*<i>n</i> or 4*<i>n</i> values, where 5967 * <i>n</i> is the number of vertices). Only one of 5968 * <code>colorRefFloat</code>, <code>colorRefByte</code>, 5969 * <code>colorRef3f</code>, <code>colorRef4f</code>, 5970 * <code>colorRef3b</code>, or <code>colorRef4b</code> may be 5971 * non-null (or they may all be null). An attempt to set more 5972 * than one of these attributes to a non-null reference will 5973 * result in an exception being thrown. If all color array 5974 * references are null and colors are enabled (that is, the 5975 * vertexFormat includes either <code>COLOR_3</code> or 5976 * <code>COLOR_4</code>), the entire geometry array object is 5977 * treated as if it were null--any Shape3D or Morph node that uses 5978 * this geometry array will not be drawn. 5979 * 5980 * @param colors an array of 3*<i>n</i> or 4*<i>n</i> values to which a 5981 * reference will be set. 5982 * @exception CapabilityNotSetException if the appropriate capability is 5983 * not set and this object is part of a live or compiled scene graph 5984 * @exception IllegalStateException if the data mode for this geometry 5985 * array object is not <code>BY_REFERENCE</code>, 5986 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 5987 * @exception IllegalArgumentException if the specified array is 5988 * non-null and any other color reference is also non-null. 5989 * 5990 * @exception ArrayIndexOutOfBoundsException if none of the 5991 * <code>COLOR</code> bits are set in the 5992 * <code>vertexFormat</code>, or if 5993 * <code>colors.length < </code> <i>num_words</i> <code> * 5994 * (initialColorIndex + validVertexCount)</code>, 5995 * where <i>num_words</i> is 3 or 4 depending on the vertex color format. 5996 * 5997 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 5998 * object is a subclass of IndexedGeometryArray, and any element 5999 * in the range 6000 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 6001 * in the color index array is greater than or equal to the 6002 * number of vertices defined by the colors array, 6003 * <code>colors.length / </code> <i>num_words</i>. 6004 * 6005 * @since Java 3D 1.2 6006 */ setColorRefFloat(float[] colors)6007 public void setColorRefFloat(float[] colors) { 6008 if (isLiveOrCompiled()) 6009 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6010 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6011 6012 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6013 if ((format & BY_REFERENCE) == 0) 6014 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6015 6016 if ((format & USE_NIO_BUFFER) != 0) 6017 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6018 6019 if ((format & INTERLEAVED) != 0) 6020 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6021 6022 ((GeometryArrayRetained)this.retained).setColorRefFloat(colors); 6023 6024 } 6025 6026 6027 /** 6028 * Gets the float color array reference. 6029 * @return the current float color array reference. 6030 * @exception CapabilityNotSetException if the appropriate capability is 6031 * not set and this object is part of a live or compiled scene graph 6032 * @exception IllegalStateException if the data mode for this geometry 6033 * array object is not <code>BY_REFERENCE</code>, 6034 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6035 * 6036 * @since Java 3D 1.2 6037 */ getColorRefFloat()6038 public float[] getColorRefFloat() { 6039 if (isLiveOrCompiled()) 6040 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6041 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6042 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6043 } 6044 6045 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6046 if ((format & BY_REFERENCE) == 0) 6047 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6048 6049 if ((format & USE_NIO_BUFFER) != 0) 6050 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6051 6052 if ((format & INTERLEAVED) != 0) 6053 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6054 6055 return ((GeometryArrayRetained)this.retained).getColorRefFloat(); 6056 } 6057 6058 6059 /** 6060 * Sets the byte color array reference to the specified array. 6061 * The array contains <i>red</i>, <i>green</i>, 6062 * <i>blue</i>, and, optionally, <i>alpha</i> values for each 6063 * vertex (for a total of 3*<i>n</i> or 4*<i>n</i> values, where 6064 * <i>n</i> is the number of vertices). Only one of 6065 * <code>colorRefFloat</code>, <code>colorRefByte</code>, 6066 * <code>colorRef3f</code>, <code>colorRef4f</code>, 6067 * <code>colorRef3b</code>, or <code>colorRef4b</code> may be 6068 * non-null (or they may all be null). An attempt to set more 6069 * than one of these attributes to a non-null reference will 6070 * result in an exception being thrown. If all color array 6071 * references are null and colors are enabled (that is, the 6072 * vertexFormat includes either <code>COLOR_3</code> or 6073 * <code>COLOR_4</code>), the entire geometry array object is 6074 * treated as if it were null--any Shape3D or Morph node that uses 6075 * this geometry array will not be drawn. 6076 * 6077 * @param colors an array of 3*<i>n</i> or 4*<i>n</i> values to which a 6078 * reference will be set. 6079 * @exception CapabilityNotSetException if the appropriate capability is 6080 * not set and this object is part of a live or compiled scene graph 6081 * @exception IllegalStateException if the data mode for this geometry 6082 * array object is not <code>BY_REFERENCE</code>, 6083 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6084 * @exception IllegalArgumentException if the specified array is 6085 * non-null and any other color reference is also non-null. 6086 * 6087 * @exception ArrayIndexOutOfBoundsException if none of the 6088 * <code>COLOR</code> bits are set in the 6089 * <code>vertexFormat</code>, or if 6090 * <code>colors.length < </code> <i>num_words</i> <code> * 6091 * (initialColorIndex + validVertexCount)</code>, 6092 * where <i>num_words</i> is 3 or 4 depending on the vertex color format. 6093 * 6094 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 6095 * object is a subclass of IndexedGeometryArray, and any element 6096 * in the range 6097 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 6098 * in the color index array is greater than or equal to the 6099 * number of vertices defined by the colors array, 6100 * <code>colors.length / </code> <i>num_words</i>. 6101 * 6102 * @since Java 3D 1.2 6103 */ setColorRefByte(byte[] colors)6104 public void setColorRefByte(byte[] colors) { 6105 if (isLiveOrCompiled()) 6106 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6107 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6108 6109 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6110 if ((format & BY_REFERENCE) == 0) 6111 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6112 6113 if ((format & USE_NIO_BUFFER) != 0) 6114 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6115 6116 if ((format & INTERLEAVED) != 0) 6117 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6118 6119 ((GeometryArrayRetained)this.retained).setColorRefByte(colors); 6120 6121 // NOTE: the checks for multiple non-null references, and the 6122 // array length check need to be done in the retained method 6123 } 6124 6125 6126 /** 6127 * Gets the byte color array reference. 6128 * @return the current byte color array reference. 6129 * @exception CapabilityNotSetException if the appropriate capability is 6130 * not set and this object is part of a live or compiled scene graph 6131 * @exception IllegalStateException if the data mode for this geometry 6132 * array object is not <code>BY_REFERENCE</code>, 6133 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6134 * 6135 * @since Java 3D 1.2 6136 */ getColorRefByte()6137 public byte[] getColorRefByte() { 6138 if (isLiveOrCompiled()) 6139 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6140 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6141 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6142 } 6143 6144 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6145 if ((format & BY_REFERENCE) == 0) 6146 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6147 6148 if ((format & USE_NIO_BUFFER) != 0) 6149 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6150 6151 if ((format & INTERLEAVED) != 0) 6152 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6153 6154 return ((GeometryArrayRetained)this.retained).getColorRefByte(); 6155 } 6156 6157 6158 /** 6159 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6160 * for Color3f arrays 6161 * 6162 * @since Java 3D 1.2 6163 */ setColorRef3f(Color3f[] colors)6164 public void setColorRef3f(Color3f[] colors) { 6165 if (isLiveOrCompiled()) 6166 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6167 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6168 6169 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6170 if ((format & BY_REFERENCE) == 0) 6171 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6172 6173 if ((format & USE_NIO_BUFFER) != 0) 6174 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6175 6176 if ((format & INTERLEAVED) != 0) 6177 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6178 6179 if ((format & WITH_ALPHA) != 0) 6180 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 6181 6182 ((GeometryArrayRetained)this.retained).setColorRef3f(colors); 6183 6184 // NOTE: the checks for multiple non-null references, and the 6185 // array length check need to be done in the retained method 6186 } 6187 6188 6189 /** 6190 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6191 * for Color3f arrays 6192 * 6193 * @since Java 3D 1.2 6194 */ getColorRef3f()6195 public Color3f[] getColorRef3f() { 6196 if (isLiveOrCompiled()) 6197 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6198 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6199 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6200 } 6201 6202 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6203 if ((format & BY_REFERENCE) == 0) 6204 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6205 6206 if ((format & USE_NIO_BUFFER) != 0) 6207 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6208 6209 if ((format & INTERLEAVED) != 0) 6210 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6211 6212 return ((GeometryArrayRetained)this.retained).getColorRef3f(); 6213 } 6214 6215 6216 /** 6217 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6218 * for Color4f arrays 6219 * 6220 * @since Java 3D 1.2 6221 */ setColorRef4f(Color4f[] colors)6222 public void setColorRef4f(Color4f[] colors) { 6223 if (isLiveOrCompiled()) 6224 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6225 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6226 6227 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6228 if ((format & BY_REFERENCE) == 0) 6229 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6230 6231 if ((format & USE_NIO_BUFFER) != 0) 6232 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6233 6234 if ((format & INTERLEAVED) != 0) 6235 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6236 6237 if ((format & WITH_ALPHA) == 0) 6238 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 6239 6240 ((GeometryArrayRetained)this.retained).setColorRef4f(colors); 6241 6242 // NOTE: the checks for multiple non-null references, and the 6243 // array length check need to be done in the retained method 6244 } 6245 6246 6247 /** 6248 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6249 * for Color4f arrays 6250 * 6251 * @since Java 3D 1.2 6252 */ getColorRef4f()6253 public Color4f[] getColorRef4f() { 6254 if (isLiveOrCompiled()) 6255 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6256 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6257 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6258 } 6259 6260 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6261 if ((format & BY_REFERENCE) == 0) 6262 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6263 6264 if ((format & USE_NIO_BUFFER) != 0) 6265 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6266 6267 if ((format & INTERLEAVED) != 0) 6268 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6269 6270 return ((GeometryArrayRetained)this.retained).getColorRef4f(); 6271 } 6272 6273 6274 /** 6275 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6276 * for Color3b arrays 6277 * 6278 * @since Java 3D 1.2 6279 */ setColorRef3b(Color3b[] colors)6280 public void setColorRef3b(Color3b[] colors) { 6281 if (isLiveOrCompiled()) 6282 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6283 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6284 6285 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6286 if ((format & BY_REFERENCE) == 0) 6287 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6288 6289 if ((format & USE_NIO_BUFFER) != 0) 6290 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6291 6292 if ((format & INTERLEAVED) != 0) 6293 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6294 6295 if ((format & WITH_ALPHA) != 0) 6296 throw new IllegalStateException(J3dI18N.getString("GeometryArray92")); 6297 6298 ((GeometryArrayRetained)this.retained).setColorRef3b(colors); 6299 6300 // NOTE: the checks for multiple non-null references, and the 6301 // array length check need to be done in the retained method 6302 } 6303 6304 6305 /** 6306 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6307 * for Color3b arrays 6308 * 6309 * @since Java 3D 1.2 6310 */ getColorRef3b()6311 public Color3b[] getColorRef3b() { 6312 if (isLiveOrCompiled()) 6313 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6314 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6315 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6316 } 6317 6318 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6319 if ((format & BY_REFERENCE) == 0) 6320 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6321 6322 if ((format & USE_NIO_BUFFER) != 0) 6323 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6324 6325 if ((format & USE_NIO_BUFFER) != 0) 6326 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6327 6328 if ((format & INTERLEAVED) != 0) 6329 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6330 6331 return ((GeometryArrayRetained)this.retained).getColorRef3b(); 6332 } 6333 6334 6335 /** 6336 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6337 * for Color4b arrays 6338 * 6339 * @since Java 3D 1.2 6340 */ setColorRef4b(Color4b[] colors)6341 public void setColorRef4b(Color4b[] colors) { 6342 if (isLiveOrCompiled()) 6343 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6344 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6345 6346 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6347 if ((format & BY_REFERENCE) == 0) 6348 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6349 6350 if ((format & USE_NIO_BUFFER) != 0) 6351 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6352 6353 if ((format & INTERLEAVED) != 0) 6354 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6355 6356 if ((format & WITH_ALPHA) == 0) 6357 throw new IllegalStateException(J3dI18N.getString("GeometryArray93")); 6358 6359 ((GeometryArrayRetained)this.retained).setColorRef4b(colors); 6360 6361 // NOTE: the checks for multiple non-null references, and the 6362 // array length check need to be done in the retained method 6363 } 6364 6365 6366 /** 6367 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6368 * for Color4b arrays 6369 * 6370 * @since Java 3D 1.2 6371 */ getColorRef4b()6372 public Color4b[] getColorRef4b() { 6373 if (isLiveOrCompiled()) 6374 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6375 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6376 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6377 } 6378 6379 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6380 if ((format & BY_REFERENCE) == 0) 6381 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6382 6383 if ((format & USE_NIO_BUFFER) != 0) 6384 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6385 6386 if ((format & INTERLEAVED) != 0) 6387 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6388 6389 return ((GeometryArrayRetained)this.retained).getColorRef4b(); 6390 } 6391 6392 6393 /** 6394 * Sets the normal buffer reference to the specified 6395 * buffer object. The buffer contains a java.nio.FloatBuffer 6396 * object containing <i>nx</i>, <i>ny</i>, 6397 * and <i>nz</i> values for each vertex (for a total of 3*<i>n</i> 6398 * values, where <i>n</i> is the number of vertices). 6399 * If the normal buffer reference is null and normals are enabled 6400 * (that is, the vertexFormat includes <code>NORMAL</code>), the 6401 * entire geometry array object is treated as if it were null--any 6402 * Shape3D or Morph node that uses this geometry array will not be 6403 * drawn. 6404 * 6405 * @param normals a J3DBuffer object to which a reference will be set. 6406 * The buffer contains an NIO buffer of 3*<i>n</i> float values. 6407 * 6408 * @exception CapabilityNotSetException if the appropriate capability is 6409 * not set and this object is part of a live or compiled scene graph 6410 * 6411 * @exception IllegalStateException if the data mode for this geometry 6412 * array object is not <code>BY_REFERENCE</code>, 6413 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6414 * 6415 * @exception IllegalArgumentException if the java.nio.Buffer 6416 * contained in the specified J3DBuffer is not a 6417 * java.nio.FloatBuffer object. 6418 * 6419 * @exception ArrayIndexOutOfBoundsException if 6420 * <code>NORMALS</code> bit is not set in the 6421 * <code>vertexFormat</code>, or if 6422 * <code>normals.getBuffer().limit() < 6423 * 3 * (initialNormalIndex + validVertexCount)</code>. 6424 * 6425 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 6426 * object is a subclass of IndexedGeometryArray, and any element 6427 * in the range 6428 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 6429 * in the normal index array is greater than or equal to the 6430 * number of vertices defined by the normals object, 6431 * <code>normals.getBuffer().limit() / 3</code>. 6432 * 6433 * @since Java 3D 1.3 6434 */ setNormalRefBuffer(J3DBuffer normals)6435 public void setNormalRefBuffer(J3DBuffer normals) { 6436 if (isLiveOrCompiled()) 6437 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6438 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6439 6440 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6441 if ((format & USE_NIO_BUFFER) == 0) 6442 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 6443 6444 if ((format & INTERLEAVED) != 0) 6445 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6446 6447 ((GeometryArrayRetained)this.retained).setNormalRefBuffer(normals); 6448 } 6449 6450 6451 /** 6452 * Gets the normal array buffer reference. 6453 * @return the current normal array buffer reference. 6454 * @exception CapabilityNotSetException if the appropriate capability is 6455 * not set and this object is part of a live or compiled scene graph 6456 * @exception IllegalStateException if the data mode for this geometry 6457 * array object is not <code>BY_REFERENCE</code>, 6458 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6459 * 6460 * @since Java 3D 1.3 6461 */ getNormalRefBuffer()6462 public J3DBuffer getNormalRefBuffer() { 6463 if (isLiveOrCompiled()) 6464 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6465 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6466 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6467 } 6468 6469 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6470 6471 if ((format & USE_NIO_BUFFER) == 0) 6472 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 6473 6474 if ((format & INTERLEAVED) != 0) 6475 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6476 6477 return ((GeometryArrayRetained)this.retained).getNormalRefBuffer(); 6478 } 6479 6480 6481 /** 6482 * Sets the float normal array reference to the specified 6483 * array. The array contains floating-point <i>nx</i>, <i>ny</i>, 6484 * and <i>nz</i> values for each vertex (for a total of 3*<i>n</i> 6485 * values, where <i>n</i> is the number of vertices). Only one of 6486 * <code>normalRefFloat</code> or <code>normalRef3f</code> may be 6487 * non-null (or they may all be null). An attempt to set more 6488 * than one of these attributes to a non-null reference will 6489 * result in an exception being thrown. If all normal array 6490 * references are null and normals are enabled (that is, the 6491 * vertexFormat includes 6492 * <code>NORMAL</code>), the entire geometry array object is 6493 * treated as if it were null--any Shape3D or Morph node that uses 6494 * this geometry array will not be drawn. 6495 * 6496 * @param normals an array of 3*<i>n</i> values to which a 6497 * reference will be set. 6498 * @exception CapabilityNotSetException if the appropriate capability is 6499 * not set and this object is part of a live or compiled scene graph 6500 * @exception IllegalStateException if the data mode for this geometry 6501 * array object is not <code>BY_REFERENCE</code>, 6502 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6503 * @exception IllegalArgumentException if the specified array is 6504 * non-null and any other normal reference is also non-null. 6505 * @exception ArrayIndexOutOfBoundsException if 6506 * <code>NORMALS</code> bit is not set in the 6507 * <code>vertexFormat</code>, or if 6508 * <code>normals.length < 3 * (initialNormalIndex + validVertexCount)</code>. 6509 * 6510 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 6511 * object is a subclass of IndexedGeometryArray, and any element 6512 * in the range 6513 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 6514 * in the normal index array is greater than or equal to the 6515 * number of vertices defined by the normals array, 6516 * <code>normals.length / 3</code>. 6517 * 6518 * @since Java 3D 1.2 6519 */ setNormalRefFloat(float[] normals)6520 public void setNormalRefFloat(float[] normals) { 6521 if (isLiveOrCompiled()) 6522 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6523 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6524 6525 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6526 if ((format & BY_REFERENCE) == 0) 6527 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6528 6529 if ((format & USE_NIO_BUFFER) != 0) 6530 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6531 6532 if ((format & INTERLEAVED) != 0) 6533 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6534 6535 ((GeometryArrayRetained)this.retained).setNormalRefFloat(normals); 6536 6537 // NOTE: the checks for multiple non-null references, and the 6538 // array length check need to be done in the retained method 6539 } 6540 6541 6542 /** 6543 * Gets the float normal array reference. 6544 * @return the current float normal array reference. 6545 * @exception CapabilityNotSetException if the appropriate capability is 6546 * not set and this object is part of a live or compiled scene graph 6547 * @exception IllegalStateException if the data mode for this geometry 6548 * array object is not <code>BY_REFERENCE</code>, 6549 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6550 * 6551 * @since Java 3D 1.2 6552 */ getNormalRefFloat()6553 public float[] getNormalRefFloat() { 6554 if (isLiveOrCompiled()) 6555 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6556 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6557 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6558 } 6559 6560 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6561 if ((format & BY_REFERENCE) == 0) 6562 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6563 6564 if ((format & USE_NIO_BUFFER) != 0) 6565 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6566 6567 if ((format & INTERLEAVED) != 0) 6568 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6569 6570 return ((GeometryArrayRetained)this.retained).getNormalRefFloat(); 6571 } 6572 6573 6574 /** 6575 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6576 * for Vector3f arrays 6577 * 6578 * @since Java 3D 1.2 6579 */ setNormalRef3f(Vector3f[] normals)6580 public void setNormalRef3f(Vector3f[] normals) { 6581 if (isLiveOrCompiled()) 6582 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6583 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6584 6585 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6586 if ((format & BY_REFERENCE) == 0) 6587 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6588 6589 if ((format & USE_NIO_BUFFER) != 0) 6590 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6591 6592 if ((format & INTERLEAVED) != 0) 6593 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6594 6595 ((GeometryArrayRetained)this.retained).setNormalRef3f(normals); 6596 6597 // NOTE: the checks for multiple non-null references, and the 6598 // array length check need to be done in the retained method 6599 } 6600 6601 6602 /** 6603 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6604 * for Vector3f arrays 6605 * 6606 * @since Java 3D 1.2 6607 */ getNormalRef3f()6608 public Vector3f[] getNormalRef3f() { 6609 if (isLiveOrCompiled()) 6610 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6611 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6612 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6613 } 6614 6615 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6616 if ((format & BY_REFERENCE) == 0) 6617 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6618 6619 if ((format & USE_NIO_BUFFER) != 0) 6620 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6621 6622 if ((format & INTERLEAVED) != 0) 6623 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6624 6625 return ((GeometryArrayRetained)this.retained).getNormalRef3f(); 6626 } 6627 6628 6629 /** 6630 * Sets the texture coordinate buffer reference for the specified 6631 * texture coordinate set to the 6632 * specified buffer object. The buffer contains a java.nio.FloatBuffer 6633 * object containing <i>s</i>, 6634 * <i>t</i>, and, optionally, <i>r</i> and <i>q</i> values for each 6635 * vertex (for 6636 * a total of 2*<i>n</i> , 3*<i>n</i> or 4*<i>n</i> values, 6637 * where <i>n</i> is 6638 * the number of vertices). 6639 * If the texCoord buffer reference is null and texture 6640 * coordinates are enabled (that is, the vertexFormat includes 6641 * <code>TEXTURE_COORDINATE_2</code>, 6642 * <code>TEXTURE_COORDINATE_3</code>, or 6643 * <code>TEXTURE_COORDINATE_4</code>), the entire geometry 6644 * array object is treated as if it were null--any Shape3D or 6645 * Morph node that uses this geometry array will not be drawn. 6646 * 6647 * @param texCoordSet texture coordinate set in this geometry array 6648 * @param texCoords a J3DBuffer object to which a reference will be set. 6649 * The buffer contains an NIO buffer of 2*<i>n</i>, 3*<i>n</i> or 6650 * 4*<i>n</i> float values. 6651 * 6652 * @exception CapabilityNotSetException if the appropriate capability is 6653 * not set and this object is part of a live or compiled scene graph 6654 * 6655 * @exception IllegalStateException if the data mode for this geometry 6656 * array object is not <code>BY_REFERENCE</code>, 6657 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6658 * 6659 * @exception IllegalArgumentException if the java.nio.Buffer 6660 * contained in the specified J3DBuffer is not a 6661 * java.nio.FloatBuffer object. 6662 * 6663 * @exception ArrayIndexOutOfBoundsException if none of the 6664 * <code>TEXTURE_COORDINATE</code> bits are set in the 6665 * <code>vertexFormat</code>, or if texCoordSet is out of range, 6666 * or if 6667 * <code>texCoords.getBuffer().limit() < </code> <i>num_words</i> 6668 * <code> * (initialTexCoordIndex + validVertexCount)</code>, 6669 * where <i>num_words</i> is 2, 3, or 4 depending on the vertex 6670 * texture coordinate format. 6671 * 6672 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 6673 * object is a subclass of IndexedGeometryArray, and any element 6674 * in the range 6675 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 6676 * in the texture coordinate index array is greater than or equal to the 6677 * number of vertices defined by the texCoords object, 6678 * <code>texCoords.getBuffer().limit() / </code> <i>num_words</i>. 6679 * 6680 * @since Java 3D 1.3 6681 */ setTexCoordRefBuffer(int texCoordSet, J3DBuffer texCoords)6682 public void setTexCoordRefBuffer(int texCoordSet, J3DBuffer texCoords) { 6683 if (isLiveOrCompiled()) 6684 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6685 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6686 6687 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6688 6689 if ((format & USE_NIO_BUFFER) == 0) 6690 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 6691 6692 if ((format & INTERLEAVED) != 0) 6693 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6694 6695 ((GeometryArrayRetained)this.retained).setTexCoordRefBuffer( 6696 texCoordSet, texCoords); 6697 6698 } 6699 6700 6701 /** 6702 * Gets the texture coordinate array buffer reference for the specified 6703 * texture coordinate set. 6704 * 6705 * @param texCoordSet texture coordinate set in this geometry array 6706 * 6707 * @return the current texture coordinate array buffer reference 6708 * for the specified texture coordinate set 6709 * 6710 * @exception CapabilityNotSetException if the appropriate capability is 6711 * not set and this object is part of a live or compiled scene graph 6712 * 6713 * @exception IllegalStateException if the data mode for this geometry 6714 * array object is not <code>BY_REFERENCE</code>, 6715 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6716 * 6717 * @exception ArrayIndexOutOfBoundsException if none of the 6718 * <code>TEXTURE_COORDINATE</code> bits are set in the 6719 * <code>vertexFormat</code> or texCoordSet is out of range. 6720 * 6721 * @since Java 3D 1.3 6722 */ getTexCoordRefBuffer(int texCoordSet)6723 public J3DBuffer getTexCoordRefBuffer(int texCoordSet) { 6724 if (isLiveOrCompiled()) 6725 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6726 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6727 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6728 } 6729 6730 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6731 6732 if ((format & USE_NIO_BUFFER) == 0) 6733 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 6734 6735 if ((format & INTERLEAVED) != 0) 6736 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6737 6738 return ((GeometryArrayRetained)this.retained).getTexCoordRefBuffer(texCoordSet); 6739 } 6740 6741 6742 /** 6743 * Sets the float texture coordinate array reference for the specified 6744 * texture coordinate set to the 6745 * specified array. The array contains floating-point <i>s</i>, 6746 * <i>t</i>, and, optionally, <i>r</i> and <i>q</i> values for each 6747 * vertex (for 6748 * a total of 2*<i>n</i> , 3*<i>n</i> or 4*<i>n</i> values, 6749 * where <i>n</i> is 6750 * the number of vertices). Only one of 6751 * <code>texCoordRefFloat</code>, <code>texCoordRef2f</code>, or 6752 * <code>texCoordRef3f</code> may be non-null (or they may all be 6753 * null). An attempt to set more than one of these attributes to 6754 * a non-null reference will result in an exception being thrown. 6755 * If all texCoord array references are null and texture 6756 * coordinates are enabled (that is, the vertexFormat includes 6757 * <code>TEXTURE_COORDINATE_2</code>, 6758 * <code>TEXTURE_COORDINATE_3</code>, or 6759 * <code>TEXTURE_COORDINATE_4</code>), the entire geometry 6760 * array object is treated as if it were null--any Shape3D or 6761 * Morph node that uses this geometry array will not be drawn. 6762 * 6763 * @param texCoordSet texture coordinate set in this geometry array 6764 * @param texCoords an array of 2*<i>n</i>, 3*<i>n</i> or 6765 * 4*<i>n</i> values to 6766 * which a reference will be set. 6767 * 6768 * @exception CapabilityNotSetException if the appropriate capability is 6769 * not set and this object is part of a live or compiled scene graph 6770 * @exception IllegalStateException if the data mode for this geometry 6771 * array object is not <code>BY_REFERENCE</code>, 6772 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6773 * @exception IllegalArgumentException if the specified array is 6774 * non-null and any other texCoord reference is also non-null. 6775 * 6776 * @exception ArrayIndexOutOfBoundsException if none of the 6777 * <code>TEXTURE_COORDINATE</code> bits are set in the 6778 * <code>vertexFormat</code>, or if texCoordSet is out of range, 6779 * or if 6780 * <code>texCoords.length < </code> <i>num_words</i> <code> * 6781 * (initialTexCoordIndex + validVertexCount)</code>, 6782 * where <i>num_words</i> is 2, 3, or 4 depending on the vertex 6783 * texture coordinate format. 6784 * 6785 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 6786 * object is a subclass of IndexedGeometryArray, and any element 6787 * in the range 6788 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 6789 * in the texture coordinate index array is greater than or equal to the 6790 * number of vertices defined by the texCoords array, 6791 * <code>texCoords.length / </code> <i>num_words</i>. 6792 * 6793 * @since Java 3D 1.2 6794 */ setTexCoordRefFloat(int texCoordSet, float[] texCoords)6795 public void setTexCoordRefFloat(int texCoordSet, float[] texCoords) { 6796 6797 if (isLiveOrCompiled()) 6798 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6799 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6800 6801 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6802 if ((format & BY_REFERENCE) == 0) 6803 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6804 6805 if ((format & USE_NIO_BUFFER) != 0) 6806 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6807 6808 if ((format & INTERLEAVED) != 0) 6809 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6810 6811 ((GeometryArrayRetained)this.retained).setTexCoordRefFloat( 6812 texCoordSet, texCoords); 6813 6814 // NOTE: the checks for multiple non-null references, and the 6815 // array length check need to be done in the retained method 6816 } 6817 6818 6819 /** 6820 * Gets the float texture coordinate array reference for the specified 6821 * texture coordinate set. 6822 * 6823 * @param texCoordSet texture coordinate set in this geometry array 6824 * 6825 * @return the current float texture coordinate array reference 6826 * for the specified texture coordinate set 6827 * 6828 * @exception CapabilityNotSetException if the appropriate capability is 6829 * not set and this object is part of a live or compiled scene graph 6830 * 6831 * @exception IllegalStateException if the data mode for this geometry 6832 * array object is not <code>BY_REFERENCE</code>, 6833 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 6834 * 6835 * @exception ArrayIndexOutOfBoundsException if none of the 6836 * <code>TEXTURE_COORDINATE</code> bits are set in the 6837 * <code>vertexFormat</code> or texCoordSet is out of range. 6838 * 6839 * @since Java 3D 1.2 6840 */ getTexCoordRefFloat(int texCoordSet)6841 public float[] getTexCoordRefFloat(int texCoordSet) { 6842 6843 if (isLiveOrCompiled()) 6844 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6845 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6846 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6847 } 6848 6849 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6850 if ((format & BY_REFERENCE) == 0) 6851 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6852 6853 if ((format & USE_NIO_BUFFER) != 0) 6854 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6855 6856 if ((format & INTERLEAVED) != 0) 6857 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6858 6859 return ((GeometryArrayRetained)this.retained).getTexCoordRefFloat( 6860 texCoordSet); 6861 } 6862 6863 6864 /** 6865 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6866 * for TexCoord2f arrays 6867 * 6868 * @since Java 3D 1.2 6869 */ setTexCoordRef2f(int texCoordSet, TexCoord2f[] texCoords)6870 public void setTexCoordRef2f(int texCoordSet, TexCoord2f[] texCoords) { 6871 6872 if (isLiveOrCompiled()) 6873 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6874 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6875 6876 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6877 if ((format & BY_REFERENCE) == 0) 6878 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6879 6880 if ((format & USE_NIO_BUFFER) != 0) 6881 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6882 6883 if ((format & INTERLEAVED) != 0) 6884 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6885 6886 if ((format & (TEXTURE_COORDINATE_3 | TEXTURE_COORDINATE_4)) != 0) 6887 throw new IllegalStateException(J3dI18N.getString("GeometryArray94")); 6888 6889 ((GeometryArrayRetained)this.retained).setTexCoordRef2f( 6890 texCoordSet, texCoords); 6891 6892 // NOTE: the checks for multiple non-null references, and the 6893 // array length check need to be done in the retained method 6894 } 6895 6896 6897 /** 6898 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6899 * for TexCoord2f arrays 6900 * 6901 * @since Java 3D 1.2 6902 */ getTexCoordRef2f(int texCoordSet)6903 public TexCoord2f[] getTexCoordRef2f(int texCoordSet) { 6904 6905 if (isLiveOrCompiled()) 6906 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6907 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6908 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6909 } 6910 6911 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6912 if ((format & BY_REFERENCE) == 0) 6913 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6914 6915 if ((format & USE_NIO_BUFFER) != 0) 6916 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6917 6918 if ((format & INTERLEAVED) != 0) 6919 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6920 6921 return ((GeometryArrayRetained)this.retained).getTexCoordRef2f( 6922 texCoordSet); 6923 } 6924 6925 6926 /** 6927 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6928 * for TexCoord3f arrays 6929 * 6930 * @since Java 3D 1.2 6931 */ setTexCoordRef3f(int texCoordSet, TexCoord3f[] texCoords)6932 public void setTexCoordRef3f(int texCoordSet, TexCoord3f[] texCoords) { 6933 6934 if (isLiveOrCompiled()) 6935 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 6936 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 6937 6938 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6939 if ((format & BY_REFERENCE) == 0) 6940 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6941 6942 if ((format & USE_NIO_BUFFER) != 0) 6943 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6944 6945 if ((format & INTERLEAVED) != 0) 6946 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6947 6948 if ((format & (TEXTURE_COORDINATE_2 | TEXTURE_COORDINATE_4)) != 0) 6949 throw new IllegalStateException(J3dI18N.getString("GeometryArray95")); 6950 6951 ((GeometryArrayRetained)this.retained).setTexCoordRef3f( 6952 texCoordSet, texCoords); 6953 6954 // NOTE: the checks for multiple non-null references, and the 6955 // array length check need to be done in the retained method 6956 } 6957 6958 6959 /** 6960 * @deprecated As of Java 3D version 1.3, use geometry by-copy 6961 * for TexCoord3f arrays 6962 * 6963 * @since Java 3D 1.2 6964 */ getTexCoordRef3f(int texCoordSet)6965 public TexCoord3f[] getTexCoordRef3f(int texCoordSet) { 6966 6967 if (isLiveOrCompiled()) 6968 if (!this.getCapability(ALLOW_REF_DATA_READ) && 6969 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 6970 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 6971 } 6972 6973 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 6974 if ((format & BY_REFERENCE) == 0) 6975 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 6976 6977 if ((format & USE_NIO_BUFFER) != 0) 6978 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 6979 6980 if ((format & INTERLEAVED) != 0) 6981 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 6982 6983 return ((GeometryArrayRetained)this.retained).getTexCoordRef3f( 6984 texCoordSet); 6985 } 6986 6987 6988 /** 6989 * Sets the vertex attribute buffer reference for the specified 6990 * vertex attribute number to the specified buffer object. The 6991 * buffer contains a java.nio.FloatBuffer object containing 1, 2, 6992 * 3, or 4 values for each vertex (for a total of 1*<i>n</i>, 6993 * 2*<i>n</i>, 3*<i>n</i>, or 4*<i>n</i> values, where <i>n</i> is 6994 * the number of vertices). 6995 * If the vertexAttr buffer reference is null and vertex 6996 * attributes are enabled (that is, the vertexFormat includes 6997 * <code>VERTEX_ATTRIBUTES</code>), the entire geometry array 6998 * object is treated as if it were null--any Shape3D node that 6999 * uses this geometry array will not be drawn. 7000 * 7001 * @param vertexAttrNum vertex attribute number in this geometry array 7002 * 7003 * @param vertexAttrs a J3DBuffer object to which a reference will 7004 * be set. The buffer contains an NIO buffer of 1*<i>n</i>, 7005 * 2*<i>n</i>, 3*<i>n</i>, or 4*<i>n</i> float values. 7006 * 7007 * @exception CapabilityNotSetException if the appropriate capability is 7008 * not set and this object is part of a live or compiled scene graph 7009 * 7010 * @exception IllegalStateException if the data mode for this geometry 7011 * array object is not <code>BY_REFERENCE</code>, 7012 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 7013 * 7014 * @exception IllegalArgumentException if the java.nio.Buffer 7015 * contained in the specified J3DBuffer is not a 7016 * java.nio.FloatBuffer object. 7017 * 7018 * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is out of 7019 * range, or if 7020 * <code>vertexAttrs.getBuffer().limit() < </code> <i>num_words</i> 7021 * <code> * (initialVertexAttrIndex + validVertexCount)</code>, 7022 * where <i>num_words</i> is the size of the specified 7023 * vertexAttrNum (1, 2, 3, or 4). 7024 * 7025 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 7026 * object is a subclass of IndexedGeometryArray, and any element 7027 * in the range 7028 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 7029 * in the vertex attribute index array is greater than or equal to the 7030 * number of vertices defined by the vertexAttrs object, 7031 * <code>vertexAttrs.getBuffer().limit() / </code> <i>num_words</i>. 7032 * 7033 * @since Java 3D 1.4 7034 */ setVertexAttrRefBuffer(int vertexAttrNum, J3DBuffer vertexAttrs)7035 public void setVertexAttrRefBuffer(int vertexAttrNum, J3DBuffer vertexAttrs) { 7036 if (isLiveOrCompiled()) { 7037 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) { 7038 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 7039 } 7040 } 7041 7042 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7043 7044 if ((format & USE_NIO_BUFFER) == 0) { 7045 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 7046 } 7047 7048 if ((format & INTERLEAVED) != 0) { 7049 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 7050 } 7051 7052 ((GeometryArrayRetained)this.retained).setVertexAttrRefBuffer( 7053 vertexAttrNum, vertexAttrs); 7054 } 7055 7056 7057 /** 7058 * Gets the vertex attribute array buffer reference for the specified 7059 * vertex attribute number. 7060 * 7061 * @param vertexAttrNum vertex attribute number in this geometry array 7062 * 7063 * @return the current vertex attribute array buffer reference 7064 * for the specified vertex attribute number 7065 * 7066 * @exception CapabilityNotSetException if the appropriate capability is 7067 * not set and this object is part of a live or compiled scene graph 7068 * 7069 * @exception IllegalStateException if the data mode for this geometry 7070 * array object is not <code>BY_REFERENCE</code>, 7071 * is not <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 7072 * 7073 * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is out 7074 * of range. 7075 * 7076 * @since Java 3D 1.4 7077 */ getVertexAttrRefBuffer(int vertexAttrNum)7078 public J3DBuffer getVertexAttrRefBuffer(int vertexAttrNum) { 7079 if (isLiveOrCompiled()) { 7080 if (!this.getCapability(ALLOW_REF_DATA_READ) && 7081 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 7082 7083 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 7084 } 7085 } 7086 7087 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7088 7089 if ((format & USE_NIO_BUFFER) == 0) { 7090 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 7091 } 7092 7093 if ((format & INTERLEAVED) != 0) { 7094 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 7095 } 7096 7097 return ((GeometryArrayRetained)this.retained).getVertexAttrRefBuffer(vertexAttrNum); 7098 } 7099 7100 7101 /* 7102 * XXXX: add the following to the javadoc if we ever add double-precision 7103 * methods for vertex attribtues. 7104 * 7105 *----------------------------------------------------------------- 7106 * Only one of <code>vertexAttrRefFloat</code>, or 7107 * <code>vertexAttrRefDouble</code> may be non-null (or they may 7108 * all be null). An attempt to set more than one of these 7109 * attributes to a non-null reference will result in an exception 7110 * being thrown. 7111 * 7112 * If all vertexAttr array references are null and vertex 7113 * ... 7114 * @exception IllegalArgumentException if the specified array is 7115 * non-null and any other vertexAttr reference is also non-null. 7116 * ... 7117 *----------------------------------------------------------------- 7118 */ 7119 7120 /** 7121 * Sets the float vertex attribute array reference for the 7122 * specified vertex attribute number to the specified array. The 7123 * array contains 1, 2, 3, or 4 floating-point values for each 7124 * vertex (for a total of 1*<i>n</i>, 2*<i>n</i>, 3*<i>n</i>, or 7125 * 4*<i>n</i> values, where <i>n</i> is the number of vertices). 7126 * 7127 * If the vertexAttr array reference is null and vertex 7128 * attributes are enabled (that is, the vertexFormat includes 7129 * <code>VERTEX_ATTRIBUTES</code>), the entire geometry array 7130 * object is treated as if it were null--any Shape3D node that 7131 * uses this geometry array will not be drawn. 7132 * 7133 * @param vertexAttrNum vertex attribute number in this geometry array 7134 * 7135 * @param vertexAttrs an array of 1*<i>n</i>, 2*<i>n</i>, 7136 * 3*<i>n</i>, or 4*<i>n</i> values to which a reference will be 7137 * set. 7138 * 7139 * @exception CapabilityNotSetException if the appropriate capability is 7140 * not set and this object is part of a live or compiled scene graph 7141 * @exception IllegalStateException if the data mode for this geometry 7142 * array object is not <code>BY_REFERENCE</code>, 7143 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 7144 * 7145 * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is 7146 * out of range, or if 7147 * <code>vertexAttrs.length < </code> <i>num_words</i> <code> * 7148 * (initialVertexAttrIndex + validVertexCount)</code>, 7149 * where <i>num_words</i> is the size of the specified 7150 * vertexAttrNum (1, 2, 3, or 4). 7151 * 7152 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 7153 * object is a subclass of IndexedGeometryArray, and any element 7154 * in the range 7155 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 7156 * in the vertex attribute index array is greater than or equal to the 7157 * number of vertices defined by the vertexAttrs array, 7158 * <code>vertexAttrs.length / </code> <i>num_words</i>. 7159 * 7160 * @since Java 3D 1.4 7161 */ setVertexAttrRefFloat(int vertexAttrNum, float[] vertexAttrs)7162 public void setVertexAttrRefFloat(int vertexAttrNum, float[] vertexAttrs) { 7163 7164 if (isLiveOrCompiled()) { 7165 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) { 7166 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 7167 } 7168 } 7169 7170 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7171 if ((format & BY_REFERENCE) == 0) { 7172 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 7173 } 7174 7175 if ((format & USE_NIO_BUFFER) != 0) { 7176 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 7177 } 7178 7179 if ((format & INTERLEAVED) != 0) { 7180 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 7181 } 7182 7183 ((GeometryArrayRetained)this.retained).setVertexAttrRefFloat( 7184 vertexAttrNum, vertexAttrs); 7185 7186 // NOTE: the checks for multiple non-null references, and the 7187 // array length check need to be done in the retained method 7188 } 7189 7190 7191 /** 7192 * Gets the float vertex attribute array reference for the specified 7193 * vertex attribute number. 7194 * 7195 * @param vertexAttrNum vertex attribute number in this geometry array 7196 * 7197 * @return the current float vertex attribute array reference 7198 * for the specified vertex attribute number 7199 * 7200 * @exception CapabilityNotSetException if the appropriate capability is 7201 * not set and this object is part of a live or compiled scene graph 7202 * 7203 * @exception IllegalStateException if the data mode for this geometry 7204 * array object is not <code>BY_REFERENCE</code>, 7205 * is <code>USE_NIO_BUFFER</code>, or is <code>INTERLEAVED</code>. 7206 * 7207 * @exception ArrayIndexOutOfBoundsException if vertexAttrNum is 7208 * out of range. 7209 * 7210 * @since Java 3D 1.4 7211 */ getVertexAttrRefFloat(int vertexAttrNum)7212 public float[] getVertexAttrRefFloat(int vertexAttrNum) { 7213 7214 if (isLiveOrCompiled()) { 7215 if (!this.getCapability(ALLOW_REF_DATA_READ) && 7216 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 7217 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 7218 } 7219 } 7220 7221 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7222 if ((format & BY_REFERENCE) == 0) { 7223 throw new IllegalStateException(J3dI18N.getString("GeometryArray83")); 7224 } 7225 7226 if ((format & USE_NIO_BUFFER) != 0) { 7227 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 7228 } 7229 7230 if ((format & INTERLEAVED) != 0) { 7231 throw new IllegalStateException(J3dI18N.getString("GeometryArray84")); 7232 } 7233 7234 return ((GeometryArrayRetained)this.retained).getVertexAttrRefFloat( 7235 vertexAttrNum); 7236 } 7237 7238 7239 /** 7240 * Sets the interleaved vertex array reference to the specified 7241 * array. The vertex components must be stored in a predetermined 7242 * order in the array. The order is: texture coordinates, colors, 7243 * normals, and positional coordinates. 7244 * Vertex attributes are not supported in interleaved mode. 7245 * In the case of texture 7246 * coordinates, the values for each texture coordinate set 7247 * are stored in order from 0 through texCoordSetCount-1. Only those 7248 * components that are enabled appear in the vertex. The number 7249 * of words per vertex depends on which vertex components are 7250 * enabled. Texture coordinates, if enabled, use 2 words per 7251 * texture coordinate set per vertex for 7252 * <code>TEXTURE_COORDINATE_2</code>, 3 words per texture 7253 * coordinate set per vertex for 7254 * <code>TEXTURE_COORDINATE_3</code> or 4 words per texture 7255 * coordinate set per vertex for 7256 * <code>TEXTURE_COORDINATE_4</code>. Colors, if enabled, use 3 7257 * words per vertex for <code>COLOR_3</code> or 4 words per vertex 7258 * for <code>COLOR_4</code>. Normals, if enabled, use 3 words per 7259 * vertex. Positional coordinates, which are always enabled, use 7260 * 3 words per vertex. For example, the format of interleaved 7261 * data for a GeometryArray object whose vertexFormat includes 7262 * <code>COORDINATES</code>, <code>COLOR_3</code>, and 7263 * <code>NORMALS</code> would be: <i>red</i>, <i>green</i>, 7264 * <i>blue</i>, <i>Nx</i>, <i>Ny</i>, <i>Nz</i>, <i>x</i>, 7265 * <i>y</i>, <i>z</i>. All components of a vertex are stored in 7266 * adjacent memory locations. The first component of vertex 0 is 7267 * stored beginning at index 0 in the array. The first component 7268 * of vertex 1 is stored beginning at index 7269 * <i>words_per_vertex</i> in the array. The total number of 7270 * words needed to store <i>n</i> vertices is 7271 * <i>words_per_vertex</i>*<i>n</i>. 7272 * 7273 * @param vertexData an array of vertex values to which a 7274 * reference will be set. 7275 * @exception CapabilityNotSetException if the appropriate capability is 7276 * not set and this object is part of a live or compiled scene graph 7277 * @exception IllegalStateException if the data mode for this geometry 7278 * array object is not <code>INTERLEAVED</code> 7279 * or is <code>USE_NIO_BUFFER</code>. 7280 * 7281 * @exception ArrayIndexOutOfBoundsException if 7282 * <code>vertexData.length</code> < <i>words_per_vertex</i> * 7283 * (<code>initialVertexIndex + validVertexCount</code>), 7284 * where <i>words_per_vertex</i> depends on which formats are enabled. 7285 * 7286 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 7287 * object is a subclass of IndexedGeometryArray, and any element 7288 * in the range 7289 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 7290 * in the index array associated with any of the enabled vertex 7291 * components (coord, color, normal, texcoord) is greater than or 7292 * equal to the number of vertices defined by the vertexData 7293 * array, 7294 * <code>vertexData.length / </code> <i>words_per_vertex</i>. 7295 * 7296 * @since Java 3D 1.2 7297 */ setInterleavedVertices(float[] vertexData)7298 public void setInterleavedVertices(float[] vertexData) { 7299 if (isLiveOrCompiled()) 7300 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 7301 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 7302 7303 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7304 if ((format & INTERLEAVED) == 0) 7305 throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); 7306 7307 if ((format & USE_NIO_BUFFER) != 0) 7308 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 7309 7310 ((GeometryArrayRetained)this.retained).setInterleavedVertices(vertexData); 7311 7312 // NOTE: the array length check needs to be done in the retained method 7313 } 7314 7315 7316 /** 7317 * Gets the interleaved vertices array reference. 7318 * @return the current interleaved vertices array reference. 7319 * @exception CapabilityNotSetException if the appropriate capability is 7320 * not set and this object is part of a live or compiled scene graph 7321 * @exception IllegalStateException if the data mode for this geometry 7322 * array object is not <code>INTERLEAVED</code> 7323 * or is <code>USE_NIO_BUFFER</code>. 7324 * 7325 * @since Java 3D 1.2 7326 */ getInterleavedVertices()7327 public float[] getInterleavedVertices() { 7328 if (isLiveOrCompiled()) 7329 if (!this.getCapability(ALLOW_REF_DATA_READ) && 7330 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 7331 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 7332 } 7333 7334 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7335 if ((format & INTERLEAVED) == 0) 7336 throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); 7337 7338 7339 if ((format & USE_NIO_BUFFER) != 0) 7340 throw new IllegalStateException(J3dI18N.getString("GeometryArray119")); 7341 7342 return ((GeometryArrayRetained)this.retained).getInterleavedVertices(); 7343 } 7344 7345 /** 7346 * Sets the interleaved vertex buffer reference to the specified 7347 * buffer object. The buffer must contain a java.nio.FloatBuffer object. 7348 * The vertex components must be stored in a predetermined 7349 * order in the buffer. The order is: texture coordinates, colors, 7350 * normals, and positional coordinates. 7351 * Vertex attributes are not supported in interleaved mode. 7352 * In the case of texture 7353 * coordinates, the values for each texture coordinate set 7354 * are stored in order from 0 through texCoordSetCount-1. Only those 7355 * components that are enabled appear in the vertex. The number 7356 * of words per vertex depends on which vertex components are 7357 * enabled. Texture coordinates, if enabled, use 2 words per 7358 * texture coordinate set per vertex for 7359 * <code>TEXTURE_COORDINATE_2</code>, 3 words per texture 7360 * coordinate set per vertex for 7361 * <code>TEXTURE_COORDINATE_3</code> or 4 words per texture 7362 * coordinate set per vertex for 7363 * <code>TEXTURE_COORDINATE_4</code>. Colors, if enabled, use 3 7364 * words per vertex for <code>COLOR_3</code> or 4 words per vertex 7365 * for <code>COLOR_4</code>. Normals, if enabled, use 3 words per 7366 * vertex. Positional coordinates, which are always enabled, use 7367 * 3 words per vertex. For example, the format of interleaved 7368 * data for a GeometryArray object whose vertexFormat includes 7369 * <code>COORDINATES</code>, <code>COLOR_3</code>, and 7370 * <code>NORMALS</code> would be: <i>red</i>, <i>green</i>, 7371 * <i>blue</i>, <i>Nx</i>, <i>Ny</i>, <i>Nz</i>, <i>x</i>, 7372 * <i>y</i>, <i>z</i>. All components of a vertex are stored in 7373 * adjacent memory locations. The first component of vertex 0 is 7374 * stored beginning at index 0 in the buffer. The first component 7375 * of vertex 1 is stored beginning at index 7376 * <i>words_per_vertex</i> in the buffer. The total number of 7377 * words needed to store <i>n</i> vertices is 7378 * <i>words_per_vertex</i>*<i>n</i>. 7379 * 7380 * @param vertexData a J3DBuffer object to which a reference will be set. 7381 * The buffer contains an NIO float buffer of 7382 * <i>words_per_vertex</i>*<i>n</i> values. 7383 * 7384 * @exception CapabilityNotSetException if the appropriate capability is 7385 * not set and this object is part of a live or compiled scene graph 7386 * 7387 * @exception IllegalStateException if the data mode for this geometry 7388 * array object is not <code>INTERLEAVED</code> 7389 * or is not <code>USE_NIO_BUFFER</code>. 7390 * 7391 * @exception IllegalArgumentException if the java.nio.Buffer 7392 * contained in the specified J3DBuffer is not a 7393 * java.nio.FloatBuffer object. 7394 * 7395 * @exception ArrayIndexOutOfBoundsException if 7396 * <code>vertexData.getBuffer().limit()</code> < <i>words_per_vertex</i> * 7397 * (<code>initialVertexIndex + validVertexCount</code>), 7398 * where <i>words_per_vertex</i> depends on which formats are enabled. 7399 * 7400 * @exception ArrayIndexOutOfBoundsException if this GeometryArray 7401 * object is a subclass of IndexedGeometryArray, and any element 7402 * in the range 7403 * <code>[initialIndexIndex, initialIndexIndex+validIndexCount-1]</code> 7404 * in the index array associated with any of the enabled vertex 7405 * components (coord, color, normal, texcoord) is greater than or 7406 * equal to the number of vertices defined by the vertexData 7407 * object, 7408 * <code>vertexData.getBuffer().limit() / </code> <i>words_per_vertex</i>. 7409 * 7410 * @since Java 3D 1.3 7411 */ setInterleavedVertexBuffer(J3DBuffer vertexData)7412 public void setInterleavedVertexBuffer(J3DBuffer vertexData) { 7413 if (isLiveOrCompiled()) 7414 if (!this.getCapability(ALLOW_REF_DATA_WRITE)) 7415 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray86")); 7416 7417 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7418 if ((format & INTERLEAVED) == 0) 7419 throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); 7420 7421 7422 if ((format & USE_NIO_BUFFER) == 0) 7423 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 7424 7425 ((GeometryArrayRetained)this.retained).setInterleavedVertexBuffer(vertexData); 7426 7427 } 7428 7429 7430 /** 7431 * Gets the interleaved vertex array buffer reference. 7432 * @return the current interleaved vertex array buffer reference. 7433 * 7434 * @exception CapabilityNotSetException if the appropriate capability is 7435 * not set and this object is part of a live or compiled scene graph 7436 * 7437 * @exception IllegalStateException if the data mode for this geometry 7438 * array object is not <code>INTERLEAVED</code> 7439 * or is not <code>USE_NIO_BUFFER</code>. 7440 * 7441 * @since Java 3D 1.3 7442 */ getInterleavedVertexBuffer()7443 public J3DBuffer getInterleavedVertexBuffer() { 7444 if (isLiveOrCompiled()) 7445 if (!this.getCapability(ALLOW_REF_DATA_READ) && 7446 !this.getCapability(J3D_1_2_ALLOW_REF_DATA_READ)) { 7447 throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray87")); 7448 } 7449 7450 int format = ((GeometryArrayRetained)this.retained).vertexFormat; 7451 if ((format & INTERLEAVED) == 0) 7452 throw new IllegalStateException(J3dI18N.getString("GeometryArray85")); 7453 7454 if ((format & USE_NIO_BUFFER) == 0) 7455 throw new IllegalStateException(J3dI18N.getString("GeometryArray118")); 7456 7457 return ((GeometryArrayRetained)this.retained).getInterleavedVertexBuffer(); 7458 7459 } 7460 } 7461