Package org.xjge.core

Class Skybox

java.lang.Object
org.xjge.core.Skybox

public final class Skybox
extends java.lang.Object
Enables a Scene to exhibit a greater level of detail in its environment by projecting a 3D texture onto the corresponding faces of a cuboid mesh, creating the illusion of an infinitely distant sky.
Since:
2.0.0
  • Constructor Summary

    Constructors
    Constructor Description
    Skybox​(java.lang.String topFilename, java.lang.String centerFilename, java.lang.String bottomFilename, boolean useLinearFilter)
    Creates a new skybox using the images specified.
    Skybox​(java.lang.String rightFilename, java.lang.String leftFilename, java.lang.String topFilename, java.lang.String bottomFilename, java.lang.String frontFilename, java.lang.String backFilename, boolean useLinearFilter)
  • Method Summary

    Modifier and Type Method Description
    void freeResources()
    Frees the texture objects and data buffers used by the skybox.
    org.joml.Matrix4f getModelMatrix()
    Provides the model matrix of the skybox.

    Methods inherited from class java.lang.Object

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

    • Skybox

      public Skybox​(java.lang.String topFilename, java.lang.String centerFilename, java.lang.String bottomFilename, boolean useLinearFilter)
      Creates a new skybox using the images specified. These images should all exhibit the same width/height dimensions in pixels and may exhibit transparency.
      Parameters:
      topFilename - the filename of the image to use for the top of the skybox
      centerFilename - the filename of the image to use for the sides of the skybox
      bottomFilename - the filename of the image to use for the bottom of the skybox
      useLinearFilter - if true, the textures will be filtered without hard edges
    • Skybox

      public Skybox​(java.lang.String rightFilename, java.lang.String leftFilename, java.lang.String topFilename, java.lang.String bottomFilename, java.lang.String frontFilename, java.lang.String backFilename, boolean useLinearFilter)
      Overloaded version of Skybox(java.lang.String,java.lang.String,java.lang.String,boolean). This variant permits more variation between faces of the skybox.
      Parameters:
      rightFilename - the filename of the image to use for the right side of the skybox
      leftFilename - the filename of the image to use for the left side of the skybox
      topFilename - the filename of the image to use for the top of the skybox
      bottomFilename - the filename of the image to use for the bottom of the skybox
      frontFilename - the filename of the image to use for the front of the skybox
      backFilename - the filename of the image to use for the back of the skybox
      useLinearFilter - if true, the textures will be filtered without hard edges
  • Method Details

    • getModelMatrix

      public org.joml.Matrix4f getModelMatrix()
      Provides the model matrix of the skybox. This can be used to achieve various effects such as rotation.
      Returns:
      the model matrix of the skybox
    • freeResources

      public void freeResources()
      Frees the texture objects and data buffers used by the skybox.