Class OBJModel

java.lang.Object
com.eco.bio7.loader3d.MeshModel
com.eco.bio7.loader3d.OBJModel

public class OBJModel extends com.eco.bio7.loader3d.MeshModel
A model of an OBJ file (with the materials and textures of the MTL file), centered and scaled to a size. The file is read with the MeshReader (also polygons, negative indices and vertex colors), see MeshModel for the other formats.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OBJModel(com.eco.bio7.loader3d.MeshData mesh, float size)
    Creates the model of a read OBJ file (see MeshReader).
    OBJModel(String nm, String path, float sz, com.jogamp.opengl.GL2 gl, boolean showDetails)
    Loads the OBJ file path + nm + ".obj".
  • Method Summary

    Modifier and Type
    Method
    Description
    ArrayList<com.eco.bio7.loader3d.Tuple3>
    Returns the normals of the vertices (empty if the file has no normals).
    ArrayList<com.eco.bio7.loader3d.Tuple3>
    Returns the texture coordinates of the vertices (empty if the file has none).
    ArrayList<com.eco.bio7.loader3d.Tuple3>
    Returns the vertices of the file (centered and scaled like the display).

    Methods inherited from class com.eco.bio7.loader3d.MeshModel

    draw, getDisplayPositions, getFormat, getMaxSize, getMeshData, getModelDims, getName, getNumFaces, getNumVertices, getReport, getWeldedMesh, load

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OBJModel

      public OBJModel(String nm, String path, float sz, com.jogamp.opengl.GL2 gl, boolean showDetails)
      Loads the OBJ file path + nm + ".obj".
      Parameters:
      nm - the name of the file without the extension
      path - the directory (with a separator at the end)
      sz - the size of the largest dimension in the 3D view
      gl - the OpenGL context (not used, the model is drawn with draw)
      showDetails - prints the checks of the mesh
      Throws:
      UncheckedIOException - if the file can't be read
    • OBJModel

      public OBJModel(com.eco.bio7.loader3d.MeshData mesh, float size)
      Creates the model of a read OBJ file (see MeshReader).
      Parameters:
      mesh - the mesh
      size - the size of the largest dimension in the 3D view
  • Method Details

    • getVerts

      public ArrayList<com.eco.bio7.loader3d.Tuple3> getVerts()
      Returns the vertices of the file (centered and scaled like the display).
    • getNormals

      public ArrayList<com.eco.bio7.loader3d.Tuple3> getNormals()
      Returns the normals of the vertices (empty if the file has no normals).
    • getTexCoords

      public ArrayList<com.eco.bio7.loader3d.Tuple3> getTexCoords()
      Returns the texture coordinates of the vertices (empty if the file has none).