📄 geometryarray.java
字号:
* (subclasses of IndexedGeometryArray). * * @since Java 3D 1.3 */ public static final int USE_COORD_INDEX_ONLY = 0x200; /** * Specifies that this GeometryArray contains one or more arrays of * vertex attributes. These attributes are used in programmable * shading. * * @since Java 3D 1.4 */ public static final int VERTEX_ATTRIBUTES = 0x1000; //NVaidya /** * Specifies that the indices in this GeometryArray * are accessed by reference. This flag is only valid for * indexed geometry arrays (subclasses of IndexedGeometryArray) and only * when used in conjunction with the <code>BY_REFERENCE</code> and * <code>USE_COORD_INDEX_ONLY</code> flags. * * @since Java 3D 1.5 */ public static final int BY_REFERENCE_INDICES = 0x2000; // Used to keep track of the last bit (for adding new bits only) private static final int LAST_FORMAT_BIT = 0x2000; // Scratch arrays for converting Point[234]f to TexCoord[234]f private TexCoord2f [] texCoord2fArray = null; private TexCoord3f [] texCoord3fArray = null; private TexCoord4f [] texCoord4fArray = null; private TexCoord2f texCoord2fScratch = null; private TexCoord3f texCoord3fScratch = null; private static final int[] defTexCoordMap = { 0 }; // Array for setting default read capabilities private static final int[] readCapabilities = { ALLOW_COLOR_READ, ALLOW_COORDINATE_READ, ALLOW_COUNT_READ, ALLOW_FORMAT_READ, ALLOW_NORMAL_READ, ALLOW_REF_DATA_READ, ALLOW_TEXCOORD_READ, ALLOW_VERTEX_ATTR_READ }; // non-public, no parameter constructor GeometryArray() { // set default read capabilities setDefaultReadCapabilities(readCapabilities); } //NVaidya /** * Constructs an empty GeometryArray object with the specified * number of vertices and vertex format. Defaults are used * for all other parameters. The default values are as follows: * <ul> * texCoordSetCount : 1<br> * texCoordSetMap : { 0 }<br> * vertexAttrCount : 0<br> * vertexAttrSizes : null<br> * validVertexCount : vertexCount<br> * initialVertexIndex : 0<br> * initialCoordIndex : 0<br> * initialColorIndex : 0<br> * initialNormalIndex : 0<br> * initialTexCoordIndex : 0<br> * initialVertexAttrIndex : 0<br> * all data array values : 0.0<br> * all data array references : null<br> * </ul> * * @param vertexCount the number of vertex elements in this GeometryArray * @param vertexFormat a mask indicating which components are * present in each vertex. This is specified as one or more * individual flags that are bitwise "OR"ed together to describe * the per-vertex data. * The flags include: <code>COORDINATES</code>, to signal the inclusion of * vertex positions--always present; <code>NORMALS</code>, to signal * the inclusion of per vertex normals; one of <code>COLOR_3</code> or * <code>COLOR_4</code>, to signal the inclusion of per vertex * colors (without or with alpha information); one of * <code>TEXTURE_COORDINATE_2</code>, <code>TEXTURE_COORDINATE_3</code> * or <code>TEXTURE_COORDINATE_4</code>, * to signal the * inclusion of per-vertex texture coordinates (2D, 3D or 4D); * <code>BY_REFERENCE</code>, to indicate that the data is passed * by reference * rather than by copying; <code>INTERLEAVED</code>, to indicate * that the referenced * data is interleaved in a single array; * <code>USE_NIO_BUFFER</code>, to indicate that the referenced data * is accessed via a J3DBuffer object that wraps an NIO buffer; * <code>USE_COORD_INDEX_ONLY</code>, * to indicate that only the coordinate indices are used for indexed * geometry arrays; * <code>BY_REFERENCE_INDICES</code>, to indicate * that the indices are accessed by reference in indexed * geometry arrays.<p> * * @exception IllegalArgumentException if vertexCount < 0 * * @exception IllegalArgumentException if vertexFormat does <b>not</b> * include <code>COORDINATES</code> * * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for * non-indexed geometry arrays (that is, GeometryArray objects * that are not a subclass of IndexedGeometryArray) * * @exception IllegalArgumentException if the <code>INTERLEAVED</code> * bit is set without the <code>BY_REFERENCE</code> bit being set * * @exception IllegalArgumentException if the <code>USE_NIO_BUFFER</code> * bit is set without the <code>BY_REFERENCE</code> bit being set * * @exception IllegalArgumentException if the <code>INTERLEAVED</code> * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set * * @exception IllegalArgumentException if the * <code>BY_REFERENCE_INDICES</code> * bit is set without the <code>BY_REFERENCE</code> and * <code>USE_COORD_INDEX_ONLY</code> bits being set */ public GeometryArray(int vertexCount, int vertexFormat) { this(vertexCount, vertexFormat, ((vertexFormat & TEXTURE_COORDINATE) != 0 ? 1 : 0), ((vertexFormat & TEXTURE_COORDINATE) != 0 ? defTexCoordMap : null)); } //NVaidya /** * Constructs an empty GeometryArray object with the specified * number of vertices, vertex format, number of texture coordinate * sets, and texture coordinate mapping array. Defaults are used * for all other parameters. * * @param vertexCount the number of vertex elements in this * GeometryArray<p> * * @param vertexFormat a mask indicating which components are * present in each vertex. This is specified as one or more * individual flags that are bitwise "OR"ed together to describe * the per-vertex data. * The flags include: <code>COORDINATES</code>, to signal the inclusion of * vertex positions--always present; <code>NORMALS</code>, to signal * the inclusion of per vertex normals; one of <code>COLOR_3</code> or * <code>COLOR_4</code>, to signal the inclusion of per vertex * colors (without or with alpha information); one of * <code>TEXTURE_COORDINATE_2</code> or <code>TEXTURE_COORDINATE_3</code> * or <code>TEXTURE_COORDINATE_4</code>, * to signal the * inclusion of per-vertex texture coordinates (2D , 3D or 4D); * <code>BY_REFERENCE</code>, to indicate that the data is passed * by reference * rather than by copying; <code>INTERLEAVED</code>, to indicate * that the referenced * data is interleaved in a single array; * <code>USE_NIO_BUFFER</code>, to indicate that the referenced data * is accessed via a J3DBuffer object that wraps an NIO buffer; * <code>USE_COORD_INDEX_ONLY</code>, * to indicate that only the coordinate indices are used for indexed * geometry arrays; * <code>BY_REFERENCE_INDICES</code>, to indicate * that the indices are accessed by reference in indexed * geometry arrays.<p> * * @param texCoordSetCount the number of texture coordinate sets * in this GeometryArray object. If <code>vertexFormat</code> * does not include one of <code>TEXTURE_COORDINATE_2</code> or * <code>TEXTURE_COORDINATE_3</code>, the * <code>texCoordSetCount</code> parameter is not used.<p> * * <a name="texCoordSetMap"> * @param texCoordSetMap an array that maps texture coordinate * sets to texture units. The array is indexed by texture unit * number for each texture unit in the associated Appearance * object. The values in the array specify the texture coordinate * set within this GeometryArray object that maps to the * corresponding texture * unit. All elements within the array must be less than * <code>texCoordSetCount</code>. A negative value specifies that * no texture coordinate set maps to the texture unit * corresponding to the index. If there are more texture units in * any associated Appearance object than elements in the mapping * array, the extra elements are assumed to be -1. The same * texture coordinate set may be used for more than one texture * unit. Each texture unit in every associated Appearance must * have a valid source of texture coordinates: either a * non-negative texture coordinate set must be specified in the * mapping array or texture coordinate generation must be enabled. * Texture coordinate generation will take precedence for those * texture units for which a texture coordinate set is specified * and texture coordinate generation is enabled. If * <code>vertexFormat</code> does not include one of * <code>TEXTURE_COORDINATE_2</code> or * <code>TEXTURE_COORDINATE_3</code> or * <code>TEXTURE_COORDINATE_4</code>, the * <code>texCoordSetMap</code> array is not used. The following example * illustrates the use of the <code>texCoordSetMap</code> array. * * <p> * <ul> * <table BORDER=1 CELLSPACING=2 CELLPADDING=2> * <tr> * <td><center><b>Index</b></center></td> * <td><center><b>Element</b></center></td> * <td><b>Description</b></td> * </tr> * <tr> * <td><center>0</center></td> * <td><center>1</center></td> * <td>Use tex coord set 1 for tex unit 0</td> * </tr> * <tr> * <td><center>1</center></td> * <td><center>-1</center></td> * <td>Use no tex coord set for tex unit 1</td> * </tr> * <tr> * <td><center>2</center></td> * <td><center>0</center></td> * <td>Use tex coord set 0 for tex unit 2</td> * </tr> * <tr> * <td><center>3</center></td> * <td><center>1</center></td> * <td>Reuse tex coord set 1 for tex unit 3</td> * </tr> * </table> * </ul> * <p> * * @exception IllegalArgumentException if vertexCount < 0 * * @exception IllegalArgumentException if vertexFormat does <b>not</b> * include <code>COORDINATES</code> * * @exception IllegalArgumentException if the <code>USE_COORD_INDEX_ONLY</code> * bit or the <code>BY_REFERENCE_INDICES</code> bit is set for * non-indexed geometry arrays (that is, GeometryArray objects * that are not a subclass of IndexedGeometryArray) * * @exception IllegalArgumentException if the <code>INTERLEAVED</code> * bit is set without the <code>BY_REFERENCE</code> bit being set * * @exception IllegalArgumentException if the <code>USE_NIO_BUFFER</code> * bit is set without the <code>BY_REFERENCE</code> bit being set * * @exception IllegalArgumentException if the <code>INTERLEAVED</code> * bit and the <code>VERTEX_ATTRIBUTES</code> bit are both set * * @exception IllegalArgumentException if the * <code>BY_REFERENCE_INDICES</code> * bit is set without the <code>BY_REFERENCE</code> and * <code>USE_COORD_INDEX_ONLY</code> bits being set * * @exception IllegalArgumentException if * <code>texCoordSetCount < 0</code> * * @exception IllegalArgumentException if any element in * <code>texCoordSetMap[] >= texCoordSetCount</code>. * * @since Java 3D 1.2 */ public GeometryArray(int vertexCount, int vertexFormat, int texCoordSetCount, int[] texCoordSetMap) { this(vertexCount, vertexFormat, texCoordSetCount, texCoordSetMap, 0, null); } //NVaidya /** * Constructs an empty GeometryArray object with the specified * number of vertices, vertex format, number of texture coordinate * sets, texture coordinate mapping array, vertex attribute count, * and vertex attribute sizes array. * * @param vertexCount the number of vertex elements in this * GeometryArray<p> * * @param vertexFormat a mask indicating which components are * present in each vertex. This is specified as one or more * individual flags that are bitwise "OR"ed together to describe * the per-vertex data. * The flags include: <code>COORDINATES</code>, to signal the inclusion of * vertex positions--always present; <code>NORMALS</code>, to signal * the inclusion of per vertex normals; one of <code>COLOR_3</code> or * <code>COLOR_4</code>, to signal the inclusion of per vertex * colors (without or with alpha information); one of * <code>TEXTURE_COORDINATE_2</code> or <code>TEXTURE_COORDINATE_3</code> * or <code>TEXTURE_COORDINATE_4</code>, * to signal the * inclusion of per-vertex texture coordinates (2D , 3D or 4D); * <code>VERTEX_ATTRIBUTES</code>, to signal * the inclusion of one or more arrays of vertex attributes; * <code>BY_REFERENCE</code>, to indicate that the data is passed * by reference * rather than by copying; <code>INTERLEAVED</code>, to indicate * that the referenced * data is interleaved in a single array; * <code>USE_NIO_BUFFER</code>, to indicate that the referenced data * is accessed via a J3DBuffer object that wraps an NIO buffer; * <code>USE_COORD_INDEX_ONLY</code>,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -