Class SpatialLoader

java.lang.Object
com.eco.bio7.spatial.SpatialLoader

public class SpatialLoader extends Object
This is a utility class for Jogl (OpenGL) to load and create models and textures.
  • Field Details

    • objectName

      protected String objectName
    • objectPath

      protected String objectPath
  • Constructor Details

    • SpatialLoader

      public SpatialLoader(com.jogamp.opengl.GL2 gl_)
  • Method Details

    • loadModel

      public static OBJModel loadModel(String path, float size)
      This method loads an object model from the given path.
      Parameters:
      path - the path to the model.
      size - the initial size.
      Returns:
      an OBJModel instance.
    • loadModel

      public static OBJModel loadModel(com.jogamp.opengl.GL2 gl, String path, float size)
      This method loads an object model from the given path.
      Parameters:
      gl - the GL reference.
      path - the path to the model.
      size - the initial size.
      Returns:
      an OBJModel instance.
    • loadObjModel

      protected void loadObjModel()
    • loadMesh

      public static com.eco.bio7.loader3d.MeshModel loadMesh(String path, float size)
      Loads a mesh file (OBJ with materials, STL, PLY or OFF) as a model.
      Parameters:
      path - the path of the file
      size - the size of the largest dimension in the 3D view
      Returns:
      the model or null if the file can't be loaded
    • createTexture

      public static com.jogamp.opengl.util.texture.Texture createTexture(String path, com.jogamp.opengl.GL2 gl)
      This method creates a texture from a given path.
      Parameters:
      path - the path to the texture.
      gl - an OpenGL context.
      Returns:
      t a Texture object.
    • getFileName

      public static String getFileName(String path)
      This method returns the filename of a given file without the extension.
      Parameters:
      path - the path to the file.
      Returns:
      returns the filename as a String value.