Libraries.Game.Graphics.Skybox Documentation

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Dispose()This action releases all the memory used to store the Skybox's texture.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetBackFile()This action returns the file that was used to load the back side of the skybox.
GetBottomFile()This action returns the file that was used to load the bottom side of the skybox.
GetFrontFile()This action returns the file that was used to load the front side of the skybox.
GetHashCode()This action gets the hash code for an object.
GetLeftFile()This action returns the file that was used to load the left side of the skybox.
GetRightFile()This action returns the file that was used to load the right side of the skybox.
GetTopFile()This action returns the file that was used to load the top side of the skybox.
InvertSkybox(boolean invert)The InvertSkybox action sets whether or not the images of the Skybox should be inverted when used.
IsInverted()This action returns whether or not the images of the Skybox are currently inverted.
IsLoaded()Whether this Skybox has been loaded or not yet.
Load(Libraries.System.File right, Libraries.System.File left, Libraries.System.File up, Libraries.System.File down, Libraries.System.File forward, Libraries.System.File back)The Load action loads all six sides of the Skybox.
Load(text right, text left, text up, text down, text forward, text back)The Load action loads all six sides of the Skybox.
LoadBack(Libraries.System.File image)This action loads the back of the Skybox.
LoadBack(text fileName)This action loads the back of the Skybox.
LoadBottom(Libraries.System.File image)This action loads the bottom of the Skybox.
LoadBottom(text fileName)This action loads the bottom of the Skybox.
LoadFront(Libraries.System.File image)This action loads the front of the Skybox.
LoadFront(text fileName)This action loads the front of the Skybox.
LoadLeft(text fileName)This action loads the left side of the Skybox.
LoadLeft(Libraries.System.File image)This action loads the left side of the Skybox.
LoadRight(text fileName)This action loads the right side of the Skybox.
LoadRight(Libraries.System.File image)This action loads the right side of the Skybox.
LoadTop(Libraries.System.File image)This action loads the top of the Skybox.
LoadTop(text fileName)This action loads the top of the Skybox.
Rotate(number x, number y, number z, number degrees)This action will rotate the Skybox about an axis represented by the given numbers.
Rotate(Libraries.Compute.Vector3 axis, number degrees)This action will rotate the Skybox about an axis represented by the given Vector3.
SetToRotation(Libraries.Compute.Vector3 axis, number degrees)The SetToRotation action will rotate the Skybox from its base orientation, ignoring any previous rotations that have been applied to it.
SetToRotation(number x, number y, number z, number degrees)The SetToRotation action will rotate the Skybox from its base orientation, ignoring any previous rotations that have been applied to it.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Dispose()

This action releases all the memory used to store the Skybox's texture. Once this has been called, it won't be initialized anymore, so it will need to be loaded again to be used.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetBackFile()

This action returns the file that was used to load the back side of the skybox.

Return

Libraries.System.File:

GetBottomFile()

This action returns the file that was used to load the bottom side of the skybox.

Return

Libraries.System.File:

GetFrontFile()

This action returns the file that was used to load the front side of the skybox.

Return

Libraries.System.File:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetLeftFile()

This action returns the file that was used to load the left side of the skybox.

Return

Libraries.System.File:

GetRightFile()

This action returns the file that was used to load the right side of the skybox.

Return

Libraries.System.File:

GetTopFile()

This action returns the file that was used to load the top side of the skybox.

Return

Libraries.System.File:

InvertSkybox(boolean invert)

The InvertSkybox action sets whether or not the images of the Skybox should be inverted when used. If this is true, images will appear to be flipped around the y-axis (or in other words, appear to be drawn backwards). If this is set to false, then the images will appear to be drawn in the correct direction, but the left image will appear on the right, and the right image will appear on the left. By default, this value is set to true.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "Skybox" containing our six images.
            skybox:Load("Skybox/right.jpg", "Skybox/left.jpg", "Skybox/top.jpg", "Skybox/bottom.jpg", "Skybox/front.jpg", "Skybox/back.jpg")
            skybox:InvertSkybox(false)
            SetSkybox(skybox)
        end
    end

Parameters

IsInverted()

This action returns whether or not the images of the Skybox are currently inverted. This will cause them to appear to be drawn backwards. By default, Skyboxes are inverted, so this will return true. This can be disabled or enabled using the InvertSkybox action.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "Skybox" containing our six images.
            skybox:Load("Skybox/right.jpg", "Skybox/left.jpg", "Skybox/top.jpg", "Skybox/bottom.jpg", "Skybox/front.jpg", "Skybox/back.jpg")
            SetSkybox(skybox)
            
            boolean inverted = skybox:IsInverted()
            output "Is the Skybox inverted? " + inverted
        end
    end

Return

boolean: Whether or not the Skybox is inverted. This is true by default.

IsLoaded()

Whether this Skybox has been loaded or not yet. On most platforms, this is true immediately after calling the Load action. On the web, this is true at some point in time after Load is called, due to the nature of how image loading is handled during online execution.

Return

boolean:

Load(Libraries.System.File right, Libraries.System.File left, Libraries.System.File up, Libraries.System.File down, Libraries.System.File forward, Libraries.System.File back)

The Load action loads all six sides of the Skybox. It takes six files as parameters, which represent the images that form the right, left, top, bottom, front, and back sides of the Skybox, respectively.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.System.File

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            File right
            right:SetPath("Skybox/right.jpg")
            File left
            left:SetPath("Skybox/left.jpg")
            File top
            top:SetPath("Skybox/top.jpg")
            File bottom
            bottom:SetPath("Skybox/bottom.jpg")
            File front
            front:SetPath("Skybox/front.jpg")
            File back
            back:SetPath("Skybox/back.jpg")
            skybox:Load(right, left, top, bottom, front, back)
            SetSkybox(skybox)
        end
    end

Parameters

Load(text right, text left, text up, text down, text forward, text back)

The Load action loads all six sides of the Skybox. It takes six text parameters, which are the the file paths from the default working directory for images comprising the right, left, top, bottom, front, and back sides of the Skybox, respectively.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
            SetSkybox(skybox)
        end
    end

Parameters

LoadBack(Libraries.System.File image)

This action loads the back of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.System.File

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            File right
            File left
            File top
            File bottom
            File front
            File back
            right:SetPath("Skybox/right.jpg")
            left:SetPath("Skybox/left.jpg")
            top:SetPath("Skybox/top.jpg")
            bottom:SetPath("Skybox/bottom.jpg")
            front:SetPath("Skybox/front.jpg")
            back:SetPath("Skybox/back.jpg")

            skybox:LoadRight(right)
            skybox:LoadLeft(left)
            skybox:LoadTop(top)
            skybox:LoadBottom(bottom)
            skybox:LoadFront(front)
            skybox:LoadBack(back)
            SetSkybox(skybox)
        end
    end

Parameters

LoadBack(text fileName)

This action loads the back of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:LoadRight("Skybox/right.jpg")
            skybox:LoadLeft("Skybox/left.jpg")
            skybox:LoadTop("Skybox/top.jpg")
            skybox:LoadBottom("Skybox/bottom.jpg")
            skybox:LoadFront("Skybox/front.jpg")
            skybox:LoadBack("Skybox/back.jpg")
            SetSkybox(skybox)
        end
    end

Parameters

LoadBottom(Libraries.System.File image)

This action loads the bottom of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.System.File

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            File right
            File left
            File top
            File bottom
            File front
            File back
            right:SetPath("Skybox/right.jpg")
            left:SetPath("Skybox/left.jpg")
            top:SetPath("Skybox/top.jpg")
            bottom:SetPath("Skybox/bottom.jpg")
            front:SetPath("Skybox/front.jpg")
            back:SetPath("Skybox/back.jpg")

            skybox:LoadRight(right)
            skybox:LoadLeft(left)
            skybox:LoadTop(top)
            skybox:LoadBottom(bottom)
            skybox:LoadFront(front)
            skybox:LoadBack(back)
            SetSkybox(skybox)
        end
    end

Parameters

LoadBottom(text fileName)

This action loads the bottom of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:LoadRight("Skybox/right.jpg")
            skybox:LoadLeft("Skybox/left.jpg")
            skybox:LoadTop("Skybox/top.jpg")
            skybox:LoadBottom("Skybox/bottom.jpg")
            skybox:LoadFront("Skybox/front.jpg")
            skybox:LoadBack("Skybox/back.jpg")
            SetSkybox(skybox)
        end
    end

Parameters

LoadFront(Libraries.System.File image)

This action loads the front of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.System.File

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            File right
            File left
            File top
            File bottom
            File front
            File back
            right:SetPath("Skybox/right.jpg")
            left:SetPath("Skybox/left.jpg")
            top:SetPath("Skybox/top.jpg")
            bottom:SetPath("Skybox/bottom.jpg")
            front:SetPath("Skybox/front.jpg")
            back:SetPath("Skybox/back.jpg")

            skybox:LoadRight(right)
            skybox:LoadLeft(left)
            skybox:LoadTop(top)
            skybox:LoadBottom(bottom)
            skybox:LoadFront(front)
            skybox:LoadBack(back)
            SetSkybox(skybox)
        end
    end

Parameters

LoadFront(text fileName)

This action loads the front of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:LoadRight("Skybox/right.jpg")
            skybox:LoadLeft("Skybox/left.jpg")
            skybox:LoadTop("Skybox/top.jpg")
            skybox:LoadBottom("Skybox/bottom.jpg")
            skybox:LoadFront("Skybox/front.jpg")
            skybox:LoadBack("Skybox/back.jpg")
            SetSkybox(skybox)
        end
    end

Parameters

LoadLeft(text fileName)

This action loads the left side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:LoadRight("Skybox/right.jpg")
            skybox:LoadLeft("Skybox/left.jpg")
            skybox:LoadTop("Skybox/top.jpg")
            skybox:LoadBottom("Skybox/bottom.jpg")
            skybox:LoadFront("Skybox/front.jpg")
            skybox:LoadBack("Skybox/back.jpg")
            SetSkybox(skybox)
        end
    end

Parameters

LoadLeft(Libraries.System.File image)

This action loads the left side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.System.File

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            File right
            File left
            File top
            File bottom
            File front
            File back
            right:SetPath("Skybox/right.jpg")
            left:SetPath("Skybox/left.jpg")
            top:SetPath("Skybox/top.jpg")
            bottom:SetPath("Skybox/bottom.jpg")
            front:SetPath("Skybox/front.jpg")
            back:SetPath("Skybox/back.jpg")

            skybox:LoadRight(right)
            skybox:LoadLeft(left)
            skybox:LoadTop(top)
            skybox:LoadBottom(bottom)
            skybox:LoadFront(front)
            skybox:LoadBack(back)
            SetSkybox(skybox)
        end
    end

Parameters

LoadRight(text fileName)

This action loads the right side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:LoadRight("Skybox/right.jpg")
            skybox:LoadLeft("Skybox/left.jpg")
            skybox:LoadTop("Skybox/top.jpg")
            skybox:LoadBottom("Skybox/bottom.jpg")
            skybox:LoadFront("Skybox/front.jpg")
            skybox:LoadBack("Skybox/back.jpg")
            SetSkybox(skybox)
        end
    end

Parameters

LoadRight(Libraries.System.File image)

This action loads the right side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.System.File

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            File right
            File left
            File top
            File bottom
            File front
            File back
            right:SetPath("Skybox/right.jpg")
            left:SetPath("Skybox/left.jpg")
            top:SetPath("Skybox/top.jpg")
            bottom:SetPath("Skybox/bottom.jpg")
            front:SetPath("Skybox/front.jpg")
            back:SetPath("Skybox/back.jpg")

            skybox:LoadRight(right)
            skybox:LoadLeft(left)
            skybox:LoadTop(top)
            skybox:LoadBottom(bottom)
            skybox:LoadFront(front)
            skybox:LoadBack(back)
            SetSkybox(skybox)
        end
    end

Parameters

LoadTop(Libraries.System.File image)

This action loads the top of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.System.File

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            File right
            File left
            File top
            File bottom
            File front
            File back
            right:SetPath("Skybox/right.jpg")
            left:SetPath("Skybox/left.jpg")
            top:SetPath("Skybox/top.jpg")
            bottom:SetPath("Skybox/bottom.jpg")
            front:SetPath("Skybox/front.jpg")
            back:SetPath("Skybox/back.jpg")

            skybox:LoadRight(right)
            skybox:LoadLeft(left)
            skybox:LoadTop(top)
            skybox:LoadBottom(bottom)
            skybox:LoadFront(front)
            skybox:LoadBack(back)
            SetSkybox(skybox)
        end
    end

Parameters

LoadTop(text fileName)

This action loads the top of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:LoadRight("Skybox/right.jpg")
            skybox:LoadLeft("Skybox/left.jpg")
            skybox:LoadTop("Skybox/top.jpg")
            skybox:LoadBottom("Skybox/bottom.jpg")
            skybox:LoadFront("Skybox/front.jpg")
            skybox:LoadBack("Skybox/back.jpg")
            SetSkybox(skybox)
        end
    end

Parameters

Rotate(number x, number y, number z, number degrees)

This action will rotate the Skybox about an axis represented by the given numbers. The axis is essentially a ray that starts at the center of the Skybox and points in the direction of the provided x, y, and z values. The Skybox will then rotate clockwise around that ray. The Skybox will be rotated by an angle given in degrees.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        Skybox skybox

        action Main
            StartGame()
        end

        action CreateGame
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
            SetSkybox(skybox)
        end

        action Update(number seconds)
            // The Skybox will rotate around the y-axis at a rate of 2 degrees per second.
            skybox:Rotate(0, 1, 0, 2 * seconds)
        end
    end

Parameters

Rotate(Libraries.Compute.Vector3 axis, number degrees)

This action will rotate the Skybox about an axis represented by the given Vector3. The axis is essentially a ray that starts at the center of the Skybox and points outward. The Skybox will then rotate clockwise around that ray. The Skybox will be rotated by an angle given in degrees.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.Compute.Vector3

    class Main is Game

        Skybox skybox
        Vector3 axis

        action Main
            StartGame()
        end

        action CreateGame
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
            SetSkybox(skybox)

            axis:Set(0, 1, 0)
        end

        action Update(number seconds)
            // The Skybox will rotate around the axis at a rate of 2 degrees per second.
            skybox:Rotate(axis, 2 * seconds)
        end
    end

Parameters

SetToRotation(Libraries.Compute.Vector3 axis, number degrees)

The SetToRotation action will rotate the Skybox from its base orientation, ignoring any previous rotations that have been applied to it. The rotation is measured as a number of degrees rotated clockwise around the given axis. The axis is essentially a ray that begins in the center of the Skybox and extends outward.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox
    use Libraries.Compute.Vector3

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
            SetSkybox(skybox)

            Vector3 axis
            axis:Set(0, 1, 0)
            skybox:SetToRotation(axis, 90)
        end
    end

Parameters

SetToRotation(number x, number y, number z, number degrees)

The SetToRotation action will rotate the Skybox from its base orientation, ignoring any previous rotations that have been applied to it. The rotation is measured as a number of degrees rotated clockwise around the given axis. The axis is essentially a ray that begins in the center of the Skybox and extends outward.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
            SetSkybox(skybox)

            skybox:SetToRotation(0, 1, 0, 90)
        end
    end

Parameters