001: /*
002: * $RCSfile: PointArray.java,v $
003: *
004: * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
006: *
007: * This code is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License version 2 only, as
009: * published by the Free Software Foundation. Sun designates this
010: * particular file as subject to the "Classpath" exception as provided
011: * by Sun in the LICENSE file that accompanied this code.
012: *
013: * This code is distributed in the hope that it will be useful, but WITHOUT
014: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: * version 2 for more details (a copy is included in the LICENSE file that
017: * accompanied this code).
018: *
019: * You should have received a copy of the GNU General Public License version
020: * 2 along with this work; if not, write to the Free Software Foundation,
021: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
022: *
023: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
024: * CA 95054 USA or visit www.sun.com if you need additional information or
025: * have any questions.
026: *
027: * $Revision: 1.6 $
028: * $Date: 2008/02/28 20:17:28 $
029: * $State: Exp $
030: */
031:
032: package javax.media.j3d;
033:
034: /**
035: * The PointArray object draws the array of vertices as individual points.
036: */
037:
038: public class PointArray extends GeometryArray {
039:
040: // non-public, no parameter constructor
041: PointArray() {
042: }
043:
044: /**
045: * Constructs an empty PointArray object using the specified
046: * parameters.
047: *
048: * @param vertexCount
049: * see {@link GeometryArray#GeometryArray(int,int)}
050: * for a description of this parameter.
051: *
052: * @param vertexFormat
053: * see {@link GeometryArray#GeometryArray(int,int)}
054: * for a description of this parameter.
055: *
056: * @exception IllegalArgumentException if vertexCount is less than 1
057: * ;<br>
058: * See {@link GeometryArray#GeometryArray(int,int)}
059: * for more exceptions that can be thrown
060: */
061: public PointArray(int vertexCount, int vertexFormat) {
062: super (vertexCount, vertexFormat);
063:
064: if (vertexCount < 1)
065: throw new IllegalArgumentException(J3dI18N
066: .getString("PointArray0"));
067: }
068:
069: /**
070: * Constructs an empty PointArray object using the specified
071: * parameters.
072: *
073: * @param vertexCount
074: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
075: * for a description of this parameter.
076: *
077: * @param vertexFormat
078: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
079: * for a description of this parameter.
080: *
081: * @param texCoordSetCount
082: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
083: * for a description of this parameter.
084: *
085: * @param texCoordSetMap
086: * see {@link GeometryArray#GeometryArray(int,int,int,int[])}
087: * for a description of this parameter.
088: *
089: * @exception IllegalArgumentException if vertexCount is less than 1
090: * ;<br>
091: * See {@link GeometryArray#GeometryArray(int,int,int,int[])}
092: * for more exceptions that can be thrown
093: *
094: * @since Java 3D 1.2
095: */
096: public PointArray(int vertexCount, int vertexFormat,
097: int texCoordSetCount, int[] texCoordSetMap) {
098:
099: super (vertexCount, vertexFormat, texCoordSetCount,
100: texCoordSetMap);
101:
102: if (vertexCount < 1)
103: throw new IllegalArgumentException(J3dI18N
104: .getString("PointArray0"));
105: }
106:
107: /**
108: * Constructs an empty PointArray object using the specified
109: * parameters.
110: *
111: * @param vertexCount
112: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
113: * for a description of this parameter.
114: *
115: * @param vertexFormat
116: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
117: * for a description of this parameter.
118: *
119: * @param texCoordSetMap
120: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
121: * for a description of this parameter.
122: *
123: * @param vertexAttrCount
124: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
125: * for a description of this parameter.
126: *
127: * @param vertexAttrSizes
128: * see {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
129: * for a description of this parameter.
130: *
131: * @exception IllegalArgumentException if vertexCount is less than 1
132: * ;<br>
133: * See {@link GeometryArray#GeometryArray(int,int,int,int[],int,int[])}
134: * for more exceptions that can be thrown
135: *
136: * @since Java 3D 1.4
137: */
138: public PointArray(int vertexCount, int vertexFormat,
139: int texCoordSetCount, int[] texCoordSetMap,
140: int vertexAttrCount, int[] vertexAttrSizes) {
141:
142: super (vertexCount, vertexFormat, texCoordSetCount,
143: texCoordSetMap, vertexAttrCount, vertexAttrSizes);
144:
145: if (vertexCount < 1)
146: throw new IllegalArgumentException(J3dI18N
147: .getString("PointArray0"));
148: }
149:
150: /**
151: * Creates the retained mode PointArrayRetained object that this
152: * PointArray object will point to.
153: */
154: void createRetained() {
155: this .retained = new PointArrayRetained();
156: this .retained.setSource(this );
157: }
158:
159: /**
160: * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate)
161: */
162: public NodeComponent cloneNodeComponent() {
163: PointArrayRetained rt = (PointArrayRetained) retained;
164: int texSetCount = rt.getTexCoordSetCount();
165: int[] texMap = null;
166: int vertexAttrCount = rt.getVertexAttrCount();
167: int[] vertexAttrSizes = null;
168: if (texSetCount > 0) {
169: texMap = new int[rt.getTexCoordSetMapLength()];
170: rt.getTexCoordSetMap(texMap);
171: }
172: if (vertexAttrCount > 0) {
173: vertexAttrSizes = new int[vertexAttrCount];
174: rt.getVertexAttrSizes(vertexAttrSizes);
175: }
176: PointArray p = new PointArray(rt.getVertexCount(), rt
177: .getVertexFormat(), texSetCount, texMap,
178: vertexAttrCount, vertexAttrSizes);
179: p.duplicateNodeComponent(this);
180: return p;
181: }
182: }
|