public static BasicModel loadModelFromTxt(String filepath) {
		BufferedReader inputStream;
		try {
			inputStream = new BufferedReader(new FileReader(filepath));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return null;
		}

		String line;
		try {
			inputStream.readLine();
			inputStream.readLine();
			inputStream.readLine();
			inputStream.readLine();
			inputStream.readLine();

			// wczytywanie ilosci subsetow
			line = inputStream.readLine();
			line = line.substring(line.indexOf(" "));
			line = line.substring(1);

			int numberOfSubsets = Integer.parseInt(line);

			Vertex4[][] arrVertices = new Vertex4[numberOfSubsets][];
			Vector4D[][] arrNormals = new Vector4D[numberOfSubsets][];
			ModelFace[][] arrFaces = new ModelFace[numberOfSubsets][];
			Material[] arrMaterials = new Material[numberOfSubsets];
			int[] meshMaterialNumbers = new int[numberOfSubsets];
			int[] meshSubflags = new int[numberOfSubsets];

			for (int i = 0; i < numberOfSubsets; i++) {

				line = inputStream.readLine();

				String subF = line.substring(line.lastIndexOf("\"") + 2, line
						.lastIndexOf("\"") + 3);

				meshSubflags[i] = Integer.valueOf(subF);

				String matNum = line.substring(line.lastIndexOf(" ") + 1);

				meshMaterialNumbers[i] = Integer.parseInt(matNum);

				// wczytywanie wierzcholkow
				arrVertices[i] = loadVertices(inputStream);

				// wczytanie normalnych
				arrNormals[i] = loadNormals(inputStream);

				// wczytanie trojkatow
				arrFaces[i] = loadFaces(inputStream);

			}

			line = inputStream.readLine();
			line = inputStream.readLine();
			line = line.substring(line.lastIndexOf(" ") + 1);
			int numberOfMaterials = Integer.parseInt(line);

			for (int i = 0; i < numberOfMaterials; i++) {
				// wczytanie materiału z tekstura
				arrMaterials[i] = loadMaterial(inputStream);
			}

			ModelSubset[] subsets = new ModelSubset[numberOfSubsets];
			for (int i = 0; i < numberOfSubsets; i++) {
				subsets[i] = new ModelSubset(arrFaces[i], arrVertices[i],
						arrNormals[i], arrMaterials[meshMaterialNumbers[i]],
						meshSubflags[i]);
			}

			BasicModel model = new BasicModel(subsets);

			return model;

		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}