/** * Constructs a quad group with specified vertex coordinates. * <p> * The (x,y,z) coordinates of vertices are packed into the specified * array xyz. The number of vertices is nv = xyz.length/3. * <p> * The (u,v,w) components of normal vectors are packed into the specified * array uvw. The number of normal vectors equals the number of vertices. * @param xyz array[3*nv] of packed vertex coordinates. * @param uvw array[3*nv] of packed normal vector components. */ public QuadGroup(float[] xyz, float[] uvw) { this(indexVertices(true,xyz),xyz,uvw,null); }
/** * Constructs a quad group with specified vertex coordinates * and optional corresponding normal vectors and colors. * <p> * The (x,y,z) coordinates of vertices are packed into the specified * array xyz. The number of vertices is nv = xyz.length/3. * <p> * The (u,v,w) components of normal vectors are packed into the specified * array uvw. The number of normal vectors equals the number of vertices. * <p> * The (r,g,b) components of colors are packed into the specified array * rgb. The number of colors equals the number of vertices. * @param xyz array[3*nv] of packed vertex coordinates. * @param uvw array[3*nv] of packed normal vector components. * @param rgb array[3*nv] of packed color components. */ public QuadGroup(float[] xyz, float[] uvw, float[] rgb) { this(indexVertices(true,xyz),xyz,uvw,rgb); }
/** * Constructs a quad group with specified vertex coordinates. * <p> * The (x,y,z) coordinates of vertices are packed into the specified * array xyz. The number of vertices is nv = xyz.length/3. The number * of quads is nq = nv/4 = xyz.length/12. * <p> * The (r,g,b) components of colors are packed into the specified * array rgb. The number of colors equals the number of vertices. * <p> * Normal vectors may be computed for either vertices or quads. * When computed for a vertex, a normal vector is the area-weighted * average of the normal vectors for all quads with that vertex. * <p> * If no vertices have the same (x,y,z) coordinates, then vertex and * quad normal vectors are the same vectors, but quad normal vectors * are less costly to compute. * @param vn true, for vertex normals; false, for quad normals. * @param xyz array[3*nv] of packed vertex coordinates. * @param rgb array[3*nv] of packed color components. */ public QuadGroup(boolean vn, float[] xyz, float[] rgb) { int[] ijkl = indexVertices(!vn,xyz); float[] uvw = computeNormals(ijkl,xyz); buildTree(ijkl,xyz,uvw,rgb); setDefaultStates(); }