public boolean load(String filepath) throws FileNotFoundException { fileType = "OBJ"; // Set the file type to OBJ in case we ever want to later identify its source filePath = Utils.dirFromPath( filepath); // The fileName is the ENTIRE path to the file (including the filename) objName = Utils.fileFromPath(filepath); // The objName is strictly the filename to begin with readVerts(filepath); // Read all of the vertices from the file // readTexVerts(filepath); // Read all of the texture vertices (if any) from the file) // Read any materials from the file // If no materials are loaded, a default one will be assigned if (readMaterials(filepath) == -1) { System.out.println("Not all materials could be loaded for: " + filepath); System.out.println("Surfaces with no materials will be assigned a default material"); } // end if readSurfaces(filepath); // Read all surface information countPolyVerts(); // Calculates how many vertices are in each polygon calcPolyNorms(); // Calculate all polygon normals (never rely on the file itself) calcVertNorms(); // Calculate all vertex normals based on polygon normals boundingSphere = calcBoundingSphere(); // Calculate the bounding sphere for raytracing active = true; // We've just created an object...so make it active! next = null; // Next object in the linked list is null // This simply loads the modelMat with an identity matrix. modelMat = MatrixOps.newIdentity(); // System.out.println("\nObject loaded!\n"); loadBuffers(); return true; } // end method load