private void parseLine(int vertexCount) { String[] rawFaces = null; int currentValue; vindices = new int[vertexCount]; nindices = new int[vertexCount]; tindices = new int[vertexCount]; vertices = new Vertex[vertexCount]; normals = new Vertex[vertexCount]; textures = new TextureCoordinate[vertexCount]; for (int i = 1; i <= vertexCount; i++) { rawFaces = words[i].split("/"); // v currentValue = Integer.parseInt(rawFaces[0]); vindices[i - 1] = currentValue - 1; // save vertex vertices[i - 1] = object.getVertices().get(currentValue - 1); // -1 because references starts at 1 if (rawFaces.length == 1) { continue; } // save texcoords if (!"".equals(rawFaces[1])) { currentValue = Integer.parseInt(rawFaces[1]); // System.out.println( currentValue+" at line: " + lineCounter); if (currentValue <= object .getTextures() .size()) // This is to compensate the fact that if no texture is in the obj file, // sometimes '1' is put instead of 'blank' (we find coord1/1/coord3 instead // of coord1//coord3 or coord1/coord3) { tindices[i - 1] = currentValue - 1; textures[i - 1] = object.getTextures().get(currentValue - 1); // -1 because references starts at 1 } // System.out.print("indice="+currentValue+" ="+textures[i-1].getU() + // ","+textures[i-1].getV()); // System.out.println(textures[i-1].getU()+"-"+textures[i-1].getV()); } // save normal if (rawFaces.length == 3) { currentValue = Integer.parseInt(rawFaces[2]); nindices[i - 1] = currentValue - 1; normals[i - 1] = object.getNormals().get(currentValue - 1); // -1 because references starts at 1 } } }