Class Skybox

All Implemented Interfaces:
Hintable, Savable

public class Skybox extends Node
A Box made of textured quads that simulate having a sky, horizon and so forth around your scene. Either attach to a camera node or update on each frame to set this skybox at the camera's position.
  • Constructor Details

    • Skybox

      public Skybox()
    • Skybox

      public Skybox(String name, float xExtent, float yExtent, float zExtent)
      Creates a new skybox. The size of the skybox and name is specified here. By default, no textures are set.
      Parameters:
      name - The name of the skybox.
      xExtent - The x size of the skybox in both directions from the center.
      yExtent - The y size of the skybox in both directions from the center.
      zExtent - The z size of the skybox in both directions from the center.
  • Method Details

    • setTexture

      public void setTexture(Skybox.Face face, Texture texture)
      Set the texture to be displayed on the given face of the skybox. Replaces any existing texture on that face.
      Parameters:
      face - the face to set
      texture - The texture for that side to assume.
      Throws:
      IllegalArgumentException - if face is null.
    • setTexture

      public void setTexture(Skybox.Face face, Texture texture, int textureUnit)
      Set the texture to be displayed on the given side of the skybox. Only replaces the texture at the index specified by textureUnit.
      Parameters:
      face - the face to set
      texture - The texture for that side to assume.
      textureUnit - The texture unite of the given side's TextureState the texture will assume.
    • getTexture

      public Texture getTexture(Skybox.Face face)
    • initialize

      public void initialize()
    • getFace

      public Quad getFace(Skybox.Face face)
      Retrieve the quad indicated by the given side.
      Parameters:
      face - One of Skybox.Face.North, Skybox.Face.South, and so on...
      Returns:
      The Quad that makes up that side of the Skybox.
    • preloadTexture

      public void preloadTexture(Skybox.Face face, Renderer r)
    • preloadTextures

      public void preloadTextures(Renderer r)
      Force all of the textures to load. This prevents pauses later during the application as you pan around the world.
      Parameters:
      r - the renderer
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Node
      Parameters:
      capsule - the capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also:
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Node
      Parameters:
      capsule - the input capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also: