Class ObjSimpleModel


  • public class ObjSimpleModel
    extends Model

    A simple demonstration of loading and drawing a basic OBJ file.

    A basic OBJ file is a text file that contains three kinds of lines: lines that begin with the character 'v', lines that begin with the character 'f', and lines that begin with the character '#'.

    A line in an OBJ file that begins with '#' is a comment line and can be ignored.

    A line in an OBJ file that begins with 'v' is a line that describes a vertex in 3-dimensional space. The 'v' will always be followed on the line by three doubles, the x, y, and z coordinates of the vertex.

    A line in an OBJ file that begins with 'f' is a line that describes a "face". The 'f' will be followed on the line by a sequence of positive integers. The integers are the indices of the vertices that make up the face. The "index" of a vertex is the order in which the vertex was listed in the OBJ file. So a line like this

    
          f  2  4  1
    
    would represent a triangle made up of the 2nd vertex read from the file, the 4th vertex read from the file, and the 1st vertex read from the file. And a line like this
    
          f  2  4  3  5
    
    would represent a quadrilateral made up of the 2nd vertex read from the file, the 4th vertex read from the file, the 3rd vertex read from the file, and the 5th vertex read from the file.

    See https://en.wikipedia.org/wiki/Wavefront_.obj_file

    • Constructor Detail

      • ObjSimpleModel

        public ObjSimpleModel​(File objFile)
        Create a wireframe model from the contents of an OBJ file.
        Parameters:
        objFile - File object for the OBJ data file