@Override
    public ElementReader nextElementReader() throws IOException {
        RandomElementReader reader = plyReader.nextElementReader();
        if (reader == null) {
            return reader;
        }

        if (!reader.getElementType().getName().equals("vertex")) {
            return reader;
        }

        if (generateNormals) {
            RandomElementReader faces = plyReader.getElementReader("face");

            NormalGenerator generator = new NormalGenerator();
            if (normalMode == NormalMode.ADD_NORMALS_CW) {
                generator.setCounterClockwise(false);
            }

            generator.generateNormals(reader.duplicate(), faces);
        }
        RectBounds bounds = new RectBounds();
        if (texGenStrategy != null) {

            // Find the bounds of the model
            ElementReader boundsReader = reader.duplicate();
            for (Element element = boundsReader.readElement();
                    element != null; element = boundsReader.readElement()) {
                bounds.addPoint(
                        element.getDouble("x"),
                        element.getDouble("y"),
                        element.getDouble("z"));
            }

            // Generate the texture coordinates.
            ElementReader texReader = reader.duplicate();
            for (Element element = texReader.readElement();
                    element != null; element = texReader.readElement()) {

                texGenStrategy.generateCoordinates(element, bounds);
            }
        }
        return reader;
    }
@ Override public ElementReader nextElementReader ( ) throws IOException { RandomElementReader reader = plyReader . nextElementReader ( ) ; if ( reader == null ) { return reader ; } if ( ! reader . getElementType ( ) . getName ( ) . equals ( "vertex" ) ) { return reader ; } if ( generateNormals ) { RandomElementReader faces = plyReader . getElementReader ( "face" ) ; NormalGenerator generator = new NormalGenerator ( ) ; if ( normalMode == NormalMode . ADD_NORMALS_CW ) { generator . setCounterClockwise ( false ) ; } generator . generateNormals ( reader . duplicate ( ) , faces ) ; } RectBounds bounds = new RectBounds ( ) ; if ( texGenStrategy != null ) { ElementReader boundsReader = reader . duplicate ( ) ; for ( Element element = boundsReader . readElement ( ) ; element != null ; element = boundsReader . readElement ( ) ) { bounds . addPoint ( element . getDouble ( "x" ) , element . getDouble ( "y" ) , element . getDouble ( "z" ) ) ; } ElementReader texReader = reader . duplicate ( ) ; for ( Element element = texReader . readElement ( ) ; element != null ; element = texReader . readElement ( ) ) { texGenStrategy . generateCoordinates ( element , bounds ) ; } } return reader ; }
Returns the reader to read the first group of elements.
<p>Each group corresponds to an element type. The groups are
returned in the order given in the file. This is also the
same order as in the list given by {@link #getElementTypes()}.</p>
<p>Each returned reader must be closed before the next reader
is requested with this method.</p>
@return Reader for the next group of elements or {@code null} if
there are no more groups.
@throws IOException if an error occurs during reading.