⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geometryarray.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * 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>     *     * @param vertexAttrCount the number of vertex attributes     * in this GeometryArray object. If <code>vertexFormat</code>     * does not include <code>VERTEX_ATTRIBUTES</code>, the     * <code>vertexAttrCount</code> parameter must be 0.<p>     *     * @param vertexAttrSizes is an array that specifes the size of     * each vertex attribute. Each element in the array specifies the     * number of components in the attribute, from 1 to 4. The length     * of the array must be equal to <code>vertexAttrCount</code>.<p>     *     * @exception IllegalArgumentException if vertexCount &lt; 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&nbsp;&lt;&nbsp;0</code>     *     * @exception IllegalArgumentException if any element in     * <code>texCoordSetMap[]&nbsp;&gt;=&nbsp;texCoordSetCount</code>.     *     * @exception IllegalArgumentException if     * <code>vertexAttrCount&nbsp;&gt;&nbsp;0</code> and the     * <code>VERTEX_ATTRIBUTES</code> bit is not set     *     * @exception IllegalArgumentException if     * <code>vertexAttrCount&nbsp;&lt;&nbsp;0</code>     *     * @exception IllegalArgumentException if     * <code>vertexAttrSizes.length&nbsp;!=&nbsp;vertexAttrCount</code>     *     * @exception IllegalArgumentException if any element in     * <code>vertexAttrSizes[]</code> is <code>&lt; 1</code> or     * <code>&gt; 4</code>.     *     * @since Java 3D 1.4     */    public GeometryArray(int vertexCount,			 int vertexFormat,			 int texCoordSetCount,			 int[] texCoordSetMap,			 int vertexAttrCount,			 int[] vertexAttrSizes) {        if (vertexCount < 0)            throw new IllegalArgumentException(J3dI18N.getString("GeometryArray96"));        if (texCoordSetCount < 0)            throw new IllegalArgumentException(J3dI18N.getString("GeometryArray124"));        if (vertexAttrCount < 0)            throw new IllegalArgumentException(J3dI18N.getString("GeometryArray125"));        if ((vertexFormat & COORDINATES) == 0)          throw new IllegalArgumentException(J3dI18N.getString("GeometryArray0"));        if ((vertexFormat & INTERLEAVED) != 0 &&            (vertexFormat & BY_REFERENCE) == 0)            throw new IllegalArgumentException(J3dI18N.getString("GeometryArray80"));        if ((vertexFormat & INTERLEAVED) != 0 &&                (vertexFormat & VERTEX_ATTRIBUTES) != 0) {            throw new IllegalArgumentException(J3dI18N.getString("GeometryArray128"));        }        if ((vertexFormat & USE_COORD_INDEX_ONLY) != 0 &&                !(this instanceof IndexedGeometryArray)) {            throw new IllegalArgumentException(J3dI18N.getString("GeometryArray135"));        }        //NVaidya        if ((vertexFormat & BY_REFERENCE_INDICES) != 0) {            if (!(this instanceof IndexedGeometryArray))                throw new IllegalArgumentException(J3dI18N.getString("GeometryArray136"));            if ((vertexFormat & BY_REFERENCE) == 0)                throw new IllegalArgumentException(J3dI18N.getString("GeometryArray137"));            if ((vertexFormat & USE_COORD_INDEX_ONLY) == 0)                throw new IllegalArgumentException(J3dI18N.getString("GeometryArray138"));        }        if ((vertexFormat & USE_NIO_BUFFER) != 0 &&            (vertexFormat & BY_REFERENCE) == 0)	    throw new IllegalArgumentException(J3dI18N.getString("GeometryArray117"));	if ((vertexFormat & TEXTURE_COORDINATE) != 0) {	    if (texCoordSetMap == null)                throw new IllegalArgumentException(J3dI18N.getString("GeometryArray106"));	    if (texCoordSetCount == 0)                throw new IllegalArgumentException(J3dI18N.getString("GeometryArray107"));	    for (int i = 0; i < texCoordSetMap.length; i++) {	         if (texCoordSetMap[i] >= texCoordSetCount)                     throw new IllegalArgumentException(J3dI18N.getString("GeometryArray108"));	    }	    if ((vertexFormat & TEXTURE_COORDINATE_2) != 0) {	        texCoord2fArray = new TexCoord2f[1];	        texCoord2fScratch = new TexCoord2f();	    }	    else if ((vertexFormat & TEXTURE_COORDINATE_3) != 0) {	        texCoord3fArray = new TexCoord3f[1];	        texCoord3fScratch = new TexCoord3f();	    }	    else if ((vertexFormat & TEXTURE_COORDINATE_4) != 0) {	        texCoord4fArray = new TexCoord4f[1];	    }	}                if ((vertexFormat & VERTEX_ATTRIBUTES) != 0) {            if (vertexAttrCount > 0) {                if (vertexAttrCount != vertexAttrSizes.length) {                    throw new IllegalArgumentException(J3dI18N.getString("GeometryArray132"));                }                                for (int i = 0; i < vertexAttrSizes.length; i++) {                    if (vertexAttrSizes[i] < 1 || vertexAttrSizes[i] > 4) {                        throw new IllegalArgumentException(J3dI18N.getString("GeometryArray133"));                    }                }            } else {                if (vertexAttrSizes != null && vertexAttrSizes.length != 0) {                    throw new IllegalArgumentException(J3dI18N.getString("GeometryArray132"));                }            }        } else {            if (vertexAttrCount > 0) {                throw new IllegalArgumentException(J3dI18N.getString("GeometryArray131"));            }        }                // set default read capabilities        setDefaultReadCapabilities(readCapabilities);                ((GeometryArrayRetained)this.retained).createGeometryArrayData(	    vertexCount, vertexFormat,	    texCoordSetCount, texCoordSetMap,	    vertexAttrCount, vertexAttrSizes);    }    //------------------------------------------------------------------    // Common methods    //------------------------------------------------------------------    /**     * Retrieves the number of vertices in this GeometryArray     * @return number of vertices in this GeometryArray     * @exception CapabilityNotSetException if the appropriate capability is     * not set and this object is part of a live or compiled scene graph     */    public int getVertexCount() {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_COUNT_READ))		throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray1"));	return ((GeometryArrayRetained)this.retained).getVertexCount();    }    /**     * Retrieves the vertexFormat of this GeometryArray     * @return format of vertices in this GeometryArray     * @exception CapabilityNotSetException if the appropriate capability is     * not set and this object is part of a live or compiled scene graph     */    public int getVertexFormat() {	if (isLiveOrCompiled())	    if(!this.getCapability(ALLOW_FORMAT_READ))		throw new CapabilityNotSetException(J3dI18N.getString("GeometryArray2"));	return ((GeometryArrayRetained)this.retained).getVertexFormat();    }    /**     * Retrieves the number of texture coordinate sets in this     * GeometryArray object.     *     * @return the number of texture coordinate sets     * in this GeometryArray object     *     * @since Java 3D 1.2     */    public int getTexCoordSetCount() {	return ((GeometryArrayRetained)this.retained).getTexCoordSetCount();    }    /**     * Retrieves the length of the texture coordinate set mapping     * array of this GeometryArray object.     *     * @return the length of the texture coordinate set mapping     * array of this GeometryArray object     *     * @since Java 3D 1.2     */    public int getTexCoordSetMapLength() {	return ((GeometryArrayRetained)this.retained).getTexCoordSetMapLength();    }    /**     * Retrieves the texture coordinate set mapping     * array from this GeometryArray object.     *     * @param texCoordSetMap an array that will receive a copy of the     * texture coordinate set mapping array.  The array must be large     * enough to hold all entries of the texture coordinate set     * mapping array.     *     * @since Java 3D 1.2     */    public void getTexCoordSetMap(int[] texCoordSetMap) {        ((GeometryArrayRetained)this.retained).getTexCoordSetMap(texCoordSetMap);    }    /**     * Retrieves the number of vertex attributes in this GeometryArray     * object.     *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -