Class Skybox.Builder

  • Enclosing class:
    Skybox

    public static class Skybox.Builder
    extends java.lang.Object
    Use Builder to construct a Skybox object instance.
    • Constructor Detail

      • Builder

        public Builder()
        Use Builder to construct a Skybox object instance.
    • Method Detail

      • environment

        @NonNull
        public Skybox.Builder environment​(@NonNull
                                          Texture cubemap)
        Set the environment map (i.e. the skybox content).

        The Skybox is rendered as though it were an infinitely large cube with the camera inside it. This means that the cubemap which is mapped onto the cube's exterior will appear mirrored. This follows the OpenGL conventions.

        The cmgen tool generates reflection maps by default which are therefore ideal to use as skyboxes.

        Parameters:
        cubemap - A cubemap Texture
        Returns:
        This Builder, for chaining calls.
        See Also:
        Texture
      • showSun

        @NonNull
        public Skybox.Builder showSun​(boolean show)
        Indicates whether the sun should be rendered. The sun can only be rendered if there is at least one light of type LightManager.Type.SUN in the Scene. The default value is false.
        Parameters:
        show - true if the sun should be rendered, false otherwise
        Returns:
        This Builder, for chaining calls.
      • color

        @NonNull
        public Skybox.Builder color​(float r,
                                    float g,
                                    float b,
                                    float a)
        Sets the Skybox to a constant color. Default is opaque black. Ignored if an environment is set.
        Returns:
        This Builder, for chaining calls.
      • color

        @NonNull
        public Skybox.Builder color​(@NonNull @Size(min=4L)
                                    float[] color)
        Sets the Skybox to a constant color. Default is opaque black. Ignored if an environment is set.
        Parameters:
        color - an array of 4 floats
        Returns:
        This Builder, for chaining calls.
      • build

        @NonNull
        public Skybox build​(@NonNull
                            Engine engine)
        Creates a Skybox object
        Parameters:
        engine - the Engine to associate this Skybox with.
        Returns:
        A newly created Skyboxobject
        Throws:
        java.lang.IllegalStateException - can be thrown if the Skybox couldn't be created